@lobu/runtime-server 24.0.0 → 24.1.1
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/component.json +1 -1
- package/dist/connectors/x-dm-adapter.js +65 -30
- package/dist/db/migrations/20261021010000_views_compile_config_hash.sql +16 -0
- package/dist/dependencies.bun.lock +1 -1
- package/dist/owletto/dist/assets/{_-CC8cTmRg.js → _-BorucF19.js} +3 -3
- package/dist/owletto/dist/assets/_-CkGyNi0G.js +2 -0
- package/dist/owletto/dist/assets/_agentId-BrhcaxUk.js +2 -0
- package/dist/owletto/dist/assets/{_agentId-DWUFSrVp.js → _agentId-DgRrCE2B.js} +2 -2
- package/dist/owletto/dist/assets/{_automationId-BnHqdXOC.js → _automationId-DSrZIYcs.js} +2 -2
- package/dist/owletto/dist/assets/{_connectorKey._connectionId-CefXIqy2.js → _connectorKey._connectionId-DWxv1uoi.js} +2 -2
- package/dist/owletto/dist/assets/{_connectorKey.index-C1QPGf9E.js → _connectorKey.index-BTP5ijdT.js} +2 -2
- package/dist/owletto/dist/assets/{_conversationId-DinuPCUp.js → _conversationId-98Y3RuRO.js} +2 -2
- package/dist/owletto/dist/assets/{_deploymentId-BeyzVjRm.js → _deploymentId-B1UWPY0i.js} +2 -2
- package/dist/owletto/dist/assets/{_eventId-3L_qeL_l.js → _eventId-BAnr8g8z.js} +2 -2
- package/dist/owletto/dist/assets/_name-BUfFO_A0.js +2 -0
- package/dist/owletto/dist/assets/{_owner-DbrKma4e.js → _owner-C79BwQ0I.js} +3 -3
- package/dist/owletto/dist/assets/_shape-Ep6JpyFX.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-B24alBfT.js +2 -0
- package/dist/owletto/dist/assets/{_slug-ndDr_CUg.js → _slug-DbPdDc-5.js} +2 -2
- package/dist/owletto/dist/assets/_viewKey-DDUxjjFD.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-hdpq3RoX.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-CRKbM2Xy.js → accept-invitation-UXU5Fx2G.js} +2 -2
- package/dist/owletto/dist/assets/{activity-route-view-CFLNukhD.js → activity-route-view-D7ORHntE.js} +2 -2
- package/dist/owletto/dist/assets/{agent-card-controls-Be1Okb2C.js → agent-card-controls-CplnPhbv.js} +2 -2
- package/dist/owletto/dist/assets/{agent-client-setup-list-BA8dU_C6.js → agent-client-setup-list-BlXB4SE5.js} +2 -2
- package/dist/owletto/dist/assets/{agent-connect-pages-CAV-yXus.js → agent-connect-pages-BmknviTI.js} +2 -2
- package/dist/owletto/dist/assets/{agent-editor-form-Bi6WvYX-.js → agent-editor-form-DsSoeQeF.js} +2 -2
- package/dist/owletto/dist/assets/{agent-guardrails-route-DMOjG1D4.js → agent-guardrails-route-TdvvIc_J.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-De_2d8Lr.js → agent-loading-shells-B7v6Cffw.js} +2 -2
- package/dist/owletto/dist/assets/{agent-permissions-matrix-gZWl6mAe.js → agent-permissions-matrix-BkZu1LYE.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skill-context-JLaTamGR.js → agent-skill-context-DFucg4c4.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skills-route-DcK41PWj.js → agent-skills-route-B3vvvZZe.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-BBJoyTuC.js → agent-subpage-shell-CZJvnjNC.js} +2 -2
- package/dist/owletto/dist/assets/agent-thread-D38STyeu.js +6 -0
- package/dist/owletto/dist/assets/agents-DAOln24A.js +2 -0
- package/dist/owletto/dist/assets/{agents-workbench-CqaKGggb.js → agents-workbench-DJ67GZ93.js} +2 -2
- package/dist/owletto/dist/assets/{app._appId-Cl1fTuIt.js → app._appId-Cp78oEZ9.js} +2 -2
- package/dist/owletto/dist/assets/{automation-detail-content-BMLL4lxO.js → automation-detail-content-DSwbRpbx.js} +2 -2
- package/dist/owletto/dist/assets/automations-DAOln24A.js +2 -0
- package/dist/owletto/dist/assets/{callback-DTKKsfkz.js → callback-CBexCo3F.js} +2 -2
- package/dist/owletto/dist/assets/{card-yU0TmNRH.js → card-jzhQrMDP.js} +2 -2
- package/dist/owletto/dist/assets/{claim-DJfTvlT2.js → claim-B-wq745Q.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows--FrZfJol.js → client-rows-BYbsXGy9.js} +2 -2
- package/dist/owletto/dist/assets/{clients-L4K1UT8c.js → clients-BhNl1tVq.js} +2 -2
- package/dist/owletto/dist/assets/{code-editor-U54Gwjit.js → code-editor-CEqoCky-.js} +2 -2
- package/dist/owletto/dist/assets/connect-wx-qqLir.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-kk0_4Svo.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-QR8o-7M5.js +2 -0
- package/dist/owletto/dist/assets/{connected._clientId.activity-DTpSW1Xy.js → connected._clientId.activity-BqprYeOX.js} +2 -2
- package/dist/owletto/dist/assets/{connected._clientId.index-h9X5H1x8.js → connected._clientId.index-DhRoSzBr.js} +2 -2
- package/dist/owletto/dist/assets/{connection-ByvKkyFm.js → connection-CNm2ukrI.js} +2 -2
- package/dist/owletto/dist/assets/{connection-feed-detail-DWM9lTao.js → connection-feed-detail-WcGCA6qY.js} +2 -2
- package/dist/owletto/dist/assets/{connections-browser-CEwYrYqt.js → connections-browser-CrtnAs0Q.js} +2 -2
- package/dist/owletto/dist/assets/{connector-provenance-BocTm__v.js → connector-provenance-D-ECOlMJ.js} +2 -2
- package/dist/owletto/dist/assets/{connector-scope-lists-OYDOydtz.js → connector-scope-lists-CRFEpSvk.js} +2 -2
- package/dist/owletto/dist/assets/{connectors-CyZpcE5f.js → connectors-CH4KBZyT.js} +2 -2
- package/dist/owletto/dist/assets/{consent-DdfINrVp.js → consent-C9ZpHb7V.js} +2 -2
- package/dist/owletto/dist/assets/{conversations-table-BSznfdYt.js → conversations-table-D_HOe1jN.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-Dr7tcIB-.js → core.esm-BupT3V0i.js} +2 -2
- package/dist/owletto/dist/assets/create-C4lptGWj.js +2 -0
- package/dist/owletto/dist/assets/{create-CBGwASon.js → create-CCjZxIkK.js} +2 -2
- package/dist/owletto/dist/assets/create-DkgUQAbB.js +2 -0
- package/dist/owletto/dist/assets/{create-automation-form-9T5WnoUs.js → create-automation-form-Bpy92SM5.js} +2 -2
- package/dist/owletto/dist/assets/create._connectorKey-D6Kc-YQ3.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-BWFEyy_P.js → cronstrue-CWImw-kf.js} +2 -2
- package/dist/owletto/dist/assets/{deployments-wG_8QzOF.js → deployments-C5hvipQh.js} +2 -2
- package/dist/owletto/dist/assets/deployments-CPpFAd_w.js +2 -0
- package/dist/owletto/dist/assets/{deployments-body-2xKS8gRo.js → deployments-body-DGII20dQ.js} +2 -2
- package/dist/owletto/dist/assets/{device-6z-xgsoW.js → device-D-7WBe9E.js} +2 -2
- package/dist/owletto/dist/assets/{device-pin-tombstone-Cwq88RMU.js → device-pin-tombstone-2U0UMu3_.js} +2 -2
- package/dist/owletto/dist/assets/{device._deviceId-BDerBfD9.js → device._deviceId-Bn37UpWH.js} +2 -2
- package/dist/owletto/dist/assets/{entity-avatar-Cc1CuI-0.js → entity-avatar-mdh7Kq5D.js} +2 -2
- package/dist/owletto/dist/assets/{entity-options-DHdMC1Lx.js → entity-options-Clz_WXK-.js} +2 -2
- package/dist/owletto/dist/assets/{entity-page--OkXmlNP.js → entity-page-D3e4iPle.js} +2 -2
- package/dist/owletto/dist/assets/{entity-type-page-89RoK_-P.js → entity-type-page-DebN1vCM.js} +2 -2
- package/dist/owletto/dist/assets/{event-detail-D4YZRtrA.js → event-detail-DV_zfWnC.js} +2 -2
- package/dist/owletto/dist/assets/events-feed-DO3IiJO2.js +2 -0
- package/dist/owletto/dist/assets/{filter-editors-B1_QUpg_.js → filter-editors-Bwhqj7lY.js} +2 -2
- package/dist/owletto/dist/assets/{full-page-spinner-Cqih-8IW.js → full-page-spinner-BVbcpW3R.js} +2 -2
- package/dist/owletto/dist/assets/guardrails-BiJollCA.js +2 -0
- package/dist/owletto/dist/assets/identity-HCFWtdaI.js +2 -0
- package/dist/owletto/dist/assets/index-8wxsyxqt.js +2 -0
- package/dist/owletto/dist/assets/{index-DYCqXaMf.js → index-9YuSRymd.js} +4 -4
- package/dist/owletto/dist/assets/index-B3c-0eZG.js +2 -0
- package/dist/owletto/dist/assets/{index-TgRS2v_F.js → index-B64PGxQm.js} +2 -2
- package/dist/owletto/dist/assets/{index-DfyDUpuI.js → index-BTlx9K_t.js} +2 -2
- package/dist/owletto/dist/assets/index-BX0EA_oB.js +2 -0
- package/dist/owletto/dist/assets/index-CdJJaQDX.js +2 -0
- package/dist/owletto/dist/assets/index-CfT_W8Vo.js +2 -0
- package/dist/owletto/dist/assets/{index-DYzWV5_z.js → index-CxF2XXzl.js} +2 -2
- package/dist/owletto/dist/assets/index-D3WHeGql.js +2 -0
- package/dist/owletto/dist/assets/{index-ZNlrDc_f.js → index-D7gHOpfg.js} +2 -2
- package/dist/owletto/dist/assets/{index-DKPwCasf.js → index-DB1iWI_a.js} +2 -2
- package/dist/owletto/dist/assets/index-DMNzF8Lf.js +2 -0
- package/dist/owletto/dist/assets/index-DyB3IzOA.js +2 -0
- package/dist/owletto/dist/assets/{index-DAOyXG1X.js → index-fgAJydgX.js} +2 -2
- package/dist/owletto/dist/assets/{json-diff-DFvYINBT.js → json-diff-DIN5Jhfx.js} +2 -2
- package/dist/owletto/dist/assets/{list-skeleton-DFsEqLU1.js → list-skeleton-CepswBka.js} +2 -2
- package/dist/owletto/dist/assets/{login-DO0j-AYr.js → login-DxGYyE4n.js} +2 -2
- package/dist/owletto/dist/assets/{logout-BmNwoAf7.js → logout-Bkzc7J44.js} +2 -2
- package/dist/owletto/dist/assets/{member-scope-gate-B2LrMWBU.js → member-scope-gate-DD4YBFn-.js} +2 -2
- package/dist/owletto/dist/assets/{memory-browse-page-Cjpl8EbB.js → memory-browse-page-D_UlBa27.js} +2 -2
- package/dist/owletto/dist/assets/{model-selector-TQcA93xm.js → model-selector-CDrAjH31.js} +2 -2
- package/dist/owletto/dist/assets/models-BAVeysNq.js +2 -0
- package/dist/owletto/dist/assets/{new-BMrFy5Qa.js → new-C2av0diq.js} +2 -2
- package/dist/owletto/dist/assets/{new-ByBhteWA.js → new-ktz9Cs_P.js} +2 -2
- package/dist/owletto/dist/assets/{new-DWp3deoW.js → new-snm1ctHn.js} +2 -2
- package/dist/owletto/dist/assets/{oauth-workspace-access-D_5uESuz.js → oauth-workspace-access-lZNZ9gul.js} +2 -2
- package/dist/owletto/dist/assets/{organization-DTFoYP4V.js → organization-Cb0W823y.js} +2 -2
- package/dist/owletto/dist/assets/{peek-pane-content-DF5iGC3c.js → peek-pane-content-BNR9ImQY.js} +2 -2
- package/dist/owletto/dist/assets/{permissions-C_auqxfP.js → permissions-Dv39zWKt.js} +2 -2
- package/dist/owletto/dist/assets/{proposal-review-shell-DsNiavG_.js → proposal-review-shell-CFhOqCLf.js} +2 -2
- package/dist/owletto/dist/assets/public-shell-ready-DqX8AXfw.js +2 -0
- package/dist/owletto/dist/assets/{recent-3d99S2IE.js → recent-QhnLDU1_.js} +2 -2
- package/dist/owletto/dist/assets/{record-activity-C9KfBkXb.js → record-activity-ZJntBfN_.js} +2 -2
- package/dist/owletto/dist/assets/{record-field-peek-BBZcRuGT.js → record-field-peek-Brh1IQGy.js} +2 -2
- package/dist/owletto/dist/assets/{record-session-BizRugWs.js → record-session-Pbr5czGw.js} +2 -2
- package/dist/owletto/dist/assets/{reset-password-DqfcSn8M.js → reset-password-CzZw6RcC.js} +2 -2
- package/dist/owletto/dist/assets/{runs-panel-T1ZxTVz6.js → runs-panel-C0_DNTcq.js} +2 -2
- package/dist/owletto/dist/assets/{runs-table-D_8QlCCN.js → runs-table-B1APZv7d.js} +2 -2
- package/dist/owletto/dist/assets/{schema-value-normalization-CylKX3PK.js → schema-value-normalization-CKdPjdPC.js} +2 -2
- package/dist/owletto/dist/assets/settings-CgZ5Z7wD.js +2 -0
- package/dist/owletto/dist/assets/{settings-B_ClYztB.js → settings-VDNiffKU.js} +2 -2
- package/dist/owletto/dist/assets/skills-DgDGscm5.js +2 -0
- package/dist/owletto/dist/assets/{source-record-panels-Cg249m1S.js → source-record-panels-BdfOVPWn.js} +2 -2
- package/dist/owletto/dist/assets/{use-mention-search-BYbFvHbJ.js → use-mention-search-Dcunv4L0.js} +2 -2
- package/dist/owletto/dist/assets/{view-param-filters-DMSqkN2J.js → view-param-filters-B0quibBi.js} +2 -2
- package/dist/owletto/dist/index.html +1 -1
- package/dist/server-main.bundle.mjs +455 -201
- package/npm-shrinkwrap.json +8 -8
- package/package.json +1 -1
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/contracts/tools/view-runtime.d.ts +74 -0
- package/vendor/core/dist/contracts/tools/view-runtime.js +86 -0
- package/vendor/core/package.json +6 -1
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-ksFp4zVf.js +0 -2
- package/dist/owletto/dist/assets/_agentId-MENLoohA.js +0 -2
- package/dist/owletto/dist/assets/_name-Dgedji78.js +0 -2
- package/dist/owletto/dist/assets/_shape-DtVfRFz_.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-CqLHzm7L.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-3CH5w8mr.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DHQY9A8u.js +0 -2
- package/dist/owletto/dist/assets/agent-thread-Buz3naVF.js +0 -6
- package/dist/owletto/dist/assets/agents-C-ReckCa.js +0 -2
- package/dist/owletto/dist/assets/automations-C-ReckCa.js +0 -2
- package/dist/owletto/dist/assets/connect-4zqtnDHb.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-Dj0SqgbE.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-sgtocSvf.js +0 -2
- package/dist/owletto/dist/assets/create-Cf5hp6Z8.js +0 -2
- package/dist/owletto/dist/assets/create-CwThQtd3.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-sNHQHNpg.js +0 -2
- package/dist/owletto/dist/assets/deployments-DHh9dyzv.js +0 -2
- package/dist/owletto/dist/assets/events-feed-DsrkV2ix.js +0 -2
- package/dist/owletto/dist/assets/guardrails-B8Rs1be3.js +0 -2
- package/dist/owletto/dist/assets/identity-B0nH4yiC.js +0 -2
- package/dist/owletto/dist/assets/index-4TSkcsth.js +0 -2
- package/dist/owletto/dist/assets/index-BgkhXElB.js +0 -2
- package/dist/owletto/dist/assets/index-CoW4Bz3w.js +0 -2
- package/dist/owletto/dist/assets/index-Codw-Qqi.js +0 -2
- package/dist/owletto/dist/assets/index-DMyXd3bJ.js +0 -2
- package/dist/owletto/dist/assets/index-DYYZLcJ0.js +0 -2
- package/dist/owletto/dist/assets/index-Da6CrGEu.js +0 -2
- package/dist/owletto/dist/assets/index-DneshLbf.js +0 -2
- package/dist/owletto/dist/assets/models-D7aED5Sa.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-B2NUI89V.js +0 -2
- package/dist/owletto/dist/assets/settings-DgX1-xo7.js +0 -2
- package/dist/owletto/dist/assets/skills-Drw5tcZw.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_owner-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_owner-C79BwQ0I.js","assets/record-session-Pbr5czGw.js","assets/index-BTlx9K_t.js","assets/full-page-spinner-BVbcpW3R.js","assets/index-DyB3IzOA.js","assets/activity-route-view-D7ORHntE.js","assets/record-activity-ZJntBfN_.js","assets/filter-editors-Bwhqj7lY.js","assets/connection-label-BobuYiAG.js","assets/source-record-panels-BdfOVPWn.js","assets/events-feed-DO3IiJO2.js","assets/conversations-table-D_HOe1jN.js","assets/clients-BhNl1tVq.js","assets/schema-value-normalization-CKdPjdPC.js","assets/card-jzhQrMDP.js","assets/client-rows-BYbsXGy9.js","assets/agent-loading-shells-B7v6Cffw.js","assets/member-scope-gate-DD4YBFn-.js","assets/public-shell-ready-DqX8AXfw.js","assets/new-ktz9Cs_P.js","assets/device-D-7WBe9E.js","assets/oauth-workspace-access-lZNZ9gul.js","assets/workspace-label-o_QfBuCM.js","assets/consent-C9ZpHb7V.js","assets/reset-password-CzZw6RcC.js","assets/login-DxGYyE4n.js","assets/accept-invitation-UXU5Fx2G.js","assets/settings-VDNiffKU.js","assets/_-BorucF19.js","assets/index-D3WHeGql.js","assets/index-CfT_W8Vo.js","assets/memory-browse-page-D_UlBa27.js","assets/entity-type-page-DebN1vCM.js","assets/json-diff-DIN5Jhfx.js","assets/index-CDz3-ieP.js","assets/index-Vcq4gwWv.js","assets/code-editor-CEqoCky-.js","assets/entity-avatar-mdh7Kq5D.js","assets/core.esm-BupT3V0i.js","assets/view-param-filters-B0quibBi.js","assets/app-bridge-BCm4muqj.js","assets/memory-browse-page-BnuhLJ6X.css","assets/index-B64PGxQm.js","assets/index-fgAJydgX.js","assets/list-skeleton-CepswBka.js","assets/cronstrue-CWImw-kf.js","assets/index-CxF2XXzl.js","assets/agent-client-setup-list-BlXB4SE5.js","assets/index-CdJJaQDX.js","assets/connection-CNm2ukrI.js","assets/organization-Cb0W823y.js","assets/agent-permissions-matrix-BkZu1LYE.js","assets/_eventId-BAnr8g8z.js","assets/event-detail-DV_zfWnC.js","assets/_-CkGyNi0G.js","assets/_slug-DbPdDc-5.js","assets/_agentId-DgRrCE2B.js","assets/agent-thread-D38STyeu.js","assets/use-mention-search-Dcunv4L0.js","assets/new-snm1ctHn.js","assets/create-automation-form-Bpy92SM5.js","assets/entity-options-Clz_WXK-.js","assets/model-selector-CDrAjH31.js","assets/skill-editor-D_W3QlRz.js","assets/_automationId-DSrZIYcs.js","assets/automation-detail-content-DSwbRpbx.js","assets/proposal-review-shell-CFhOqCLf.js","assets/deployments-C5hvipQh.js","assets/new-C2av0diq.js","assets/agent-editor-form-DsSoeQeF.js","assets/_agentId-BrhcaxUk.js","assets/agents-workbench-DJ67GZ93.js","assets/index-8wxsyxqt.js","assets/deployments-body-DGII20dQ.js","assets/_connectorKey.index-BTP5ijdT.js","assets/connections-browser-CrtnAs0Q.js","assets/connector-provenance-D-ECOlMJ.js","assets/runs-panel-C0_DNTcq.js","assets/runs-table-B1APZv7d.js","assets/index-B3c-0eZG.js","assets/agent-connect-pages-BmknviTI.js","assets/device._deviceId-Bn37UpWH.js","assets/device-pin-tombstone-2U0UMu3_.js","assets/connector-scope-lists-CRFEpSvk.js","assets/_deploymentId-B1UWPY0i.js","assets/app._appId-Cp78oEZ9.js","assets/_connectorKey._connectionId-DWxv1uoi.js","assets/connection-feed-detail-WcGCA6qY.js","assets/connect._clientId-kk0_4Svo.js","assets/skills-DgDGscm5.js","assets/agent-skill-context-DFucg4c4.js","assets/settings-CgZ5Z7wD.js","assets/permissions-Dv39zWKt.js","assets/agent-subpage-shell-CZJvnjNC.js","assets/models-BAVeysNq.js","assets/identity-HCFWtdaI.js","assets/_shape-Ep6JpyFX.js","assets/connected._clientId.index-DhRoSzBr.js","assets/index-DMNzF8Lf.js","assets/agent-skills-route-B3vvvZZe.js","assets/agent-card-controls-CplnPhbv.js","assets/index-BX0EA_oB.js","assets/agent-guardrails-route-TdvvIc_J.js","assets/_viewKey-DDUxjjFD.js","assets/connected._clientId.activity-BqprYeOX.js","assets/create-DkgUQAbB.js","assets/_skillKey-B24alBfT.js","assets/create-C4lptGWj.js","assets/_name-BUfFO_A0.js","assets/_conversationId-98Y3RuRO.js","assets/_viewKey-hdpq3RoX.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function K$(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var TYe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ns(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bv={exports:{}},z1={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -7934,7 +7934,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
7934
7934
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:s,tableCell:c,tableRow:u}};function s(k,b,M,_){return d(p(k,M,_),k.align)}function u(k,b,M,_){const C=y(k,M,_),E=d([C]);return E.slice(0,E.indexOf(`
|
|
7935
7935
|
`))}function c(k,b,M,_){const C=M.enter("tableCell"),E=M.enter("phrasing"),A=M.containerPhrasing(k,{..._,before:i,after:i});return E(),C(),A}function d(k,b){return Dze(k,{align:b,alignDelimiters:r,padding:n,stringLength:a})}function p(k,b,M){const _=k.children;let C=-1;const E=[],A=b.enter("table");for(;++C<_.length;)E[C]=y(_[C],b,M);return A(),E}function y(k,b,M){const _=k.children;let C=-1;const E=[],A=b.enter("tableRow");for(;++C<_.length;)E[C]=c(_[C],k,b,M);return A(),E}function v(k,b,M){let _=XD.inlineCode(k,b,M);return M.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function MFe(){return{exit:{taskListCheckValueChecked:jC,taskListCheckValueUnchecked:jC,paragraph:_Fe}}}function SFe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:CFe}}}function jC(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function _Fe(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let i=-1,s;for(;++i<a.length;){const u=a[i];if(u.type==="paragraph"){s=u;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function CFe(e,t,n,r){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);i&&u.move(s);let c=XD.listItem(e,t,n,{...r,...u.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+s}}function EFe(){return[oze(),Cze(),Oze(),mFe(),MFe()]}function AFe(e){return{extensions:[ize(),Eze(e),Tze(),wFe(e),SFe()]}}const RFe={tokenize:PFe,partial:!0},JD={tokenize:DFe,partial:!0},eL={tokenize:LFe,partial:!0},tL={tokenize:zFe,partial:!0},OFe={tokenize:FFe,partial:!0},nL={name:"wwwAutolink",tokenize:jFe,previous:aL},rL={name:"protocolAutolink",tokenize:IFe,previous:oL},ss={name:"emailAutolink",tokenize:NFe,previous:iL},ci={};function TFe(){return{text:ci}}let ac=48;for(;ac<123;)ci[ac]=ss,ac++,ac===58?ac=65:ac===91&&(ac=97);ci[43]=ss;ci[45]=ss;ci[46]=ss;ci[95]=ss;ci[72]=[ss,rL];ci[104]=[ss,rL];ci[87]=[ss,nL];ci[119]=[ss,nL];function NFe(e,t,n){const r=this;let a,i;return s;function s(y){return!nx(y)||!iL.call(r,r.previous)||f6(r.events)?n(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(y))}function u(y){return nx(y)?(e.consume(y),u):y===64?(e.consume(y),c):n(y)}function c(y){return y===46?e.check(OFe,p,d)(y):y===45||y===95||Nr(y)?(i=!0,e.consume(y),c):p(y)}function d(y){return e.consume(y),a=!0,c}function p(y){return i&&a&&Ur(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(y)):n(y)}}function jFe(e,t,n){const r=this;return a;function a(s){return s!==87&&s!==119||!aL.call(r,r.previous)||f6(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(RFe,e.attempt(JD,e.attempt(eL,i),n),n)(s))}function i(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function IFe(e,t,n){const r=this;let a="",i=!1;return s;function s(y){return(y===72||y===104)&&oL.call(r,r.previous)&&!f6(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(y),e.consume(y),u):n(y)}function u(y){if(Ur(y)&&a.length<5)return a+=String.fromCodePoint(y),e.consume(y),u;if(y===58){const v=a.toLowerCase();if(v==="http"||v==="https")return e.consume(y),c}return n(y)}function c(y){return y===47?(e.consume(y),i?d:(i=!0,c)):n(y)}function d(y){return y===null||Dp(y)||an(y)||_c(y)||bm(y)?n(y):e.attempt(JD,e.attempt(eL,p),n)(y)}function p(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(y)}}function PFe(e,t,n){let r=0;return a;function a(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),a):s===46&&r===3?(e.consume(s),i):n(s)}function i(s){return s===null?n(s):t(s)}}function DFe(e,t,n){let r,a,i;return s;function s(d){return d===46||d===95?e.check(tL,c,u)(d):d===null||an(d)||_c(d)||d!==45&&bm(d)?c(d):(i=!0,e.consume(d),s)}function u(d){return d===95?r=!0:(a=r,r=void 0),e.consume(d),s}function c(d){return a||r||!i?n(d):t(d)}}function LFe(e,t){let n=0,r=0;return a;function a(s){return s===40?(n++,e.consume(s),a):s===41&&r<n?i(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(tL,t,i)(s):s===null||an(s)||_c(s)?t(s):(e.consume(s),a)}function i(s){return s===41&&r++,e.consume(s),a}}function zFe(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),i):u===93?(e.consume(u),a):u===60||u===null||an(u)||_c(u)?t(u):n(u)}function a(u){return u===null||u===40||u===91||an(u)||_c(u)?t(u):r(u)}function i(u){return Ur(u)?s(u):n(u)}function s(u){return u===59?(e.consume(u),r):Ur(u)?(e.consume(u),s):n(u)}}function FFe(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return Nr(i)?n(i):t(i)}}function aL(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||an(e)}function oL(e){return!Ur(e)}function iL(e){return!(e===47||nx(e))}function nx(e){return e===43||e===45||e===46||e===95||Nr(e)}function f6(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $Fe={tokenize:GFe,partial:!0};function qFe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:VFe,continuation:{tokenize:WFe},exit:KFe}},text:{91:{name:"gfmFootnoteCall",tokenize:BFe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:HFe,resolveTo:UFe}}}}function HFe(e,t,n){const r=this;let a=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){s=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!s||!s._balanced)return n(c);const d=wo(r.sliceSerialize({start:s.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function UFe(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function BFe(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;return u;function u(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),c}function c(y){return y!==94?n(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(y){if(i>999||y===93&&!s||y===null||y===91||an(y))return n(y);if(y===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return a.includes(wo(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(y)}return an(y)||(s=!0),i++,e.consume(y),y===92?p:d}function p(y){return y===91||y===92||y===93?(e.consume(y),i++,d):d(y)}}function VFe(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0,u;return c;function c(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(b)}function p(b){if(s>999||b===93&&!u||b===null||b===91||an(b))return n(b);if(b===93){e.exit("chunkString");const M=e.exit("gfmFootnoteDefinitionLabelString");return i=wo(r.sliceSerialize(M)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return an(b)||(u=!0),s++,e.consume(b),b===92?y:p}function y(b){return b===91||b===92||b===93?(e.consume(b),s++,p):p(b)}function v(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),a.includes(i)||a.push(i),Et(e,k,"gfmFootnoteDefinitionWhitespace")):n(b)}function k(b){return t(b)}}function WFe(e,t,n){return e.check(Of,t,e.attempt($Fe,t,n))}function KFe(e){e.exit("gfmFootnoteDefinition")}function GFe(e,t,n){const r=this;return Et(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(i):n(i)}}function YFe(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(s,u){let c=-1;for(;++c<s.length;)if(s[c][0]==="enter"&&s[c][1].type==="strikethroughSequenceTemporary"&&s[c][1]._close){let d=c;for(;d--;)if(s[d][0]==="exit"&&s[d][1].type==="strikethroughSequenceTemporary"&&s[d][1]._open&&s[c][1].end.offset-s[c][1].start.offset===s[d][1].end.offset-s[d][1].start.offset){s[c][1].type="strikethroughSequence",s[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},s[d][1].start),end:Object.assign({},s[c][1].end)},y={type:"strikethroughText",start:Object.assign({},s[d][1].end),end:Object.assign({},s[c][1].start)},v=[["enter",p,u],["enter",s[d][1],u],["exit",s[d][1],u],["enter",y,u]],k=u.parser.constructs.insideSpan.null;k&&Na(v,v.length,0,wm(k,s.slice(d+1,c),u)),Na(v,v.length,0,[["exit",y,u],["enter",s[c][1],u],["exit",s[c][1],u],["exit",p,u]]),Na(s,d-1,c-d+3,v),c=d+v.length-2;break}}for(c=-1;++c<s.length;)s[c][1].type==="strikethroughSequenceTemporary"&&(s[c][1].type="data");return s}function i(s,u,c){const d=this.previous,p=this.events;let y=0;return v;function v(b){return d===126&&p[p.length-1][1].type!=="characterEscape"?c(b):(s.enter("strikethroughSequenceTemporary"),k(b))}function k(b){const M=kd(d);if(b===126)return y>1?c(b):(s.consume(b),y++,k);if(y<2&&!n)return c(b);const _=s.exit("strikethroughSequenceTemporary"),C=kd(b);return _._open=!C||C===2&&!!M,_._close=!M||M===2&&!!C,u(b)}}}class ZFe{constructor(){this.map=[]}add(t,n,r){QFe(this,t,n,r)}consume(t){if(this.map.sort(function(i,s){return i[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const i of a)t.push(i);a=r.pop()}this.map.length=0}}function QFe(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function XFe(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function JFe(){return{flow:{null:{name:"table",tokenize:e$e,resolveAll:t$e}}}}function e$e(e,t,n){const r=this;let a=0,i=0,s;return u;function u(D){let H=r.events.length-1;for(;H>-1;){const Y=r.events[H][1].type;if(Y==="lineEnding"||Y==="linePrefix")H--;else break}const K=H>-1?r.events[H][1].type:null,W=K==="tableHead"||K==="tableRow"?N:c;return W===N&&r.parser.lazy[r.now().line]?n(D):W(D)}function c(D){return e.enter("tableHead"),e.enter("tableRow"),d(D)}function d(D){return D===124||(s=!0,i+=1),p(D)}function p(D){return D===null?n(D):Ve(D)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),k):n(D):yt(D)?Et(e,p,"whitespace")(D):(i+=1,s&&(s=!1,a+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),s=!0,p):(e.enter("data"),y(D)))}function y(D){return D===null||D===124||an(D)?(e.exit("data"),p(D)):(e.consume(D),D===92?v:y)}function v(D){return D===92||D===124?(e.consume(D),y):y(D)}function k(D){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(D):(e.enter("tableDelimiterRow"),s=!1,yt(D)?Et(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):b(D))}function b(D){return D===45||D===58?_(D):D===124?(s=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),M):O(D)}function M(D){return yt(D)?Et(e,_,"whitespace")(D):_(D)}function _(D){return D===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),C):D===45?(i+=1,C(D)):D===null||Ve(D)?R(D):O(D)}function C(D){return D===45?(e.enter("tableDelimiterFiller"),E(D)):O(D)}function E(D){return D===45?(e.consume(D),E):D===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(D))}function A(D){return yt(D)?Et(e,R,"whitespace")(D):R(D)}function R(D){return D===124?b(D):D===null||Ve(D)?!s||a!==i?O(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):O(D)}function O(D){return n(D)}function N(D){return e.enter("tableRow"),P(D)}function P(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),P):D===null||Ve(D)?(e.exit("tableRow"),t(D)):yt(D)?Et(e,P,"whitespace")(D):(e.enter("data"),L(D))}function L(D){return D===null||D===124||an(D)?(e.exit("data"),P(D)):(e.consume(D),D===92?I:L)}function I(D){return D===92||D===124?(e.consume(D),L):L(D)}}function t$e(e,t){let n=-1,r=!0,a=0,i=[0,0,0,0],s=[0,0,0,0],u=!1,c=0,d,p,y;const v=new ZFe;for(;++n<e.length;){const k=e[n],b=k[1];k[0]==="enter"?b.type==="tableHead"?(u=!1,c!==0&&(IC(v,t,c,d,p),p=void 0,c=0),d={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},v.add(n,0,[["enter",d,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(r=!0,y=void 0,i=[0,0,0,0],s=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},v.add(n,0,[["enter",p,t]])),a=b.type==="tableDelimiterRow"?2:p?3:1):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(i[1]!==0&&(s[0]=s[1],y=R0(v,t,i,a,void 0,y),i=[0,0,0,0]),s[2]=n)):b.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(s[0]=s[1],y=R0(v,t,i,a,void 0,y)),i=s,s=[i[1],n,0,0])):b.type==="tableHead"?(u=!0,c=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(c=n,i[1]!==0?(s[0]=s[1],y=R0(v,t,i,a,n,y)):s[1]!==0&&(y=R0(v,t,s,a,n,y)),a=0):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(s[3]=n)}for(c!==0&&IC(v,t,c,d,p),v.consume(t.events),n=-1;++n<t.events.length;){const k=t.events[n];k[0]==="enter"&&k[1].type==="table"&&(k[1]._align=XFe(t.events,n))}return e}function R0(e,t,n,r,a,i){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(i.end=Object.assign({},Gu(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=Gu(t.events,n[1]);if(i={type:s,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const d=Gu(t.events,n[2]),p=Gu(t.events,n[3]),y={type:u,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",y,t]]),r!==2){const v=t.events[n[2]],k=t.events[n[3]];if(v[1].end=Object.assign({},k[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,M=n[3]-n[2]-1;e.add(b,M,[])}}e.add(n[3]+1,0,[["exit",y,t]])}return a!==void 0&&(i.end=Object.assign({},Gu(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function IC(e,t,n,r,a){const i=[],s=Gu(t.events,n);a&&(a.end=Object.assign({},s),i.push(["exit",a,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(n+1,0,i)}function Gu(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const n$e={name:"tasklistCheck",tokenize:a$e};function r$e(){return{text:{91:n$e}}}function a$e(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return an(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),s):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),s):n(c)}function s(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return Ve(c)?t(c):yt(c)?e.check({tokenize:o$e},t,n)(c):n(c)}}function o$e(e,t,n){return Et(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function i$e(e){return mD([TFe(),qFe(),YFe(e),JFe(),r$e()])}const s$e={};function sL(e){const t=this,n=e||s$e,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(i$e(n)),i.push(EFe()),s.push(AFe(n))}function l$e(e){if(!e)return!1;try{const t=typeof window>"u"?"https://localhost":window.location.href,n=new URL(e,t);return n.protocol!=="https:"&&n.protocol!=="http:"?!1:typeof window>"u"||n.host===window.location.host}catch{return!1}}const lL={h1:({children:e})=>h.jsx("h1",{className:"mt-3 mb-1 font-semibold text-base",children:e}),h2:({children:e})=>h.jsx("h2",{className:"mt-3 mb-1 font-semibold text-base",children:e}),h3:({children:e})=>h.jsx("h3",{className:"mt-2 mb-1 font-semibold text-sm",children:e}),h4:({children:e})=>h.jsx("h4",{className:"mt-2 mb-1 font-semibold text-sm",children:e}),p:({children:e})=>h.jsx("p",{className:"leading-relaxed",children:e}),ul:({children:e})=>h.jsx("ul",{className:"my-1 list-disc space-y-0.5 pl-5",children:e}),ol:({children:e})=>h.jsx("ol",{className:"my-1 list-decimal space-y-0.5 pl-5",children:e}),li:({children:e})=>h.jsx("li",{className:"leading-relaxed",children:e}),strong:({children:e})=>h.jsx("strong",{className:"font-semibold",children:e}),em:({children:e})=>h.jsx("em",{className:"italic",children:e}),a:({href:e,children:t})=>l$e(e)?h.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-primary underline underline-offset-2",children:t}):h.jsx(h.Fragment,{children:t}),img:({alt:e})=>h.jsx(h.Fragment,{children:e}),code:({className:e,children:t})=>/^language-/.test(e??"")?h.jsx("code",{className:e,children:t}):h.jsx("code",{className:"rounded bg-foreground/10 px-1 py-0.5 text-[0.85em]",children:t}),pre:({children:e})=>h.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg border bg-foreground/5 p-3 text-xs",children:e}),blockquote:({children:e})=>h.jsx("blockquote",{className:"border-border border-l-2 pl-3 text-muted-foreground italic",children:e}),hr:()=>h.jsx("hr",{className:"my-3 border-border"}),table:({children:e})=>h.jsx("div",{className:"my-2 overflow-x-auto",children:h.jsx("table",{className:"w-full border-collapse text-xs",children:e})}),th:({children:e})=>h.jsx("th",{className:"border border-border px-2 py-1 text-left font-semibold",children:e}),td:({children:e})=>h.jsx("td",{className:"border border-border px-2 py-1",children:e})},cXe=({text:e,className:t})=>h.jsx("div",{className:ve("space-y-2 break-words text-sm",t),children:h.jsx(LD,{remarkPlugins:[sL],components:lL,children:e})}),cL={...lL,p:({children:e})=>h.jsx(h.Fragment,{children:e}),h1:({children:e})=>h.jsx(h.Fragment,{children:e}),h2:({children:e})=>h.jsx(h.Fragment,{children:e}),h3:({children:e})=>h.jsx(h.Fragment,{children:e}),h4:({children:e})=>h.jsx(h.Fragment,{children:e}),h5:({children:e})=>h.jsx(h.Fragment,{children:e}),h6:({children:e})=>h.jsx(h.Fragment,{children:e}),ul:({children:e})=>h.jsx(h.Fragment,{children:e}),ol:({children:e})=>h.jsx(h.Fragment,{children:e}),li:({children:e})=>h.jsx(h.Fragment,{children:e}),blockquote:({children:e})=>h.jsx(h.Fragment,{children:e}),pre:({children:e})=>h.jsx(h.Fragment,{children:e}),hr:()=>null},c$e={...cL,a:({children:e})=>h.jsx(h.Fragment,{children:e})},u$e=({text:e,className:t,linkPolicy:n="strip"})=>h.jsx("span",{className:ve("break-words",t),children:h.jsx(LD,{remarkPlugins:[sL],components:n==="app-links"?cL:c$e,children:e})});function uL(e){const t=Number(e);return Number.isSafeInteger(t)&&t>0&&String(t)===e?t:null}function p6(e){const t=e.split("/").filter(Boolean),[n,r,a]=t;if(!n||r!=="events"||a===void 0)return null;const i=uL(a);if(i===null)return null;if(t.length===3)return{owner:n,eventId:i};const s=t[5];return t.length===6&&t[3]===Hi&&t[4]==="views"&&s&&encodeURIComponent(s)===s?{owner:n,eventId:i,viewKey:s}:null}function PC(e,t,n){return`/${e}/events/${t}${n?_A(n):""}`}const Cm=["peek","peek_run_id","peek_content_ids","peek_automation","peek_view","peek_entity"];function dL(e){return e==="1"||e==="true"||e===!0||e===1}function Em(e){if(!e)return{};const t={};for(const n of Cm){const r=e[n];if(!(r==null||r==="")){if(n==="peek"){dL(r)&&(t.peek="1");continue}typeof r=="string"&&r.trim()?t[n]=r.trim():typeof r=="number"&&Number.isFinite(r)&&(t[n]=String(r))}}return t}function DC(e){const t={...e};for(const n of Cm)delete t[n];return t}function d$e(e){return dL(e?.peek)}function E4(e){const t=e.split("/").filter(Boolean);if(t.length<3||t.length%2===0||ai(t[1]))return null;const n=t.slice(1).join("/");return Cc(n)?n:null}function A4(e,t){if(t.peek_automation){const n=new URLSearchParams;(t.peek_view==="activity"||t.peek_view==="definition")&&n.set("view",t.peek_view),t.peek_run_id&&/^\d+$/.test(t.peek_run_id)&&n.set("run_id",t.peek_run_id);const r=n.size>0?`?${n.toString()}`:"";return`/${e}/automations/${t.peek_automation}${r}`}if(t.peek_run_id&&$p(t.peek_run_id)){const n=new URLSearchParams({run_ids:t.peek_run_id});return`/${e}/events?${n.toString()}`}if(t.peek_content_ids&&$p(t.peek_content_ids)){const n=t.peek_content_ids.split(",");if(n.length===1){const a=PC(e,Number(n[0].trim())),i=t.peek_view?PC(e,Number(n[0].trim()),t.peek_view):a;return p6(i)?i:a}const r=new URLSearchParams({content_ids:t.peek_content_ids});return`/${e}/events?${r.toString()}`}return t.peek_entity&&Cc(t.peek_entity)&&t.peek_view?`/${e}/${t.peek_entity}${_A(t.peek_view)}`:t.peek_entity&&Cc(t.peek_entity)?`/${e}/events/${t.peek_entity}`:null}function nh(e){const t=typeof window<"u"?window.location.origin:null;if(URL.canParse(e)){const s=new URL(e);if((s.protocol==="http:"||s.protocol==="https:")&&s.origin!==t)return null}const{pathname:n,search:r}=Ed(e),a=n.split("/").filter(Boolean);if(a.length===2&&(a[1]==="events"||a[1]==="memory")){const s=r?.run_ids;if(s&&$p(s))return{peek:"1",peek_run_id:s};const u=r?.content_ids;return u&&$p(u)?{peek:"1",peek_content_ids:u}:null}const i=p6(n);if(i)return{peek:"1",peek_content_ids:String(i.eventId),...i.viewKey?{peek_view:i.viewKey}:{}};if(a.length>=4&&a[1]==="events"){const s=a.slice(2).join("/");return Cc(s)?{peek:"1",peek_entity:s}:null}if(a.length>=3&&!ai(a[1])){const s=Cp(a.slice(1).join("/"));return!s||!Cc(s.entityPath)?null:s.viewKey?{peek:"1",peek_entity:s.entityPath,peek_view:s.viewKey}:{peek:"1",peek_entity:s.entityPath}}if(a.length===3&&a[1]==="automations"){const s={peek:"1",peek_automation:a[2]};return(r?.view==="activity"||r?.view==="definition")&&(s.peek_view=r.view),r?.run_id&&/^\d+$/.test(r.run_id)&&(s.peek_run_id=r.run_id),s}return null}function Cc(e){const t=e.split("/");return t.length>=2&&t.length%2===0&&t.every(n=>n.length>0&&!n.includes("?"))&&!ai(t[0])&&!["chat","entity-types","recent"].includes(t[0])}function $p(e){const t=e.split(",");return t.length>0&&t.length<=50&&t.every(n=>/^\d+$/.test(n.trim())&&Number(n)>0)}function R4(e,t){const n={...e};for(const r of Cm)delete n[r];for(const[r,a]of Object.entries(t))a&&(n[r]=a);return n}const rx="[^/]+",h$e=new RegExp(`^/(${rx})/automations/(${rx})/?$`),f$e=new RegExp(`^/(${rx})/(?:events|memory)/?$`);function Am(e){const{pathname:t,search:n}=Ed(e),r=t.match(h$e);if(r){const[,c,d]=r,p=n?.view==="activity"||n?.view==="definition"?n.view:void 0,y=hL(n?.run_id);return{kind:"automation",owner:c,automationId:d,view:p,runId:y}}const a=t.match(f$e);if(a){const[,c]=a,d=LC(n?.run_ids);if(d?.length===1)return{kind:"memory",owner:c,runId:d[0]};if(d&&d.length>1)return{kind:"memory",owner:c,runIds:d};const p=LC(n?.content_ids);return p?{kind:"memory",owner:c,contentIds:p}:null}const i=p6(t);if(i)return{kind:"event",...i};const s=t.split("/").filter(Boolean);if(s.length>=4&&s[1]==="events")return Cc(s.slice(2).join("/"))?{kind:"entity",owner:s[0],path:s.slice(2).join("/")}:null;const u=s.length>=3?Cp(s.slice(1).join("/")):null;return u&&Cc(u.entityPath)?u.viewKey?{kind:"record-view",owner:s[0],path:u.entityPath,viewKey:u.viewKey}:{kind:"entity",owner:s[0],path:u.entityPath}:null}function LC(e){if(!e)return null;const t=e.split(",");if(t.length===0||t.length>50)return null;const n=t.map(r=>hL(r.trim()));return n.every(r=>r!=null)?n:null}function hL(e){if(e==null||e==="")return;const t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}const fL=x.createContext(null);function p$e(e,t){if(t?.trim())return t.trim();const n=Am(e);return n?n.kind==="memory"&&"runId"in n?`Run #${n.runId}`:n.kind==="memory"||n.kind==="entity"?"Activity":n.kind==="event"?"Event":n.kind==="record-view"?"View":n.kind==="automation"?n.runId!=null?`Automation run #${n.runId}`:"Automation":"Details":"Details"}function uXe({children:e}){const t=cr(),n=ri(),a=Tc({strict:!1}).owner??"",i=ZAe(n.pathname),[s,u]=x.useState(null),[c,d]=x.useState([]);x.useEffect(()=>{const M=()=>{u(null),d(O=>O.length>0?[]:O)};if(!a){M();return}if(i)return;const _=n.search;if(!d$e(_)){M();return}const C=Em(_);if(!C.peek_entity&&!C.peek_run_id&&!C.peek_content_ids&&!C.peek_automation){const O=E4(n.pathname);O&&(C.peek_entity=O)}const E=A4(a,C),A=E?Am(E):null;if(!E||!A){M();return}const R=A.kind==="memory"&&"runId"in A||A.kind==="automation"?A.runId:void 0;u(O=>{if(O?.href===E&&O.runId===R)return O;const N=O?nh(O.href):null,P=O?.href===E||N!==null&&A4(a,N)===E;return{href:E,title:p$e(E,P?O?.title:void 0),runId:R}})},[n.search,n.pathname,a,i]);const p=x.useCallback(M=>{const _=E=>{if(E.key)return E.key;const A=nh(E.href);return A&&A4(a,A)||E.href};d(E=>s&&_(s)!==_(M)?[...E,s]:E);const C=nh(M.href);if(!C||i){u(M);return}if(typeof M.browserUrl=="string"&&M.browserUrl.length>0){u(M);return}M.runId!=null&&C.peek_automation&&!C.peek_run_id&&(C.peek_run_id=String(M.runId)),C.peek_entity&&C.peek_entity===E4(n.pathname)&&(C.peek_entity=void 0),u(M),t({search:(E=>R4(E,C)),replace:!0})},[t,n.pathname,s,i,a]),y=x.useCallback(()=>{const M=c[c.length-1];if(!M)return;d(C=>C.slice(0,-1)),u(M);const _=nh(M.href);!_||M.browserUrl||i||(_?.peek_entity&&_.peek_entity===E4(n.pathname)&&(_.peek_entity=void 0),t({search:(C=>_?R4(C,_):DC(C)),replace:!0}))},[t,c,n.pathname,i]),v=x.useCallback(M=>{u(C=>C&&{...C,href:M});const _=nh(M);!_||i||t({search:(C=>R4(C,_)),replace:!0})},[t,i]),k=x.useCallback(()=>{d([]),u(null),!i&&t({search:(M=>DC(M)),replace:!0})},[t,i]),b=x.useMemo(()=>({item:s,open:p,close:k,back:c.length>0?y:null,retarget:v}),[s,p,k,y,c.length,v]);return h.jsx(fL.Provider,{value:b,children:e})}function y6(){return x.useContext(fL)}const pL={screentime:"Screen Time",healthkit:"Apple Health",photos:"Photos",calendar:"Calendar",reminders:"Reminders",computer_use:"Computer use"},y$e={ios:"iPhone",macos:"Mac","chrome-extension":"Chrome",headless:"Worker"};function Nf(e){return e.platform?e.platform:/^ios-bridge-/i.test(e.worker_id)?"ios":/^mac-bridge-/i.test(e.worker_id)?"macos":null}function m$e(e){return y$e[e??""]??e??"Device"}function m6(e){const t=e.label?.trim();return t&&!/^(device|(ios|mac|lobu)?\s*bridge)$/i.test(t)?t:`${m$e(Nf(e))} · ${e.id.slice(0,8)}`}function g$e(e){const t=e?.trim();return t?/^\d/.test(t)?`v${t}`:t:null}function v$e(e,t){const n=/^(ios|mac)-bridge-/i.test(e.worker_id)?null:e.worker_id;return[t,n].filter(Boolean).join(" · ")}function dXe(e,t){return e.find(n=>n.id===t||n.worker_id===t)}function yL({platform:e,className:t}){return e==="ios"?h.jsx(gR,{className:ve("h-4 w-4 text-muted-foreground",t)}):e==="headless"?h.jsx(Wx,{className:ve("h-4 w-4 text-muted-foreground",t)}):e==="chrome-extension"?h.jsx(XA,{className:ve("h-4 w-4 text-muted-foreground",t)}):h.jsx(Fx,{className:ve("h-4 w-4 text-muted-foreground",t)})}function k$e({online:e,className:t}){return h.jsx("span",{"aria-hidden":!0,className:ve("inline-block h-2 w-2 shrink-0 rounded-full",e?"bg-green-500":"bg-muted-foreground/40",t)})}function x$e({owner:e,source:t,connectorDefinitions:n=[],className:r,onFiltersChange:a,variant:i="inline",hideOriginator:s=!1,runId:u,onRunSelect:c}){const d=e==="me"?void 0:e,p=t.platform?.trim()||null,y=p?ZN(p,n??[]):null,v=t.connection_name||y?.name||p,k=t.feed_name||t.feed_key||null,b=d&&p&&t.connection_id!=null?`/${d}/connectors/${encodeURIComponent(p)}/${t.connection_id}`:null,M=[],_=({key:O,label:N,content:P,href:L,filters:I,detail:D=N,search:H,onSelect:K})=>{const W=ve("inline-flex min-w-0 items-center gap-1",i==="chips"&&"rounded-md bg-muted px-1.5 py-1");M.push({key:O,node:K!=null?h.jsx("button",{type:"button",className:`${W} hover:underline`,title:D,"aria-label":D,onClick:K,children:P}):a&&I?h.jsx("button",{type:"button",className:`${W} text-left hover:underline`,title:`Filter activity by ${N}`,"aria-label":`Filter activity by ${N}`,onClick:()=>a(I),children:P}):L?h.jsx(nn,{to:L,search:H,className:`${W} hover:underline`,title:D,children:P}):h.jsx("span",{className:W,title:D,children:P})})};if(p&&v&&_({key:"connection",label:v,content:h.jsxs(h.Fragment,{children:[h.jsx(yf,{plain:!0,name:y?.name??p,icon:y?.icon,faviconDomain:y?.faviconDomain,fallback:h.jsx(Ux,{className:"h-3.5 w-3.5"}),className:"h-3.5 w-3.5 rounded-sm text-[9px]"}),h.jsx("span",{className:"truncate",children:v})]}),href:b,filters:t.connection_id!=null?{platforms:[p],connectionIds:[t.connection_id],feedIds:void 0}:void 0}),k&&_({key:"feed",label:k,content:h.jsxs(h.Fragment,{children:[h.jsx(fR,{className:"h-3.5 w-3.5 shrink-0"}),h.jsx("span",{className:"truncate",children:k})]}),href:b&&t.feed_id!=null?b:null,filters:t.feed_id!=null?{platforms:p?[p]:void 0,connectionIds:t.connection_id!=null?[t.connection_id]:void 0,feedIds:[t.feed_id]}:void 0,search:{feedId:t.feed_id??void 0}}),t.automation_name&&_({key:"automation",label:t.automation_name,content:h.jsxs(h.Fragment,{children:[h.jsx(Gx,{className:"h-3.5 w-3.5 shrink-0"}),h.jsx("span",{className:"truncate",children:t.automation_name})]}),href:d&&t.automation_id!=null?`/${d}/automations/${t.automation_id}`:null,filters:t.automation_id!=null?{producedByAutomationId:t.automation_id}:void 0,search:{view:"activity",run_id:void 0}}),u!=null&&c){const O=t.automation_name??`Automation ${t.automation_id}`;_({key:"run",label:`Run #${u}`,content:h.jsxs(h.Fragment,{children:[h.jsx(ny,{className:"h-3.5 w-3.5 shrink-0"}),h.jsxs("span",{className:"truncate",children:["Run #",u]})]}),href:null,detail:`${O} · Run #${u} conversation`,onSelect:c})}const C=t.agent_name||t.agent_id||null,E=t.client_name||t.client_id||null,A=t.device_label||t.device_worker_id||null,R=C?{kind:"agent",label:C}:E?{kind:"client",label:E}:A?{kind:"device",label:A}:null;if(R&&!s){const O=[R.kind==="agent"&&E?`${R.label} via ${E}`:R.label,R.kind!=="device"&&A?`executed on ${A}`:null].filter(Boolean).join(" · "),N=d?R.kind==="agent"&&t.agent_id?`/${d}/agents/${encodeURIComponent(t.agent_id)}`:R.kind==="client"&&t.client_id?`/${d}/agents/connected/${encodeURIComponent(t.client_id)}`:R.kind==="device"&&t.device_worker_id?`/${d}/connectors/device/${encodeURIComponent(t.device_worker_id)}`:null:null;_({key:"originator",label:R.label,content:h.jsxs(h.Fragment,{children:[R.kind==="agent"?h.jsx(ay,{className:"h-3.5 w-3.5 shrink-0"}):R.kind==="client"?h.jsx(hj,{name:R.label}):h.jsx(yL,{platform:t.device_platform??null,className:"h-3.5 w-3.5"}),h.jsx("span",{className:"truncate",children:R.label})]}),href:N,filters:R.kind==="agent"&&t.agent_id?{agentId:t.agent_id}:R.kind==="client"&&t.client_id?{clientIds:[t.client_id]}:void 0,detail:O})}return M.length===0?null:h.jsx("div",{className:ve("flex min-w-0 flex-wrap items-center gap-1 text-muted-foreground",r),children:M.map(({key:O,node:N},P)=>h.jsxs(x.Fragment,{children:[i==="inline"&&P>0?h.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"}):null,N]},O))})}const b$e={xs:"h-2.5 w-2.5",sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4",xl:"h-5 w-5"};function Dt({size:e="md",className:t,...n}){return h.jsx(rp,{"aria-hidden":"true",className:ve(b$e[e],"animate-spin",t),...n})}function mL(e){const t=`open-browser-target:${crypto.randomUUID()}`;return new Promise(n=>{const r=window.setTimeout(()=>{document.removeEventListener(c4,a),n(!1)},1500),a=i=>{const s=tD(i);s?.id===t&&(window.clearTimeout(r),document.removeEventListener(c4,a),n(s.ok===!0))};document.addEventListener(c4,a),jje(Oje,{id:t,...e})})}async function zC(e,t){let n;try{n=new URL(e)}catch{return!1}if(n.protocol!=="http:"&&n.protocol!=="https:")return!1;if(document.documentElement.hasAttribute("data-owletto-lens-bridge"))return t&&await t(),mL({url:n.toString()});if(window.parent===window){const a=window.open("","_blank");if(!a)return!1;a.opener=null;try{t&&await t(),a.location.replace(n.toString())}catch(i){throw a.close(),i}return!0}t&&await t();const r=`open-tab:${crypto.randomUUID()}`;return new Promise(a=>{const i=window.setTimeout(()=>{window.removeEventListener("message",s),a(!1)},1500),s=u=>{u.data?.id===r&&(window.clearTimeout(i),window.removeEventListener("message",s),a(u.data?.ok===!0))};window.addEventListener("message",s),window.parent.postMessage({id:r,op:"openTab",params:{url:n.toString()}},"*")})}async function w$e(){return document.documentElement.hasAttribute("data-owletto-lens-bridge")?mL({focusHost:!0}):(window.focus(),!0)}const FC=/^\[Review in Lobu\]\(.*\)$/,M$e=/^[-*]\s/;function S$e(e){if(!e)return null;const t=[];for(const a of e.split(`
|
|
7936
7936
|
`)){const i=a.trim();if(i===""){if(t.length>0)break;continue}if(M$e.test(i)||FC.test(i))break;t.push(i)}const n=t.join(" ").trim();if(n!=="")return n;const r=e.split(`
|
|
7937
|
-
`).map(a=>a.trim()).filter(a=>a!==""&&!FC.test(a)).join(" ").trim();return r===""?null:r}function _$e(e){switch(e){case"action_approval_needed":return"Needs approval";case"connection_permission_request":return"Authorization needed";case"browser_auth_expired":return"Sign-in required";case"invitation_received":return"Invitation";case"agent_message":return"Agent";default:return"Notification"}}function C$e(e,t){if(t==null||t==="")return null;switch(e){case"action_approval_needed":return"Review & approve";case"connection_permission_request":return"Authorize connection";case"browser_auth_expired":return"Open connection";case"invitation_received":return"Accept invitation";default:return null}}function E$e(){const e=cr();return t=>{const{pathname:n,search:r}=Ed(t);e({to:n,search:r??{}})}}function gL({href:e,className:t,onClick:n,children:r}){const{pathname:a,search:i}=Ed(e);return h.jsx(nn,{to:a,search:i??{},className:t,onClick:n,children:r})}function A$e(e){return e?_$e(e):"Notification"}function R$e({runId:e,notificationId:t,reviewHref:n,reviewTitle:r,choiceField:a,choices:i}){const{orgContext:s}=Mr(),u=Nve(),c=jve(),d=gO(s),p=y6(),[y,v]=x.useState(null),[k,b]=x.useState(!1),[M,_]=x.useState(""),C=u.isPending||c.isPending;return y==="approved"?h.jsx("p",{className:"mt-2 text-xs font-medium text-emerald-600 dark:text-emerald-400",children:"Approved — executing…"}):y==="rejected"?h.jsx("p",{className:"mt-2 text-xs font-medium text-muted-foreground",children:"Rejected"}):k?h.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[h.jsx("input",{type:"text",placeholder:"Reason (optional)",value:M,onChange:E=>_(E.target.value),className:"h-7 min-w-[10rem] flex-1 rounded-md border bg-background px-2 text-xs",onClick:E=>E.stopPropagation()}),h.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:C,onClick:E=>{E.stopPropagation(),c.mutate({run_id:e,reason:M.trim()||void 0},{onSuccess:()=>{v("rejected"),d.mutate(t)}})},children:[c.isPending?h.jsx(Dt,{size:"sm",className:"mr-1"}):h.jsx(ol,{className:"mr-1 h-3 w-3"}),"Reject"]}),h.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:E=>{E.stopPropagation(),b(!1)},children:"Cancel"})]}):a&&i&&i.length>0?h.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.map(E=>h.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:C,onClick:A=>{A.stopPropagation(),u.mutate({run_id:e,input:{[a]:E.value}},{onSuccess:()=>{v("approved"),d.mutate(t)}})},children:[u.isPending?h.jsx(Dt,{size:"sm",className:"mr-1"}):null,E.label]},E.value)),h.jsxs(ke,{size:"sm",variant:"ghost",className:"h-7 text-xs text-muted-foreground",disabled:C,onClick:E=>{E.stopPropagation(),b(!0)},children:[h.jsx(ol,{className:"mr-1 h-3 w-3"}),"Dismiss"]})]}):h.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[n?p&&Am(n)?h.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 text-xs",onClick:E=>{E.stopPropagation(),d.mutate(t),p.open({href:n,title:r??"Approval",runId:e})},children:"Review"}):h.jsx(gL,{href:n,className:ve("inline-flex h-7 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium transition-colors hover:bg-accent hover:text-accent-foreground"),onClick:E=>{E.stopPropagation(),d.mutate(t)},children:"Review"}):null,h.jsxs(ke,{size:"sm",className:"h-7 text-xs",disabled:C,onClick:E=>{E.stopPropagation(),u.mutate({run_id:e},{onSuccess:()=>{v("approved"),d.mutate(t)}})},children:[u.isPending?h.jsx(Dt,{size:"sm",className:"mr-1"}):h.jsx(ja,{className:"mr-1 h-3 w-3"}),"Approve"]}),h.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:C,onClick:E=>{E.stopPropagation(),b(!0)},children:[h.jsx(ol,{className:"mr-1 h-3 w-3"}),"Reject"]})]})}function O$e({owner:e,item:t,index:n,onFocus:r,onOpenItem:a,tone:i="default",rowAction:s="open",tag:u}){const c=E$e(),d=y6(),{orgContext:p}=Mr(),{data:y=[]}=KR(p.organizationId??null),v=gO(p),k=tke(p),b=nke(p),M=b.isPending&&typeof b.variables=="number"?b.variables:null,_=s==="open",C=q=>{if(!q.browserUrl&&q.notificationId!=null&&q.unread&&v.mutate(q.notificationId),q.interactionType==="authorization"&&q.href){c(q.href);return}if(a){a(q);return}if(d){d.open({href:q.href??"",title:q.title,runId:q.runId??void 0,body:q.body,notificationType:q.notification?.type,createdAt:q.notification?.created_at,browserUrl:q.browserUrl??null,browserHandoff:q.browserHandoff??null,owner:e,sourceAttribution:q.notification??null});return}q.href&&c(q.href)},E=async q=>{if(!q.browserUrl)return;const $=q.browserHandoff?.state==="expired"&&q.browserHandoff.run_id!=null;if(q.browserHandoff?.state==="completed"||q.browserHandoff?.state==="preparing"){gn.info(q.browserHandoff.state==="preparing"?"Preparing the draft in your browser. Keep that tab open.":"Draft prepared. Review and post in your browser, then mark it Done.");return}if($&&q.notificationId==null){gn.error("This expired draft cannot be recreated from this card.");return}try{const B=q.notificationId,J=$&&B!=null?()=>b.mutateAsync(B):void 0;(J?await zC(q.browserUrl,J):await zC(q.browserUrl))||gn.error("Chrome blocked the handoff tab. Allow pop-ups for Lobu and try again.")}catch(B){gn.error(B instanceof Error?B.message:"Could not recreate this browser draft.")}},A=q=>{if(q.browserUrl){E(q);return}C(q)},R=t.approvalRunId??null,O=t.interactionType==="approval",N=O?t.interactionStatus==="approved"?"Approved":t.interactionStatus==="rejected"?"Rejected":t.interactionStatus==="expired"?"Expired":t.interactionStatus&&t.interactionStatus!=="pending"?t.interactionStatus.charAt(0).toUpperCase()+t.interactionStatus.slice(1):null:null,P=O&&t.interactionStatus==="pending"&&t.interactionInline===!0&&R!=null,L=!P&&!N&&t.notification?C$e(t.notification.type,t.href):null,I=O&&N?"Approval":A$e(t.notification?.type),D=S$e(t.body),H=t.notification,K=D?h.jsx("div",{className:"line-clamp-2 text-sm",onClick:q=>{q.target.closest("a")&&q.stopPropagation()},children:h.jsx(u$e,{text:D,linkPolicy:t.notification?.type==="action_approval_needed"?"app-links":"strip"})}):t.body?h.jsx("p",{className:"line-clamp-2 text-sm",children:t.body}):null,W=h.jsxs(h.Fragment,{children:[h.jsx(zje,{dot:t.unread?i==="relevant"?"bg-primary":"bg-blue-500":void 0,tag:u,children:I}),P&&t.notification&&R!=null?h.jsx(R$e,{runId:R,notificationId:t.notification.id,reviewHref:t.href,reviewTitle:t.title,choiceField:t.interactionChoiceField,choices:t.interactionChoices}):N?h.jsx("p",{className:ve("mt-2 text-xs font-medium",t.interactionStatus==="approved"?"text-emerald-600 dark:text-emerald-400":"text-muted-foreground"),children:N}):null,L&&t.href?h.jsx("div",{className:"mt-2",children:h.jsx(gL,{href:t.href,className:"inline-flex h-7 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium transition-colors hover:bg-accent hover:text-accent-foreground",onClick:q=>{q.stopPropagation(),t.notification&&!t.notification.is_read&&v.mutate(t.notification.id),t.notification?.type==="action_approval_needed"&&d&&Am(t.href??"")&&(q.preventDefault(),A(t))},children:L})}):null,t.browserUrl?h.jsxs("div",{className:"mt-2 space-y-1.5",children:[t.browserHandoff?.state==="expired"?h.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Draft expired",t.browserHandoff.error_message?` — ${t.browserHandoff.error_message}`:"."]}):null,h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.browserHandoff?.state!=="completed"&&t.browserHandoff?.state!=="preparing"?h.jsxs(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 text-xs",disabled:M!=null&&M===t.notificationId,onClick:q=>{q.stopPropagation(),E(t)},children:[M!=null&&M===t.notificationId?h.jsx(Dt,{size:"sm",className:"mr-1"}):null,t.browserHandoff?.state==="expired"&&t.browserHandoff.run_id!=null?"Recreate draft":t.browserHandoff?.state==="expired"?"Open page without draft":"Open page"]}):h.jsx("span",{className:"self-center text-xs text-muted-foreground",children:t.browserHandoff?.state==="preparing"?"Preparing draft — keep your browser tab open.":"Draft prepared — review and post in your browser."}),d?h.jsx(ke,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-xs text-muted-foreground",onClick:q=>{q.stopPropagation(),C(t)},children:"Why/how"}):null,t.interactionStatus!=="pending"?h.jsxs(ke,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-xs text-muted-foreground",disabled:k.isPending,onClick:q=>{q.stopPropagation(),t.notificationId!=null&&k.mutate(t.notificationId)},children:[h.jsx(ol,{className:"mr-1 h-3 w-3"}),"Done"]}):null]})]}):null]}),Y=h.jsxs("div",{className:"flex gap-3",children:[h.jsx(Dje,{className:Lje,children:h.jsx(Pje,{platform:H?.platform,connectorDefinitions:y,label:I,fallback:h.jsx(jx,{className:"h-4 w-4"})})}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-start justify-between gap-3",children:[h.jsx("h4",{className:"line-clamp-2 min-w-0 text-sm font-medium",children:t.title}),h.jsx(Fje,{at:new Date(t.at)})]}),K?h.jsx("div",{className:"mt-1 text-muted-foreground",children:K}):null,H?h.jsx(x$e,{owner:e,source:H,connectorDefinitions:y,variant:"chips",className:"mt-2 text-xs"}):null,W]})]});return h.jsx("div",{"data-attention-index":n,role:_?"link":void 0,tabIndex:_?0:void 0,onFocus:_?r:void 0,onClick:_?()=>A(t):void 0,onKeyDown:_?q=>{q.target===q.currentTarget&&(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),A(t))}:void 0,className:ve("block w-full rounded-lg p-3 text-left transition-colors",_&&"cursor-pointer hover:bg-accent/40"),children:Y})}function T$e({owner:e,emptyState:t=null,itemFilter:n,onOpenItem:r,ariaLabel:a="Needs attention",tone:i="default",rowAction:s="open"}){const{session:u,isLoading:c,isError:d,attentionItems:p,markManyRead:y}=Ad(e),v=x.useMemo(()=>n?p.filter(n):p,[p,n]),[k,b]=x.useState(0),M=x.useRef(null),_=s==="open",C=A=>{const R=Math.min(Math.max(A,0),v.length-1);b(R),M.current?.querySelector(`[data-attention-index="${R}"]`)?.focus()};if(!u)return h.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Sign in to see workspace activity."});if(c&&v.length===0)return h.jsx("div",{className:"space-y-2",children:Array.from({length:4}).map((A,R)=>h.jsx("div",{className:ve(Qh,"h-14 animate-pulse")},R))});if(d)return h.jsx("p",{className:"py-6 text-center text-sm text-destructive",children:"Could not load recent activity."});if(v.length===0)return t;const E=h.jsx("ul",{className:"space-y-1",children:v.map((A,R)=>h.jsx("li",{children:h.jsx(O$e,{owner:e,item:A,index:R,onFocus:()=>b(R),onOpenItem:r,tone:i,rowAction:s})},A.id))});return h.jsxs("section",{ref:M,"data-attention-list":!0,"aria-label":a,"aria-keyshortcuts":_?"ArrowDown ArrowUp Enter R":void 0,className:"space-y-2.5",onKeyDown:_?A=>{const R=A.target;if(!(R.matches("input, textarea, select")||R.isContentEditable)){if(A.key==="ArrowDown"||A.key==="ArrowUp"){const O=R.closest("[data-attention-index]");if(!O)return;A.preventDefault();const N=Number(O?.dataset.attentionIndex),P=Number.isInteger(N)?N:A.key==="ArrowDown"?-1:0;C(P+(A.key==="ArrowDown"?1:-1))}if(A.key.toLowerCase()==="r"){const O=v[k];O?.unread&&O.notificationId!=null&&(A.preventDefault(),y.mutateAsync([O.notificationId]))}}}:void 0,children:[E,_?h.jsxs("div",{"data-testid":"attention-shortcut-hint",role:"note","aria-label":"Attention keyboard shortcuts",className:"attention-shortcut-hint pointer-events-none mx-auto mt-3 w-fit items-center gap-4 rounded-full border bg-background/95 px-5 py-2 text-xs text-muted-foreground backdrop-blur",children:[h.jsxs("span",{children:[h.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5",children:"↑↓"})," Navigate"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5",children:"Enter"})," Open"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5",children:"R"})," Mark read"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5",children:"Tab"})," Actions"]})]}):null]})}function $C(){if(window.__lobuAmbientContext)return window.__lobuAmbientContext;if(window.parent!==window&&/^chrome-extension:\/\/[a-p]{32}$/.test(window.location.ancestorOrigins?.[0]??""))return{kind:"browser",url:null,title:null,applicationName:"Chrome"}}function hXe(){const[e,t]=x.useState($C);return x.useEffect(()=>{const n=()=>t($C());window.addEventListener("owletto:ambient-context",n),n();const r=a=>{const i=Ije(a,window.parent,window);i&&t(i)};return window.addEventListener("message",r),window.parent!==window&&window.parent.postMessage({owletto:"ambient-context-request"},"*"),()=>{window.removeEventListener("owletto:ambient-context",n),window.removeEventListener("message",r)}},[]),e}function N$e({owner:e,context:t,emptyState:n,onOpenItem:r,compact:a=!1}){const[i,s]=x.useState(!1),u=eD(),{attentionItems:c}=Ad(e),d=t!==void 0&&!i,p=d?v=>Tje(v,t):void 0,y=p?c.filter(p).length:c.length;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:ve("sticky top-0 z-20 flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2 bg-background pt-1",u?"justify-center":"justify-between"),children:[t?h.jsxs("fieldset",{className:"flex items-center gap-2","aria-label":"Notification scope",children:[h.jsxs("button",{type:"button","aria-pressed":!i,onClick:()=>s(!1),className:"rounded-md px-2.5 py-1 text-xs aria-pressed:bg-muted",children:["Relevant here",d?` (${y})`:""]}),h.jsx("button",{type:"button","aria-pressed":i,onClick:()=>s(!0),className:"rounded-md px-2.5 py-1 text-xs aria-pressed:bg-muted",children:"All notifications"})]}):null,!d&&!a&&h.jsx(i3e,{owner:e})]}),h.jsx(T$e,{owner:e,itemFilter:p,onOpenItem:r,rowAction:a?"none":"open",ariaLabel:d?"Relevant here":"Needs attention",tone:d?"relevant":"default",emptyState:d?h.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No notifications linked to this context."}):n})]})}const j$e={width:340,height:360},I$e={width:340,height:436},vL=x.createContext(null);function qC(){return window.documentPictureInPicture??null}function P$e(e){const t=e.createElement("base");t.href=document.baseURI,e.head.append(t);for(const n of document.querySelectorAll('link[rel="stylesheet"], style')){const r=n.cloneNode(!0);n instanceof HTMLLinkElement&&r instanceof HTMLLinkElement&&(r.href=n.href),e.head.append(r)}e.documentElement.className=document.documentElement.className,e.documentElement.style.colorScheme=getComputedStyle(document.documentElement).colorScheme,e.body.style.margin="0",e.body.style.width="100vw",e.body.style.height="100vh",e.body.style.overflow="hidden"}function D$e({owner:e,activeContext:t}){const n=cr(),r=x.useCallback(i=>{(async()=>{if(!i.href)return;const{pathname:s,search:u}=Ed(i.href);await n({to:s,search:u??{}}),await w$e()})()},[n]),a=t??{kind:"browser",url:null,title:null,applicationName:"Chrome"};return h.jsx("main",{className:"lobu-lens-surface bg-background text-foreground","aria-label":"Context notifications",children:h.jsx("div",{className:"lobu-lens-content",children:h.jsx(N$e,{owner:e,context:a,compact:!0,onOpenItem:r,emptyState:h.jsx("div",{className:"lobu-lens-empty text-muted-foreground",children:"All caught up"})},`${e}:${Nje(a)}`)})})}function L$e({children:e}){const{currentOwner:t}=Mr(),n=t??null,[r,a]=x.useState(()=>({kind:"browser",url:window.location.href,title:document.title||null,applicationName:"Browser"})),[i,s]=x.useState(null),u=x.useRef(null),c=x.useCallback(async()=>{if(u.current&&!u.current.closed){u.current.focus();return}if(!n)throw new Error("Open a Lobu workspace before starting Lens.");const p=qC();if(!p)throw new Error("This browser does not support Document Picture-in-Picture.");const y=document.documentElement.dataset.owlettoDebuggerAttached==="true",v=await p.requestWindow(y?I$e:j$e);u.current=v,P$e(v.document);const k=v.document.createElement("div");k.id="lobu-lens-root",k.style.width="100%",k.style.height="100%",v.document.body.append(k),s(k),v.addEventListener("pagehide",()=>{u.current===v&&(u.current=null,s(null))},{once:!0})},[n]);x.useEffect(()=>{const p=y=>{const v=tD(y);(v?.kind==="browser"||v?.kind==="application")&&a(v)};return document.addEventListener(V_,p),document.dispatchEvent(new Event(Rje)),()=>{document.removeEventListener(V_,p),u.current?.close()}},[]);const d=x.useMemo(()=>({available:n!=null&&qC()!=null,isOpen:i!=null,open:c}),[c,n,i]);return h.jsxs(vL.Provider,{value:d,children:[e,i&&n?ni.createPortal(h.jsx(D$e,{owner:n,activeContext:r}),i):null]})}function z$e(){const e=x.useContext(vL);return e||{available:!1,isOpen:!1,open:async()=>{}}}const ax=new Set;function fXe(e){return ax.add(e),()=>{ax.delete(e)}}function F$e(){for(const e of[...ax])try{e()}catch{}}const O4=3e3,$$e=6e4;function q$e(e){const t=Tn(),n=x.useRef(null),r=x.useRef(null),a=x.useRef(O4);x.useEffect(()=>{if(!e)return;let i=!1;function s(){for(const c of[[Qi],[Ic],["event-view-match",e]])t.invalidateQueries({queryKey:c});F$e()}async function u(){const c=await WV(`${At}/api/${e}/events`);if(i){c.close();return}n.current=c,c.onopen=()=>{a.current=O4},c.addEventListener("connected",s),c.addEventListener("invalidate",d=>{try{const p=JSON.parse(d.data);if(p.keys)for(const y of p.keys)y===Qi?s():t.invalidateQueries({queryKey:[y]}),y.startsWith("view:")&&t.invalidateQueries({queryKey:["views"]})}catch{}}),c.onerror=()=>{c.close(),n.current=null,!i&&(r.current=setTimeout(()=>{r.current=null,i||u()},a.current),a.current=Math.min(a.current*2,$$e))}}return u(),()=>{i=!0,n.current?.close(),n.current=null,r.current!=null&&(clearTimeout(r.current),r.current=null),a.current=O4}},[e,t])}function H$e(){const{session:e,sessionResult:t,isReady:n}=wr(),r=typeof window<"u"&&!window.location.pathname.startsWith("/auth/"),{data:a}=yO({enabled:r}),i=Tn(),s=x.useRef(!1);x.useEffect(()=>{!n||e||s.current||a?.singleUserMode&&(s.current=!0,(async()=>{try{(await BV()).ok&&(await t.refetch(),await i.invalidateQueries())}catch{}})())},[n,e,a,t,i])}const ga=rU()({component:U$e});function U$e(){const{session:e,isReady:t}=wr();t3e(),H$e();const n=typeof window<"u"?location.pathname:"/",r=n.startsWith("/oauth/")||n.startsWith("/slack/")||n.startsWith("/connector/"),a=PA();return q$e(t&&e?a:null),r?h.jsx("div",{className:"min-h-screen bg-background text-foreground",children:h.jsx(J4,{})}):h.jsx(L$e,{children:h.jsxs(qN,{delayDuration:200,children:[h.jsx(kve,{richColors:!0,position:"bottom-right"}),h.jsx(Aje,{children:h.jsx(J4,{})}),null]})})}const B$e=()=>Te(()=>import("./_owner-DbrKma4e.js"),__vite__mapDeps([0,1])),V$e=Ce("/$owner")({loader:({context:{queryClient:e},params:t})=>{t.owner!=="me"&&e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},pendingComponent:()=>null,component:Oe(B$e,"component")}),W$e=()=>Te(()=>import("./index-DfyDUpuI.js"),__vite__mapDeps([2,3])),K$e=Ce("/")({component:Oe(W$e,"component")}),G$e=()=>Te(()=>import("./index-Codw-Qqi.js"),__vite__mapDeps([4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),Y$e=Ce("/$owner/")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:e=>Vn(e),component:Oe(G$e,"component")}),Z$e=()=>Te(()=>import("./claim-DJfTvlT2.js"),[]),Q$e=Ce("/slack/claim")({component:Oe(Z$e,"component"),validateSearch:e=>({team:typeof e.team=="string"?e.team:void 0,t:typeof e.t=="string"?e.t:void 0})}),X$e=()=>Te(()=>import("./new-ByBhteWA.js"),__vite__mapDeps([19,14,3])),J$e=Ce("/orgs/new")({component:Oe(X$e,"component"),validateSearch:e=>Vn({slug:e.slug||void 0,name:e.name||void 0})});function eqe(e){if(typeof e!="string")return;const t=e.trim();if(t)try{const n=new URL(t);return n.protocol==="lobu:"||n.protocol==="lobu-ios-bridge:"?t:void 0}catch{return}}const tqe=()=>Te(()=>import("./device-6z-xgsoW.js"),__vite__mapDeps([20,21,14,22])),nqe=Ce("/oauth/device")({component:Oe(tqe,"component"),validateSearch:e=>Vn({user_code:typeof e.user_code=="string"&&e.user_code.trim().length>0?e.user_code.trim():void 0,return_to:eqe(e.return_to)})}),rqe=()=>Te(()=>import("./consent-DdfINrVp.js"),__vite__mapDeps([23,21,14]));function zi(e){return typeof e=="string"?e:void 0}const aqe=Ce("/oauth/consent")({component:Oe(rqe,"component"),validateSearch:e=>Vn({client_id:zi(e.client_id),redirect_uri:zi(e.redirect_uri),scope:zi(e.scope),state:zi(e.state),code_challenge:zi(e.code_challenge),code_challenge_method:zi(e.code_challenge_method),client_name:zi(e.client_name),resource:zi(e.resource),authorization_intent:zi(e.authorization_intent),workspace_grants:e.workspace_grants==="1"||e.workspace_grants===1?"1":void 0})}),oqe=()=>Te(()=>import("./reset-password-DqfcSn8M.js"),__vite__mapDeps([24,14])),iqe=Ce("/auth/reset-password")({component:Oe(oqe,"component"),validateSearch:e=>Vn({token:typeof e.token=="string"?e.token:void 0,error:typeof e.error=="string"?e.error:void 0})}),sqe=()=>Te(()=>import("./logout-BmNwoAf7.js"),[]),lqe=Ce("/auth/logout")({component:Oe(sqe,"component")}),cqe=()=>Te(()=>import("./login-DO0j-AYr.js"),__vite__mapDeps([25,14])),uqe=Ce("/auth/login")({component:Oe(cqe,"component"),validateSearch:e=>Vn({callbackUrl:e.callbackUrl||void 0,mode:e.mode||void 0,error:e.error||void 0,errorDescription:e.error_description||void 0,loginHint:e.loginHint||e.login_hint||void 0,invitationOrg:e.invitationOrg||void 0,provider:typeof e.provider=="string"&&e.provider.trim()?e.provider.trim().toLowerCase():void 0,intent:e.intent==="sign-up"||e.intent==="sign-in"?e.intent:void 0})}),dqe=()=>Te(()=>import("./callback-DTKKsfkz.js"),[]),hqe=Ce("/auth/callback")({component:Oe(dqe,"component")}),fqe=()=>Te(()=>import("./accept-invitation-CRKbM2Xy.js"),__vite__mapDeps([26,3])),pqe=Ce("/auth/accept-invitation")({component:Oe(fqe,"component"),validateSearch:e=>Vn({invitationId:e.invitationId||void 0})}),yqe=()=>Te(()=>import("./settings-B_ClYztB.js"),__vite__mapDeps([27,3])),mqe=Ce("/account/settings")({component:Oe(yqe,"component")}),gqe=()=>Te(()=>import("./recent-3d99S2IE.js"),[]),vqe=Ce("/$owner/recent")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(gqe,"component")}),kqe=()=>Te(()=>import("./connectors-CyZpcE5f.js"),[]),xqe=Ce("/$owner/connectors")({component:Oe(kqe,"component")}),bqe=()=>Te(()=>import("./automations-C-ReckCa.js"),[]),wqe=Ce("/$owner/automations")({component:Oe(bqe,"component")}),Mqe=()=>Te(()=>import("./agents-C-ReckCa.js"),[]),Sqe=Ce("/$owner/agents")({component:Oe(Mqe,"component")});function _qe(e,t){const n=t;return{path:n?`/${[e,n].filter(Boolean).join("/")}`:e,effectiveSplat:n}}const Cqe=()=>Te(()=>import("./_-CC8cTmRg.js"),__vite__mapDeps([28,18]));function Eqe(){return h.jsx("div",{"data-public-loading":"true",children:h.jsx(FR,{})})}const Aqe=Ce("/$owner/$")({pendingComponent:Eqe,beforeLoad:({params:e})=>{const t=e._splat||"",n=t.split("/")[0];if(n&&ai(n)||!Cp(t))throw Zi()},component:Oe(Cqe,"component"),validateSearch:e=>{const t=Ib(e),n=[...rO,...Cm,"page"],r=i=>typeof i=="number"?i:String(i),a=i=>i!=null&&typeof i!="object";for(const i of n)a(e[i])&&(t[i]=r(e[i]));for(const i of Object.keys(e))i.startsWith("clf_")&&a(e[i])&&(t[i]=String(e[i]));return t},loader:({context:{queryClient:e},params:t})=>{const{path:n}=_qe(t.owner,Cp(t._splat||"")?.entityPath);e.prefetchQuery(uy.queryOptions(n,{slug:t.owner},{includeBootstrap:!0}))}}),Rqe=["agent","agent_id","automation","produced_by","schedule","connection_ids","feed_ids","run_ids","content_ids","entity_id","run_id","platforms","at"],Hu=e=>typeof e=="string"&&e.trim()?e.trim():void 0;function Oqe(e){return e.view==="events"||e.view==="feeds"||e.browse_view==="events"?!0:Rqe.some(t=>e[t]!=null&&String(e[t]).trim()!=="")}const Tqe=Ce("/$owner/memory/")({beforeLoad:({params:e,search:t})=>{const n=t,r=e.owner,a=Hu(n.browse_path)??Hu(n.entity);if(a)throw no({to:"/$owner/$",params:{owner:r,_splat:CV(a)},search:{},replace:!0});if(Oqe(n))throw no({to:"/$owner/events",params:{owner:r},search:Vn({...n,type:Hu(n.browse_type)?Ch(Hu(n.browse_type)):n.type,view:void 0,create:void 0,create_type:void 0,browse_type:void 0,browse_view:void 0}),replace:!0});const i=Hu(n.type)??Hu(n.browse_type);throw i?no({to:"/$owner/$entityType",params:{owner:r,entityType:Ch(i)},search:{create:n.create===!0||n.create==="true"?!0:void 0},replace:!0}):n.view==="entities"||n.create_type===!0||n.create_type==="true"?no({to:"/$owner/data",params:{owner:r},search:{create_type:n.create_type===!0||n.create_type==="true"?"true":void 0},replace:!0}):no({to:"/$owner/events",params:{owner:r},search:n,replace:!0})}}),Nqe=()=>Te(()=>import("./index-DtqBFgK5.js"),[]),jqe=Ce("/$owner/members/")({beforeLoad:({params:e})=>{throw no({...Rwe(e.owner),replace:!0})},component:Oe(Nqe,"component")}),Iqe=()=>Te(()=>import("./index-4TSkcsth.js"),__vite__mapDeps([29,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),Pqe=Ce("/$owner/events/")({loader:({context:{queryClient:e},params:t})=>{t.owner!=="me"&&e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(Iqe,"component"),validateSearch:e=>Vn(e)}),Dqe=()=>Te(()=>import("./index-DYYZLcJ0.js"),__vite__mapDeps([30,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),Lqe=Ce("/$owner/data/")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:e=>({create_type:e.create_type===!0||e.create_type==="true"?"true":void 0}),component:Oe(Dqe,"component")}),zqe={all:"All",data:"Data",chat:"Chat",actions:"Actions",inference:"Inference",runtime:"Runtime",device:"On device"},Fqe=["all","data","chat","actions","inference","runtime","device"];function $qe(e){return typeof e=="string"&&Fqe.includes(e)?e:void 0}function qqe(e){return e.options_schema?.["x-lobu-chat-platform"]!=null}function kL(e){return!!e.runtime||!!e.required_capability}function Hqe(e,t){const n=e.feeds_schema?Object.keys(e.feeds_schema).length>0:!1,r=e.has_operations||(e.actions_schema?Object.keys(e.actions_schema).length>0:!1);return{data:t?.facets.data??n,chat:t?.facets.chat??qqe(e),actions:t?.facets.actions??r,audience:t?.facets.audience??!1,inference:!1,runtime:!1}}function T4(e,t){const{connector:n,facets:r}=e;return t==="all"?!0:t==="data"?r.data:t==="chat"?r.chat:t==="actions"?r.actions:t==="inference"?r.inference:t==="runtime"?r.runtime===!0:e.isDevice===!0||kL(n)}const Uqe=()=>Te(()=>import("./index-DKPwCasf.js"),[]),Bqe=Ce("/$owner/connectors/")({validateSearch:e=>{const t=$qe(e.filter);return t?{filter:t}:{}},loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(Uqe,"component")}),Vqe=()=>Te(()=>import("./index-TgRS2v_F.js"),__vite__mapDeps([42,16])),Wqe=Ce("/$owner/chat/")({validateSearch:e=>{const t={};return(e.new===!0||e.new==="1"||e.new==="true")&&(t.new=!0),typeof e.prompt=="string"&&e.prompt.length>0&&(t.prompt=e.prompt),Object.assign(t,Em(e)),t},component:Oe(Vqe,"component")}),Kqe=()=>Te(()=>import("./index-DAOyXG1X.js"),__vite__mapDeps([43,44,45])),Gqe=Ce("/$owner/automations/")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(Kqe,"component")}),Yqe=()=>Te(()=>import("./index-DYzWV5_z.js"),__vite__mapDeps([46,47,44,12,15])),Zqe=Ce("/$owner/agents/")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(Yqe,"component")}),Qqe=()=>Te(()=>import("./index-DMyXd3bJ.js"),__vite__mapDeps([48,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),Xqe=Ce("/$owner/$entityType/")({validateSearch:e=>({$collection:yc(e.$collection),$preset:yc(e.$preset),$table:yc(e.$table),create:e.create===!0||e.create==="true"?!0:void 0,segment:typeof e.segment=="string"&&e.segment?e.segment:void 0}),beforeLoad:({params:e})=>{if(ai(e.entityType))throw Zi()},component:Oe(Qqe,"component")}),Jqe=()=>Te(()=>import("./connection-ByvKkyFm.js"),__vite__mapDeps([49,14])),eHe=Ce("/connector/$name/connection")({component:Oe(Jqe,"component"),validateSearch:e=>({ref:typeof e.ref=="string"?e.ref:void 0})}),tHe=()=>Te(()=>import("./organization-DTFoYP4V.js"),__vite__mapDeps([50,51,14])),nHe=Ce("/$owner/settings/organization")({component:Oe(tHe,"component"),validateSearch:e=>({connector:typeof e.connector=="string"?e.connector:void 0,connection:Number.isSafeInteger(Number(e.connection))&&Number(e.connection)>0?Number(e.connection):void 0,agent:typeof e.agent=="string"?e.agent:void 0})}),rHe=()=>Te(()=>import("./_-DtqBFgK5.js"),[]),aHe=Ce("/$owner/memory/$")({beforeLoad:({params:e})=>{const t=WN(e._splat||"");throw t.typeSegment?ai(t.typeSegment)?Zi():t.isEntityDetail?no({to:"/$owner/$",params:{owner:e.owner,_splat:t.path},search:{},replace:!0}):no({to:"/$owner/$entityType",params:{owner:e.owner,entityType:t.typeSegment},search:{create:void 0},replace:!0}):no({to:"/$owner/data",params:{owner:e.owner},search:{},replace:!0})},component:Oe(rHe,"component")}),oHe=()=>Te(()=>import("./_eventId-3L_qeL_l.js"),__vite__mapDeps([52,53,10,11,12,13,14,39,40,7])),iHe=Ce("/$owner/events/$eventId")({beforeLoad:({params:e})=>{if(uL(e.eventId)===null)throw Zi()},component:Oe(oHe,"component"),validateSearch:e=>Vn(e)}),sHe=()=>Te(()=>import("./_-ksFp4zVf.js"),__vite__mapDeps([54,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),lHe=Ce("/$owner/events/$")({beforeLoad:({params:e})=>{const t=WN(e._splat||"");if(!t.typeSegment||!t.isEntityDetail||ai(t.typeSegment))throw Zi()},component:Oe(sHe,"component"),validateSearch:e=>Vn(e)}),cHe=Ce("/$owner/entity-types/new")({beforeLoad:({params:e})=>{throw no({to:"/$owner/data",params:{owner:e.owner},search:{create_type:"true"},replace:!0})}}),uHe=()=>Te(()=>import("./_slug-ndDr_CUg.js"),__vite__mapDeps([55,32,33,34,35,36])),dHe=Ce("/$owner/entity-types/$slug")({component:Oe(uHe,"component")}),hHe=()=>Te(()=>import("./deployments-DHh9dyzv.js"),[]),fHe=Ce("/$owner/connectors/deployments")({component:Oe(hHe,"component")});function xL({className:e,children:t}){return h.jsx("div",{className:ve("mx-auto w-full max-w-3xl",e),children:t})}function pXe({header:e,children:t}){return h.jsxs(xL,{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[h.jsx("div",{className:"sticky top-0 z-10 space-y-4 bg-background pb-1",children:e}),h.jsx("div",{className:"mt-4 min-w-0 flex-1 space-y-7",children:t})]})}const pHe="min-w-0 truncate text-sm text-muted-foreground transition-colors hover:text-foreground hover:underline";function yHe({crumbs:e}){return e.length===0?null:h.jsx("nav",{"aria-label":"Breadcrumb",className:"flex min-w-0 flex-wrap items-center gap-1.5",children:e.map((t,n)=>h.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n>0?h.jsx(Br,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground/50"}):null,t]},n))})}function mHe({breadcrumb:e,icon:t,title:n,badge:r,status:a,meta:i,caption:s,captionTone:u="muted"}){const c=h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[h.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1",children:[typeof n=="string"?h.jsx("h1",{className:"text-2xl font-semibold leading-none tracking-tight",children:n}):n,r,a]}),i?h.jsx("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:i}):null]}),d=s?h.jsx("p",{className:ve("max-w-2xl text-base leading-relaxed",u==="error"?"text-destructive":"text-muted-foreground"),children:s}):null;return h.jsxs("div",{className:"flex flex-col gap-2",children:[e,t?h.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[h.jsx("div",{className:"shrink-0",children:t}),c]}):c,d]})}function Qn({className:e,variant:t="default",...n}){const r={default:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",destructive:"bg-destructive text-destructive-foreground",outline:"border border-current bg-transparent"};return h.jsx("span",{"data-slot":"badge",className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-medium ${r[t]} ${e||""}`,...n})}function gHe({badges:e}){return e.length===0?null:h.jsx("div",{className:"mt-auto flex flex-wrap items-center gap-1.5",children:e.map(t=>h.jsx(Qn,{variant:"secondary",className:"h-4 shrink-0 px-1.5 py-0 text-[10px]",children:t},t))})}function vHe({count:e=4}){return h.jsx("div",{className:"grid grid-cols-1 gap-2",role:"status","aria-label":"Loading catalog",children:Array.from({length:e}).map((t,n)=>h.jsx(Ft,{className:"h-16 w-full rounded-lg"},n))})}function kHe({count:e=8}){return h.jsx("div",{className:"overflow-hidden rounded-lg border",role:"status","aria-label":"Loading connector catalog",children:Array.from({length:e}).map((t,n)=>h.jsxs("div",{className:`flex items-center gap-3 bg-card px-3 py-2.5 ${n===e-1?"":"border-b"}`,children:[h.jsx(Ft,{className:"h-8 w-8 shrink-0 rounded-lg"}),h.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[h.jsx(Ft,{className:"h-3.5 w-24 rounded"}),h.jsx(Ft,{className:"h-3 w-48 max-w-full rounded"})]}),h.jsx(Ft,{className:"h-4 w-14 shrink-0 rounded-full"}),h.jsx(Ft,{className:"h-4 w-4 shrink-0 rounded"})]},n))})}function yXe({count:e=4,withSearch:t=!0}){return h.jsxs("div",{className:"space-y-3",role:"status","aria-label":"Loading catalog",children:[t?h.jsx(Ft,{className:"h-9 w-full rounded-md"}):null,h.jsx(vHe,{count:e})]})}function mXe({items:e,searchQuery:t,onSearchChange:n,onSelect:r,emptyMessage:a,searchPlaceholder:i="Search...",searchAriaLabel:s="Search catalog",renderTitle:u}){return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"relative",children:[h.jsx(Zh,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(yn,{"aria-label":s,placeholder:i,value:t,onChange:c=>n(c.target.value),className:"pl-9"})]}),e.length===0?h.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:a??`No items match "${t}"`}):h.jsx("div",{className:"overflow-hidden rounded-lg border",children:e.map((c,d)=>h.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 bg-card px-4 py-3 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"+(d===e.length-1?"":" border-b"),onClick:()=>r(c),children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u?u(c):h.jsx("span",{className:"text-sm font-medium text-foreground",children:c.name}),h.jsx(gHe,{badges:c.badges})]}),c.description?h.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:c.description}):null]}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},c.key))})]})}function xHe(e){return e?e.charAt(0).toUpperCase()+e.slice(1):"App"}function bHe(e,{recovery:t=!1,installShape:n}={}){if(!t||n==="oauth-code-exchange")return e;const r=new URL(e);return r.searchParams.set("recovery","1"),r.toString()}function ox({organizationId:e,connectorKey:t,provider:n,providerLabel:r,recovery:a=!1,installShape:i,size:s="sm",variant:u,className:c,label:d,icon:p}){const y=nO(e,t),v=y.data?.options.find(M=>M.kind==="local");if(!e||y.isPending)return h.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking app setup…"});if(y.isError)return h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"App setup could not be checked."}),h.jsx(ke,{variant:"link",className:"px-0",onClick:()=>void y.refetch(),children:"Retry app setup"})]});if(!v?.configured||!v.url)return h.jsx("p",{className:"text-sm text-muted-foreground",children:"This server has no app configured. Choose an available connection option or configure your own app."});const k=r??xHe(n),b=d??`${a?"Reconnect":"Connect"} ${k}`;return h.jsx(ke,{asChild:!0,size:s,variant:u,className:c,children:h.jsxs("a",{href:bHe(v.url,{recovery:a,installShape:i}),children:[p,b]})})}const wHe=[{key:"data",label:"Data",icon:nR},{key:"chat",label:"Chat",icon:lR},{key:"actions",label:"Actions",icon:Gx},{key:"audience",label:"Audience",icon:Kx},{key:"inference",label:"Inference",icon:tR},{key:"runtime",label:"Runtime",icon:VA}];function ix({facets:e,className:t}){if(!e)return null;const n=wHe.filter(r=>e[r.key]);return n.length===0?null:h.jsx("div",{className:ve("flex flex-wrap items-center gap-1",t),children:n.map(({key:r,label:a,icon:i})=>h.jsxs(Qn,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[h.jsx(i,{className:"h-3 w-3"}),a]},r))})}function MHe({data:e,error:t,retry:n}){const r=e?.options.filter(i=>i.kind!=="local"&&i.configured&&!!i.url)??[],a=t||e?.cloud_status==="unavailable";return!r.length&&!a?null:h.jsxs("section",{"aria-label":"Available connection options",className:"space-y-3",children:[a&&h.jsxs("div",{role:"status",className:"text-sm text-muted-foreground",children:[h.jsx("p",{children:"Cloud connection options could not be checked. You can retry or continue with your own app."}),n&&h.jsx(ke,{variant:"link",className:"px-0",onClick:n,children:"Retry cloud discovery"})]}),r.map(i=>h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.url&&h.jsx(ke,{asChild:!0,variant:"outline",children:h.jsx("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",children:i.label})}),h.jsx("span",{className:"text-xs text-muted-foreground",children:i.execution==="cloud"?"Runs in Lobu Cloud":"Available for local execution"})]}),h.jsx("p",{className:"text-sm text-muted-foreground",children:i.description}),h.jsxs("details",{className:"text-xs text-muted-foreground",children:[h.jsx("summary",{className:"cursor-pointer",children:"Setup steps"}),h.jsx("p",{className:"pt-1",children:i.instructions})]})]},`${i.kind}:${i.managed_by_org??i.url}`))]})}function sx({organizationId:e,connectorKey:t}){const n=nO(e,t);return!e||n.isPending?h.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Checking connection options…"}):h.jsx(MHe,{data:n.data,error:n.isError,retry:()=>void n.refetch()})}const Ws=YI,Ks=XI,Fi=x.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(zb,{ref:r,className:ve("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-muted px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(JI,{asChild:!0,children:h.jsx(ey,{className:"h-4 w-4 opacity-50"})})]}));Fi.displayName=zb.displayName;const bL=x.forwardRef(({className:e,...t},n)=>h.jsx(Hb,{ref:n,className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(ZA,{className:"h-4 w-4"})}));bL.displayName=Hb.displayName;const wL=x.forwardRef(({className:e,...t},n)=>h.jsx(Ub,{ref:n,className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(ey,{className:"h-4 w-4"})}));wL.displayName=Ub.displayName;const $i=x.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>h.jsx(tP,{children:h.jsxs(Fb,{ref:a,className:ve("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(bL,{}),h.jsx(iP,{className:ve("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(wL,{})]})}));$i.displayName=Fb.displayName;const Hr=x.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(qb,{ref:r,className:ve("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(hP,{children:h.jsx(ja,{className:"h-4 w-4"})})}),h.jsx(uP,{children:t})]}));Hr.displayName=qb.displayName;const SHe=x.forwardRef(({className:e,...t},n)=>h.jsx(Bb,{ref:n,className:ve("-mx-1 my-1 h-px bg-muted",e),...t}));SHe.displayName=Bb.displayName;function ML({device:e}){const t=g$e(e.app_version),n=v$e(e,t);return h.jsx(Hr,{value:e.id,children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(k$e,{online:e.online}),h.jsx(yL,{platform:Nf(e)}),h.jsx("span",{children:m6(e)}),n?h.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",n]}):null,e.online?null:h.jsx("span",{className:"text-xs text-muted-foreground",children:"· offline"})]})})}var Rm="Popover",[SL]=lo(Rm,[xl]),jf=xl(),[_He,jl]=SL(Rm),_L=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,u=jf(t),c=x.useRef(null),[d,p]=x.useState(!1),[y,v]=Xi({prop:r,defaultProp:a??!1,onChange:i,caller:Rm});return h.jsx(Ty,{...u,children:h.jsx(_He,{scope:t,contentId:ao(),triggerRef:c,open:y,onOpenChange:v,onOpenToggle:x.useCallback(()=>v(k=>!k),[v]),hasCustomAnchor:d,onCustomAnchorAdd:x.useCallback(()=>p(!0),[]),onCustomAnchorRemove:x.useCallback(()=>p(!1),[]),modal:s,children:n})})};_L.displayName=Rm;var CL="PopoverAnchor",CHe=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=jl(CL,n),i=jf(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:u}=a;return x.useEffect(()=>(s(),()=>u()),[s,u]),h.jsx(uf,{...i,...r,ref:t})});CHe.displayName=CL;var EL="PopoverTrigger",AL=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=jl(EL,n),i=jf(n),s=Rt(t,a.triggerRef),u=h.jsx(Qe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":jL(a.open),...r,ref:s,onClick:Ne(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:h.jsx(uf,{asChild:!0,...i,children:u})});AL.displayName=EL;var g6="PopoverPortal",[EHe,AHe]=SL(g6,{forceMount:void 0}),RL=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=jl(g6,t);return h.jsx(EHe,{scope:t,forceMount:n,children:h.jsx(Kr,{present:n||i.open,children:h.jsx(_d,{asChild:!0,container:a,children:r})})})};RL.displayName=g6;var xd="PopoverContent",OL=x.forwardRef((e,t)=>{const n=AHe(xd,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,i=jl(xd,e.__scopePopover);return h.jsx(Kr,{present:r||i.open,children:i.modal?h.jsx(OHe,{...a,ref:t}):h.jsx(THe,{...a,ref:t})})});OL.displayName=xd;var RHe=dl("PopoverContent.RemoveScroll"),OHe=x.forwardRef((e,t)=>{const n=jl(xd,e.__scopePopover),r=x.useRef(null),a=Rt(t,r),i=x.useRef(!1);return x.useEffect(()=>{const s=r.current;if(s)return Cd(s)},[]),h.jsx(Dc,{as:RHe,allowPinchZoom:!0,children:h.jsx(TL,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ne(e.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ne(e.onPointerDownOutside,s=>{const u=s.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0,d=u.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Ne(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),THe=x.forwardRef((e,t)=>{const n=jl(xd,e.__scopePopover),r=x.useRef(!1),a=x.useRef(!1);return h.jsx(TL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),TL=x.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:p,...y}=e,v=jl(xd,n),k=jf(n);return fy(),h.jsx(nf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:h.jsx(Sd,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:p,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>v.onOpenChange(!1),deferPointerDownOutside:!0,children:h.jsx(Ny,{"data-state":jL(v.open),role:"dialog",id:v.contentId,...k,...y,ref:t,style:{...y.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),NL="PopoverClose",NHe=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=jl(NL,n);return h.jsx(Qe.button,{type:"button",...r,ref:t,onClick:Ne(e.onClick,()=>a.onOpenChange(!1))})});NHe.displayName=NL;var jHe="PopoverArrow",IHe=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=jf(n);return h.jsx(jy,{...a,...r,ref:t})});IHe.displayName=jHe;function jL(e){return e?"open":"closed"}var PHe=_L,DHe=AL,LHe=RL,IL=OL;const zHe=PHe,FHe=DHe,PL=x.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>h.jsx(LHe,{children:h.jsx(IL,{ref:a,align:t,sideOffset:n,className:ve("z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));PL.displayName=IL.displayName;function $He({trigger:e,searchPlaceholder:t,emptyText:n,contentClassName:r,align:a="start",onQueryChange:i,children:s}){const[u,c]=x.useState(!1),[d,p]=x.useState(""),y=v=>{p(v),i?.(v)};return h.jsxs(zHe,{open:u,onOpenChange:v=>{c(v),v||y("")},children:[h.jsx(FHe,{asChild:!0,children:e(u)}),h.jsx(PL,{className:ve("p-0",r),align:a,children:h.jsxs(af,{shouldFilter:!i,children:[h.jsx(My,{placeholder:t,value:d,onValueChange:y}),h.jsxs(Sy,{children:[h.jsx(_y,{children:n}),h.jsx(eo,{children:s(()=>{c(!1),y("")},d)})]})]})})]})}function HC({member:e,size:t="sm"}){const n=t==="sm"?"h-5 w-5 text-[10px]":"h-6 w-6 text-xs";return e.user.image?h.jsx("img",{src:e.user.image,alt:e.user.name,referrerPolicy:"no-referrer",className:ve("rounded-full object-cover shrink-0",n)}):h.jsx("div",{className:ve("rounded-full bg-muted flex items-center justify-center font-medium shrink-0",n),children:(e.user.name||e.user.email).charAt(0).toUpperCase()})}function qHe({organizationId:e,value:t,onValueChange:n,disabled:r,placeholder:a="Select member...",className:i}){const{members:s,isLoading:u}=Fy(e),c=t?s.find(d=>d.userId===t):void 0;return h.jsx($He,{contentClassName:"w-[--radix-popover-trigger-width]",searchPlaceholder:"Search members...",emptyText:"No members found.",trigger:d=>h.jsxs(ke,{variant:"outline",role:"combobox","aria-expanded":d,disabled:r||u,className:ve("w-full justify-between font-normal",i),children:[c?h.jsxs("span",{className:"flex items-center gap-2 truncate",children:[h.jsx(HC,{member:c}),h.jsx("span",{className:"truncate",children:c.user.name||c.user.email})]}):h.jsx("span",{className:"text-muted-foreground",children:u?"Loading...":a}),h.jsx(QA,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:d=>h.jsxs(h.Fragment,{children:[t&&h.jsx(ar,{value:"__clear__",onSelect:()=>{n(void 0),d()},children:h.jsx("span",{className:"text-muted-foreground",children:"Clear selection"})}),s.map(p=>h.jsxs(ar,{value:`${p.user.name} ${p.user.email}`,onSelect:()=>{n(p.userId===t?void 0:p.userId),d()},children:[h.jsx(HC,{member:p}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"truncate text-sm",children:p.user.name||p.user.email}),p.user.name&&h.jsx("p",{className:"truncate text-xs text-muted-foreground",children:p.user.email})]}),h.jsx(ja,{className:ve("ml-auto h-4 w-4 shrink-0",t===p.userId?"opacity-100":"opacity-0")})]},p.userId))]})})}function HHe({onCancel:e,cancelLabel:t="Cancel",cancelDisabled:n,children:r,className:a}){return!e&&!r?null:h.jsxs("div",{className:ve("flex items-center justify-end gap-2",a),children:[e?h.jsx(ke,{type:"button",variant:"outline",onClick:e,disabled:n,children:t}):null,r]})}const DL={data:!1,chat:!1,actions:!1,audience:!1,inference:!1,runtime:!0};function Uh(e){return e==="vercel"?"Vercel":e.charAt(0).toUpperCase()+e.slice(1)}function LL(e){return e==="vercel"?"vercel.com":null}function UHe(e){if(!e.startsWith(n5))return null;const t=e.slice(n5.length);return t.length>0?t:null}function V0(e){if(!e.startsWith(np))return null;const t=e.slice(np.length);return t.length>0?t:null}function gXe(e){return e.map(t=>({sandbox:t,facets:DL,connector:{key:`${n5}${t.id}`,name:t.name||Uh(t.providerKind),description:null,version:"",auth_schema:null,feeds_schema:null,actions_schema:null,options_schema:null,status:t.connected?"active":"error",login_enabled:!1,installed:!0}}))}function BHe(e){return e.map(t=>({key:`${np}${t}`,name:Uh(t),description:`Run agents in a ${Uh(t)} sandbox instead of the built-in local runtime.`,version:"",auth_schema:null,feeds_schema:null,actions_schema:null,options_schema:null,status:"active",login_enabled:!1,favicon_domain:LL(t),installed:!1,installable:!1}))}function lx(){return DL}function VHe({providerKind:e,credentialFields:t,pending:n,onCancel:r,onCreate:a}){const[i,s]=x.useState(""),[u,c]=x.useState({}),d=Uh(e),p=y=>{y.preventDefault();const v=Object.fromEntries(Object.entries(u).filter(([,k])=>k.trim()));a({name:i.trim(),provider_kind:e,credential:Object.keys(v).length>0?v:void 0})};return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsxs("h3",{className:"text-sm font-medium",children:["Connect ",d]}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Add a credential so agents can execute in a ",d," sandbox."]})]}),h.jsxs("form",{onSubmit:p,className:"grid max-w-md gap-3",children:[h.jsxs("div",{className:"grid gap-2",children:[h.jsxs(la,{htmlFor:"sandbox-name",children:["Name ",h.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),h.jsx(yn,{id:"sandbox-name",placeholder:`${d} production`,value:i,onChange:y=>s(y.target.value),required:!0})]}),t.map(y=>h.jsxs("div",{className:"grid gap-2",children:[h.jsxs(la,{htmlFor:`sandbox-cred-${y.key}`,children:[y.label,y.required?h.jsx("span",{className:"ml-1 text-destructive",children:"*"}):null]}),h.jsx(yn,{id:`sandbox-cred-${y.key}`,type:y.secret===!1?"text":"password",value:u[y.key]??"",onChange:v=>c(k=>({...k,[y.key]:v.target.value})),autoComplete:"off",required:y.required})]},y.key)),h.jsx(HHe,{onCancel:r,children:h.jsx(ke,{type:"submit",disabled:n||!i.trim(),children:n?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"}),"Connecting..."]}):`Connect ${d}`})})]})]})}function od({visible:e,onReload:t}){return e?h.jsxs("div",{role:"alert",className:"rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm",children:[h.jsx("p",{children:"This form changed while you were editing. Your edits are preserved. Reload the latest values before saving."}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Discard edits and reload"})]}):null}function zL({rows:e=4,className:t}){return h.jsxs("div",{role:"status","aria-label":"Loading form",className:ve("space-y-5",t),children:[Array.from({length:e}).map((n,r)=>h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ft,{className:"h-3.5 w-24"}),h.jsx(Ft,{className:"h-9 w-full rounded-md"})]},r)),h.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[h.jsx(Ft,{className:"h-9 w-24 rounded-md"}),h.jsx(Ft,{className:"h-9 w-20 rounded-md"})]})]})}function WHe(e){const t=[];e.configSchema&&t.push({title:"Configuration",schema:e.configSchema});for(const[n,r]of Object.entries(e.eventKinds??{}))r.metadataSchema&&t.push({title:n,description:r.description,schema:r.metadataSchema});return{description:e.description,sections:t}}function KHe(e){const t=[];return e.inputSchema&&t.push({title:"Input",schema:e.inputSchema}),e.outputSchema&&t.push({title:"Output",schema:e.outputSchema}),{description:e.description,sections:t}}function FL(){const e=y6(),t=x.useCallback((r,a,i="")=>{e&&e.open({href:i,title:a.name??r,schemaSections:WHe(a)})},[e]),n=x.useCallback((r,a)=>{e&&e.open({href:"",title:a.name??r,schemaSections:KHe(a)})},[e]);return{inspectFeed:t,inspectAction:n}}const GHe={image:"Image",stt:"Speech-to-text",tts:"Text-to-speech"};function vXe(e){return e.filter(t=>t!=="text").map(t=>GHe[t])}function kXe(e){return e.supportedAuthTypes.some(t=>t==="oauth"||t==="device-code")}function YHe(e){return e.sdkCompat!=null&&e.supportedAuthTypes.includes("api-key")}function Il(e,t=""){return`${At}/api/${e}/agents/inference-providers${t}`}function xXe(e){const{slug:t}=br();return rt({queryKey:["inference-providers",t],queryFn:async()=>{const n=await Ke(Il(t??""),{credentials:"include"});return await Wr(n,"Failed to load inference providers"),(await n.json()).providers??[]},enabled:!!t&&(e?.enabled??!0),staleTime:3e4})}function ZHe(e){const{slug:t}=br();return rt({queryKey:["inference-providers-catalog",t],queryFn:async()=>{const n=await Ke(Il(t??"","/catalog"),{credentials:"include"});return await Wr(n,"Failed to load inference provider catalog"),(await n.json()).catalog??[]},enabled:!!t&&(e?.enabled??!0),staleTime:6e4})}const bXe=so({method:"POST",url:({slug:e})=>Il(e),body:e=>e,invalidate:()=>[["inference-providers"]],successMessage:"Provider created",errorMessage:"Failed to create provider"}),wXe=so({method:"PUT",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}/capabilities/${t.modality}`),body:e=>({block:e.block}),invalidate:()=>[["inference-providers"]],successMessage:"Capability updated",errorMessage:"Failed to update capability"}),MXe=so({method:"PUT",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}`),body:e=>({displayName:e.displayName}),invalidate:()=>[["inference-providers"]],successMessage:"Provider updated",errorMessage:"Failed to update provider"}),SXe=so({method:"PUT",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}/default`),invalidate:()=>[["inference-providers"]],successMessage:"Default provider set",errorMessage:"Failed to set default provider"}),_Xe=so({method:"PUT",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}/key`),body:e=>({value:e.value}),invalidate:()=>[["inference-providers"]],successMessage:"Key rotated",errorMessage:"Failed to rotate key"}),CXe=so({method:"DELETE",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}`),invalidate:()=>[["inference-providers"]],successMessage:"Provider deleted",errorMessage:"Failed to delete provider"});function EXe(e,t){const n=t.find(r=>r.slug===e);return n?YHe(n):!0}function QHe(e){const t=e.trim();if(!t)return null;let n;try{n=new URL(t)}catch{return"Enter a valid URL"}return n.protocol!=="https:"?"Must start with https://":n.username||n.password?"Credentials in the URL aren't allowed":n.search||n.hash?"Query or fragment isn't allowed":null}const XHe=/^\/[A-Za-z0-9/_.-]*$/;function JHe(e){const t=e.trim();return t?t.startsWith("//")?"Can't start with //":XHe.test(t)?null:"Must be a path like /v1/models":null}function eUe(e){return e.length>0&&!e.trim()?"Model can't be blank":null}function AXe(e){const t={},n=QHe(e.base_url??"");n&&(t.base_url=n);const r=eUe(e.model??"");r&&(t.model=r);const a=JHe(e.models_endpoint??"");return a&&(t.models_endpoint=a),t}function RXe(e){return!!(e.base_url||e.model||e.models_endpoint)}const tUe="https://github.com/lobu-ai/lobu/releases/latest/download/Lobu.dmg",nUe="https://chromewebstore.google.com/detail/jhgcecbdpnoehfnhpdfihlchjddapepi";function rUe(e){const t=new URL(e);return["127.0.0.1","localhost","[::1]"].includes(t.hostname)&&(t.hostname="host.docker.internal"),`docker run --rm --name lobu-worker --interactive --tty \\
|
|
7937
|
+
`).map(a=>a.trim()).filter(a=>a!==""&&!FC.test(a)).join(" ").trim();return r===""?null:r}function _$e(e){switch(e){case"action_approval_needed":return"Needs approval";case"connection_permission_request":return"Authorization needed";case"browser_auth_expired":return"Sign-in required";case"invitation_received":return"Invitation";case"agent_message":return"Agent";default:return"Notification"}}function C$e(e,t){if(t==null||t==="")return null;switch(e){case"action_approval_needed":return"Review & approve";case"connection_permission_request":return"Authorize connection";case"browser_auth_expired":return"Open connection";case"invitation_received":return"Accept invitation";default:return null}}function E$e(){const e=cr();return t=>{const{pathname:n,search:r}=Ed(t);e({to:n,search:r??{}})}}function gL({href:e,className:t,onClick:n,children:r}){const{pathname:a,search:i}=Ed(e);return h.jsx(nn,{to:a,search:i??{},className:t,onClick:n,children:r})}function A$e(e){return e?_$e(e):"Notification"}function R$e({runId:e,notificationId:t,reviewHref:n,reviewTitle:r,choiceField:a,choices:i}){const{orgContext:s}=Mr(),u=Nve(),c=jve(),d=gO(s),p=y6(),[y,v]=x.useState(null),[k,b]=x.useState(!1),[M,_]=x.useState(""),C=u.isPending||c.isPending;return y==="approved"?h.jsx("p",{className:"mt-2 text-xs font-medium text-emerald-600 dark:text-emerald-400",children:"Approved — executing…"}):y==="rejected"?h.jsx("p",{className:"mt-2 text-xs font-medium text-muted-foreground",children:"Rejected"}):k?h.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[h.jsx("input",{type:"text",placeholder:"Reason (optional)",value:M,onChange:E=>_(E.target.value),className:"h-7 min-w-[10rem] flex-1 rounded-md border bg-background px-2 text-xs",onClick:E=>E.stopPropagation()}),h.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:C,onClick:E=>{E.stopPropagation(),c.mutate({run_id:e,reason:M.trim()||void 0},{onSuccess:()=>{v("rejected"),d.mutate(t)}})},children:[c.isPending?h.jsx(Dt,{size:"sm",className:"mr-1"}):h.jsx(ol,{className:"mr-1 h-3 w-3"}),"Reject"]}),h.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:E=>{E.stopPropagation(),b(!1)},children:"Cancel"})]}):a&&i&&i.length>0?h.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.map(E=>h.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:C,onClick:A=>{A.stopPropagation(),u.mutate({run_id:e,input:{[a]:E.value}},{onSuccess:()=>{v("approved"),d.mutate(t)}})},children:[u.isPending?h.jsx(Dt,{size:"sm",className:"mr-1"}):null,E.label]},E.value)),h.jsxs(ke,{size:"sm",variant:"ghost",className:"h-7 text-xs text-muted-foreground",disabled:C,onClick:E=>{E.stopPropagation(),b(!0)},children:[h.jsx(ol,{className:"mr-1 h-3 w-3"}),"Dismiss"]})]}):h.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[n?p&&Am(n)?h.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 text-xs",onClick:E=>{E.stopPropagation(),d.mutate(t),p.open({href:n,title:r??"Approval",runId:e})},children:"Review"}):h.jsx(gL,{href:n,className:ve("inline-flex h-7 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium transition-colors hover:bg-accent hover:text-accent-foreground"),onClick:E=>{E.stopPropagation(),d.mutate(t)},children:"Review"}):null,h.jsxs(ke,{size:"sm",className:"h-7 text-xs",disabled:C,onClick:E=>{E.stopPropagation(),u.mutate({run_id:e},{onSuccess:()=>{v("approved"),d.mutate(t)}})},children:[u.isPending?h.jsx(Dt,{size:"sm",className:"mr-1"}):h.jsx(ja,{className:"mr-1 h-3 w-3"}),"Approve"]}),h.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:C,onClick:E=>{E.stopPropagation(),b(!0)},children:[h.jsx(ol,{className:"mr-1 h-3 w-3"}),"Reject"]})]})}function O$e({owner:e,item:t,index:n,onFocus:r,onOpenItem:a,tone:i="default",rowAction:s="open",tag:u}){const c=E$e(),d=y6(),{orgContext:p}=Mr(),{data:y=[]}=KR(p.organizationId??null),v=gO(p),k=tke(p),b=nke(p),M=b.isPending&&typeof b.variables=="number"?b.variables:null,_=s==="open",C=q=>{if(!q.browserUrl&&q.notificationId!=null&&q.unread&&v.mutate(q.notificationId),q.interactionType==="authorization"&&q.href){c(q.href);return}if(a){a(q);return}if(d){d.open({href:q.href??"",title:q.title,runId:q.runId??void 0,body:q.body,notificationType:q.notification?.type,createdAt:q.notification?.created_at,browserUrl:q.browserUrl??null,browserHandoff:q.browserHandoff??null,owner:e,sourceAttribution:q.notification??null});return}q.href&&c(q.href)},E=async q=>{if(!q.browserUrl)return;const $=q.browserHandoff?.state==="expired"&&q.browserHandoff.run_id!=null;if(q.browserHandoff?.state==="completed"||q.browserHandoff?.state==="preparing"){gn.info(q.browserHandoff.state==="preparing"?"Preparing the draft in your browser. Keep that tab open.":"Draft prepared. Review and post in your browser, then mark it Done.");return}if($&&q.notificationId==null){gn.error("This expired draft cannot be recreated from this card.");return}try{const B=q.notificationId,J=$&&B!=null?()=>b.mutateAsync(B):void 0;(J?await zC(q.browserUrl,J):await zC(q.browserUrl))||gn.error("Chrome blocked the handoff tab. Allow pop-ups for Lobu and try again.")}catch(B){gn.error(B instanceof Error?B.message:"Could not recreate this browser draft.")}},A=q=>{if(q.browserUrl){E(q);return}C(q)},R=t.approvalRunId??null,O=t.interactionType==="approval",N=O?t.interactionStatus==="approved"?"Approved":t.interactionStatus==="rejected"?"Rejected":t.interactionStatus==="expired"?"Expired":t.interactionStatus&&t.interactionStatus!=="pending"?t.interactionStatus.charAt(0).toUpperCase()+t.interactionStatus.slice(1):null:null,P=O&&t.interactionStatus==="pending"&&t.interactionInline===!0&&R!=null,L=!P&&!N&&t.notification?C$e(t.notification.type,t.href):null,I=O&&N?"Approval":A$e(t.notification?.type),D=S$e(t.body),H=t.notification,K=D?h.jsx("div",{className:"line-clamp-2 text-sm",onClick:q=>{q.target.closest("a")&&q.stopPropagation()},children:h.jsx(u$e,{text:D,linkPolicy:t.notification?.type==="action_approval_needed"?"app-links":"strip"})}):t.body?h.jsx("p",{className:"line-clamp-2 text-sm",children:t.body}):null,W=h.jsxs(h.Fragment,{children:[h.jsx(zje,{dot:t.unread?i==="relevant"?"bg-primary":"bg-blue-500":void 0,tag:u,children:I}),P&&t.notification&&R!=null?h.jsx(R$e,{runId:R,notificationId:t.notification.id,reviewHref:t.href,reviewTitle:t.title,choiceField:t.interactionChoiceField,choices:t.interactionChoices}):N?h.jsx("p",{className:ve("mt-2 text-xs font-medium",t.interactionStatus==="approved"?"text-emerald-600 dark:text-emerald-400":"text-muted-foreground"),children:N}):null,L&&t.href?h.jsx("div",{className:"mt-2",children:h.jsx(gL,{href:t.href,className:"inline-flex h-7 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium transition-colors hover:bg-accent hover:text-accent-foreground",onClick:q=>{q.stopPropagation(),t.notification&&!t.notification.is_read&&v.mutate(t.notification.id),t.notification?.type==="action_approval_needed"&&d&&Am(t.href??"")&&(q.preventDefault(),A(t))},children:L})}):null,t.browserUrl?h.jsxs("div",{className:"mt-2 space-y-1.5",children:[t.browserHandoff?.state==="expired"?h.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Draft expired",t.browserHandoff.error_message?` — ${t.browserHandoff.error_message}`:"."]}):null,h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.browserHandoff?.state!=="completed"&&t.browserHandoff?.state!=="preparing"?h.jsxs(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 text-xs",disabled:M!=null&&M===t.notificationId,onClick:q=>{q.stopPropagation(),E(t)},children:[M!=null&&M===t.notificationId?h.jsx(Dt,{size:"sm",className:"mr-1"}):null,t.browserHandoff?.state==="expired"&&t.browserHandoff.run_id!=null?"Recreate draft":t.browserHandoff?.state==="expired"?"Open page without draft":"Open page"]}):h.jsx("span",{className:"self-center text-xs text-muted-foreground",children:t.browserHandoff?.state==="preparing"?"Preparing draft — keep your browser tab open.":"Draft prepared — review and post in your browser."}),d?h.jsx(ke,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-xs text-muted-foreground",onClick:q=>{q.stopPropagation(),C(t)},children:"Why/how"}):null,t.interactionStatus!=="pending"?h.jsxs(ke,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-xs text-muted-foreground",disabled:k.isPending,onClick:q=>{q.stopPropagation(),t.notificationId!=null&&k.mutate(t.notificationId)},children:[h.jsx(ol,{className:"mr-1 h-3 w-3"}),"Done"]}):null]})]}):null]}),Y=h.jsxs("div",{className:"flex gap-3",children:[h.jsx(Dje,{className:Lje,children:h.jsx(Pje,{platform:H?.platform,connectorDefinitions:y,label:I,fallback:h.jsx(jx,{className:"h-4 w-4"})})}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-start justify-between gap-3",children:[h.jsx("h4",{className:"line-clamp-2 min-w-0 text-sm font-medium",children:t.title}),h.jsx(Fje,{at:new Date(t.at)})]}),K?h.jsx("div",{className:"mt-1 text-muted-foreground",children:K}):null,H?h.jsx(x$e,{owner:e,source:H,connectorDefinitions:y,variant:"chips",className:"mt-2 text-xs"}):null,W]})]});return h.jsx("div",{"data-attention-index":n,role:_?"link":void 0,tabIndex:_?0:void 0,onFocus:_?r:void 0,onClick:_?()=>A(t):void 0,onKeyDown:_?q=>{q.target===q.currentTarget&&(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),A(t))}:void 0,className:ve("block w-full rounded-lg p-3 text-left transition-colors",_&&"cursor-pointer hover:bg-accent/40"),children:Y})}function T$e({owner:e,emptyState:t=null,itemFilter:n,onOpenItem:r,ariaLabel:a="Needs attention",tone:i="default",rowAction:s="open"}){const{session:u,isLoading:c,isError:d,attentionItems:p,markManyRead:y}=Ad(e),v=x.useMemo(()=>n?p.filter(n):p,[p,n]),[k,b]=x.useState(0),M=x.useRef(null),_=s==="open",C=A=>{const R=Math.min(Math.max(A,0),v.length-1);b(R),M.current?.querySelector(`[data-attention-index="${R}"]`)?.focus()};if(!u)return h.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Sign in to see workspace activity."});if(c&&v.length===0)return h.jsx("div",{className:"space-y-2",children:Array.from({length:4}).map((A,R)=>h.jsx("div",{className:ve(Qh,"h-14 animate-pulse")},R))});if(d)return h.jsx("p",{className:"py-6 text-center text-sm text-destructive",children:"Could not load recent activity."});if(v.length===0)return t;const E=h.jsx("ul",{className:"space-y-1",children:v.map((A,R)=>h.jsx("li",{children:h.jsx(O$e,{owner:e,item:A,index:R,onFocus:()=>b(R),onOpenItem:r,tone:i,rowAction:s})},A.id))});return h.jsxs("section",{ref:M,"data-attention-list":!0,"aria-label":a,"aria-keyshortcuts":_?"ArrowDown ArrowUp Enter R":void 0,className:"space-y-2.5",onKeyDown:_?A=>{const R=A.target;if(!(R.matches("input, textarea, select")||R.isContentEditable)){if(A.key==="ArrowDown"||A.key==="ArrowUp"){const O=R.closest("[data-attention-index]");if(!O)return;A.preventDefault();const N=Number(O?.dataset.attentionIndex),P=Number.isInteger(N)?N:A.key==="ArrowDown"?-1:0;C(P+(A.key==="ArrowDown"?1:-1))}if(A.key.toLowerCase()==="r"){const O=v[k];O?.unread&&O.notificationId!=null&&(A.preventDefault(),y.mutateAsync([O.notificationId]))}}}:void 0,children:[E,_?h.jsxs("div",{"data-testid":"attention-shortcut-hint",role:"note","aria-label":"Attention keyboard shortcuts",className:"attention-shortcut-hint pointer-events-none mx-auto mt-3 w-fit items-center gap-4 rounded-full border bg-background/95 px-5 py-2 text-xs text-muted-foreground backdrop-blur",children:[h.jsxs("span",{children:[h.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5",children:"↑↓"})," Navigate"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5",children:"Enter"})," Open"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5",children:"R"})," Mark read"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5",children:"Tab"})," Actions"]})]}):null]})}function $C(){if(window.__lobuAmbientContext)return window.__lobuAmbientContext;if(window.parent!==window&&/^chrome-extension:\/\/[a-p]{32}$/.test(window.location.ancestorOrigins?.[0]??""))return{kind:"browser",url:null,title:null,applicationName:"Chrome"}}function hXe(){const[e,t]=x.useState($C);return x.useEffect(()=>{const n=()=>t($C());window.addEventListener("owletto:ambient-context",n),n();const r=a=>{const i=Ije(a,window.parent,window);i&&t(i)};return window.addEventListener("message",r),window.parent!==window&&window.parent.postMessage({owletto:"ambient-context-request"},"*"),()=>{window.removeEventListener("owletto:ambient-context",n),window.removeEventListener("message",r)}},[]),e}function N$e({owner:e,context:t,emptyState:n,onOpenItem:r,compact:a=!1}){const[i,s]=x.useState(!1),u=eD(),{attentionItems:c}=Ad(e),d=t!==void 0&&!i,p=d?v=>Tje(v,t):void 0,y=p?c.filter(p).length:c.length;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:ve("sticky top-0 z-20 flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2 bg-background pt-1",u?"justify-center":"justify-between"),children:[t?h.jsxs("fieldset",{className:"flex items-center gap-2","aria-label":"Notification scope",children:[h.jsxs("button",{type:"button","aria-pressed":!i,onClick:()=>s(!1),className:"rounded-md px-2.5 py-1 text-xs aria-pressed:bg-muted",children:["Relevant here",d?` (${y})`:""]}),h.jsx("button",{type:"button","aria-pressed":i,onClick:()=>s(!0),className:"rounded-md px-2.5 py-1 text-xs aria-pressed:bg-muted",children:"All notifications"})]}):null,!d&&!a&&h.jsx(i3e,{owner:e})]}),h.jsx(T$e,{owner:e,itemFilter:p,onOpenItem:r,rowAction:a?"none":"open",ariaLabel:d?"Relevant here":"Needs attention",tone:d?"relevant":"default",emptyState:d?h.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No notifications linked to this context."}):n})]})}const j$e={width:340,height:360},I$e={width:340,height:436},vL=x.createContext(null);function qC(){return window.documentPictureInPicture??null}function P$e(e){const t=e.createElement("base");t.href=document.baseURI,e.head.append(t);for(const n of document.querySelectorAll('link[rel="stylesheet"], style')){const r=n.cloneNode(!0);n instanceof HTMLLinkElement&&r instanceof HTMLLinkElement&&(r.href=n.href),e.head.append(r)}e.documentElement.className=document.documentElement.className,e.documentElement.style.colorScheme=getComputedStyle(document.documentElement).colorScheme,e.body.style.margin="0",e.body.style.width="100vw",e.body.style.height="100vh",e.body.style.overflow="hidden"}function D$e({owner:e,activeContext:t}){const n=cr(),r=x.useCallback(i=>{(async()=>{if(!i.href)return;const{pathname:s,search:u}=Ed(i.href);await n({to:s,search:u??{}}),await w$e()})()},[n]),a=t??{kind:"browser",url:null,title:null,applicationName:"Chrome"};return h.jsx("main",{className:"lobu-lens-surface bg-background text-foreground","aria-label":"Context notifications",children:h.jsx("div",{className:"lobu-lens-content",children:h.jsx(N$e,{owner:e,context:a,compact:!0,onOpenItem:r,emptyState:h.jsx("div",{className:"lobu-lens-empty text-muted-foreground",children:"All caught up"})},`${e}:${Nje(a)}`)})})}function L$e({children:e}){const{currentOwner:t}=Mr(),n=t??null,[r,a]=x.useState(()=>({kind:"browser",url:window.location.href,title:document.title||null,applicationName:"Browser"})),[i,s]=x.useState(null),u=x.useRef(null),c=x.useCallback(async()=>{if(u.current&&!u.current.closed){u.current.focus();return}if(!n)throw new Error("Open a Lobu workspace before starting Lens.");const p=qC();if(!p)throw new Error("This browser does not support Document Picture-in-Picture.");const y=document.documentElement.dataset.owlettoDebuggerAttached==="true",v=await p.requestWindow(y?I$e:j$e);u.current=v,P$e(v.document);const k=v.document.createElement("div");k.id="lobu-lens-root",k.style.width="100%",k.style.height="100%",v.document.body.append(k),s(k),v.addEventListener("pagehide",()=>{u.current===v&&(u.current=null,s(null))},{once:!0})},[n]);x.useEffect(()=>{const p=y=>{const v=tD(y);(v?.kind==="browser"||v?.kind==="application")&&a(v)};return document.addEventListener(V_,p),document.dispatchEvent(new Event(Rje)),()=>{document.removeEventListener(V_,p),u.current?.close()}},[]);const d=x.useMemo(()=>({available:n!=null&&qC()!=null,isOpen:i!=null,open:c}),[c,n,i]);return h.jsxs(vL.Provider,{value:d,children:[e,i&&n?ni.createPortal(h.jsx(D$e,{owner:n,activeContext:r}),i):null]})}function z$e(){const e=x.useContext(vL);return e||{available:!1,isOpen:!1,open:async()=>{}}}const ax=new Set;function fXe(e){return ax.add(e),()=>{ax.delete(e)}}function F$e(){for(const e of[...ax])try{e()}catch{}}const O4=3e3,$$e=6e4;function q$e(e){const t=Tn(),n=x.useRef(null),r=x.useRef(null),a=x.useRef(O4);x.useEffect(()=>{if(!e)return;let i=!1;function s(){for(const c of[[Qi],[Ic],["event-view-match",e]])t.invalidateQueries({queryKey:c});F$e()}async function u(){const c=await WV(`${At}/api/${e}/events`);if(i){c.close();return}n.current=c,c.onopen=()=>{a.current=O4},c.addEventListener("connected",s),c.addEventListener("invalidate",d=>{try{const p=JSON.parse(d.data);if(p.keys)for(const y of p.keys)y===Qi?s():t.invalidateQueries({queryKey:[y]}),y.startsWith("view:")&&t.invalidateQueries({queryKey:["views"]})}catch{}}),c.onerror=()=>{c.close(),n.current=null,!i&&(r.current=setTimeout(()=>{r.current=null,i||u()},a.current),a.current=Math.min(a.current*2,$$e))}}return u(),()=>{i=!0,n.current?.close(),n.current=null,r.current!=null&&(clearTimeout(r.current),r.current=null),a.current=O4}},[e,t])}function H$e(){const{session:e,sessionResult:t,isReady:n}=wr(),r=typeof window<"u"&&!window.location.pathname.startsWith("/auth/"),{data:a}=yO({enabled:r}),i=Tn(),s=x.useRef(!1);x.useEffect(()=>{!n||e||s.current||a?.singleUserMode&&(s.current=!0,(async()=>{try{(await BV()).ok&&(await t.refetch(),await i.invalidateQueries())}catch{}})())},[n,e,a,t,i])}const ga=rU()({component:U$e});function U$e(){const{session:e,isReady:t}=wr();t3e(),H$e();const n=typeof window<"u"?location.pathname:"/",r=n.startsWith("/oauth/")||n.startsWith("/slack/")||n.startsWith("/connector/"),a=PA();return q$e(t&&e?a:null),r?h.jsx("div",{className:"min-h-screen bg-background text-foreground",children:h.jsx(J4,{})}):h.jsx(L$e,{children:h.jsxs(qN,{delayDuration:200,children:[h.jsx(kve,{richColors:!0,position:"bottom-right"}),h.jsx(Aje,{children:h.jsx(J4,{})}),null]})})}const B$e=()=>Te(()=>import("./_owner-C79BwQ0I.js"),__vite__mapDeps([0,1])),V$e=Ce("/$owner")({loader:({context:{queryClient:e},params:t})=>{t.owner!=="me"&&e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},pendingComponent:()=>null,component:Oe(B$e,"component")}),W$e=()=>Te(()=>import("./index-BTlx9K_t.js"),__vite__mapDeps([2,3])),K$e=Ce("/")({component:Oe(W$e,"component")}),G$e=()=>Te(()=>import("./index-DyB3IzOA.js"),__vite__mapDeps([4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),Y$e=Ce("/$owner/")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:e=>Vn(e),component:Oe(G$e,"component")}),Z$e=()=>Te(()=>import("./claim-B-wq745Q.js"),[]),Q$e=Ce("/slack/claim")({component:Oe(Z$e,"component"),validateSearch:e=>({team:typeof e.team=="string"?e.team:void 0,t:typeof e.t=="string"?e.t:void 0})}),X$e=()=>Te(()=>import("./new-ktz9Cs_P.js"),__vite__mapDeps([19,14,3])),J$e=Ce("/orgs/new")({component:Oe(X$e,"component"),validateSearch:e=>Vn({slug:e.slug||void 0,name:e.name||void 0})});function eqe(e){if(typeof e!="string")return;const t=e.trim();if(t)try{const n=new URL(t);return n.protocol==="lobu:"||n.protocol==="lobu-ios-bridge:"?t:void 0}catch{return}}const tqe=()=>Te(()=>import("./device-D-7WBe9E.js"),__vite__mapDeps([20,21,14,22])),nqe=Ce("/oauth/device")({component:Oe(tqe,"component"),validateSearch:e=>Vn({user_code:typeof e.user_code=="string"&&e.user_code.trim().length>0?e.user_code.trim():void 0,return_to:eqe(e.return_to)})}),rqe=()=>Te(()=>import("./consent-C9ZpHb7V.js"),__vite__mapDeps([23,21,14]));function zi(e){return typeof e=="string"?e:void 0}const aqe=Ce("/oauth/consent")({component:Oe(rqe,"component"),validateSearch:e=>Vn({client_id:zi(e.client_id),redirect_uri:zi(e.redirect_uri),scope:zi(e.scope),state:zi(e.state),code_challenge:zi(e.code_challenge),code_challenge_method:zi(e.code_challenge_method),client_name:zi(e.client_name),resource:zi(e.resource),authorization_intent:zi(e.authorization_intent),workspace_grants:e.workspace_grants==="1"||e.workspace_grants===1?"1":void 0})}),oqe=()=>Te(()=>import("./reset-password-CzZw6RcC.js"),__vite__mapDeps([24,14])),iqe=Ce("/auth/reset-password")({component:Oe(oqe,"component"),validateSearch:e=>Vn({token:typeof e.token=="string"?e.token:void 0,error:typeof e.error=="string"?e.error:void 0})}),sqe=()=>Te(()=>import("./logout-Bkzc7J44.js"),[]),lqe=Ce("/auth/logout")({component:Oe(sqe,"component")}),cqe=()=>Te(()=>import("./login-DxGYyE4n.js"),__vite__mapDeps([25,14])),uqe=Ce("/auth/login")({component:Oe(cqe,"component"),validateSearch:e=>Vn({callbackUrl:e.callbackUrl||void 0,mode:e.mode||void 0,error:e.error||void 0,errorDescription:e.error_description||void 0,loginHint:e.loginHint||e.login_hint||void 0,invitationOrg:e.invitationOrg||void 0,provider:typeof e.provider=="string"&&e.provider.trim()?e.provider.trim().toLowerCase():void 0,intent:e.intent==="sign-up"||e.intent==="sign-in"?e.intent:void 0})}),dqe=()=>Te(()=>import("./callback-CBexCo3F.js"),[]),hqe=Ce("/auth/callback")({component:Oe(dqe,"component")}),fqe=()=>Te(()=>import("./accept-invitation-UXU5Fx2G.js"),__vite__mapDeps([26,3])),pqe=Ce("/auth/accept-invitation")({component:Oe(fqe,"component"),validateSearch:e=>Vn({invitationId:e.invitationId||void 0})}),yqe=()=>Te(()=>import("./settings-VDNiffKU.js"),__vite__mapDeps([27,3])),mqe=Ce("/account/settings")({component:Oe(yqe,"component")}),gqe=()=>Te(()=>import("./recent-QhnLDU1_.js"),[]),vqe=Ce("/$owner/recent")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(gqe,"component")}),kqe=()=>Te(()=>import("./connectors-CH4KBZyT.js"),[]),xqe=Ce("/$owner/connectors")({component:Oe(kqe,"component")}),bqe=()=>Te(()=>import("./automations-DAOln24A.js"),[]),wqe=Ce("/$owner/automations")({component:Oe(bqe,"component")}),Mqe=()=>Te(()=>import("./agents-DAOln24A.js"),[]),Sqe=Ce("/$owner/agents")({component:Oe(Mqe,"component")});function _qe(e,t){const n=t;return{path:n?`/${[e,n].filter(Boolean).join("/")}`:e,effectiveSplat:n}}const Cqe=()=>Te(()=>import("./_-BorucF19.js"),__vite__mapDeps([28,18]));function Eqe(){return h.jsx("div",{"data-public-loading":"true",children:h.jsx(FR,{})})}const Aqe=Ce("/$owner/$")({pendingComponent:Eqe,beforeLoad:({params:e})=>{const t=e._splat||"",n=t.split("/")[0];if(n&&ai(n)||!Cp(t))throw Zi()},component:Oe(Cqe,"component"),validateSearch:e=>{const t=Ib(e),n=[...rO,...Cm,"page"],r=i=>typeof i=="number"?i:String(i),a=i=>i!=null&&typeof i!="object";for(const i of n)a(e[i])&&(t[i]=r(e[i]));for(const i of Object.keys(e))i.startsWith("clf_")&&a(e[i])&&(t[i]=String(e[i]));return t},loader:({context:{queryClient:e},params:t})=>{const{path:n}=_qe(t.owner,Cp(t._splat||"")?.entityPath);e.prefetchQuery(uy.queryOptions(n,{slug:t.owner},{includeBootstrap:!0}))}}),Rqe=["agent","agent_id","automation","produced_by","schedule","connection_ids","feed_ids","run_ids","content_ids","entity_id","run_id","platforms","at"],Hu=e=>typeof e=="string"&&e.trim()?e.trim():void 0;function Oqe(e){return e.view==="events"||e.view==="feeds"||e.browse_view==="events"?!0:Rqe.some(t=>e[t]!=null&&String(e[t]).trim()!=="")}const Tqe=Ce("/$owner/memory/")({beforeLoad:({params:e,search:t})=>{const n=t,r=e.owner,a=Hu(n.browse_path)??Hu(n.entity);if(a)throw no({to:"/$owner/$",params:{owner:r,_splat:CV(a)},search:{},replace:!0});if(Oqe(n))throw no({to:"/$owner/events",params:{owner:r},search:Vn({...n,type:Hu(n.browse_type)?Ch(Hu(n.browse_type)):n.type,view:void 0,create:void 0,create_type:void 0,browse_type:void 0,browse_view:void 0}),replace:!0});const i=Hu(n.type)??Hu(n.browse_type);throw i?no({to:"/$owner/$entityType",params:{owner:r,entityType:Ch(i)},search:{create:n.create===!0||n.create==="true"?!0:void 0},replace:!0}):n.view==="entities"||n.create_type===!0||n.create_type==="true"?no({to:"/$owner/data",params:{owner:r},search:{create_type:n.create_type===!0||n.create_type==="true"?"true":void 0},replace:!0}):no({to:"/$owner/events",params:{owner:r},search:n,replace:!0})}}),Nqe=()=>Te(()=>import("./index-DtqBFgK5.js"),[]),jqe=Ce("/$owner/members/")({beforeLoad:({params:e})=>{throw no({...Rwe(e.owner),replace:!0})},component:Oe(Nqe,"component")}),Iqe=()=>Te(()=>import("./index-D3WHeGql.js"),__vite__mapDeps([29,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),Pqe=Ce("/$owner/events/")({loader:({context:{queryClient:e},params:t})=>{t.owner!=="me"&&e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(Iqe,"component"),validateSearch:e=>Vn(e)}),Dqe=()=>Te(()=>import("./index-CfT_W8Vo.js"),__vite__mapDeps([30,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),Lqe=Ce("/$owner/data/")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:e=>({create_type:e.create_type===!0||e.create_type==="true"?"true":void 0}),component:Oe(Dqe,"component")}),zqe={all:"All",data:"Data",chat:"Chat",actions:"Actions",inference:"Inference",runtime:"Runtime",device:"On device"},Fqe=["all","data","chat","actions","inference","runtime","device"];function $qe(e){return typeof e=="string"&&Fqe.includes(e)?e:void 0}function qqe(e){return e.options_schema?.["x-lobu-chat-platform"]!=null}function kL(e){return!!e.runtime||!!e.required_capability}function Hqe(e,t){const n=e.feeds_schema?Object.keys(e.feeds_schema).length>0:!1,r=e.has_operations||(e.actions_schema?Object.keys(e.actions_schema).length>0:!1);return{data:t?.facets.data??n,chat:t?.facets.chat??qqe(e),actions:t?.facets.actions??r,audience:t?.facets.audience??!1,inference:!1,runtime:!1}}function T4(e,t){const{connector:n,facets:r}=e;return t==="all"?!0:t==="data"?r.data:t==="chat"?r.chat:t==="actions"?r.actions:t==="inference"?r.inference:t==="runtime"?r.runtime===!0:e.isDevice===!0||kL(n)}const Uqe=()=>Te(()=>import("./index-DB1iWI_a.js"),[]),Bqe=Ce("/$owner/connectors/")({validateSearch:e=>{const t=$qe(e.filter);return t?{filter:t}:{}},loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(Uqe,"component")}),Vqe=()=>Te(()=>import("./index-B64PGxQm.js"),__vite__mapDeps([42,16])),Wqe=Ce("/$owner/chat/")({validateSearch:e=>{const t={};return(e.new===!0||e.new==="1"||e.new==="true")&&(t.new=!0),typeof e.prompt=="string"&&e.prompt.length>0&&(t.prompt=e.prompt),Object.assign(t,Em(e)),t},component:Oe(Vqe,"component")}),Kqe=()=>Te(()=>import("./index-fgAJydgX.js"),__vite__mapDeps([43,44,45])),Gqe=Ce("/$owner/automations/")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(Kqe,"component")}),Yqe=()=>Te(()=>import("./index-CxF2XXzl.js"),__vite__mapDeps([46,47,44,12,15])),Zqe=Ce("/$owner/agents/")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},component:Oe(Yqe,"component")}),Qqe=()=>Te(()=>import("./index-CdJJaQDX.js"),__vite__mapDeps([48,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),Xqe=Ce("/$owner/$entityType/")({validateSearch:e=>({$collection:yc(e.$collection),$preset:yc(e.$preset),$table:yc(e.$table),create:e.create===!0||e.create==="true"?!0:void 0,segment:typeof e.segment=="string"&&e.segment?e.segment:void 0}),beforeLoad:({params:e})=>{if(ai(e.entityType))throw Zi()},component:Oe(Qqe,"component")}),Jqe=()=>Te(()=>import("./connection-CNm2ukrI.js"),__vite__mapDeps([49,14])),eHe=Ce("/connector/$name/connection")({component:Oe(Jqe,"component"),validateSearch:e=>({ref:typeof e.ref=="string"?e.ref:void 0})}),tHe=()=>Te(()=>import("./organization-Cb0W823y.js"),__vite__mapDeps([50,51,14])),nHe=Ce("/$owner/settings/organization")({component:Oe(tHe,"component"),validateSearch:e=>({connector:typeof e.connector=="string"?e.connector:void 0,connection:Number.isSafeInteger(Number(e.connection))&&Number(e.connection)>0?Number(e.connection):void 0,agent:typeof e.agent=="string"?e.agent:void 0})}),rHe=()=>Te(()=>import("./_-DtqBFgK5.js"),[]),aHe=Ce("/$owner/memory/$")({beforeLoad:({params:e})=>{const t=WN(e._splat||"");throw t.typeSegment?ai(t.typeSegment)?Zi():t.isEntityDetail?no({to:"/$owner/$",params:{owner:e.owner,_splat:t.path},search:{},replace:!0}):no({to:"/$owner/$entityType",params:{owner:e.owner,entityType:t.typeSegment},search:{create:void 0},replace:!0}):no({to:"/$owner/data",params:{owner:e.owner},search:{},replace:!0})},component:Oe(rHe,"component")}),oHe=()=>Te(()=>import("./_eventId-BAnr8g8z.js"),__vite__mapDeps([52,53,10,11,12,13,14,39,40,7])),iHe=Ce("/$owner/events/$eventId")({beforeLoad:({params:e})=>{if(uL(e.eventId)===null)throw Zi()},component:Oe(oHe,"component"),validateSearch:e=>Vn(e)}),sHe=()=>Te(()=>import("./_-CkGyNi0G.js"),__vite__mapDeps([54,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),lHe=Ce("/$owner/events/$")({beforeLoad:({params:e})=>{const t=WN(e._splat||"");if(!t.typeSegment||!t.isEntityDetail||ai(t.typeSegment))throw Zi()},component:Oe(sHe,"component"),validateSearch:e=>Vn(e)}),cHe=Ce("/$owner/entity-types/new")({beforeLoad:({params:e})=>{throw no({to:"/$owner/data",params:{owner:e.owner},search:{create_type:"true"},replace:!0})}}),uHe=()=>Te(()=>import("./_slug-DbPdDc-5.js"),__vite__mapDeps([55,32,33,34,35,36])),dHe=Ce("/$owner/entity-types/$slug")({component:Oe(uHe,"component")}),hHe=()=>Te(()=>import("./deployments-CPpFAd_w.js"),[]),fHe=Ce("/$owner/connectors/deployments")({component:Oe(hHe,"component")});function xL({className:e,children:t}){return h.jsx("div",{className:ve("mx-auto w-full max-w-3xl",e),children:t})}function pXe({header:e,children:t}){return h.jsxs(xL,{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[h.jsx("div",{className:"sticky top-0 z-10 space-y-4 bg-background pb-1",children:e}),h.jsx("div",{className:"mt-4 min-w-0 flex-1 space-y-7",children:t})]})}const pHe="min-w-0 truncate text-sm text-muted-foreground transition-colors hover:text-foreground hover:underline";function yHe({crumbs:e}){return e.length===0?null:h.jsx("nav",{"aria-label":"Breadcrumb",className:"flex min-w-0 flex-wrap items-center gap-1.5",children:e.map((t,n)=>h.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n>0?h.jsx(Br,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground/50"}):null,t]},n))})}function mHe({breadcrumb:e,icon:t,title:n,badge:r,status:a,meta:i,caption:s,captionTone:u="muted"}){const c=h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[h.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1",children:[typeof n=="string"?h.jsx("h1",{className:"text-2xl font-semibold leading-none tracking-tight",children:n}):n,r,a]}),i?h.jsx("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:i}):null]}),d=s?h.jsx("p",{className:ve("max-w-2xl text-base leading-relaxed",u==="error"?"text-destructive":"text-muted-foreground"),children:s}):null;return h.jsxs("div",{className:"flex flex-col gap-2",children:[e,t?h.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[h.jsx("div",{className:"shrink-0",children:t}),c]}):c,d]})}function Qn({className:e,variant:t="default",...n}){const r={default:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",destructive:"bg-destructive text-destructive-foreground",outline:"border border-current bg-transparent"};return h.jsx("span",{"data-slot":"badge",className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-medium ${r[t]} ${e||""}`,...n})}function gHe({badges:e}){return e.length===0?null:h.jsx("div",{className:"mt-auto flex flex-wrap items-center gap-1.5",children:e.map(t=>h.jsx(Qn,{variant:"secondary",className:"h-4 shrink-0 px-1.5 py-0 text-[10px]",children:t},t))})}function vHe({count:e=4}){return h.jsx("div",{className:"grid grid-cols-1 gap-2",role:"status","aria-label":"Loading catalog",children:Array.from({length:e}).map((t,n)=>h.jsx(Ft,{className:"h-16 w-full rounded-lg"},n))})}function kHe({count:e=8}){return h.jsx("div",{className:"overflow-hidden rounded-lg border",role:"status","aria-label":"Loading connector catalog",children:Array.from({length:e}).map((t,n)=>h.jsxs("div",{className:`flex items-center gap-3 bg-card px-3 py-2.5 ${n===e-1?"":"border-b"}`,children:[h.jsx(Ft,{className:"h-8 w-8 shrink-0 rounded-lg"}),h.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[h.jsx(Ft,{className:"h-3.5 w-24 rounded"}),h.jsx(Ft,{className:"h-3 w-48 max-w-full rounded"})]}),h.jsx(Ft,{className:"h-4 w-14 shrink-0 rounded-full"}),h.jsx(Ft,{className:"h-4 w-4 shrink-0 rounded"})]},n))})}function yXe({count:e=4,withSearch:t=!0}){return h.jsxs("div",{className:"space-y-3",role:"status","aria-label":"Loading catalog",children:[t?h.jsx(Ft,{className:"h-9 w-full rounded-md"}):null,h.jsx(vHe,{count:e})]})}function mXe({items:e,searchQuery:t,onSearchChange:n,onSelect:r,emptyMessage:a,searchPlaceholder:i="Search...",searchAriaLabel:s="Search catalog",renderTitle:u}){return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"relative",children:[h.jsx(Zh,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(yn,{"aria-label":s,placeholder:i,value:t,onChange:c=>n(c.target.value),className:"pl-9"})]}),e.length===0?h.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:a??`No items match "${t}"`}):h.jsx("div",{className:"overflow-hidden rounded-lg border",children:e.map((c,d)=>h.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 bg-card px-4 py-3 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"+(d===e.length-1?"":" border-b"),onClick:()=>r(c),children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u?u(c):h.jsx("span",{className:"text-sm font-medium text-foreground",children:c.name}),h.jsx(gHe,{badges:c.badges})]}),c.description?h.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:c.description}):null]}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},c.key))})]})}function xHe(e){return e?e.charAt(0).toUpperCase()+e.slice(1):"App"}function bHe(e,{recovery:t=!1,installShape:n}={}){if(!t||n==="oauth-code-exchange")return e;const r=new URL(e);return r.searchParams.set("recovery","1"),r.toString()}function ox({organizationId:e,connectorKey:t,provider:n,providerLabel:r,recovery:a=!1,installShape:i,size:s="sm",variant:u,className:c,label:d,icon:p}){const y=nO(e,t),v=y.data?.options.find(M=>M.kind==="local");if(!e||y.isPending)return h.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking app setup…"});if(y.isError)return h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"App setup could not be checked."}),h.jsx(ke,{variant:"link",className:"px-0",onClick:()=>void y.refetch(),children:"Retry app setup"})]});if(!v?.configured||!v.url)return h.jsx("p",{className:"text-sm text-muted-foreground",children:"This server has no app configured. Choose an available connection option or configure your own app."});const k=r??xHe(n),b=d??`${a?"Reconnect":"Connect"} ${k}`;return h.jsx(ke,{asChild:!0,size:s,variant:u,className:c,children:h.jsxs("a",{href:bHe(v.url,{recovery:a,installShape:i}),children:[p,b]})})}const wHe=[{key:"data",label:"Data",icon:nR},{key:"chat",label:"Chat",icon:lR},{key:"actions",label:"Actions",icon:Gx},{key:"audience",label:"Audience",icon:Kx},{key:"inference",label:"Inference",icon:tR},{key:"runtime",label:"Runtime",icon:VA}];function ix({facets:e,className:t}){if(!e)return null;const n=wHe.filter(r=>e[r.key]);return n.length===0?null:h.jsx("div",{className:ve("flex flex-wrap items-center gap-1",t),children:n.map(({key:r,label:a,icon:i})=>h.jsxs(Qn,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[h.jsx(i,{className:"h-3 w-3"}),a]},r))})}function MHe({data:e,error:t,retry:n}){const r=e?.options.filter(i=>i.kind!=="local"&&i.configured&&!!i.url)??[],a=t||e?.cloud_status==="unavailable";return!r.length&&!a?null:h.jsxs("section",{"aria-label":"Available connection options",className:"space-y-3",children:[a&&h.jsxs("div",{role:"status",className:"text-sm text-muted-foreground",children:[h.jsx("p",{children:"Cloud connection options could not be checked. You can retry or continue with your own app."}),n&&h.jsx(ke,{variant:"link",className:"px-0",onClick:n,children:"Retry cloud discovery"})]}),r.map(i=>h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.url&&h.jsx(ke,{asChild:!0,variant:"outline",children:h.jsx("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",children:i.label})}),h.jsx("span",{className:"text-xs text-muted-foreground",children:i.execution==="cloud"?"Runs in Lobu Cloud":"Available for local execution"})]}),h.jsx("p",{className:"text-sm text-muted-foreground",children:i.description}),h.jsxs("details",{className:"text-xs text-muted-foreground",children:[h.jsx("summary",{className:"cursor-pointer",children:"Setup steps"}),h.jsx("p",{className:"pt-1",children:i.instructions})]})]},`${i.kind}:${i.managed_by_org??i.url}`))]})}function sx({organizationId:e,connectorKey:t}){const n=nO(e,t);return!e||n.isPending?h.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Checking connection options…"}):h.jsx(MHe,{data:n.data,error:n.isError,retry:()=>void n.refetch()})}const Ws=YI,Ks=XI,Fi=x.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(zb,{ref:r,className:ve("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-muted px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(JI,{asChild:!0,children:h.jsx(ey,{className:"h-4 w-4 opacity-50"})})]}));Fi.displayName=zb.displayName;const bL=x.forwardRef(({className:e,...t},n)=>h.jsx(Hb,{ref:n,className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(ZA,{className:"h-4 w-4"})}));bL.displayName=Hb.displayName;const wL=x.forwardRef(({className:e,...t},n)=>h.jsx(Ub,{ref:n,className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(ey,{className:"h-4 w-4"})}));wL.displayName=Ub.displayName;const $i=x.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>h.jsx(tP,{children:h.jsxs(Fb,{ref:a,className:ve("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(bL,{}),h.jsx(iP,{className:ve("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(wL,{})]})}));$i.displayName=Fb.displayName;const Hr=x.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(qb,{ref:r,className:ve("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(hP,{children:h.jsx(ja,{className:"h-4 w-4"})})}),h.jsx(uP,{children:t})]}));Hr.displayName=qb.displayName;const SHe=x.forwardRef(({className:e,...t},n)=>h.jsx(Bb,{ref:n,className:ve("-mx-1 my-1 h-px bg-muted",e),...t}));SHe.displayName=Bb.displayName;function ML({device:e}){const t=g$e(e.app_version),n=v$e(e,t);return h.jsx(Hr,{value:e.id,children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(k$e,{online:e.online}),h.jsx(yL,{platform:Nf(e)}),h.jsx("span",{children:m6(e)}),n?h.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",n]}):null,e.online?null:h.jsx("span",{className:"text-xs text-muted-foreground",children:"· offline"})]})})}var Rm="Popover",[SL]=lo(Rm,[xl]),jf=xl(),[_He,jl]=SL(Rm),_L=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,u=jf(t),c=x.useRef(null),[d,p]=x.useState(!1),[y,v]=Xi({prop:r,defaultProp:a??!1,onChange:i,caller:Rm});return h.jsx(Ty,{...u,children:h.jsx(_He,{scope:t,contentId:ao(),triggerRef:c,open:y,onOpenChange:v,onOpenToggle:x.useCallback(()=>v(k=>!k),[v]),hasCustomAnchor:d,onCustomAnchorAdd:x.useCallback(()=>p(!0),[]),onCustomAnchorRemove:x.useCallback(()=>p(!1),[]),modal:s,children:n})})};_L.displayName=Rm;var CL="PopoverAnchor",CHe=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=jl(CL,n),i=jf(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:u}=a;return x.useEffect(()=>(s(),()=>u()),[s,u]),h.jsx(uf,{...i,...r,ref:t})});CHe.displayName=CL;var EL="PopoverTrigger",AL=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=jl(EL,n),i=jf(n),s=Rt(t,a.triggerRef),u=h.jsx(Qe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":jL(a.open),...r,ref:s,onClick:Ne(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:h.jsx(uf,{asChild:!0,...i,children:u})});AL.displayName=EL;var g6="PopoverPortal",[EHe,AHe]=SL(g6,{forceMount:void 0}),RL=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=jl(g6,t);return h.jsx(EHe,{scope:t,forceMount:n,children:h.jsx(Kr,{present:n||i.open,children:h.jsx(_d,{asChild:!0,container:a,children:r})})})};RL.displayName=g6;var xd="PopoverContent",OL=x.forwardRef((e,t)=>{const n=AHe(xd,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,i=jl(xd,e.__scopePopover);return h.jsx(Kr,{present:r||i.open,children:i.modal?h.jsx(OHe,{...a,ref:t}):h.jsx(THe,{...a,ref:t})})});OL.displayName=xd;var RHe=dl("PopoverContent.RemoveScroll"),OHe=x.forwardRef((e,t)=>{const n=jl(xd,e.__scopePopover),r=x.useRef(null),a=Rt(t,r),i=x.useRef(!1);return x.useEffect(()=>{const s=r.current;if(s)return Cd(s)},[]),h.jsx(Dc,{as:RHe,allowPinchZoom:!0,children:h.jsx(TL,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ne(e.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ne(e.onPointerDownOutside,s=>{const u=s.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0,d=u.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Ne(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),THe=x.forwardRef((e,t)=>{const n=jl(xd,e.__scopePopover),r=x.useRef(!1),a=x.useRef(!1);return h.jsx(TL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),TL=x.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:p,...y}=e,v=jl(xd,n),k=jf(n);return fy(),h.jsx(nf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:h.jsx(Sd,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:p,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>v.onOpenChange(!1),deferPointerDownOutside:!0,children:h.jsx(Ny,{"data-state":jL(v.open),role:"dialog",id:v.contentId,...k,...y,ref:t,style:{...y.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),NL="PopoverClose",NHe=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=jl(NL,n);return h.jsx(Qe.button,{type:"button",...r,ref:t,onClick:Ne(e.onClick,()=>a.onOpenChange(!1))})});NHe.displayName=NL;var jHe="PopoverArrow",IHe=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=jf(n);return h.jsx(jy,{...a,...r,ref:t})});IHe.displayName=jHe;function jL(e){return e?"open":"closed"}var PHe=_L,DHe=AL,LHe=RL,IL=OL;const zHe=PHe,FHe=DHe,PL=x.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>h.jsx(LHe,{children:h.jsx(IL,{ref:a,align:t,sideOffset:n,className:ve("z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));PL.displayName=IL.displayName;function $He({trigger:e,searchPlaceholder:t,emptyText:n,contentClassName:r,align:a="start",onQueryChange:i,children:s}){const[u,c]=x.useState(!1),[d,p]=x.useState(""),y=v=>{p(v),i?.(v)};return h.jsxs(zHe,{open:u,onOpenChange:v=>{c(v),v||y("")},children:[h.jsx(FHe,{asChild:!0,children:e(u)}),h.jsx(PL,{className:ve("p-0",r),align:a,children:h.jsxs(af,{shouldFilter:!i,children:[h.jsx(My,{placeholder:t,value:d,onValueChange:y}),h.jsxs(Sy,{children:[h.jsx(_y,{children:n}),h.jsx(eo,{children:s(()=>{c(!1),y("")},d)})]})]})})]})}function HC({member:e,size:t="sm"}){const n=t==="sm"?"h-5 w-5 text-[10px]":"h-6 w-6 text-xs";return e.user.image?h.jsx("img",{src:e.user.image,alt:e.user.name,referrerPolicy:"no-referrer",className:ve("rounded-full object-cover shrink-0",n)}):h.jsx("div",{className:ve("rounded-full bg-muted flex items-center justify-center font-medium shrink-0",n),children:(e.user.name||e.user.email).charAt(0).toUpperCase()})}function qHe({organizationId:e,value:t,onValueChange:n,disabled:r,placeholder:a="Select member...",className:i}){const{members:s,isLoading:u}=Fy(e),c=t?s.find(d=>d.userId===t):void 0;return h.jsx($He,{contentClassName:"w-[--radix-popover-trigger-width]",searchPlaceholder:"Search members...",emptyText:"No members found.",trigger:d=>h.jsxs(ke,{variant:"outline",role:"combobox","aria-expanded":d,disabled:r||u,className:ve("w-full justify-between font-normal",i),children:[c?h.jsxs("span",{className:"flex items-center gap-2 truncate",children:[h.jsx(HC,{member:c}),h.jsx("span",{className:"truncate",children:c.user.name||c.user.email})]}):h.jsx("span",{className:"text-muted-foreground",children:u?"Loading...":a}),h.jsx(QA,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:d=>h.jsxs(h.Fragment,{children:[t&&h.jsx(ar,{value:"__clear__",onSelect:()=>{n(void 0),d()},children:h.jsx("span",{className:"text-muted-foreground",children:"Clear selection"})}),s.map(p=>h.jsxs(ar,{value:`${p.user.name} ${p.user.email}`,onSelect:()=>{n(p.userId===t?void 0:p.userId),d()},children:[h.jsx(HC,{member:p}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"truncate text-sm",children:p.user.name||p.user.email}),p.user.name&&h.jsx("p",{className:"truncate text-xs text-muted-foreground",children:p.user.email})]}),h.jsx(ja,{className:ve("ml-auto h-4 w-4 shrink-0",t===p.userId?"opacity-100":"opacity-0")})]},p.userId))]})})}function HHe({onCancel:e,cancelLabel:t="Cancel",cancelDisabled:n,children:r,className:a}){return!e&&!r?null:h.jsxs("div",{className:ve("flex items-center justify-end gap-2",a),children:[e?h.jsx(ke,{type:"button",variant:"outline",onClick:e,disabled:n,children:t}):null,r]})}const DL={data:!1,chat:!1,actions:!1,audience:!1,inference:!1,runtime:!0};function Uh(e){return e==="vercel"?"Vercel":e.charAt(0).toUpperCase()+e.slice(1)}function LL(e){return e==="vercel"?"vercel.com":null}function UHe(e){if(!e.startsWith(n5))return null;const t=e.slice(n5.length);return t.length>0?t:null}function V0(e){if(!e.startsWith(np))return null;const t=e.slice(np.length);return t.length>0?t:null}function gXe(e){return e.map(t=>({sandbox:t,facets:DL,connector:{key:`${n5}${t.id}`,name:t.name||Uh(t.providerKind),description:null,version:"",auth_schema:null,feeds_schema:null,actions_schema:null,options_schema:null,status:t.connected?"active":"error",login_enabled:!1,installed:!0}}))}function BHe(e){return e.map(t=>({key:`${np}${t}`,name:Uh(t),description:`Run agents in a ${Uh(t)} sandbox instead of the built-in local runtime.`,version:"",auth_schema:null,feeds_schema:null,actions_schema:null,options_schema:null,status:"active",login_enabled:!1,favicon_domain:LL(t),installed:!1,installable:!1}))}function lx(){return DL}function VHe({providerKind:e,credentialFields:t,pending:n,onCancel:r,onCreate:a}){const[i,s]=x.useState(""),[u,c]=x.useState({}),d=Uh(e),p=y=>{y.preventDefault();const v=Object.fromEntries(Object.entries(u).filter(([,k])=>k.trim()));a({name:i.trim(),provider_kind:e,credential:Object.keys(v).length>0?v:void 0})};return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsxs("h3",{className:"text-sm font-medium",children:["Connect ",d]}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Add a credential so agents can execute in a ",d," sandbox."]})]}),h.jsxs("form",{onSubmit:p,className:"grid max-w-md gap-3",children:[h.jsxs("div",{className:"grid gap-2",children:[h.jsxs(la,{htmlFor:"sandbox-name",children:["Name ",h.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),h.jsx(yn,{id:"sandbox-name",placeholder:`${d} production`,value:i,onChange:y=>s(y.target.value),required:!0})]}),t.map(y=>h.jsxs("div",{className:"grid gap-2",children:[h.jsxs(la,{htmlFor:`sandbox-cred-${y.key}`,children:[y.label,y.required?h.jsx("span",{className:"ml-1 text-destructive",children:"*"}):null]}),h.jsx(yn,{id:`sandbox-cred-${y.key}`,type:y.secret===!1?"text":"password",value:u[y.key]??"",onChange:v=>c(k=>({...k,[y.key]:v.target.value})),autoComplete:"off",required:y.required})]},y.key)),h.jsx(HHe,{onCancel:r,children:h.jsx(ke,{type:"submit",disabled:n||!i.trim(),children:n?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"}),"Connecting..."]}):`Connect ${d}`})})]})]})}function od({visible:e,onReload:t}){return e?h.jsxs("div",{role:"alert",className:"rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm",children:[h.jsx("p",{children:"This form changed while you were editing. Your edits are preserved. Reload the latest values before saving."}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Discard edits and reload"})]}):null}function zL({rows:e=4,className:t}){return h.jsxs("div",{role:"status","aria-label":"Loading form",className:ve("space-y-5",t),children:[Array.from({length:e}).map((n,r)=>h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ft,{className:"h-3.5 w-24"}),h.jsx(Ft,{className:"h-9 w-full rounded-md"})]},r)),h.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[h.jsx(Ft,{className:"h-9 w-24 rounded-md"}),h.jsx(Ft,{className:"h-9 w-20 rounded-md"})]})]})}function WHe(e){const t=[];e.configSchema&&t.push({title:"Configuration",schema:e.configSchema});for(const[n,r]of Object.entries(e.eventKinds??{}))r.metadataSchema&&t.push({title:n,description:r.description,schema:r.metadataSchema});return{description:e.description,sections:t}}function KHe(e){const t=[];return e.inputSchema&&t.push({title:"Input",schema:e.inputSchema}),e.outputSchema&&t.push({title:"Output",schema:e.outputSchema}),{description:e.description,sections:t}}function FL(){const e=y6(),t=x.useCallback((r,a,i="")=>{e&&e.open({href:i,title:a.name??r,schemaSections:WHe(a)})},[e]),n=x.useCallback((r,a)=>{e&&e.open({href:"",title:a.name??r,schemaSections:KHe(a)})},[e]);return{inspectFeed:t,inspectAction:n}}const GHe={image:"Image",stt:"Speech-to-text",tts:"Text-to-speech"};function vXe(e){return e.filter(t=>t!=="text").map(t=>GHe[t])}function kXe(e){return e.supportedAuthTypes.some(t=>t==="oauth"||t==="device-code")}function YHe(e){return e.sdkCompat!=null&&e.supportedAuthTypes.includes("api-key")}function Il(e,t=""){return`${At}/api/${e}/agents/inference-providers${t}`}function xXe(e){const{slug:t}=br();return rt({queryKey:["inference-providers",t],queryFn:async()=>{const n=await Ke(Il(t??""),{credentials:"include"});return await Wr(n,"Failed to load inference providers"),(await n.json()).providers??[]},enabled:!!t&&(e?.enabled??!0),staleTime:3e4})}function ZHe(e){const{slug:t}=br();return rt({queryKey:["inference-providers-catalog",t],queryFn:async()=>{const n=await Ke(Il(t??"","/catalog"),{credentials:"include"});return await Wr(n,"Failed to load inference provider catalog"),(await n.json()).catalog??[]},enabled:!!t&&(e?.enabled??!0),staleTime:6e4})}const bXe=so({method:"POST",url:({slug:e})=>Il(e),body:e=>e,invalidate:()=>[["inference-providers"]],successMessage:"Provider created",errorMessage:"Failed to create provider"}),wXe=so({method:"PUT",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}/capabilities/${t.modality}`),body:e=>({block:e.block}),invalidate:()=>[["inference-providers"]],successMessage:"Capability updated",errorMessage:"Failed to update capability"}),MXe=so({method:"PUT",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}`),body:e=>({displayName:e.displayName}),invalidate:()=>[["inference-providers"]],successMessage:"Provider updated",errorMessage:"Failed to update provider"}),SXe=so({method:"PUT",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}/default`),invalidate:()=>[["inference-providers"]],successMessage:"Default provider set",errorMessage:"Failed to set default provider"}),_Xe=so({method:"PUT",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}/key`),body:e=>({value:e.value}),invalidate:()=>[["inference-providers"]],successMessage:"Key rotated",errorMessage:"Failed to rotate key"}),CXe=so({method:"DELETE",url:({slug:e,params:t})=>Il(e,`/${t.providerSlug}`),invalidate:()=>[["inference-providers"]],successMessage:"Provider deleted",errorMessage:"Failed to delete provider"});function EXe(e,t){const n=t.find(r=>r.slug===e);return n?YHe(n):!0}function QHe(e){const t=e.trim();if(!t)return null;let n;try{n=new URL(t)}catch{return"Enter a valid URL"}return n.protocol!=="https:"?"Must start with https://":n.username||n.password?"Credentials in the URL aren't allowed":n.search||n.hash?"Query or fragment isn't allowed":null}const XHe=/^\/[A-Za-z0-9/_.-]*$/;function JHe(e){const t=e.trim();return t?t.startsWith("//")?"Can't start with //":XHe.test(t)?null:"Must be a path like /v1/models":null}function eUe(e){return e.length>0&&!e.trim()?"Model can't be blank":null}function AXe(e){const t={},n=QHe(e.base_url??"");n&&(t.base_url=n);const r=eUe(e.model??"");r&&(t.model=r);const a=JHe(e.models_endpoint??"");return a&&(t.models_endpoint=a),t}function RXe(e){return!!(e.base_url||e.model||e.models_endpoint)}const tUe="https://github.com/lobu-ai/lobu/releases/latest/download/Lobu.dmg",nUe="https://chromewebstore.google.com/detail/jhgcecbdpnoehfnhpdfihlchjddapepi";function rUe(e){const t=new URL(e);return["127.0.0.1","localhost","[::1]"].includes(t.hostname)&&(t.hostname="host.docker.internal"),`docker run --rm --name lobu-worker --interactive --tty \\
|
|
7938
7938
|
--add-host host.docker.internal:host-gateway \\
|
|
7939
7939
|
--volume lobu-worker-state:/home/worker \\
|
|
7940
7940
|
ghcr.io/lobu-ai/lobu-worker:latest \\
|
|
@@ -7946,5 +7946,5 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
7946
7946
|
* @license qrcode.react
|
|
7947
7947
|
* Copyright (c) Paul O'Shannessy
|
|
7948
7948
|
* SPDX-License-Identifier: ISC
|
|
7949
|
-
*/var fUe={L:Ju.QrCode.Ecc.LOW,M:Ju.QrCode.Ecc.MEDIUM,Q:Ju.QrCode.Ecc.QUARTILE,H:Ju.QrCode.Ecc.HIGH},BL=128,VL="L",WL="#FFFFFF",KL="#000000",GL=!1,YL=1,pUe=4,yUe=0,mUe=.1;function ZL(e,t=0){const n=[];return e.forEach(function(r,a){let i=null;r.forEach(function(s,u){if(!s&&i!==null){n.push(`M${i+t} ${a+t}h${u-i}v1H${i+t}z`),i=null;return}if(u===r.length-1){if(!s)return;i===null?n.push(`M${u+t},${a+t} h1v1H${u+t}z`):n.push(`M${i+t},${a+t} h${u+1-i}v1H${i+t}z`);return}s&&i===null&&(i=u)})}),n.join("")}function QL(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((a,i)=>i<t.x||i>=t.x+t.w?a:!1))}function gUe(e,t,n,r){if(r==null)return null;const a=e.length+n*2,i=Math.floor(t*mUe),s=a/t,u=(r.width||i)*s,c=(r.height||i)*s,d=r.x==null?e.length/2-u/2:r.x*s,p=r.y==null?e.length/2-c/2:r.y*s,y=r.opacity==null?1:r.opacity;let v=null;if(r.excavate){let b=Math.floor(d),M=Math.floor(p),_=Math.ceil(u+d-b),C=Math.ceil(c+p-M);v={x:b,y:M,w:_,h:C}}const k=r.crossOrigin;return{x:d,y:p,h:c,w:u,excavation:v,opacity:y,crossOrigin:k}}function vUe(e,t){return t!=null?Math.max(Math.floor(t),0):e?pUe:yUe}function XL({value:e,level:t,minVersion:n,includeMargin:r,marginSize:a,imageSettings:i,size:s,boostLevel:u}){let c=X.useMemo(()=>{const b=(Array.isArray(e)?e:[e]).reduce((M,_)=>(M.push(...Ju.QrSegment.makeSegments(_)),M),[]);return Ju.QrCode.encodeSegments(b,fUe[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:d,margin:p,numCells:y,calculatedImageSettings:v}=X.useMemo(()=>{let k=c.getModules();const b=vUe(r,a),M=k.length+b*2,_=gUe(k,s,b,i);return{cells:k,margin:b,numCells:M,calculatedImageSettings:_}},[c,s,i,r,a]);return{qrcode:c,margin:p,cells:d,numCells:y,calculatedImageSettings:v}}var kUe=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),xUe=X.forwardRef(function(t,n){const r=t,{value:a,size:i=BL,level:s=VL,bgColor:u=WL,fgColor:c=KL,includeMargin:d=GL,minVersion:p=YL,boostLevel:y,marginSize:v,imageSettings:k}=r,M=ux(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:_}=M,C=ux(M,["style"]),E=k?.src,A=X.useRef(null),R=X.useRef(null),O=X.useCallback(Y=>{A.current=Y,typeof n=="function"?n(Y):n&&(n.current=Y)},[n]),[N,P]=X.useState(!1),{margin:L,cells:I,numCells:D,calculatedImageSettings:H}=XL({value:a,level:s,minVersion:p,boostLevel:y,includeMargin:d,marginSize:v,imageSettings:k,size:i});X.useEffect(()=>{if(A.current!=null){const Y=A.current,q=Y.getContext("2d");if(!q)return;let $=I;const B=R.current,J=H!=null&&B!==null&&B.complete&&B.naturalHeight!==0&&B.naturalWidth!==0;J&&H.excavation!=null&&($=QL(I,H.excavation));const te=window.devicePixelRatio||1;Y.height=Y.width=i*te;const z=i/D*te;q.scale(z,z),q.fillStyle=u,q.fillRect(0,0,D,D),q.fillStyle=c,kUe?q.fill(new Path2D(ZL($,L))):I.forEach(function(U,V){U.forEach(function(j,Z){j&&q.fillRect(Z+L,V+L,1,1)})}),H&&(q.globalAlpha=H.opacity),J&&q.drawImage(B,H.x+L,H.y+L,H.w,H.h)}}),X.useEffect(()=>{P(!1)},[E]);const K=cx({height:i,width:i},_);let W=null;return E!=null&&(W=X.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{P(!0)},ref:R,crossOrigin:H?.crossOrigin})),X.createElement(X.Fragment,null,X.createElement("canvas",cx({style:K,height:i,width:i,ref:O,role:"img"},C)),W)});xUe.displayName="QRCodeCanvas";var JL=X.forwardRef(function(t,n){const r=t,{value:a,size:i=BL,level:s=VL,bgColor:u=WL,fgColor:c=KL,includeMargin:d=GL,minVersion:p=YL,boostLevel:y,title:v,marginSize:k,imageSettings:b}=r,M=ux(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:_,cells:C,numCells:E,calculatedImageSettings:A}=XL({value:a,level:s,minVersion:p,boostLevel:y,includeMargin:d,marginSize:k,imageSettings:b,size:i});let R=C,O=null;b!=null&&A!=null&&(A.excavation!=null&&(R=QL(C,A.excavation)),O=X.createElement("image",{href:b.src,height:A.h,width:A.w,x:A.x+_,y:A.y+_,preserveAspectRatio:"none",opacity:A.opacity,crossOrigin:A.crossOrigin}));const N=ZL(R,_);return X.createElement("svg",cx({height:i,width:i,viewBox:`0 0 ${E} ${E}`,ref:n,role:"img"},M),!!v&&X.createElement("title",null,v),X.createElement("path",{fill:u,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),X.createElement("path",{fill:c,d:N,shapeRendering:"crispEdges"}),O)});JL.displayName="QRCodeSVG";function bUe(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`}function ez({expiresAt:e}){const[t,n]=x.useState(()=>Date.now());x.useEffect(()=>{const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[]);const a=new Date(e).getTime()-t,i=a<=0;return h.jsx("span",{className:`text-xs font-mono ${i?"text-destructive":"text-muted-foreground"}`,children:i?"Expired — waiting for refresh…":`Expires in ${bUe(a)}`})}function wUe({artifact:e}){return h.jsxs("div",{className:"space-y-3",children:[h.jsx("div",{className:"flex justify-center",children:h.jsx("div",{className:"rounded-md bg-white p-3 border",children:h.jsx(JL,{value:e.value,size:220,level:"M"})})}),e.expiresAt&&h.jsx("div",{className:"flex justify-center",children:h.jsx(ez,{expiresAt:e.expiresAt})}),e.instructions&&h.jsx("p",{className:"text-sm text-muted-foreground text-center",children:e.instructions})]})}function MUe({artifact:e}){const[t,n]=x.useState(!1),r=x.useCallback(async()=>{try{await navigator.clipboard.writeText(e.value.replace(/[^A-Za-z0-9]/g,"")),n(!0),setTimeout(()=>n(!1),1500)}catch{}},[e.value]);return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-center gap-2",children:[h.jsx("code",{className:"font-mono text-2xl tracking-widest px-4 py-2 rounded bg-muted border",children:e.value}),h.jsx(ke,{variant:"outline",size:"sm",onClick:()=>void r(),children:t?h.jsxs(h.Fragment,{children:[h.jsx(ja,{className:"h-3.5 w-3.5 mr-1.5"})," Copied"]}):h.jsxs(h.Fragment,{children:[h.jsx(Eh,{className:"h-3.5 w-3.5 mr-1.5"})," Copy"]})})]}),e.expiresAt&&h.jsx("div",{className:"flex justify-center",children:h.jsx(ez,{expiresAt:e.expiresAt})}),e.instructions&&h.jsx("p",{className:"text-sm text-muted-foreground text-center",children:e.instructions})]})}function SUe({artifact:e,runId:t}){const n=eO(),[r,a]=x.useState(!1),i=x.useCallback(()=>{e.mode==="popup"?window.open(e.url,"_blank","noopener,noreferrer,width=600,height=700"):window.location.href=e.url,a(!0)},[e.mode,e.url]),s=x.useCallback(()=>{n.mutateAsync({run_id:t,name:e.awaitSignal,payload:{}})},[n,t,e.awaitSignal]);return h.jsxs("div",{className:"space-y-3",children:[e.instructions&&h.jsx("p",{className:"text-sm text-muted-foreground",children:e.instructions}),h.jsxs("div",{className:"flex flex-col items-stretch gap-2",children:[h.jsxs(ke,{onClick:i,children:[h.jsx(Yh,{className:"h-4 w-4 mr-2"}),r?"Re-open authorization page":"Open authorization page"]}),r&&h.jsx(ke,{variant:"outline",onClick:s,disabled:n.isPending,children:n.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"})," Notifying…"]}):"I have completed authorization"})]})]})}function _Ue({artifact:e,runId:t}){const n=eO(),[r,a]=x.useState({}),i=x.useCallback(u=>{u.preventDefault(),n.mutateAsync({run_id:t,name:e.submitSignal,payload:r})},[n,t,e.submitSignal,r]),s=e.fields.every(u=>!u.required||(r[u.key]??"").trim().length>0);return h.jsxs("form",{onSubmit:i,className:"space-y-3",children:[e.instructions&&h.jsx("p",{className:"text-sm text-muted-foreground",children:e.instructions}),e.fields.map(u=>h.jsxs("div",{className:"space-y-1",children:[h.jsxs("label",{htmlFor:`auth-field-${u.key}`,className:"text-xs font-medium",children:[u.label,u.required&&h.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),h.jsx(yn,{id:`auth-field-${u.key}`,type:u.kind==="password"?"password":"text",inputMode:u.kind==="otp"?"numeric":void 0,autoComplete:u.kind==="otp"?"one-time-code":void 0,value:r[u.key]??"",onChange:c=>a(d=>({...d,[u.key]:c.target.value}))})]},u.key)),h.jsx(ke,{type:"submit",disabled:!s||n.isPending,className:"w-full",children:n.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"})," Submitting…"]}):"Submit"})]})}function CUe({artifact:e}){return h.jsxs("div",{className:"flex items-center gap-3 py-2",children:[h.jsx(Dt,{size:"xl",className:"text-muted-foreground"}),h.jsx("span",{className:"text-sm text-muted-foreground",children:e.message})]})}function tz({artifact:e,runId:t}){switch(e.type){case"qr":return h.jsx(wUe,{artifact:e});case"code":return h.jsx(MUe,{artifact:e});case"redirect":return h.jsx(SUe,{artifact:e,runId:t});case"prompt":return h.jsx(_Ue,{artifact:e,runId:t});case"status":return h.jsx(CUe,{artifact:e})}}function EUe({runId:e,onClose:t}){const{data:n,isLoading:r}=JR(e),a=x.useMemo(()=>n?.status==="completed"||n?.status==="failed"||n?.status==="cancelled",[n?.status]);x.useEffect(()=>{if(n?.status==="completed"){const s=setTimeout(()=>t(!0),1500);return()=>clearTimeout(s)}},[n?.status,t]);const i=e!=null;return h.jsx(M3,{open:i,onOpenChange:s=>{s||t(n?.status==="completed")},children:h.jsxs(wy,{className:"sm:max-w-md",children:[h.jsxs(S3,{children:[h.jsx(_3,{children:n?.status==="completed"?"Connection authorized":n?.status==="failed"?"Authorization failed":n?.status==="cancelled"?"Authorization cancelled":"Connect your account"}),h.jsx(C3,{children:n?.connector_key?`Complete sign-in for ${n.connector_key} to finish setup. You can add feeds later if you want scheduled syncs.`:"Complete sign-in to finish setup. You can add feeds later if you want scheduled syncs."})]}),h.jsxs("div",{className:"py-2 space-y-4",children:[r&&!n&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(Dt,{size:"lg"})," Preparing…"]}),n?.status==="completed"&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-emerald-600",children:[h.jsx(Ix,{className:"h-5 w-5"})," Success — closing…"]}),n?.status==="failed"&&h.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive flex items-start gap-2",children:[h.jsx(JA,{className:"h-4 w-4 mt-0.5 shrink-0"}),h.jsx("span",{children:n.error_message||"Authentication failed."})]}),n?.status==="cancelled"&&h.jsxs("div",{className:"rounded-md border p-3 text-sm text-muted-foreground flex items-start gap-2",children:[h.jsx(ty,{className:"h-4 w-4 mt-0.5 shrink-0"}),h.jsx("span",{children:"Authorization was cancelled."})]}),!a&&n&&!n.artifact&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(Dt,{size:"lg"})," Waiting for connector…"]}),!a&&n?.artifact&&e!=null&&h.jsx(tz,{artifact:n.artifact,runId:e})]}),h.jsx("div",{className:"flex justify-end gap-2",children:h.jsx(ke,{variant:"outline",onClick:()=>t(n?.status==="completed"),children:a?"Close":"Cancel"})})]})})}function AUe(e){return k6(e).find(t=>t.type==="app_installation")}function RUe(e){const t=e.provider.toUpperCase();return{clientIdKey:e.clientIdKey||`${t}_CLIENT_ID`,clientSecretKey:e.clientSecretKey||`${t}_CLIENT_SECRET`}}function OUe(e){if(e)return e}function k6(e){return OUe(e)?.methods??[]}function nz(e,t){if(!(e.auth_profile_slug||e.auth_profile_kind||e.app_auth_profile_slug||e.config?.managedBy||e.config?.installation_ref||e.config?.consent_only))return k6(t).find(n=>n.type==="none")}function ch(e,t){const n=k6(e),r=n.some(a=>a.type!=="none");return n.filter(a=>a.type!=="none"||r).filter(a=>{if(a.type==="oauth"){const i=a,s=Bh(i),u=Om(i);return!(s.length===0&&u.length===0)}return a.type==="env_keys",!0})}function Bh(e){return Array.isArray(e?.requiredScopes)?e.requiredScopes.filter(t=>typeof t=="string"):[]}function Om(e){return Array.isArray(e?.optionalScopes)?e.optionalScopes.filter(t=>typeof t=="string"):[]}function BC(e,t){const n=Bh(e),r=new Set(Om(e)),a=(t??[]).filter(i=>r.has(i));return Array.from(new Set([...n,...a]))}function W0(e){return e.type==="app_installation"?`${e.provider.charAt(0).toUpperCase()+e.provider.slice(1)} App`:e.type==="oauth"?`OAuth (${e.provider.charAt(0).toUpperCase()+e.provider.slice(1)})`:e.type==="env_keys"?"API Key / Token":e.type==="browser"?"Browser":e.type==="none"?e.label??"No Authentication":e.type==="interactive"?"Interactive pairing":e.type}function TUe(e,t){const n=e.fields;if(n.length===0)return;const r=Object.fromEntries(n.map(i=>[i.key,{type:"string",title:i.label||i.key,description:i.description,example:i.example,...i.secret?{format:"password"}:{}}])),a=n.filter(i=>i.required!==!1).map(i=>i.key);return{type:"object",properties:r,...a.length>0?{required:a}:{}}}function NUe(e){if(e.type==="env_keys"){const t=e.required!==!1;return e.fields.map(n=>({key:n.key,label:n.label,description:n.description,example:n.example,secret:n.secret,required:t&&n.required!==!1}))}if(e.type==="oauth"){const t=e.required!==!1,n=e.provider?e.provider.charAt(0).toUpperCase()+e.provider.slice(1):"OAuth",{clientIdKey:r,clientSecretKey:a}=RUe(e);return[{key:r,label:`${n} Client ID`,description:`${n} OAuth client ID`,secret:!1,required:t},{key:a,label:`${n} Client Secret`,description:`${n} OAuth client secret`,secret:!0,required:t}]}return[]}function jUe(e){if(!e||e.type==="none")return;const t=NUe(e);if(t.length===0)return;const n=Object.fromEntries(t.map(a=>[a.key,{type:"string",title:a.required?a.label||a.key:`${a.label||a.key} (Optional)`,description:a.description,example:a.example,...a.secret?{format:"password"}:{}}])),r=t.filter(a=>a.required).map(a=>a.key);return{type:"object",properties:n,...r.length>0?{required:r}:{}}}function IUe(){return v6()}function PUe({checked:e,onCheckedChange:t,disabled:n,className:r,...a}){return h.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:n,onClick:()=>t(!e),className:ve("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e?"bg-primary":"bg-input",r),...a,children:h.jsx("span",{className:ve("pointer-events-none block h-4 w-4 rounded-full bg-background ring-0 transition-transform",e?"translate-x-4":"translate-x-0")})})}function DUe({connection:e}){const t=x.useId(),{session:n}=wr(),{data:r}=cy(),a=Jh(),[i,s]=x.useState(!1),[u,c]=x.useState(null),d=r?.find(b=>b.id===e.organization_id),p=d?.name??"this workspace",y=!!(n?.user?.id&&n.user.id===e.created_by),v=e.visibility==="org";if(!y||d?.is_personal)return h.jsxs("p",{className:"text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Access: "}),v?`Shared with ${p}`:"Private"]});const k=b=>{c(null),a.mutate({connection_id:e.id,visibility:b},{onSuccess:()=>s(!1),onError:M=>c(M.message||"Could not change who can use this.")})};return h.jsxs("div",{className:"space-y-2 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(PUe,{"aria-labelledby":t,checked:v||i,disabled:a.isPending,onCheckedChange:b=>{c(null),b?s(!0):i?s(!1):k("private")}}),h.jsxs("span",{id:t,children:["Share with ",p]})]}),i&&!v?h.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-xs",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:["Everyone in ",p," will be able to see this connection's data and run actions through it."]}),h.jsx(ke,{size:"sm",disabled:a.isPending,onClick:()=>k("org"),children:"Share"}),h.jsx(ke,{size:"sm",variant:"ghost",disabled:a.isPending,onClick:()=>s(!1),children:"Cancel"})]}):null,u?h.jsx("p",{role:"alert",className:"text-sm text-destructive",children:u}):null]})}var Tm="Collapsible",[LUe]=lo(Tm),[zUe,x6]=LUe(Tm),rz=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:i,onOpenChange:s,...u}=e,[c,d]=Xi({prop:r,defaultProp:a??!1,onChange:s,caller:Tm});return h.jsx(zUe,{scope:n,disabled:i,contentId:ao(),open:c,onOpenToggle:x.useCallback(()=>d(p=>!p),[d]),children:h.jsx(Qe.div,{"data-state":w6(c),"data-disabled":i?"":void 0,...u,ref:t})})});rz.displayName=Tm;var az="CollapsibleTrigger",oz=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,a=x6(az,n);return h.jsx(Qe.button,{type:"button","aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open||!1,"data-state":w6(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...r,ref:t,onClick:Ne(e.onClick,a.onOpenToggle)})});oz.displayName=az;var b6="CollapsibleContent",iz=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=x6(b6,e.__scopeCollapsible);return h.jsx(Kr,{present:n||a.open,children:({present:i})=>h.jsx(FUe,{...r,ref:t,present:i})})});iz.displayName=b6;var FUe=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:a,...i}=e,s=x6(b6,n),[u,c]=x.useState(r),d=x.useRef(null),p=Rt(t,d),y=x.useRef(0),v=y.current,k=x.useRef(0),b=k.current,M=s.open||u,_=x.useRef(M),C=x.useRef(void 0);return x.useEffect(()=>{const E=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(E)},[]),Hn(()=>{const E=d.current;if(E){C.current=C.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const A=E.getBoundingClientRect();y.current=A.height,k.current=A.width,_.current||(E.style.transitionDuration=C.current.transitionDuration,E.style.animationName=C.current.animationName),c(r)}},[s.open,r]),h.jsx(Qe.div,{"data-state":w6(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!M,...i,ref:p,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:M&&a})});function w6(e){return e?"open":"closed"}var $Ue=rz;const M6=$Ue,S6=oz,_6=iz;function qUe({id:e,title:t,count:n,action:r,muted:a,children:i}){return h.jsxs("section",{id:e,className:"min-w-0 scroll-mt-24",children:[h.jsxs("div",{className:"mb-2.5 flex items-center justify-between gap-3 border-b pb-2",children:[h.jsxs("h2",{className:ve("text-[13px] font-semibold tracking-[-0.005em]",a&&"text-muted-foreground"),children:[t,n?h.jsx("span",{className:"ml-1.5 text-[11.5px] font-normal text-muted-foreground",children:n}):null]}),r]}),i]})}function zXe({title:e,summary:t,open:n,onOpenChange:r,children:a}){return h.jsxs(M6,{open:n,onOpenChange:r,className:"min-w-0",children:[h.jsxs(S6,{className:"group flex w-full items-center gap-2 border-b pb-2 text-left transition-colors hover:border-muted-foreground",children:[h.jsx(Br,{className:ve("size-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}),h.jsx("span",{className:"text-[13px] font-semibold tracking-[-0.005em]",children:e}),h.jsx("span",{className:"ml-auto truncate text-[11.5px] text-muted-foreground transition-colors group-hover:text-foreground",children:n?"Hide":t})]}),h.jsx(_6,{className:"pt-3",children:a})]})}class ir{constructor(t,n,r,a=null){this.kind=t,this.text=n,this.value=r,this.error=a}toJSON(){if(this.error)throw new Error(this.error);return this.value}}function Vh(e){return e instanceof ir?e.error!==null:Array.isArray(e)?e.some(Vh):e!==null&&typeof e=="object"?Object.values(e).some(Vh):!1}function id(e){return e instanceof ir?id(e.toJSON()):Array.isArray(e)?e.map(id):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,id(n)])):e}function K0(e){return e instanceof ir?{kind:e.kind,text:e.text,value:K0(e.value),error:e.error}:Array.isArray(e)?e.map(K0):e!==null&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,K0(e[t])])):e}function Gs(e){return JSON.stringify(K0(e))??""}function Hp(e,t){return{source:e,token:t,baseline:e.initial,values:e.initial,acceptedKey:void 0}}function sz(e,t){return e.source.initialKey!==t.initialKey||e.source.revisionKey!==t.revisionKey}function HUe(e,t){if(t.sessionKey!==e.source.sessionKey)return Hp(t,{});if(!sz(e,t))return e;const n=Gs(e.values);return n===Gs(e.baseline)||n===t.initialKey?Hp(t,e.token):e.acceptedKey===t.initialKey&&e.source.revisionKey===t.revisionKey?{...e,source:t,baseline:t.initial,acceptedKey:void 0}:e}function vh(e,t,n){const r=x.useMemo(()=>Gs(n),[n]),a={sessionKey:e,initial:t,initialKey:Gs(t),revision:n,revisionKey:r},[i,s]=x.useState(()=>Hp(a,{})),u=HUe(i,a);u!==i&&s(u);const c=u.token,d=x.useCallback(A=>{s(R=>R.token===c?A(R):R)},[c]),p=x.useCallback(A=>d(R=>({...R,values:typeof A=="function"?A(R.values):A})),[d]),y=()=>d(A=>Hp(a,A.token)),v=x.useCallback((A,R)=>d(O=>({...O,baseline:A,acceptedKey:Gs(R)})),[d]),k=x.useCallback((A,R)=>d(O=>({...O,...A(O),acceptedKey:Gs(R)})),[d]),b=x.useMemo(()=>Gs(u.values),[u.values]),M=x.useMemo(()=>Gs(u.baseline),[u.baseline]),_=b!==M,C=_&&sz(u,a),E=x.useMemo(()=>Vh(u.values),[u.values]);return{values:u.values,revision:u.source.revision,baseline:u.baseline,setValues:p,reset:y,accept:v,commit:k,field(A){return[u.values[A],R=>p(O=>({...O,[A]:typeof R=="function"?R(O[A]):R}))]},canSubmit:!C&&!E,hasInvalidInput:E,dirty:_,hasConflict:C}}function FXe(e,t){const[n,r]=x.useState(()=>({sessionKey:e,token:{},value:t}));let a=n;e!==n.sessionKey&&(a={sessionKey:e,token:{},value:t},r(a));const i=a.token,s=x.useCallback(u=>{r(c=>c.token!==i?c:{...c,value:typeof u=="function"?u(c.value):u})},[i]);return[a.value,s]}const UUe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:"false",VITE_GATEWAY_URL:""};function BUe(e,t=UUe,n=typeof window<"u"?window.location.origin:void 0){const r=e.startsWith("agentconn-")?e.slice(10):e;return`${v6(t,n)}/lobu/api/v1/webhooks/${encodeURIComponent(r)}`}function $Xe({title:e,summary:t,onOpen:n}){return h.jsxs("button",{type:"button",onClick:n,className:"group flex w-full items-center justify-between gap-4 rounded-lg border border-border px-4 py-3 text-left transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[h.jsxs("span",{className:"min-w-0",children:[h.jsx("span",{className:"block text-sm font-medium",children:e}),h.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:t})]}),h.jsx(Br,{"aria-hidden":"true",className:"h-4 w-4 shrink-0 text-muted-foreground"})]})}function VUe({label:e,query:t,onQueryChange:n,count:r,action:a}){return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"relative min-w-0 flex-1",children:[h.jsx(Zh,{"aria-hidden":"true",className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(yn,{type:"search","aria-label":`Search ${e}`,placeholder:`Search ${e}…`,value:t,onChange:i=>n(i.target.value),className:"pl-9"})]}),a]}),h.jsxs("p",{className:"text-xs text-muted-foreground",role:"status",children:[r," ",r===1?e.replace(/s$/,""):e,t.trim()?" found":""]})]})}function WUe({entries:e,label:t,action:n,renderControl:r,renderDetail:a}){const[i,s]=x.useState(""),u=new Set(e.filter(c=>`${c.name} ${c.description??""}`.toLowerCase().includes(i.trim().toLowerCase())).map(c=>c.id));return h.jsxs("div",{className:"space-y-4",children:[h.jsx(VUe,{label:t,query:i,onQueryChange:s,count:u.size,action:n}),h.jsx("ul",{children:e.map(c=>h.jsx(KUe,{entry:c,hidden:!u.has(c.id),control:r?.(c),renderDetail:()=>a(c)},c.id))}),u.size===0&&h.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:i?"No matches. Try another search.":`No ${t} yet.`})]})}function KUe({entry:e,hidden:t,control:n,renderDetail:r}){const[a,i]=x.useState(!1),[s,u]=x.useState(!1);return h.jsx("li",{hidden:t,className:"border-b border-border last:border-b-0",children:h.jsxs(M6,{open:a,onOpenChange:c=>{i(c),c&&u(!0)},children:[h.jsxs("div",{className:"flex items-center gap-3 py-3",children:[h.jsxs(S6,{className:"group flex min-w-0 flex-1 items-start gap-2 rounded-sm text-left hover:text-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[h.jsx(Br,{"aria-hidden":"true",className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none"}),h.jsxs("span",{className:"min-w-0",children:[h.jsx("span",{className:"block text-sm font-medium",children:e.name}),e.status&&h.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:e.status})]})]}),n&&h.jsx("div",{className:"shrink-0",children:n})]}),s&&h.jsxs(_6,{forceMount:!0,hidden:!a,className:"space-y-4 pb-4 pl-6",children:[e.description&&h.jsx("p",{className:"text-sm text-muted-foreground",children:e.description}),r()]})]})})}const C6={entity:["read","create","update","delete"],agent_config:["read","create","update","delete"],entity_schema:["create_type","update_type","delete_type","create_relationship_type","update_relationship_type","delete_relationship_type"]},GUe={entity:{read:"auto",create:"auto",update:"auto",delete:"approval"},agent_config:{read:"auto",create:"approval",update:"approval",delete:"deny"},entity_schema:{create_type:"auto",update_type:"auto",delete_type:"auto",create_relationship_type:"auto",update_relationship_type:"auto",delete_relationship_type:"auto"}};function qXe(e,t){return(e==="entity"||e==="agent_config")&&t==="read"?["auto","deny"]:["auto","approval","deny"]}const lz={auto:"Auto",approval:"Ask",deny:"Block"};function Nm(e,t){return e.effects?.[t]}function YUe(e,t){return ip[e]<ip[t]}function dx(e,t){return ip[e]>=ip[t]?e:t}function ZUe(e,t,n,r,a=null){let i=null;for(const s of e){if(s.resource_class!==t||s.field_path!==null||s.entity_id!==null||s.entity_type_slug!==null&&s.entity_type_slug!==r||s.operation_key!==null||s.target_agent_id!==null&&s.target_agent_id!==a)continue;const u=Nm(s,n);u&&(i=i===null?u:dx(i,u))}return i??GUe[t]?.[n]??"deny"}function QUe(e,t,n,r,a=null){return e.some(i=>i.resource_class!==t||i.field_path!==null||i.entity_id!==null||i.entity_type_slug!==null&&i.entity_type_slug!==r||i.operation_key!==null||i.target_agent_id!==null&&i.target_agent_id!==a?!1:Nm(i,n)!==void 0)}function HXe(e,t,n){const r=Up(e,t,null);return r?Nm(r,n)!==void 0:!1}function Up(e,t,n,r=null){return e.find(a=>a.resource_class===t&&(a.entity_type_slug??null)===n&&a.operation_key===null&&(a.target_agent_id??null)===r)}function UXe(e,t,n,r=null){const a=Up(e.agent,t,n,r),i={};if(!a?.effects)return i;for(const s of C6[t]){const u=a.effects[s];u&&(i[s]=u)}return i}function Bp(e,t,n,r,a=null){const i=ZUe(e.floor,t,n,r,a),s=QUe(e.floor,t,n,r,a),u=r!==null||a!==null?Up(e.agent,t,r,a):void 0,c=Up(e.agent,t,null);let d=null;for(const p of[c,u]){const y=p&&Nm(p,n);y&&(d=d===null?y:dx(d,y))}return d===null?i:s?dx(d,i):d}function BXe(e){const{option:t,floor:n}=e;return YUe(t,n)?{disabled:!0,reason:`Below org floor (${lz[n]})`}:{disabled:!1}}function VXe(e){const t=new Set;for(const r of e.agent)r.resource_class==="entity"&&r.entity_type_slug&&t.add(r.entity_type_slug);for(const r of e.floor)r.resource_class==="entity"&&r.entity_type_slug&&r.field_path===null&&r.entity_id===null&&t.add(r.entity_type_slug);const n=new Map(e.entity_types.map(r=>[r.slug,r]));return[...t].map(r=>n.get(r)??{slug:r,name:r})}function WXe(e,t){return e.agent.some(n=>n.resource_class==="entity"&&n.entity_type_slug===t)}function KXe(e,t){let n=0;for(const r of C6.entity){const a=Bp(e,"entity",r,null);Bp(e,"entity",r,t)!==a&&(n+=1)}return n}function GXe(e){const t=new Set;for(const r of e.agent)r.resource_class==="agent_config"&&r.target_agent_id&&t.add(r.target_agent_id);for(const r of e.floor)r.resource_class==="agent_config"&&r.target_agent_id&&t.add(r.target_agent_id);const n=new Map(e.agents.map(r=>[r.id,r]));return[...t].map(r=>n.get(r)??{id:r,name:r})}function YXe(e,t){return e.agent.some(n=>n.resource_class==="agent_config"&&n.target_agent_id===t)}function ZXe(e,t){let n=0;for(const r of C6.agent_config){const a=Bp(e,"agent_config",r,null);Bp(e,"agent_config",r,null,t)!==a&&(n+=1)}return n}function VC({effect:e}){return h.jsx("span",{className:"text-xs text-muted-foreground",children:e?lz[e]:"Policy unavailable"})}function Vp({ownerSlug:e,connectorKey:t,connectionId:n}){return e?h.jsx(nn,{to:"/$owner/settings/organization",params:{owner:e},search:{connector:t,connection:n},hash:"policies",className:"text-xs underline underline-offset-2",children:"Policies"}):null}function cz({name:e,description:t,onInspect:n,leading:r,trailing:a,badge:i}){return h.jsxs("div",{className:ve(Qh,"flex items-start gap-3 p-3"),children:[r,h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n?h.jsx("button",{type:"button",onClick:n,className:"text-sm font-medium text-left hover:underline",children:e}):h.jsx("span",{className:"text-sm font-medium",children:e}),i]}),t&&h.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:t})]}),a]})}function uz({feedsSchema:e,enabledFeeds:t,onToggleFeed:n,onInspect:r}){if(!e)return null;const a=Object.entries(e);if(a.length===0)return null;const i=!!t&&!!n;return h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Feeds"}),h.jsx("div",{className:"space-y-1.5",children:a.map(([s,u])=>h.jsx(cz,{name:u.name??s,description:u.description,onInspect:r?()=>r(s,u):void 0,leading:i?h.jsx("input",{type:"checkbox",checked:t.has(s),onChange:c=>n(s,c.target.checked),className:"rounded border-input mt-0.5","aria-label":`Enable ${u.name??s}`}):void 0},s))})]})}function dz({actionsSchema:e,onInspect:t,ownerSlug:n,connectorKey:r}){if(!e)return null;const a=Object.entries(e);return a.length===0?null:h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Actions"}),h.jsx("div",{className:"space-y-1.5",children:a.map(([i,s])=>h.jsx(cz,{name:s.name??i,description:s.description,onInspect:t?()=>t(i,s):void 0,trailing:h.jsx(Vp,{ownerSlug:n,connectorKey:r}),badge:h.jsx("span",{className:"text-xs text-muted-foreground",children:"Policy depends on connection"})},i))})]})}const E6=x.forwardRef(({className:e,...t},n)=>h.jsx(Lb,{ref:n,className:ve("peer h-4 w-4 shrink-0 rounded-sm border border-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:h.jsx(BI,{className:ve("flex items-center justify-center text-current"),children:h.jsx(ja,{className:"h-4 w-4"})})}));E6.displayName=Lb.displayName;const hz=x.forwardRef(({className:e,...t},n)=>h.jsx("textarea",{className:ve("flex min-h-[60px] w-full rounded-md border border-input bg-muted px-3 py-2 text-base placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));hz.displayName="Textarea";function ua(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof ir)}function XUe(e){return Array.isArray(e)?e.map(t=>String(t)).join(", "):""}function JUe(e,t,n,r,a){const i=e.split(",").map(u=>u.trim()).filter(Boolean);let s;if(t==="number"||t==="integer"){const u=i.map(Number);if(!u.every(d=>t==="integer"?Number.isInteger(d):Number.isFinite(d)))return{error:`Enter comma-separated ${t==="integer"?"integers":"numbers"}`};s=u}else if(t==="boolean"){if(i.some(u=>u!=="true"&&u!=="false"))return{error:"Enter comma-separated true or false values"};s=i.map(u=>u==="true")}else s=i;return n&&s.some(u=>!n.some(c=>Object.is(u,c)))?{error:"Enter only the allowed values"}:r!==void 0&&s.length<r?{error:`Enter at least ${r} ${r===1?"item":"items"}`}:a!==void 0&&s.length>a?{error:`Enter at most ${a} ${a===1?"item":"items"}`}:{values:s}}function eBe({id:e,value:t,itemType:n,itemEnum:r,minItems:a,maxItems:i,ariaLabel:s,ariaDescribedBy:u,placeholder:c,readOnly:d=!1,showHelp:p=!0,onChange:y}){const v=t instanceof ir?t.text:XUe(t),k=t instanceof ir?t.error:null;return h.jsxs(h.Fragment,{children:[h.jsx(yn,{id:e,"aria-label":s,type:"text",value:v,onChange:b=>{const M=b.target.value,_=JUe(M,n,r,a,i);y(new ir("primitive-array",M,_.values,_.error??null))},placeholder:c||"Enter comma-separated values",readOnly:d,disabled:d,"aria-invalid":k?!0:void 0,"aria-describedby":[k?`${e}-error`:p?`${e}-help`:void 0,u].filter(Boolean).join(" ")||void 0}),k?h.jsx("p",{id:`${e}-error`,role:"alert",className:"text-xs text-destructive",children:k}):p?h.jsx("p",{id:`${e}-help`,className:"text-xs text-muted-foreground",children:"Enter values separated by commas"}):null]})}function tBe(e,t){switch(t){case"array":return Array.isArray(e);case"object":return ua(e);case"integer":return typeof e=="number"&&Number.isInteger(e);case"number":return typeof e=="number"&&Number.isFinite(e);case"boolean":return typeof e=="boolean";case"string":return typeof e=="string";default:return!0}}function nBe(e){return e instanceof ir?e.kind==="primitive-array":Array.isArray(e)&&e.every(t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean")}function fz({id:e,value:t,expectedType:n,itemType:r,itemEnum:a,minItems:i,maxItems:s,ariaLabel:u,ariaDescribedBy:c,readOnly:d=!1,onChange:p}){const y=x.useMemo(()=>{if(t instanceof ir)return t.text;try{return JSON.stringify(t,null,2)??""}catch{return""}},[t]),v=t instanceof ir?t.error:null;return h.jsxs(h.Fragment,{children:[h.jsx(hz,{id:e,"aria-label":u,value:y,onChange:k=>{const b=k.target.value;try{const M=JSON.parse(b);if(!(n==="array"?Array.isArray(M):ua(M)))throw new Error(`Value must be a JSON ${n}`);if(n==="array"&&M.some(C=>!tBe(C,r)))throw new Error(`Every item must be a JSON ${String(r)}`);if(n==="array"&&a&&M.some(C=>!a.some(E=>Object.is(C,E))))throw new Error("Enter only the allowed values");if(n==="array"&&i!==void 0&&M.length<i)throw new Error(`Enter at least ${i} ${i===1?"item":"items"}`);if(n==="array"&&s!==void 0&&M.length>s)throw new Error(`Enter at most ${s} ${s===1?"item":"items"}`);p(new ir(`json-${n}`,b,M))}catch(M){p(new ir(`json-${n}`,b,void 0,M instanceof SyntaxError?`Enter a valid JSON ${n}`:M instanceof Error?M.message:`Enter a valid JSON ${n}`))}},readOnly:d,disabled:d,"aria-invalid":v?!0:void 0,"aria-describedby":[v?`${e}-error`:void 0,c].filter(Boolean).join(" ")||void 0,className:"min-h-24 font-mono text-xs"}),v?h.jsx("p",{id:`${e}-error`,role:"alert",className:"text-xs text-destructive",children:v}):null]})}function pz({id:e,value:t,ariaLabel:n="JSON object",ariaDescribedBy:r,readOnly:a=!1,onChange:i}){return h.jsx(fz,{id:e,value:t,expectedType:"object",ariaLabel:n,ariaDescribedBy:r,readOnly:a,onChange:i})}function hx({id:e,value:t,ariaLabel:n="JSON array",ariaDescribedBy:r,readOnly:a=!1,itemType:i,itemEnum:s,minItems:u,maxItems:c,onChange:d}){return h.jsx(fz,{id:e,value:t,expectedType:"array",itemType:i,itemEnum:s,minItems:u,maxItems:c,ariaLabel:n,ariaDescribedBy:r,readOnly:a,onChange:d})}function rBe({id:e,value:t,onChange:n,readOnly:r=!1,integer:a=!1,ariaLabel:i,ariaDescribedBy:s,placeholder:u}){const c=t instanceof ir?t.text:String(t??""),d=t instanceof ir?t.error:null;return h.jsxs(h.Fragment,{children:[h.jsx(yn,{id:e,type:"text",inputMode:"decimal","aria-label":i,value:c,readOnly:r,disabled:r,placeholder:u,"aria-invalid":d?!0:void 0,"aria-describedby":[d?`${e}-error`:void 0,s].filter(Boolean).join(" ")||void 0,onChange:p=>{const y=p.target.value,v=Number(y),k=/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(y.trim())&&Number.isFinite(v)&&(!a||Number.isInteger(v));n(new ir("number",y,y.trim()!==""&&k?v:void 0,y.trim()===""||k?null:`Enter a valid ${a?"integer":"number"}`))}}),d&&h.jsx("p",{id:`${e}-error`,role:"alert",className:"text-xs text-destructive",children:d})]})}function aBe(e){const t=[],n=/<a\b[^>]*href=['"]([^'"]+)['"][^>]*>(.*?)<\/a>/gi;let r=0,a=n.exec(e);for(;a!==null;){const[i,s,u]=a,c=a.index;c>r&&t.push({id:`text-${r}-${c}`,type:"text",value:e.slice(r,c)}),t.push({id:`link-${c}-${c+i.length}`,type:"link",href:s.trim(),label:u.replace(/<[^>]*>/g,"").trim()||s.trim()}),r=c+i.length,a=n.exec(e)}return r<e.length&&t.push({id:`text-${r}-${e.length}`,type:"text",value:e.slice(r)}),t.length>0?t:[{id:`text-0-${e.length}`,type:"text",value:e}]}function oBe({text:e,onOpenLink:t}){const n=aBe(e);return h.jsx("p",{className:"text-xs text-muted-foreground",children:n.map(r=>r.type==="text"?h.jsx("span",{children:r.value},r.id):t?h.jsx("button",{type:"button",className:"text-blue-600 hover:underline",onClick:()=>t(r.href),children:r.label},r.id):h.jsx("a",{href:r.href,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:r.label},r.id))})}function Wp(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function iBe(e,t){if(!e)return Wp(t);const n=e.replace(/\s*\(e\.g\.,?\s.*?\)/gis,"").trim();return n.split(/(?<![A-Za-z0-9])\.(?=\s|$)|\.(?=\s+[A-Z])/)[0].trim().replace(/\.$/,"")||n||Wp(t)}function sBe(e){if(e!=null){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const t=e.map(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean"?String(n):null).filter(n=>n!==null);if(t.length>0)return t.join(", ")}try{return JSON.stringify(e)}catch{return}}}function O0(e){const t=e.map(r=>Wp(String(r))),n=new Map;return t.forEach((r,a)=>{const i=n.get(r)??new Set;i.add(typeof e[a]),n.set(r,i)}),e.map((r,a)=>{const i=t[a],s=(n.get(i)?.size??0)>1;return{id:`option-${a}`,value:r,label:s?`${i} (${typeof r=="string"?"text":typeof r})`:i}})}function yz(e,t,n){const r=t.anyOf;if(r&&r.length>0&&r.find(u=>u.type==="null")){const u=r.filter(c=>c.type!=="null");if(u.length===1){const c=Object.fromEntries(Object.entries(t).filter(([d])=>d!=="anyOf"));return yz(e,{...u[0],...c},n)}}const a={name:e,label:t.title||iBe(t.description,e),type:"text",required:n,description:t.description,defaultValue:t.default,example:t.example,schema:t},i=sBe(t.example);if(t.type==="object"||ua(t.properties))a.type="object";else if(t.type==="string")a.type=t.format==="password"?"password":"text",a.placeholder=i||`Enter ${Wp(e).toLowerCase()}`,a.validation={minLength:t.minLength,maxLength:t.maxLength};else if(t.type==="number"||t.type==="integer")a.type="number",a.placeholder=i,a.validation={min:t.minimum,max:t.maximum};else if(t.type==="boolean")a.type="boolean";else if(t.type==="array"){const s=t.items;if(a.itemSchema=s,s?.type==="object"||s?.properties)a.type="object-array";else if(s?.enum&&Array.isArray(s.enum))a.type="multi-select",a.options=O0(s.enum);else if(s?.anyOf||s?.oneOf){const u=s.anyOf||s.oneOf,c=u.filter(d=>d.const!==void 0).map(d=>d.const);c.length>0&&c.length===u.length?(a.type="multi-select",a.options=O0(c)):s?.type==="string"||s?.type==="number"||s?.type==="integer"||s?.type==="boolean"?(a.type="array",a.placeholder=i??"Add items..."):a.type="json-array"}else s?.type==="string"||s?.type==="number"||s?.type==="integer"||s?.type==="boolean"?(a.type="array",a.placeholder=i??"Add items..."):a.type="json-array";a.validation={minItems:t.minItems,maxItems:t.maxItems}}else if(r){const s=r.filter(u=>u.const!==void 0).map(u=>u.const);s.length>0&&(a.type="select",a.options=O0(s),a.placeholder=i)}return t.enum&&Array.isArray(t.enum)&&(a.type="select",a.options=O0(t.enum),a.placeholder=i),a}function mz(e){if(!e?.properties)return[];const t=[],n=e.properties,r=e.required||[];for(const[a,i]of Object.entries(n)){const s=yz(a,i,r.includes(a));s&&t.push(s)}return t}function lBe({id:e,label:t,value:n,schema:r,readOnly:a,onOpenLink:i,onChange:s}){const u=ua(r.properties)?r.properties:null,c=ua(n)?n:{};if(!u||Object.keys(u).length===0||!ua(n)&&n!==void 0&&n!==null)return h.jsx(pz,{id:e,value:n,ariaLabel:`${t} JSON object`,readOnly:a,onChange:s});const d=new Set(Object.keys(u));return h.jsx("fieldset",{"aria-label":t,className:"rounded-md border p-3",children:h.jsx(ul,{schema:{type:"object",properties:u,required:r.required},values:c,onValuesChange:p=>{const y=Object.fromEntries(Object.entries(c).filter(([v])=>!d.has(v)));s({...y,...p})},onOpenLink:i,fieldIdPrefix:`${e}-`,readOnly:a})})}function cBe({id:e,label:t,value:n,itemSchema:r,validation:a,readOnly:i,onOpenLink:s,onChange:u}){if(!Array.isArray(n)&&n!==void 0&&n!==null)return h.jsx(hx,{id:e,value:n,ariaLabel:`${t} JSON array`,readOnly:i,itemType:"object",minItems:a?.minItems,maxItems:a?.maxItems,onChange:u});const c=Array.isArray(n)?n:[],d=ua(r?.properties)?r.properties:null,p=new Set(Object.keys(d??{})),y=a?.maxItems===void 0||c.length<a.maxItems,v=a?.minItems===void 0||c.length>a.minItems;return h.jsxs("div",{className:"space-y-3",children:[c.length===0?h.jsx("p",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:"No rows"}):c.map((k,b)=>{const M=`${e}-${b}`;return h.jsxs("fieldset",{className:"rounded-md border p-3",children:[h.jsxs("legend",{className:"px-1 text-xs font-medium text-muted-foreground",children:[t," row ",b+1]}),d&&Object.keys(d).length>0&&ua(k)?h.jsx(ul,{schema:{type:"object",properties:d,required:r?.required},values:k,onValuesChange:_=>{const C=Object.fromEntries(Object.entries(k).filter(([A])=>!p.has(A))),E=[...c];E[b]={...C,..._},u(E)},onOpenLink:s,fieldIdPrefix:`${M}-`,readOnly:i}):h.jsx(pz,{id:`${M}-json`,value:k,ariaLabel:`${t} row ${b+1} JSON object`,readOnly:i,onChange:_=>{const C=[...c];C[b]=_,u(C)}}),i?null:h.jsx("div",{className:"mt-2 flex justify-end",children:h.jsxs(ke,{type:"button",variant:"ghost",size:"sm","aria-label":`Remove ${t} row ${b+1}`,disabled:!v,onClick:()=>u(c.filter((_,C)=>C!==b)),children:[h.jsx(Zs,{className:"mr-1.5 h-4 w-4"}),"Remove"]})})]},b)}),i?null:h.jsxs(ke,{type:"button",variant:"outline",size:"sm","aria-label":`Add ${t} row`,disabled:!y,onClick:()=>u([...c,cl(r)]),children:[h.jsx(ia,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]})}function cl(e,t={},n=!1){const r={...t};for(const a of mz(e??void 0)){a.name in r||(n&&a.example!==void 0?r[a.name]=a.example:a.defaultValue!==void 0?r[a.name]=a.defaultValue:a.type==="boolean"?r[a.name]=!1:a.type==="object"&&ua(a.schema.properties)&&(r[a.name]={}));const i=r[a.name];a.type==="object"&&ua(i)?r[a.name]=ua(a.schema.properties)&&Object.keys(a.schema.properties).length>0?cl(a.schema,i,n):new ir("json-object",JSON.stringify(i,null,2),i):a.type==="object-array"&&Array.isArray(i)&&(r[a.name]=i.map(s=>ua(s)?cl(a.itemSchema,s,n):s))}return r}function Kp(e){const t={};for(const[n,r]of Object.entries(e))if(r instanceof ir){const a=id(r);a!==""&&a!==void 0&&a!==null&&(t[n]=a)}else Array.isArray(r)?t[n]=r.map(a=>a instanceof ir?id(a):ua(a)?Kp(a):a):ua(r)?t[n]=Kp(r):r!==""&&r!==void 0&&r!==null&&(t[n]=r);return t}function ul({connectorType:e,schema:t,values:n,onValuesChange:r,onOpenLink:a,fieldIdPrefix:i="",readOnly:s=!1,nativeSelects:u=!1}){const c=x.useMemo(()=>mz(t??e?.options_schema),[t,e]),d=(p,y)=>{r?.({...n,[p]:y})};return c.length===0?h.jsx("p",{className:"text-sm text-muted-foreground",children:"No configuration required."}):h.jsx("div",{className:"space-y-4",children:c.map(p=>{const y=`${i}${p.name}`;return h.jsxs("div",{className:"space-y-1.5",children:[p.type==="object"||p.type==="object-array"?h.jsxs("p",{className:"text-sm font-medium",children:[p.label,p.required&&!s&&h.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}):h.jsxs("label",{htmlFor:y,className:"text-sm font-medium",children:[p.label,p.required&&!s&&h.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.description&&h.jsx(oBe,{text:p.description,onOpenLink:a}),(p.type==="text"||p.type==="password")&&h.jsx(yn,{id:y,type:p.type,value:n[p.name]??"",onChange:v=>d(p.name,v.target.value),placeholder:p.placeholder,readOnly:s,disabled:s}),p.type==="number"&&h.jsx(rBe,{id:y,value:n[p.name],integer:p.schema.type==="integer",onChange:v=>d(p.name,v),placeholder:p.placeholder,readOnly:s}),p.type==="boolean"&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(E6,{id:y,checked:n[p.name]??!1,onCheckedChange:v=>d(p.name,v),disabled:s}),h.jsx("label",{htmlFor:y,className:"text-sm",children:"Enable"})]}),p.type==="select"&&p.options&&u&&h.jsxs("select",{id:y,className:"h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",value:p.options.find(v=>Object.is(v.value,n[p.name]))?.id??"",onChange:v=>{const k=p.options?.find(b=>b.id===v.target.value);k&&d(p.name,k.value)},required:p.required,disabled:s,children:[h.jsx("option",{value:"",disabled:!0,children:p.placeholder||`Select ${p.label.toLowerCase()}...`}),p.options.map(v=>h.jsx("option",{value:v.id,children:v.label},v.id))]}),p.type==="select"&&p.options&&!u&&h.jsxs(Ws,{value:p.options.find(v=>Object.is(v.value,n[p.name]))?.id??"",onValueChange:v=>{const k=p.options?.find(b=>b.id===v);k&&d(p.name,k.value)},disabled:s,children:[h.jsx(Fi,{id:y,"aria-required":p.required||void 0,children:h.jsx(Ks,{placeholder:p.placeholder||`Select ${p.label.toLowerCase()}...`})}),h.jsx($i,{children:p.options.map(v=>h.jsx(Hr,{value:v.id,children:v.label},v.id))})]}),p.type==="multi-select"&&p.options&&h.jsx("div",{className:"flex flex-wrap gap-2 p-2 border rounded-md",children:p.options.map(v=>{const k=Array.isArray(n[p.name])?n[p.name].some(b=>Object.is(b,v.value)):!1;return h.jsx("button",{type:"button",disabled:s,onClick:()=>{const b=n[p.name]||[];k?d(p.name,b.filter(M=>!Object.is(M,v.value))):d(p.name,[...b,v.value])},className:`px-2.5 py-1 text-xs rounded-md border transition-colors ${k?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted border-border"}`,children:v.label},v.id)})}),p.type==="array"&&(n[p.name]!==void 0&&n[p.name]!==null&&!nBe(n[p.name])?h.jsx(hx,{id:y,value:n[p.name],ariaLabel:`${p.label} JSON array`,readOnly:s,itemType:p.itemSchema?.type,itemEnum:p.itemSchema?.enum,minItems:p.validation?.minItems,maxItems:p.validation?.maxItems,onChange:v=>d(p.name,v)}):h.jsx(eBe,{id:y,value:n[p.name],itemType:p.itemSchema?.type,itemEnum:p.itemSchema?.enum,minItems:p.validation?.minItems,maxItems:p.validation?.maxItems,placeholder:p.placeholder,readOnly:s,onChange:v=>d(p.name,v)})),p.type==="json-array"&&h.jsx(hx,{id:y,value:n[p.name],ariaLabel:`${p.label} JSON array`,readOnly:s,itemType:p.itemSchema?.type,itemEnum:p.itemSchema?.enum,minItems:p.validation?.minItems,maxItems:p.validation?.maxItems,onChange:v=>d(p.name,v)}),p.type==="object"&&h.jsx(lBe,{id:y,label:p.label,value:n[p.name],schema:p.schema,readOnly:s,onOpenLink:a,onChange:v=>d(p.name,v)}),p.type==="object-array"&&h.jsx(cBe,{id:y,label:p.label,value:n[p.name],itemSchema:p.itemSchema,validation:p.validation,readOnly:s,onOpenLink:a,onChange:v=>d(p.name,v)})]},p.name)})})}function uBe({connectionId:e,ownerSlug:t,connectorKey:n,policyOperations:r,browse:a=!1,onReviewPermissions:i}){const{data:s}=a3(e),u=x.useMemo(()=>(s??[]).filter(L=>L.kind==="write"),[s]),c=x.useMemo(()=>new Map(u.map(L=>[L.operation_key,L])),[u]),d=x.useMemo(()=>r?r.map(L=>c.get(L.operation_key)??L):u,[r,u,c]),p=x.useMemo(()=>Object.fromEntries(d.map(L=>[L.operation_key,cl(L.output_schema,{},!0)])),[d]),{initialInputs:y,inputSchemas:v}=x.useMemo(()=>({initialInputs:Object.fromEntries(d.map(L=>[L.operation_key,cl(L.input_schema)])),inputSchemas:Object.fromEntries(d.map(L=>[L.operation_key,L.input_schema]))}),[d]),k=vh(e,y,v),{values:b,setValues:M}=k,[_,C]=x.useState({}),[E,A]=x.useState(null),R=ZR(),O=(L,I)=>{M(D=>({...D,[L]:I}))},N=async L=>{if(!(k.hasConflict||Vh(b[L]))){A(L),C(I=>{const D={...I};return delete D[L],D});try{const I=await R.mutateAsync({connection_id:e,operation_key:L,input:id(b[L]??{})});C(D=>({...D,[L]:I}))}catch(I){C(D=>({...D,[L]:{run_id:0,status:"failed",error_message:I instanceof Error?I.message:String(I)}}))}finally{A(null)}}};if(d.length===0)return null;const P=(L,I=!1)=>{const D=L.operation_key,H=E===D,K=_[D],W=s?.find(q=>q.operation_key===D),Y=W?.readiness==="scope_upgrade_required"||W?.readiness==="auth_required";return h.jsxs(M6,{open:I?!0:void 0,children:[I&&h.jsxs("div",{className:"mb-5 space-y-2",children:[h.jsx("h3",{className:"text-sm font-medium",children:"Provider permissions"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:Y?"Additional access is needed before this action can run.":W?.readiness&&W.readiness!=="ready"&&W.readiness!=="blocked"?`Availability: ${W.readiness.replaceAll("_"," ")}`:W?.readiness==="ready"?"Provider access is ready.":"Provider access is checked when the action runs."}),Y&&i&&h.jsx(ke,{variant:"outline",size:"sm",onClick:i,children:"Review permissions"})]}),h.jsxs("div",{className:"flex flex-wrap items-start gap-2 sm:flex-nowrap",children:[!I&&h.jsxs(S6,{className:"flex min-w-0 flex-[1_1_12rem] items-start gap-1.5 text-sm text-left group",children:[h.jsx(Br,{className:"h-3 w-3 mt-1 text-muted-foreground shrink-0 transition-transform group-data-[state=open]:rotate-90"}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block font-medium",children:L.name??D}),L.description&&h.jsx("span",{className:"line-clamp-2 text-xs text-muted-foreground group-data-[state=open]:line-clamp-none",children:L.description})]})]}),!I&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(VC,{effect:L.policy?.effect}),h.jsx(Vp,{ownerSlug:t,connectorKey:n,connectionId:e})]})]}),h.jsx(_6,{children:h.jsxs("div",{className:I?"mt-5 space-y-3":"ml-4 mt-1.5 space-y-3",children:[k.revision?.[D]&&h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Input"}),h.jsx(ul,{schema:k.revision[D],values:b[D],onValuesChange:q=>O(D,q),fieldIdPrefix:`action-${e}-${D}-`})]}),L.output_schema&&h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Output Schema"}),h.jsx(ul,{schema:L.output_schema,values:p[D],fieldIdPrefix:`action-${e}-${D}-output-`,readOnly:!0})]}),c.has(D)?h.jsx(ke,{size:"sm",variant:"outline",onClick:()=>N(D),disabled:Y||!L.policy||L.policy.effect==="deny"||k.hasConflict||Vh(b[D])||H||E!==null,children:H?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"md",className:"mr-1.5"}),"Running..."]}):h.jsxs(h.Fragment,{children:[h.jsx(hR,{className:"mr-1.5 h-3.5 w-3.5"}),"Run"]})}):null,K&&h.jsx(dBe,{result:K})]})})]},D)};return a?h.jsxs("div",{className:"space-y-3",children:[h.jsx(od,{visible:k.hasConflict,onReload:k.reset}),h.jsx(WUe,{entries:d.map(L=>({id:L.operation_key,name:L.name??L.operation_key,description:L.description,operation:L,status:s?.find(I=>I.operation_key===L.operation_key)?.readiness==="scope_upgrade_required"?"Additional provider access needed":void 0})),label:"actions",renderControl:({operation:L})=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(VC,{effect:L.policy?.effect}),h.jsx(Vp,{ownerSlug:t,connectorKey:n,connectionId:e})]}),renderDetail:({operation:L})=>P(L,!0)})]}):h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(od,{visible:k.hasConflict,onReload:k.reset}),h.jsx("div",{className:"space-y-2",children:d.map(L=>P(L))})]})}function dBe({result:e}){return e.status==="completed"?h.jsxs("div",{className:"rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm space-y-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium",children:[h.jsx(Ix,{className:"h-3.5 w-3.5"}),"Completed",h.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-auto",children:["Run #",e.run_id]})]}),e.output&&Object.keys(e.output).length>0&&h.jsx("pre",{className:"text-xs text-green-800 dark:text-green-300 font-mono whitespace-pre-wrap mt-1",children:JSON.stringify(e.output,null,2)})]}):e.status==="pending_approval"?h.jsxs("div",{className:"rounded-md bg-yellow-50 dark:bg-yellow-950/30 p-3 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-yellow-700 dark:text-yellow-400 font-medium",children:[h.jsx(eR,{className:"h-3.5 w-3.5"}),"Pending Approval",h.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-auto",children:["Run #",e.run_id]})]}),e.message&&h.jsx("p",{className:"text-xs text-yellow-800 dark:text-yellow-300 mt-1",children:e.message})]}):h.jsxs("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-red-700 dark:text-red-400 font-medium",children:[h.jsx(ty,{className:"h-3.5 w-3.5"}),"Failed",e.run_id>0&&h.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-auto",children:["Run #",e.run_id]})]}),e.error_message&&h.jsx("p",{className:"text-xs text-red-800 dark:text-red-300 font-mono mt-1",children:e.error_message})]})}function hBe(e){if(e)return e}function fBe(e){return hBe(e)?.methods??[]}function fx({requiredScopes:e,optionalScopes:t,selectedOptionalScopes:n,grantedScopes:r=[],onToggleOptionalScope:a}){const i=x.useId();return!e.length&&!t.length&&!r.length?null:h.jsxs("div",{className:"space-y-3 text-sm",children:[r.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"font-medium",children:"Already granted"}),h.jsx("p",{className:"text-muted-foreground",children:"These permissions are included when you authorize again."}),h.jsx("ul",{className:"mt-1 space-y-1",children:r.map(s=>h.jsx("li",{className:"break-all",children:s},s))})]}),e.some(s=>!r.includes(s))&&h.jsxs("div",{children:[h.jsx("p",{className:"font-medium",children:"Required permissions"}),h.jsx("ul",{className:"mt-1 space-y-1",children:e.filter(s=>!r.includes(s)).map(s=>h.jsx("li",{className:"break-all",children:s},s))})]}),t.some(s=>!r.includes(s))&&h.jsxs("fieldset",{className:"space-y-2",children:[h.jsx("legend",{className:"font-medium",children:"Additional permissions"}),t.filter(s=>!r.includes(s)).map(s=>h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(E6,{id:`${i}-${s}`,className:"mt-0.5",checked:n.includes(s),onCheckedChange:u=>a(s,u===!0)}),h.jsx("label",{htmlFor:`${i}-${s}`,className:"min-w-0 cursor-pointer break-all",children:s})]},s))]})]})}function px(e){return e.invalidateQueries({predicate:t=>t.queryKey.some(n=>["auth-profiles","connections","feeds","available-operations","connector-operations",...Oo].includes(String(n)))})}function QXe({result:e}){const t=Tn();return x.useEffect(()=>{e&&px(t)},[e,t]),e?h.jsx("p",{role:e==="failed"?"alert":"status",className:"rounded-md border p-3 text-sm",children:e==="connected"?"Account authorization updated. Review your permissions below.":e==="cancelled"?"Authorization cancelled. No permissions were added.":"Authorization did not finish. Review your account below to try again."}):null}function gz(e,t){const{data:n=[]}=r3(e.organization_id,{connectorKey:e.connector_key}),{data:r=[],isLoading:a,isError:i}=a3(e.id),{data:s=[]}=YR(e.id),u=n.find(p=>p.slug===e.auth_profile_slug),c=ch(t?.auth_schema).find(p=>p.type==="oauth"),d=r.filter(p=>p.readiness==="scope_upgrade_required").map(p=>({key:p.operation_key,name:p.name,scopes:p.next_action?.requested_scopes??[]}));if(u?.granted_scopes){const p=Object.entries(t?.feeds_schema??{});for(const y of s){const k=(p.find(([b,M])=>b===y.feed_key||M?.key===y.feed_key)?.[1]?.requiredScopes??[]).filter(b=>!u.granted_scopes?.includes(b));k.length&&d.push({key:`feed:${y.id}`,name:y.display_name??y.feed_key,scopes:k})}}return{profile:u,method:c,affected:d,missing:[...new Set(d.flatMap(p=>p.scopes))],isLoading:a,isError:i}}function XXe({connection:e,connectorDef:t,onReview:n}){const{affected:r}=gz(e,t),a=r.filter(i=>i.key.startsWith("feed:"));return!a.length||e.status!=="active"?null:h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-md border p-3",children:[h.jsxs("div",{className:"min-w-0 text-sm",children:[h.jsx("p",{className:"font-medium",children:"Some sources need additional permissions"}),h.jsxs("p",{className:"text-muted-foreground",children:[a.slice(0,3).map(i=>i.name).join(", "),a.length>3?` and ${a.length-3} more`:""]})]}),h.jsx(ke,{variant:"outline",size:"sm",onClick:n,children:"Review permissions"})]})}function vz(){const e=Tn(),t=x.useRef(void 0),[n,r]=x.useState(!1),[a,i]=x.useState(null),[s,u]=x.useState(null);return x.useEffect(()=>()=>t.current?.(),[]),{begin:async d=>{t.current?.();const p=window.open("about:blank","_blank");p&&(p.opener=null);let y=!0;t.current=()=>{y=!1},r(!0),i(null),u(null);try{const v=await d();if(!y){p?.close();return}const k=v.connect_url;if(!k){if(p?.close(),v.status==="active"){px(e);return}i(v.instructions??"Authorization could not start. Review the app configuration and try again."),u(v.setup_url??null);return}u(k);const b=()=>{px(e),(!p||p.closed)&&(t.current?.(),u(null))},M=p?window.setInterval(()=>{p.closed&&b()},500):void 0;window.addEventListener("focus",b),t.current=()=>{y=!1,window.removeEventListener("focus",b),M&&window.clearInterval(M)},p&&(p.location.href=k)}catch(v){if(p?.close(),!y)return;i(v instanceof Error?v.message:"Authorization could not start. Try again.")}finally{y&&r(!1)}},pending:n,error:a,continueUrl:s}}function WC({connection:e,connectorDef:t}){const{profile:n,method:r,affected:a,missing:i,isLoading:s,isError:u}=gz(e,t),{session:c}=wr(),d=QR(),p=Tve(),y=vz(),[v,k]=x.useState(!1),[b,M]=x.useState([]),_=!!c?.user?.id&&c.user.id===e.created_by&&(!e.auth_profile_slug||n?.created_by===c?.user?.id);if(!r)return null;const C=a.filter(O=>O.key.startsWith("feed:")).length,E=a.length-C,A=[C?`${C} configured ${C===1?"feed":"feeds"}`:null,E?`${E} ${E===1?"action":"actions"}`:null].filter(Boolean).join(" and "),R=O=>e.auth_profile_slug?d.mutateAsync({connection_id:e.id,requested_scopes:O}):p.mutateAsync({connector_key:e.connector_key,slug:e.slug,app_auth_profile_slug:e.app_auth_profile_slug??void 0,requested_scopes:O});return h.jsxs("div",{className:"space-y-3",children:[a.length>0&&h.jsxs("p",{role:"status",className:"text-sm text-muted-foreground",children:[A," ",a.length===1?"requires":"require"," ","additional permissions from ",t.name||r.provider,"."]}),s&&h.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking permissions…"}),u&&h.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not check capability permissions. Refresh and try again."}),_?h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsx(ke,{variant:"outline",size:"sm",disabled:y.pending,onClick:()=>void y.begin(()=>R()),children:e.auth_profile_slug?"Reconnect":"Connect account"}),h.jsx(ke,{variant:"outline",size:"sm",onClick:()=>{k(!v),M(i)},children:"Review permissions"})]}):h.jsx("p",{className:"text-sm text-muted-foreground",children:"Only the account owner can reconnect this account."}),v&&_&&h.jsxs("div",{className:"space-y-3",children:[a.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-sm font-medium",children:C?"Feeds and actions needing access":"Actions needing access"}),h.jsx("ul",{className:"mt-1 list-disc pl-5 text-sm text-muted-foreground",children:a.map(O=>h.jsx("li",{children:O.name},O.key))})]}),h.jsx(fx,{requiredScopes:Bh(r),optionalScopes:Om(r),selectedOptionalScopes:b,grantedScopes:n?.granted_scopes,onToggleOptionalScope:(O,N)=>M(P=>N?[...new Set([...P,O])]:P.filter(L=>L!==O))}),h.jsxs(ke,{size:"sm",disabled:y.pending,onClick:()=>void y.begin(()=>R(b)),children:["Continue to ",r.provider]})]}),y.error&&h.jsx("p",{role:"alert",className:"text-sm text-destructive",children:y.error}),y.continueUrl&&h.jsx("a",{className:"text-sm underline",href:y.continueUrl,target:"_blank",rel:"noreferrer",children:"Continue authorization in your browser"})]})}const N4="__serverless__",KC="__add_device__";function pBe(e){const{session:t}=wr();return e.auth_profile_kind!=="oauth_account"||!!(t?.user?.id&&t.user.id===e.created_by)}function JXe({connection:e,connectorDef:t,ownerSlug:n,showShare:r=!0}){const a=cr(),i=x.useId(),s=Jh(),u=XR(),[c,d]=x.useState(e.display_name??""),[p,y]=x.useState(!1),v=c!==(e.display_name??""),k=e.facets?.chat??!1,b=()=>{s.mutate({connection_id:e.id,display_name:c.trim()||void 0})},M=()=>{u.mutate(e.id,{onSuccess:()=>{a({to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:e.connector_key}})}})};return h.jsxs("div",{className:"space-y-6",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("dl",{className:"text-sm",children:[h.jsx("dt",{className:"text-muted-foreground",children:"Owner"}),h.jsx("dd",{children:e.created_by_username??"Unknown owner"})]}),r&&h.jsx(DUe,{connection:e})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(la,{htmlFor:i,children:"Display name"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(yn,{id:i,value:c,onChange:_=>d(_.target.value),placeholder:t?.name??e.connector_key,className:"max-w-md"}),h.jsx(ke,{onClick:b,disabled:!v||s.isPending,children:s.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})]})]}),!k&&h.jsx(mBe,{connection:e,connectorDef:t,ownerSlug:n}),k&&h.jsx(yBe,{connection:e,connectorDef:t}),!k&&h.jsx(kBe,{connection:e,connectorDef:t,ownerSlug:n}),h.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[h.jsx("p",{className:"text-sm font-medium",children:"Delete this connection"}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:k?"Disconnects this connection. Past messages stay in your workspace.":"Removes the connection and stops its feeds. Past events stay in your workspace."}),h.jsx("div",{className:"mt-3",children:p?h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(ke,{variant:"destructive",size:"sm",disabled:u.isPending,onClick:M,children:[u.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Confirm delete"]}),h.jsx(ke,{variant:"ghost",size:"sm",onClick:()=>y(!1),disabled:u.isPending,children:"Cancel"})]}):h.jsxs(ke,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>y(!0),children:[h.jsx(Zs,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete connection"]})})]})]})}function yBe({connection:e,connectorDef:t}){const n=Jh(),[r,a]=x.useState(null),i=BUe(e.slug),s=t?.options_schema,u=s&&typeof s=="object"&&Object.keys(s.properties??s).length>0?s:null,c=vh(e.id,{},u),{values:d,setValues:p}=c,y=c.hasInvalidInput?{}:Kp(d),v=e.effective_credential_mode==="managed",k=(t?.auth_schema?.methods??[]).find(E=>E.type==="app_installation"),b=k?.permissions??[],M=k?.events??[],_=e.connector_key==="slack"&&b.length>0?JSON.stringify({display_information:{name:e.display_name??"Lobu bot"},features:{bot_user:{display_name:e.display_name??"Lobu bot",always_online:!0},slash_commands:[{command:"/lobu",url:i,description:"Talk to Lobu"}]},oauth_config:{scopes:{bot:b}},settings:{event_subscriptions:{request_url:i,bot_events:M},interactivity:{is_enabled:!0,request_url:i},socket_mode_enabled:!1}},null,2):null,C=async(E,A)=>{await navigator.clipboard.writeText(A),a(E),window.setTimeout(()=>a(null),1500)};return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(la,{children:"Webhook URL"}),h.jsxs("div",{className:"flex max-w-2xl gap-2",children:[h.jsx(yn,{value:i,readOnly:!0,className:"font-mono text-xs"}),h.jsx(ke,{variant:"outline",size:"icon",onClick:()=>void C("webhook",i),children:r==="webhook"?h.jsx(ja,{className:"h-4 w-4"}):h.jsx(Eh,{className:"h-4 w-4"})})]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure this as the provider's events, commands, and interactivity endpoint."})]}),_?h.jsxs("div",{className:"space-y-2",children:[h.jsx(la,{children:"Slack app manifest"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Create a Slack app from this manifest, or copy it into Slack's app manifest editor to configure events, scopes, commands, and interactivity together. Then install the app and paste its bot token + signing secret back into the connection credentials."}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(ke,{asChild:!0,variant:"outline",size:"sm",children:h.jsxs("a",{href:`https://api.slack.com/apps?new_app=1&manifest_json=${encodeURIComponent(_)}`,target:"_blank",rel:"noreferrer",children:[h.jsx(Yh,{className:"mr-1.5 h-3.5 w-3.5"}),"Create app in Slack"]})}),h.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>void C("manifest",_),children:[r==="manifest"?h.jsx(ja,{className:"mr-1.5 h-3.5 w-3.5"}):h.jsx(Eh,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy manifest"]})]})]}):null,!v&&c.revision?h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx(la,{children:"Rotate credentials"}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Enter only values you want to replace. Stored secrets are never shown here."})]}),h.jsx(ul,{schema:c.revision??void 0,values:d,onValuesChange:p}),h.jsx(od,{visible:c.hasConflict,onReload:c.reset}),h.jsxs(ke,{disabled:!c.canSubmit||Object.keys(y).length===0||n.isPending,onClick:()=>n.mutate({connection_id:e.id,config:y}),children:[n.isPending?h.jsx(Dt,{size:"md",className:"mr-2"}):null,"Update credentials"]})]}):null]})}function mBe({connection:e,connectorDef:t,ownerSlug:n}){const r=cr(),a=pBe(e),i=Jh(),{data:s=[],refetch:u,isFetching:c}=ef(),d=t?.required_capability??null,p=e.device_worker_id,y=x.useMemo(()=>{const b=s.filter(M=>M.organization_id===e.organization_id&&(!d||M.capabilities.includes(d)));return p&&!b.some(M=>M.id===p)?[{id:p,worker_id:e.device_worker_handle??p,platform:e.device_platform??null,app_version:null,capabilities:[],label:e.device_label??null,last_seen_at:"",online:e.device_online??!1,organization_id:e.organization_id,organization_name:null,organization_slug:null,connector_count:0,connector_error_count:0,last_sync_at:null,connectors:[],update_required:[]},...b]:b},[s,d,e,p]),v=b=>{if(b===KC){r({to:"/$owner/connectors/create",params:{owner:n}});return}const M=b===N4?null:b;M!==(p??null)&&i.mutate({connection_id:e.id,device_worker_id:M})},k=p??(d?"":N4);return h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(la,{children:["Run on",d?h.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),i.isPending?h.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[h.jsx(Dt,{size:"sm"}),"Saving…"]}):null]}),h.jsxs("div",{className:"flex items-center gap-2 max-w-md",children:[h.jsxs(Ws,{value:k,onValueChange:v,disabled:!a||i.isPending,children:[h.jsx(Fi,{className:"h-8 flex-1",children:h.jsx(Ks,{placeholder:"Select a device"})}),h.jsxs($i,{children:[!d&&h.jsx(Hr,{value:N4,children:"Serverless (default)"}),y.map(b=>h.jsx(ML,{device:b},b.id)),h.jsx(Hr,{value:KC,children:h.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[h.jsx(ia,{className:"h-3.5 w-3.5"}),"Add device"]})})]})]}),h.jsxs("button",{type:"button",onClick:()=>void u(),disabled:c,className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground hover:text-foreground disabled:opacity-50",children:[h.jsx(Bx,{className:`h-3 w-3 ${c?"animate-spin":""}`}),"Refresh"]})]}),d&&y.length===0?h.jsxs("p",{className:"text-xs text-muted-foreground",children:["No device has granted the “",pL[d]??d,"” permission. Open the Lobu app on a device and grant it, then"," ",h.jsx("button",{type:"button",onClick:()=>void u(),className:"underline hover:text-foreground",children:"refresh"}),"."]}):p&&e.device_online===!1?h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Device offline — sync runs wait for it to check in",e.device_last_seen_at?` (last seen ${mf(e.device_last_seen_at)})`:"","."]}):null]})}const gBe={env:"Environment variable",oauth_app:"OAuth app (workspace-wide)",oauth_account:"OAuth account",browser_session:"Browser session (local)",interactive:"Interactive credential"},vBe={env:"A secret pulled from the worker process env. Update by changing the env var on whichever device runs this connector.",oauth_app:"Shared client configuration managed by workspace administrators. Account owners grant consent separately.",oauth_account:"The account owner can reconnect to renew access or grant additional permissions.",browser_session:"Reuses your local browser cookies on a device. Sign in again using the browser pairing flow on that device.",interactive:"A credential the agent fills in at run-time (e.g. a one-time code). Nothing stored long-term."};function kz({heading:e,name:t,kind:n,status:r,isDefault:a,headerRight:i,footer:s}){const u=n?gBe[n]:null,c=n?vBe[n]:null;return h.jsxs("div",{className:ve(Qh,"space-y-1.5 p-4"),children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:e}),i]}),h.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[h.jsx("span",{className:"text-sm font-medium",children:t}),u?h.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",u]}):null,r?h.jsxs("span",{className:r==="active"?"text-xs text-green-500":"text-xs text-amber-500",children:["· ",r]}):null,a?h.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Org default"}):null]}),c?h.jsx("p",{className:"text-xs text-muted-foreground",children:c}):null,s]})}function kBe({connection:e,connectorDef:t,ownerSlug:n}){const r=AUe(t?.auth_schema),a=fBe(t?.auth_schema).some(p=>p.type==="oauth"),i=r?r.provider.charAt(0).toUpperCase()+r.provider.slice(1):null,s=e.config?.managedBy;if(s&&typeof s=="object"&&"org"in s&&typeof s.org=="string")return h.jsxs("div",{className:"space-y-2",children:[h.jsx(la,{children:"Auth"}),h.jsxs("p",{className:"text-sm text-muted-foreground",children:["Managed authorization from ",s.org,". This runtime uses its cloud login to access your grant."]})]});const u=nz(e,t?.auth_schema);if(u)return h.jsxs("div",{id:"connection-auth",className:"space-y-2 scroll-mt-6",children:[h.jsx(la,{children:"Auth"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:W0(u)})]});if(!e.auth_profile_name)return h.jsxs("div",{id:"connection-auth",className:"space-y-2 scroll-mt-6",children:[h.jsx(sx,{organizationId:e.organization_id,connectorKey:e.connector_key}),h.jsx(la,{children:"Auth"}),r?h.jsxs("div",{className:"space-y-2",children:[h.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",i," App installation linked yet."]}),h.jsx(ox,{organizationId:e.organization_id,connectorKey:e.connector_key,provider:r.provider,providerLabel:t?.name,installShape:r.installShape,recovery:!0,variant:"outline"})]}):h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:a?"No account is connected yet.":"No auth profile attached."}),a&&t&&h.jsx(WC,{connection:e,connectorDef:t})]})]});const c=e.auth_profile_kind==="oauth_account"&&!!e.app_auth_profile_name,d=c?"Account":"Profile";return h.jsxs("div",{id:"connection-auth",className:"space-y-2 scroll-mt-6",children:[h.jsx(la,{children:"Auth"}),h.jsxs("div",{className:"space-y-2",children:[c&&e.app_auth_profile_name?h.jsx(xBe,{connection:e,ownerSlug:n}):null,h.jsx(kz,{heading:d,name:e.auth_profile_name,kind:e.auth_profile_kind,status:e.auth_profile_status,footer:e.auth_profile_kind==="oauth_account"&&t?h.jsx(WC,{connection:e,connectorDef:t}):void 0}),t?.key?h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connector slug:"," ",h.jsx("code",{className:"font-mono",children:t.key})]}):null,r?h.jsxs("div",{className:"space-y-1.5 pt-1",children:[h.jsx(sx,{organizationId:e.organization_id,connectorKey:e.connector_key}),h.jsx(ox,{organizationId:e.organization_id,connectorKey:e.connector_key,provider:r.provider,providerLabel:t?.name,installShape:r.installShape,recovery:!0,variant:"outline"})]}):null]})]})}function xBe({connection:e,ownerSlug:t}){const{isAdmin:n}=Fy(e.organization_id),{data:r=[]}=r3(e.organization_id,{connectorKey:e.connector_key,profileKind:"oauth_app"}),a=e.app_auth_profile_slug??void 0,i=r.find(u=>u.slug===a)??null,s=!!i?.is_default_for_connector&&i.connector_key===e.connector_key;return h.jsx(kz,{heading:"Workspace app",name:e.app_auth_profile_name??"—",kind:e.app_auth_profile_kind??"oauth_app",status:e.app_auth_profile_status,isDefault:s,headerRight:n?h.jsx(nn,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:e.connector_key},search:{setup:"oauth_app"},hash:"connector-oauth-apps",className:"text-xs text-muted-foreground hover:text-foreground",children:"Manage app"}):null,footer:n?h.jsx("p",{className:"text-xs text-muted-foreground",children:"This account stays linked to the app used to authorize it. To use another app, connect a new account."}):void 0})}function bBe({connection:e,ownerSlug:t,inPeek:n=!1,onReviewPermissions:r}){const{data:a=[],isLoading:i,isError:s}=a3(e.id);if(i)return h.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading actions…"});if(s)return h.jsx("p",{role:"alert",className:"text-sm",children:"Could not load actions. Close the pane and try again."});if(a.length===0)return h.jsx("p",{className:"text-sm text-muted-foreground",children:"No actions available."});const u=h.jsxs("div",{className:"space-y-3",children:[h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Approval is managed in organization settings."," ",h.jsx(Vp,{ownerSlug:t,connectorKey:e.connector_key,connectionId:e.id})]}),h.jsx(uBe,{connectionId:e.id,connectorKey:e.connector_key,ownerSlug:t,browse:n,onReviewPermissions:r,policyOperations:a})]});return n?u:h.jsx(qUe,{title:"Actions",count:`${a.length} ${a.length===1?"action":"actions"}`,children:u})}const wBe="verify_browser";function MBe(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid browser requirement");const t=e;if(!Array.isArray(t.origins)||t.origins.length===0)throw new Error("Browser origins must not be empty");for(const n of t.origins){const r=new URL(n);if(r.protocol!=="https:"||r.origin!==n||r.username||r.password||r.hostname.includes("*"))throw new Error("Browser origins must be exact HTTPS origins")}if(t.authMethods&&(!Array.isArray(t.authMethods)||!t.authMethods.length||t.authMethods.some(n=>!["none","browser","oauth","env_keys","app_installation","interactive"].includes(n))))throw new Error("Invalid browser authMethods");if(t.accountProbe&&(!t.origins.includes(new URL(t.accountProbe.url).origin)||typeof t.accountProbe.expression!="string"||!t.accountProbe.expression.trim()))throw new Error("Browser account probe must target a declared origin and provide an expression")}function SBe(e,t){return e==null?null:(MBe(e),!e.authMethods||e.authMethods.includes(t)?e:null)}function _Be({isInstalling:e,installConnectorFromSourceUri:t,reloadConnectorCatalog:n,resetConnectorConfiguration:r,selectConnector:a,clearSaveError:i,setInstallError:s}){const[u,c]=x.useState(null),[d,p]=x.useState(null),y=x.useCallback(async b=>{if(!e){if(s(null),i(),b.installed===!1&&b.installable){p(b);return}a(b),r()}},[i,e,r,a,s]),v=x.useCallback(async()=>{if(!d||e)return null;if(!d.source_uri)return s(`Connector '${d.name}' is missing a source URI.`),null;c(d.key);try{await t(d.source_uri);const M=(await n()).find(_=>_.key===d.key&&_.installed!==!1)??null;if(!M)throw new Error(`Installed connector '${d.name}' could not be reloaded.`);return p(null),M}catch(b){return s(b instanceof Error?b.message:"Failed to install connector"),null}finally{c(null)}},[t,e,d,n,s]),k=x.useCallback(()=>{p(null),s(null)},[s]);return{installingConnectorKey:u,setInstallingConnectorKey:c,previewConnector:d,handleConnectorSelect:y,handleInstallPreviewedConnector:v,clearPreview:k}}const GC="No paired Chrome browser is available. Open the Lobu Chrome extension, connect it to this workspace, and enable browser access.";function CBe({open:e,onOpenChange:t,onCreated:n,organizationId:r,editingConnection:a,connections:i=[],initialConnectorKey:s,onDeepLinkBack:u}){const c=Cve(),d=vz(),{session:p}=wr(),y=Jh(),v=Ave(),k=Ove(),b=Rve(),{data:M=[],isLoading:_,refetch:C}=n3(r),E=!!a,A=XR(),R=Pve(),[O,N]=x.useState(!1),[P,L]=x.useState(null),[I,D]=x.useState(!1),[H,K]=x.useState(""),[W,Y]=x.useState(null),[q,$]=x.useState(""),[B,J]=x.useState(null),[te,z]=x.useState(""),[U,V]=x.useState(null),j=ZR(),Z=vh(`${a?.id??"new"}:${B?.key??""}:${e}`,cl(B?.options_schema,a?a.config??{}:B?.default_connection_config??{}),B?.options_schema),{values:ee,setValues:le}=Z,[se,pe]=x.useState(0),[fe,_e]=x.useState(void 0),[me,Re]=x.useState(void 0),[Nt,we]=x.useState(!1),[Fe,lt]=x.useState(""),[gt,Tt]=x.useState(""),[Ge,dt]=x.useState(!1),[jn,ct]=x.useState(""),[Jt,ut]=x.useState(""),[Xe,oe]=x.useState(!1),[ge,ze]=x.useState(""),[Ye,Je]=x.useState(""),[hn,on]=x.useState([]),[Ht,jt]=x.useState(!1),[cn,vt]=x.useState(""),[dr,Cn]=x.useState(""),[qe,at]=x.useState(void 0),[Ie,Ze]=x.useState(a?.device_worker_id??void 0),[sn,Me]=x.useState(!1),[Gt,Ct]=x.useState(null),[In,hr]=x.useState(null),[$t,fr]=x.useState(null),{isAdmin:va}=Fy(r),Cr=x.useMemo(()=>ch(B?.auth_schema).find(tt=>tt.type==="oauth")?.provider??void 0,[B?.auth_schema]),{data:en=[]}=r3(r,{connectorKey:B?.key,provider:Cr});x.useEffect(()=>{if(!a||!e||B||_)return;const Ae=M.find(pr=>pr.key===a.connector_key)??{key:a.connector_key,name:a.connector_name||a.connector_key,description:null,version:"",auth_schema:null,feeds_schema:null,actions_schema:null,options_schema:null,status:"active",login_enabled:!1};J(Ae),z(a.display_name??""),_e(a.auth_profile_slug??void 0),Re(a.app_auth_profile_slug??void 0),Ze(a.device_worker_id??void 0);const Lt=ch(Ae.auth_schema).findIndex(pr=>a.auth_profile_kind==="browser_session"?pr.type==="browser":a.auth_profile_kind==="oauth_account"||a.app_auth_profile_slug?pr.type==="oauth":a.auth_profile_kind==="env"?pr.type==="env_keys":nz(a,Ae.auth_schema)?pr.type==="none":!1);pe(Lt>=0?Lt:0)},[a,e,M,B,_]);const di=x.useMemo(()=>ch(B?.auth_schema),[B]),Ee=di[se]??null,ls=x.useMemo(()=>en.filter(xe=>xe.profile_kind==="env"),[en]),hi=x.useMemo(()=>{if(!Ee||Ee.type!=="oauth")return[];const xe=Ee.provider.toLowerCase();return en.filter(Ae=>Ae.profile_kind==="oauth_account"&&Ae.provider?.toLowerCase()===xe&&(va||Ae.created_by===p?.user?.id))},[Ee,en,va,p?.user?.id]),zr=x.useMemo(()=>{if(!Ee||Ee.type!=="oauth")return[];const xe=Ee.provider.toLowerCase();return en.filter(Ae=>Ae.profile_kind==="oauth_app"&&Ae.status==="active"&&Ae.provider?.toLowerCase()===xe)},[Ee,en]),bn=x.useMemo(()=>en.filter(xe=>xe.profile_kind==="browser_session"),[en]),nr=x.useMemo(()=>{if(!(!Ee||Ee.type!=="env_keys"))return TUe(Ee)},[Ee]),Lo=x.useMemo(()=>jUe(Ee),[Ee]),cs=vh(`${B?.key}:${se}:${Nt}`,cl(nr),nr),Xc=vh(`${B?.key}:${se}:${Ge}`,cl(Lo),Lo),{values:Wd,setValues:Lf}=cs,{values:fi,setValues:Kd}=Xc,ho=x.useMemo(()=>Ee?.type==="oauth"?Om(Ee):[],[Ee]);x.useEffect(()=>{if(!(E||!B||!Ee))if(Ee.type==="oauth"){if(!me&&zr.length>0){const Ae=zr.find(tt=>tt.is_default_for_connector&&tt.connector_key===B.key)??(va&&zr.length===1?zr[0]:void 0);Ae&&Re(Ae.slug)}!fe&&hi.length>0&&_e(hi[0].slug)}else Ee.type==="env_keys"?!fe&&ls.length>0&&_e(ls[0].slug):Ee.type==="browser"&&Ee.mode!=="live"&&!fe&&bn.length>0&&_e(bn[0].slug)},[va,E,B,Ee,me,fe,zr,hi,ls,bn]),x.useEffect(()=>{if(Ee?.type!=="oauth"||ho.length===0){on(tt=>tt.length===0?tt:[]);return}const Ae=(hi.find(tt=>tt.slug===fe)?.requested_scopes??[]).filter(tt=>ho.includes(tt));on(tt=>tt.length===Ae.length&&tt.every((Lt,pr)=>Lt===Ae[pr])?tt:Ae)},[Ee,ho,hi,fe]);const pi=x.useCallback(()=>{we(!1),lt(""),Tt(""),dt(!1),ct(""),ut(""),oe(!1),ze(""),Je(""),on([]),jt(!1),vt(""),Cn("")},[]),yi=x.useCallback(()=>{pe(0),_e(void 0),Re(void 0),pi()},[pi]),{data:zo=[],refetch:Pn,isFetching:zf}=ef(),mi=!!SBe(B?.browser,Ee?.type??"none"),Fr=Ee?.type==="browser"&&Ee.mode==="live",$r=mi?"browser.debugger":B?.required_capability??null,us=x.useMemo(()=>{const xe=zo.filter(tt=>tt.organization_id===r&&(!mi||tt.platform==="chrome-extension")&&(!$r||tt.capabilities.includes($r))),Ae=a?.device_worker_id;return Ae&&!xe.some(tt=>tt.id===Ae)?[{id:Ae,worker_id:a?.device_worker_handle??Ae,platform:a?.device_platform??null,app_version:null,capabilities:[],label:a?.device_label??null,last_seen_at:"",online:a?.device_online??!1,organization_id:r,organization_name:null,organization_slug:null,connector_count:0,connector_error_count:0,last_sync_at:null,connectors:[],update_required:[]},...xe]:xe},[zo,$r,mi,a,r]);x.useEffect(()=>{E||Ze(void 0)},[B?.key,E]),x.useEffect(()=>{if(Ie&&!us.some(xe=>xe.id===Ie)&&Ie!==a?.device_worker_id){Ze(void 0);return}E||!$r||Ie||us.length===1&&Ze(us[0].id)},[E,$r,Ie,us,a]);const ds=x.useMemo(()=>fe?en.find(xe=>xe.slug===fe&&xe.profile_kind==="browser_session"):void 0,[en,fe])?.device_worker_id??null;x.useEffect(()=>{ds&&Ie!==ds&&Ze(ds)},[ds,Ie]);const Fm=x.useCallback(async()=>(await C()).data??[],[C]),{installingConnectorKey:Jc,setInstallingConnectorKey:eu,previewConnector:Ha,handleConnectorSelect:Er,handleInstallPreviewedConnector:Ff,clearPreview:Gd}=_Be({isInstalling:R.isPending,installConnectorFromSourceUri:async xe=>{await R.mutateAsync({source_uri:xe})},reloadConnectorCatalog:Fm,resetConnectorConfiguration:yi,selectConnector:J,clearSaveError:()=>Ct(null),setInstallError:Y}),gi=xe=>{xe||(J(null),V(null),z(""),yi(),at(void 0),Ct(null),N(!1),L(null),D(!1),K(""),Y(null),eu(null),$(""),hr(null),fr(null),Gd()),t(xe)},$f=(xe=!1)=>{hr(null),!E&&(xe&&$t&&B&&n?n($t,B.key):gi(!1))},tu=()=>{if(B&&s&&u){u();return}B?(J(null),V(null),yi(),at(void 0),Ct(null),Y(null)):Ha&&Gd()},qf=x.useRef(!1);x.useEffect(()=>{if(qf.current||E||!s||B)return;const xe=M.find(Ae=>Ae.key===s);xe&&(qf.current=!0,Er(xe))},[e,E,s,M,B,Er]);const Yr=x.useMemo(()=>{if(!B||!Z.revision||Ee&&Ee.type!=="none")return!1;const xe=Z.revision.properties;if(!xe)return!1;const Ae=new Set,tt=B.feeds_schema;if(tt){for(const Lt of Object.values(tt))if(Lt.configSchema?.properties)for(const pr of Object.keys(Lt.configSchema.properties))Ae.add(pr)}return Object.keys(xe).some(Lt=>!Ae.has(Lt))},[B,Ee,Z.revision]),Ll=x.useMemo(()=>{const xe=ch(B?.auth_schema),Ae=B?.auth_schema?.methods??[];return xe.length===0&&Ae.length>0&&Ae.every(tt=>tt.type==="none")},[B]),Hf=x.useMemo(()=>!Ll||!B||!qe?null:i.find(xe=>xe.connector_key===B.key&&xe.created_by===qe)??null,[Ll,B,qe,i]),vi=x.useCallback(xe=>Object.fromEntries(Object.entries(xe).filter(([,Ae])=>typeof Ae=="string"&&Ae.trim().length>0).map(([Ae,tt])=>[Ae,String(tt).trim()])),[]),hs=xe=>{d.begin(async()=>({connect_url:xe}))},ki=x.useCallback(async xe=>{if(!(!B||!Ee))try{const Ae=await v.mutateAsync({connector_key:B.key,profile_kind:xe.profileKind,display_name:xe.displayName,slug:xe.slug||void 0,...xe.credentials?{credentials:xe.credentials}:{},...xe.authData?{auth_data:xe.authData}:{},...xe.requestedScopes?{requested_scopes:xe.requestedScopes}:{}});await xe.onSuccess(Ae)}catch(Ae){Ct(Ae instanceof Error?Ae.message:"Failed to create auth profile")}},[Ee,v,B]),Uf=x.useCallback(async()=>{if(!cs.canSubmit||!Ee||Ee.type!=="env_keys")return;const xe=vi(Wd);await ki({profileKind:"env",displayName:Fe.trim()||`${B?.name} Auth`,slug:gt.trim(),credentials:xe,onSuccess:Ae=>{_e(Ae.auth_profile.slug),we(!1),lt(""),Tt("")}})},[Ee,ki,Fe,gt,Wd,cs.canSubmit,vi,B?.name]),fs=x.useCallback(async()=>{if(!Xc.canSubmit||!Ee||Ee.type!=="oauth")return;const xe=vi(fi);await ki({profileKind:"oauth_app",displayName:jn.trim()||`${B?.name} ${Ee.provider} App`,slug:Jt.trim(),credentials:xe,onSuccess:Ae=>{Re(Ae.auth_profile.slug),dt(!1),ct(""),ut("")}})},[Ee,ki,jn,Jt,fi,Xc.canSubmit,vi,B?.name]),$m=async()=>{if(!(!B||Ee?.type!=="oauth")){if(!me){Ct("Choose an OAuth app before connecting your account.");return}Ct(null),await d.begin(async()=>{const xe=await v.mutateAsync({connector_key:B.key,profile_kind:"oauth_account",display_name:ge.trim()||`${B.name} ${Ee.provider} Account`,slug:Ye.trim()||void 0,app_auth_profile_slug:me,requested_scopes:BC(Ee,hn)}),Ae=xe.auth_profile?.slug??xe.pending_slug;return Ae&&_e(Ae),oe(!1),ze(""),Je(""),{...xe,status:xe.auth_profile?.status}})}},Bf=x.useCallback(async()=>{!Ee||Ee.type!=="browser"||await ki({profileKind:"browser_session",displayName:cn.trim()||`${B?.name||"Connector"} Browser Session`,slug:dr.trim(),onSuccess:xe=>{xe.auth_profile?.slug&&_e(xe.auth_profile.slug),jt(!1),vt(""),Cn("")}})},[Ee,ki,cn,dr,B?.name]),Yd=async xe=>{const Ae=await j.mutateAsync({connection_id:xe,operation_key:wBe,input:{}});if(Ae.status!=="completed")throw new Error(Ae.error_message??Ae.message??"Finish sign-in or approve the account check in Lobu, then try again.");gn.success(Fr?`${B?.name} connected`:"Browser verified",{duration:1/0,closeButton:!0})},Zd=async()=>{if(B){if(!Z.canSubmit){Ct("Reload the latest connection values before saving.");return}Me(!0),Ct(null);try{if(U){await Yd(U),n?n(U,B.key):gi(!1);return}const xe=Kp(ee);let Ae,tt;if(Ee?.type==="env_keys"&&(Ae=fe?.trim()||void 0,!Ae))throw new Error("Select or create an auth profile before creating the connection.");if(Ee?.type==="oauth"){if(Ae=fe?.trim()||void 0,tt=me?.trim()||void 0,!tt)throw new Error(`Select or create an ${Ee.provider} app profile first.`);if(!Ae)throw new Error(`Select or create an ${Ee.provider} account profile first.`)}if(Ee?.type==="browser"&&!Fr&&(Ae=fe?.trim()||void 0,!Ae))throw new Error("Select or create a browser auth profile before creating the connection.");if($r&&!Ie)throw new Error(us.length===0?mi?`${GC} Then refresh.`:`No device with the "${$r}" permission. Open the Lobu app on a device and grant it, then refresh.`:"Choose a device to run this connector on.");if(E){const Lt=a.device_worker_id??void 0;await y.mutateAsync({connection_id:a.id,display_name:te||void 0,auth_profile_slug:Ee?.type==="oauth"||Ee?.type==="env_keys"||Ee?.type==="browser"?Ae??void 0:Ee?.type==="none"?null:void 0,app_auth_profile_slug:Ee?.type==="oauth"?tt??void 0:Ee?.type==="none"?null:void 0,config:Object.keys(xe).length>0?xe:void 0,device_worker_id:Ie===Lt&&!(Fr&&!a.auth_profile_slug)?void 0:Ie??null}),Fr&&await Yd(a.id),gi(!1)}else{const Lt=await c.mutateAsync({connector_key:B.key,display_name:te||void 0,auth_profile_slug:Ee?.type==="none"?null:Ae,app_auth_profile_slug:Ee?.type==="none"?null:tt,config:Object.keys(xe).length>0?xe:void 0,created_by:Fr?void 0:qe,device_worker_id:Ie??null});Lt.auth_run_id?(hr(Lt.auth_run_id),fr(Lt.connection_id??Lt.connection.id)):Lt.status==="setup_required"&&Lt.setup_family==="browser"?(V(Lt.connection_id??null),Ct(Lt.instructions??"Finish browser setup, then verify the connection.")):(mi&&Lt.connection.status==="active"&&gn.success(Fr?`${B.name} connected`:"Browser verified",{duration:1/0,closeButton:!0}),n?n(Lt.connection.id,B.key):gi(!1))}}catch(xe){Ct(xe instanceof Error?xe.message:E?"Failed to update connection":"Failed to create connection")}finally{Me(!1)}}},qm=xe=>{E||Ze(void 0),pe(xe),_e(void 0),Re(void 0),we(!1),dt(!1),oe(!1),jt(!1),on([])},Hm=async(xe,Ae)=>{try{await k.mutateAsync(xe),L(null),Ae==="app"?Re(""):_e("")}catch(tt){Ct(tt instanceof Error?tt.message:`Failed to delete ${Ae==="app"?"app":"auth"} profile`)}},nu=async xe=>{Ct(null);const Ae=en.find(Lt=>Lt.slug===xe),tt=Ae?.status==="pending_auth"&&!Ae.granted_scopes?.length;await d.begin(()=>b.mutateAsync({auth_profile_slug:xe,app_auth_profile_slug:tt?me:void 0,requested_scopes:BC(Ee?.type==="oauth"?Ee:null,hn)}))};return{pendingBrowserConnectionId:U,configDraft:Z,runtimeDraft:cs,appDraft:Xc,createAuthProfile:v,deleteAuthProfileMutation:k,reconnectAuthProfile:b,deleteConnection:A,installConnectorMutation:R,connectorDefs:M,isLoadingDefs:_,isEditMode:E,showDeleteConfirm:O,setShowDeleteConfirm:N,confirmingDeleteProfileSlug:P,setConfirmingDeleteProfileSlug:L,showInstallForm:I,setShowInstallForm:D,installSourceUrl:H,setInstallSourceUrl:K,installError:W,setInstallError:Y,installingConnectorKey:Jc,searchQuery:q,setSearchQuery:$,previewConnector:Ha,handleInstallPreviewedConnector:Ff,clearPreview:Gd,selectedConnector:B,displayName:te,setDisplayName:z,configValues:ee,selectedAuthMethodIndex:se,selectedAuthProfileSlug:fe,setSelectedAuthProfileSlug:_e,selectedAppAuthProfileSlug:me,setSelectedAppAuthProfileSlug:Re,showNewRuntimeProfileForm:Nt,setShowNewRuntimeProfileForm:we,newRuntimeProfileName:Fe,setNewRuntimeProfileName:lt,newRuntimeProfileSlug:gt,setNewRuntimeProfileSlug:Tt,newRuntimeProfileValues:Wd,setNewRuntimeProfileValues:Lf,showNewAppProfileForm:Ge,setShowNewAppProfileForm:dt,newAppProfileName:jn,setNewAppProfileName:ct,newAppProfileSlug:Jt,setNewAppProfileSlug:ut,newAppProfileValues:fi,setNewAppProfileValues:Kd,showNewOAuthAccountForm:Xe,setShowNewOAuthAccountForm:oe,newOAuthAccountName:ge,setNewOAuthAccountName:ze,newOAuthAccountSlug:Ye,setNewOAuthAccountSlug:Je,showNewBrowserProfileForm:Ht,setShowNewBrowserProfileForm:jt,newBrowserProfileName:cn,setNewBrowserProfileName:vt,newBrowserProfileSlug:dr,setNewBrowserProfileSlug:Cn,isSaving:sn,saveError:Gt??d.error,authorizationUrl:d.continueUrl,setSaveError:Ct,handleAuthClose:$f,pendingAuthRunId:In,setPendingAuthRunId:hr,authProfiles:en,selectableMethods:di,activeMethod:Ee,runtimeEnvProfiles:ls,runtimeOAuthProfiles:hi,appOAuthProfiles:zr,browserProfiles:bn,runtimeProfileSchema:nr,appProfileSchema:Lo,availableOAuthOptionalScopes:ho,selectedOAuthOptionalScopes:hn,setSelectedOAuthOptionalScopes:on,hasUniqueOptionsFields:Yr,connections:i,isNoAuthConnector:Ll,existingNoAuthConnection:Hf,selectedMemberUserId:qe,setSelectedMemberUserId:at,isAdmin:va,devices:zo,deviceOptions:us,lockedDeviceWorkerIdFromProfile:ds,browserRequired:mi,browserSetupHint:GC,liveBrowser:Fr,requiredCapability:$r,selectedDeviceWorkerId:Ie,setSelectedDeviceWorkerId:Ze,refreshDevices:Pn,devicesRefreshing:zf,handleOpenChange:gi,handleConnectorSelect:Er,handleBack:tu,handleValuesChange:le,normalizeStringValues:vi,navigateOAuthPopup:hs,handleCreateRuntimeProfile:Uf,handleCreateAppProfile:fs,handleCreateOAuthAccountProfile:$m,handleCreateBrowserProfile:Bf,handleSave:Zd,handleMethodChange:qm,handleDeleteAuthProfile:Hm,handleReconnect:nu}}const EBe=["all","data","chat","actions","inference","runtime","device"],YC={data:!1,chat:!1,actions:!1,audience:!1,inference:!0,runtime:!1},ZC="__create_oauth_app_profile__",QC="__create_oauth_account_profile__",XC="__create_browser_profile__",j4="__serverless__",JC="__add_device__",xz=IUe(),I4=`${xz}/connect/oauth/callback`;function ABe({method:e}){const[t,n]=x.useState(!1),r=e.setupInstructions||e.description,a=r?r.replace(/\{\{redirect_uri\}\}/g,I4):null;return h.jsxs("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[a&&h.jsx("p",{className:"text-xs text-muted-foreground",children:a}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Redirect URI"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("code",{className:"flex-1 rounded bg-muted px-2 py-1 text-xs font-mono break-all",children:I4}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-7 shrink-0 p-0",onClick:()=>{navigator.clipboard.writeText(I4),n(!0),setTimeout(()=>n(!1),2e3)},children:t?h.jsx(ja,{className:"h-3.5 w-3.5"}):h.jsx(Eh,{className:"h-3.5 w-3.5"})})]})]})]})}function RBe({connector:e,ownerSlug:t,existingConnectionCount:n=0,onInstall:r,onBack:a,isInstalling:i,installError:s}){const u=GN(e.auth_schema),c=KN(e.runtime?.platforms),d=e.runtime?.scopes??[],{data:p=[]}=ef(),y=e.required_capability??null,v=y?p.find(C=>(!t||qL(C,t))&&C.online&&C.capabilities.includes(y)):void 0,{inspectFeed:k,inspectAction:b}=FL(),M=e.feeds_schema??{},_=e.actions_schema??{};return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(ke,{variant:"ghost",size:"sm",onClick:a,className:"h-7 px-2 text-xs",children:"← Back"}),h.jsx(Zu,{connector:e,showDescription:!1,className:"gap-2"}),e.version&&h.jsxs(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px] font-mono",children:["v",e.version]}),e.catalog_origin==="org"&&h.jsx(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:"Org-installed"})]}),(c||e.required_capability||u.length>0||n>0)&&h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n>0&&h.jsxs(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:[n," existing connection",n===1?"":"s"]}),c&&h.jsxs(Qn,{variant:"secondary",className:"h-4 gap-1 px-1.5 py-0 text-[10px]",children:[h.jsx(Lx,{className:"h-2.5 w-2.5"}),"Requires ",c]}),e.required_capability&&h.jsxs(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:["Needs ",e.required_capability]}),u.map(C=>h.jsx(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:C},C))]}),e.description&&h.jsx("div",{className:ve(Qh,"p-3"),children:h.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})}),(e.source_uri||d.length>0)&&h.jsxs("div",{className:"space-y-1 rounded-lg border bg-muted/30 p-3 text-xs",children:[e.source_uri&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"font-medium text-muted-foreground uppercase tracking-wider text-[10px]",children:"Source"}),h.jsxs("a",{href:e.source_uri,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 break-all font-mono text-primary hover:underline",children:[e.source_uri,h.jsx(Yh,{className:"h-3 w-3 shrink-0"})]})]}),d.length>0&&h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[h.jsx("span",{className:"font-medium text-muted-foreground uppercase tracking-wider text-[10px]",children:"Scopes"}),d.map(C=>h.jsx(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px] font-mono",children:C},C))]})]}),h.jsx(uz,{feedsSchema:M,onInspect:k}),h.jsx(dz,{actionsSchema:_,ownerSlug:t,connectorKey:e.key,onInspect:b}),s&&h.jsx("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm text-red-600 dark:text-red-400",children:s}),e.required_capability?v?h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"rounded-lg border bg-muted/30 px-3 py-2 text-sm text-muted-foreground",children:["Available on ",m6(v),v.last_seen_at?` · last seen ${mf(v.last_seen_at)}`:""]}),t?h.jsx(ke,{asChild:!0,variant:"secondary",className:"w-full",children:h.jsx(nn,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:v.id},children:"Open device"})}):null]}):h.jsxs(ke,{onClick:()=>{window.location.href=eW(`grant/${e.required_capability}`)},className:"w-full",children:[h.jsx(Fx,{className:"mr-2 h-4 w-4"}),"Connect on this Mac"]}):h.jsx(ke,{onClick:r,disabled:i,className:"w-full",children:i?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"}),"Installing..."]}):"Install & Configure"})]})}function OBe({connector:e,ownerSlug:t}){const{data:n=[]}=Eve(e.installed?e.key:null),r=n.length>0?Object.fromEntries(n.map(s=>[s.operation_key,{...e.actions_schema?.[s.operation_key],name:s.name,description:s.description}])):e.actions_schema,{inspectFeed:a,inspectAction:i}=FL();return h.jsxs(h.Fragment,{children:[h.jsx(uz,{feedsSchema:e.feeds_schema,onInspect:a}),h.jsx(dz,{actionsSchema:r,onInspect:i,ownerSlug:t,connectorKey:e.key})]})}function TBe({connection:e,activeAuthRunId:t,onStart:n,onClear:r,onRecover:a,isStarting:i}){const{data:s}=Dve(t==null?e.id:null);x.useEffect(()=>{const v=s?.run_id;t==null&&v&&a(v)},[t,s?.run_id,a]);const{data:u,isLoading:c}=JR(t),d=u?.status==="completed"||u?.status==="failed"||u?.status==="cancelled",p=e.status==="pending_auth"||e.status==="error"||e.auth_profile_status!=null&&e.auth_profile_status!=="active",y=t!=null&&!d;return h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx("p",{className:"text-xs text-muted-foreground",children:"This connector pairs interactively (e.g. QR code or device link). Artifacts are only shown to the person who initiates the pairing."}),!y&&h.jsx(ke,{type:"button",variant:p?"default":"outline",size:"sm",className:"h-8",disabled:i,onClick:n,children:i?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"md",className:"mr-1.5"}),"Starting…"]}):p?"Pair device":"Reset pairing"}),y&&h.jsxs("div",{className:"space-y-3",children:[c&&!u&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(Dt,{size:"lg"})," Preparing…"]}),u&&!u.artifact&&!d&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(Dt,{size:"lg"})," Waiting for connector…"]}),u?.artifact&&!d&&t!=null&&h.jsx(tz,{artifact:u.artifact,runId:t}),h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:u?.status==="pending"?"Starting…":u?.status==="running"?"Waiting for you…":""}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:r,children:"Cancel"})]})]}),d&&u?.status==="completed"&&h.jsx("div",{className:"text-sm text-emerald-600",children:"Paired successfully."}),d&&u?.status==="failed"&&h.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-2 text-sm text-destructive",children:u.error_message||"Authentication failed."})]})}function NBe({onClose:e,onCreated:t,organizationId:n,editingConnection:r,connections:a=[],initialConnectorKey:i,ownerSlug:s,onDeepLinkBack:u}){const c=CBe({open:!0,onCreated:t,onOpenChange:I=>{I||e()},organizationId:n,editingConnection:r,connections:a,initialConnectorKey:i,onDeepLinkBack:u}),d=QR(),p=cr(),{data:y=[]}=ZHe(),{data:v,isLoading:k}=hke({enabled:!!s}),[b,M]=x.useState("all"),[_,C]=x.useState(()=>V0(i??"")),E=!c.isEditMode&&c.activeMethod?.type==="app_installation",R=r?.device_worker_id?h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connected through"," ",r.device_worker_id&&s?h.jsx(nn,{to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:r.device_worker_id},className:"text-foreground hover:underline",children:r.device_label||r.device_platform||"this device"}):h.jsx("span",{className:"text-foreground",children:r.device_label||r.device_platform||"this device"}),r.device_online===!1?" · offline":r.device_last_seen_at?` · last seen ${mf(r.device_last_seen_at)}`:""]}):null,O=h.jsxs("div",{className:"space-y-6 pb-6",children:[!c.selectedConnector&&c.previewConnector&&h.jsx(RBe,{ownerSlug:s,connector:c.previewConnector,existingConnectionCount:a.filter(I=>I.connector_key===c.previewConnector?.key).length,onInstall:()=>{c.handleInstallPreviewedConnector().then(I=>{!I||!s||p({to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:I.key}})})},onBack:c.handleBack,isInstalling:c.installConnectorMutation.isPending,installError:c.installError}),_&&h.jsx(jBe,{providerKind:_,credentialFields:v?.providerCatalog.find(I=>I.id===_)?.credentialFields,isProviderCatalogLoading:k,ownerSlug:s??"",onBack:()=>C(null)}),!_&&!c.selectedConnector&&!c.previewConnector&&h.jsxs("div",{className:"space-y-3",children:[h.jsx("div",{className:ve(Qh,"w-full"),children:c.showInstallForm?h.jsxs("div",{className:"p-3 space-y-3",children:[h.jsx("p",{className:"text-sm font-medium",children:"Install from URL"}),h.jsx(yn,{placeholder:"https://… (TypeScript source or MCP server URL)",value:c.installSourceUrl,onChange:I=>{c.setInstallSourceUrl(I.target.value),c.setInstallError(null)},className:"text-xs font-mono"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"URLs ending in .ts/.js are installed as source connectors. Other URLs are probed as MCP servers."}),c.installError&&h.jsx("p",{className:"text-xs text-destructive",children:c.installError}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{c.setShowInstallForm(!1),c.setInstallSourceUrl(""),c.setInstallError(null)},children:"Cancel"}),h.jsxs(ke,{size:"sm",className:"h-7 text-xs",disabled:c.installConnectorMutation.isPending||!c.installSourceUrl.trim(),onClick:()=>{c.setInstallError(null);const I=c.installSourceUrl.trim(),D=/\.(ts|js|mjs)(\?|$)/i.test(I);c.installConnectorMutation.mutate(D?{source_url:I}:{mcp_url:I},{onSuccess:()=>{c.setShowInstallForm(!1),c.setInstallSourceUrl("")},onError:H=>{c.setInstallError(H instanceof Error?H.message:"Failed to install connector")}})},children:[c.installConnectorMutation.isPending?h.jsx(Dt,{size:"sm",className:"mr-1"}):null,"Install"]})]})]}):h.jsxs("button",{type:"button",className:"flex items-center gap-3 p-3 w-full text-left text-muted-foreground hover:text-foreground transition-colors",onClick:()=>c.setShowInstallForm(!0),children:[h.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:h.jsx(kR,{className:"h-4 w-4"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm font-medium",children:"Install Custom Connector"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Install from a source file URL or MCP server URL"})]})]})}),h.jsxs("div",{className:"relative",children:[h.jsx(Zh,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(yn,{placeholder:"Search connectors...",value:c.searchQuery,onChange:I=>c.setSearchQuery(I.target.value),className:"pl-9"})]}),h.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:EBe.map(I=>h.jsx(ke,{type:"button",variant:b===I?"secondary":"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>M(I),children:zqe[I]},I))}),!c.showInstallForm&&c.installError&&h.jsx("p",{className:"text-xs text-destructive",children:c.installError}),c.isLoadingDefs?h.jsx(kHe,{}):(()=>{const I=c.searchQuery.toLowerCase().trim(),D=new Map;for(const j of a)D.set(j.connector_key,(D.get(j.connector_key)??0)+1);const H=c.connectorDefs.filter(j=>!I||j.name.toLowerCase().includes(I)||j.key.toLowerCase().includes(I)||j.description?.toLowerCase().includes(I)?T4({connector:j,facets:Hqe(j)},b):!1).sort((j,Z)=>j.name.localeCompare(Z.name)),K=j=>j.installed||(D.get(j.key)??0)>0,W=H.filter(K),Y=H.filter(j=>!K(j)),q=s?y.filter(j=>!I||j.displayName.toLowerCase().includes(I)||j.slug.toLowerCase().includes(I)?T4({connector:{key:`${Ys}${j.slug}`,name:j.displayName,auth_schema:null},facets:YC},b):!1).sort((j,Z)=>j.displayName.localeCompare(Z.displayName)):[],$=s?BHe(v?.availableProviders??[]).filter(j=>!I||j.name.toLowerCase().includes(I)||j.key.toLowerCase().includes(I)||j.description?.toLowerCase().includes(I)?T4({connector:j,facets:lx()},b):!1).sort((j,Z)=>j.name.localeCompare(Z.name)):[],B=s&&b==="all"?If(s,v6()).filter(j=>!I||j.name.toLowerCase().includes(I)||j.tagline.toLowerCase().includes(I)):[],J=q.length+$.length+B.length,te=j=>(Z,ee)=>{const le=c.installConnectorMutation.isPending&&c.installingConnectorKey===Z.key,se=KN(Z.runtime?.platforms),pe=GN(Z.auth_schema);return h.jsxs("button",{type:"button",className:`flex w-full items-center gap-3 bg-card px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60 ${ee===j-1?"":"border-b"}`,onClick:()=>{if(s&&Z.installed!==!1&&!V0(Z.key)&&!Z.key.startsWith(Ys)){p({to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:Z.key}});return}c.handleConnectorSelect(Z)},disabled:c.installConnectorMutation.isPending&&c.installingConnectorKey!==Z.key,children:[h.jsx(Zu,{connector:Z,className:"min-w-0 flex-1"}),h.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[le?h.jsxs(Qn,{variant:"secondary",className:"h-4 shrink-0 gap-1 px-1.5 py-0 text-[10px]",children:[h.jsx(Dt,{size:"xs"}),"Installing"]}):null,se&&h.jsxs(Qn,{variant:"secondary",className:"h-4 shrink-0 gap-1 px-1.5 py-0 text-[10px]",children:[h.jsx(Lx,{className:"h-2.5 w-2.5"}),"Requires ",se]}),pe.map(fe=>h.jsx(Qn,{variant:"secondary",className:"h-4 shrink-0 px-1.5 py-0 text-[10px]",children:fe},fe)),Z.login_enabled&&h.jsxs(Qn,{variant:"secondary",className:"h-4 shrink-0 gap-1 px-1.5 py-0 text-[10px]",children:[h.jsx(ap,{className:"h-2.5 w-2.5"}),"Login"]})]}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},Z.key)},z=(j,Z)=>h.jsxs(nn,{to:"/$owner/connectors/$connectorKey",search:{addAccount:!0},params:{owner:s??"",connectorKey:`${Ys}${j.slug}`},className:`flex w-full items-center gap-3 bg-card px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${Z===q.length-1&&$.length+B.length===0?"":"border-b"}`,children:[h.jsx(Zu,{connector:{key:`${Ys}${j.slug}`,name:j.displayName,iconUrl:j.iconUrl},className:"min-w-0 flex-1"}),h.jsx("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:h.jsx(ix,{facets:YC})}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`${Ys}${j.slug}`),U=(j,Z)=>h.jsxs("button",{type:"button",onClick:()=>C(V0(j.key)??null),className:`flex w-full items-center gap-3 bg-card px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${Z===$.length-1&&B.length===0?"":"border-b"}`,children:[h.jsx(Zu,{connector:j,className:"min-w-0 flex-1"}),h.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[h.jsx(ix,{facets:lx()}),h.jsx(Qn,{variant:"secondary",className:"h-4 shrink-0 px-1.5 py-0 text-[10px] text-muted-foreground",children:"Available"})]}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},j.key),V=(j,Z)=>h.jsxs(nn,{to:"/$owner/connectors/app/$appId",params:{owner:s??"",appId:j.id},className:`flex w-full items-center gap-3 bg-card px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${Z===B.length-1?"":"border-b"}`,children:[h.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-dashed",children:j.icon}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"truncate text-sm font-medium",children:j.name}),h.jsx("p",{className:"truncate text-xs text-muted-foreground",children:j.tagline})]}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},j.id);return H.length===0&&q.length===0&&$.length===0&&B.length===0?h.jsxs("div",{className:"space-y-3 py-4 text-center",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-sm font-medium",children:I?`No connectors match "${c.searchQuery}"`:b!=="all"?"No connectors match this filter":"No connectors found"}),h.jsx("p",{className:"mx-auto max-w-sm text-xs text-muted-foreground",children:"Install a custom connector from URL, or create an agent that links the connector your workflow needs."})]}),s?h.jsx(ke,{asChild:!0,variant:"outline",size:"sm",children:h.jsxs(nn,{to:`/${s}/agents`,search:{create:!0},children:[h.jsx(ia,{className:"mr-2 h-4 w-4"}),"Create with an agent"]})}):null]}):h.jsxs("div",{className:"space-y-4",children:[W.length>0?h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("h3",{className:"text-[11.5px] font-medium text-muted-foreground",children:"Already in this workspace"}),h.jsx("div",{className:"overflow-hidden rounded-lg border",children:W.map(te(W.length))})]}):null,Y.length+J>0?h.jsxs("div",{className:"space-y-1.5",children:[W.length>0?h.jsx("h3",{className:"text-[11.5px] font-medium text-muted-foreground",children:"From the catalog"}):null,h.jsxs("div",{className:"overflow-hidden rounded-lg border",children:[Y.map(te(Y.length+J)),q.map(z),$.map(U),B.map(V)]})]}):null]})})()]}),c.selectedConnector&&h.jsxs("div",{className:"space-y-4",children:[!c.isEditMode&&h.jsx(sx,{organizationId:n,connectorKey:c.selectedConnector.key}),h.jsxs("div",{className:"flex items-center gap-2",children:[!c.isEditMode&&h.jsx(ke,{variant:"ghost",size:"sm",onClick:c.handleBack,className:"h-7 px-2 text-xs",children:"← Back"}),h.jsx(Zu,{connector:c.selectedConnector,showDescription:!1,className:"gap-2"}),c.selectedConnector.version&&h.jsxs(Qn,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-4 font-mono",children:["v",c.selectedConnector.version]})]}),c.isEditMode&&r?.status==="pending_auth"&&r.connect_token&&h.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 p-4 space-y-3",children:[h.jsx("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-200",children:"Authorization required"}),h.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:"This connection is waiting for OAuth authorization to complete."}),h.jsxs(ke,{size:"sm",onClick:()=>{const I=`${xz}/connect/${r.connect_token}/oauth/start`;c.navigateOAuthPopup(I)},children:[h.jsx(Yh,{className:"mr-1.5 h-3.5 w-3.5"}),"Authorize"]})]}),c.isEditMode&&r?.status==="pending_auth"&&r.auth_profile_kind==="browser_session"&&r.auth_profile_slug&&h.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 p-4 space-y-3",children:[h.jsx("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-200",children:"Browser auth required"}),h.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:c.liveBrowser?"Sign in to this account in the selected Chrome profile, then save changes to verify it.":"Capture or refresh the browser session for this auth profile, then the connection will resume automatically."}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Follow the connector’s authorization instructions to refresh this session."})]}),!E&&(c.requiredCapability||c.deviceOptions.length>0)&&h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("label",{className:"text-sm font-medium",children:[c.browserRequired?"Browser":"Run on",c.requiredCapability?h.jsx("span",{className:"text-destructive ml-1",children:"*"}):h.jsx("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:"(optional)"})]}),h.jsx("div",{className:"flex items-center gap-3",children:h.jsxs("button",{type:"button",onClick:()=>void c.refreshDevices(),disabled:c.devicesRefreshing,className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground disabled:opacity-50",children:[h.jsx(Bx,{className:`h-3 w-3 ${c.devicesRefreshing?"animate-spin":""}`}),"Refresh"]})})]}),h.jsxs(Ws,{value:c.selectedDeviceWorkerId??(c.requiredCapability?"":j4),onValueChange:I=>{if(I===JC){s&&p({to:"/$owner/connectors/create",params:{owner:s}});return}c.setSelectedDeviceWorkerId(I===j4?void 0:I)},disabled:!!c.lockedDeviceWorkerIdFromProfile||!!c.pendingBrowserConnectionId,children:[h.jsx(Fi,{className:"h-8",children:h.jsx(Ks,{placeholder:c.browserRequired?"Select a Chrome browser":"Select a device"})}),h.jsxs($i,{children:[!c.requiredCapability&&h.jsx(Hr,{value:j4,children:"Serverless (default)"}),c.deviceOptions.map(I=>h.jsx(ML,{device:I},I.id)),s?h.jsx(Hr,{value:JC,children:h.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[h.jsx(ia,{className:"h-3.5 w-3.5"}),"Add device"]})}):null]})]}),c.requiredCapability&&c.deviceOptions.length===0?h.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.browserRequired?`${c.browserSetupHint} Then `:h.jsxs(h.Fragment,{children:["No device has granted the “",pL[c.requiredCapability]??c.requiredCapability,"” permission. Open the Lobu app on a device and grant it, then"," "]}),h.jsx("button",{type:"button",onClick:()=>void c.refreshDevices(),className:"underline hover:text-foreground",children:"refresh"}),"."]}):c.selectedDeviceWorkerId?h.jsx("p",{className:"text-xs text-muted-foreground",children:c.browserRequired?"Lobu uses this Chrome profile and its signed-in account. Keep this browser open when using the connection.":"Syncs and actions run on this device — with its credentials and network, not the Lobu server."}):h.jsx("p",{className:"text-xs text-muted-foreground",children:"Runs serverless, in the Lobu server."})]}),c.isEditMode&&r?.has_operations&&h.jsx("div",{className:"rounded-lg border bg-muted/30 p-4 space-y-4",children:h.jsx(bBe,{connection:r,ownerSlug:s})}),!E&&!c.isEditMode&&h.jsx(OBe,{connector:c.selectedConnector,ownerSlug:s}),c.selectableMethods.length>0&&h.jsxs("section",{className:"space-y-3",children:[h.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Authentication"}),c.selectableMethods.length>1?h.jsx("div",{className:"flex gap-2",children:c.selectableMethods.map((I,D)=>h.jsx("button",{type:"button",onClick:()=>c.handleMethodChange(D),disabled:!!c.pendingBrowserConnectionId,className:`rounded-md border px-3 py-1.5 text-sm transition-colors ${c.selectedAuthMethodIndex===D?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:text-foreground"}`,children:W0(I)},`${I.type}-${W0(I)}`))}):h.jsx("p",{className:"text-xs text-muted-foreground",children:W0(c.selectableMethods[0])}),c.activeMethod?.type!=="none"&&c.activeMethod?.description&&h.jsx("p",{className:"text-xs text-muted-foreground",children:c.activeMethod.description}),c.activeMethod?.type==="app_installation"&&h.jsxs("div",{className:"space-y-3",children:[c.activeMethod.permissions&&c.activeMethod.permissions.length>0&&h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[h.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Grants"}),c.activeMethod.permissions.map(I=>h.jsx(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:I},I))]}),h.jsx(ox,{organizationId:n,connectorKey:c.selectedConnector.key,provider:c.activeMethod.provider,providerLabel:c.selectedConnector?.name,installShape:c.activeMethod.installShape,variant:"default",size:"default",className:"w-full",label:`Install ${c.selectedConnector?.name??"App"}`}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:["You'll be sent to"," ",c.activeMethod.provider.charAt(0).toUpperCase()+c.activeMethod.provider.slice(1)," ","to choose what to grant. The connection and its feeds are created automatically when you return."]})]}),c.activeMethod?.type==="env_keys"&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Auth Profile"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs(Ws,{value:c.selectedAuthProfileSlug,onValueChange:c.setSelectedAuthProfileSlug,children:[h.jsx(Fi,{className:"h-8 flex-1 min-w-0",children:h.jsx(Ks,{placeholder:"Select auth profile"})}),h.jsx($i,{children:c.runtimeEnvProfiles.map(I=>h.jsxs(Hr,{value:I.slug,children:[I.display_name," (",I.slug,")"]},I.slug))})]}),c.selectedAuthProfileSlug&&(c.confirmingDeleteProfileSlug===c.selectedAuthProfileSlug?h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",className:"h-8 text-xs px-2",disabled:c.deleteAuthProfileMutation.isPending,onClick:()=>void c.handleDeleteAuthProfile(c.selectedAuthProfileSlug,"env"),children:c.deleteAuthProfileMutation.isPending?h.jsx(Dt,{size:"sm"}):"Delete"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs px-2",onClick:()=>c.setConfirmingDeleteProfileSlug(null),children:"Cancel"})]}):h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>c.setConfirmingDeleteProfileSlug(c.selectedAuthProfileSlug),children:h.jsx(Zs,{className:"h-3.5 w-3.5"})}))]}),c.runtimeEnvProfiles.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground",children:"No auth profiles yet for this connector."})]}),h.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:()=>c.setShowNewRuntimeProfileForm(I=>!I),children:[h.jsx(ia,{className:"mr-1.5 h-3.5 w-3.5"}),c.showNewRuntimeProfileForm?"Hide New Profile":"Create Auth Profile"]}),c.showNewRuntimeProfileForm&&h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx(yn,{placeholder:"Profile name",value:c.newRuntimeProfileName,onChange:I=>c.setNewRuntimeProfileName(I.target.value)}),h.jsx(yn,{placeholder:"profile-slug (optional)",value:c.newRuntimeProfileSlug,onChange:I=>c.setNewRuntimeProfileSlug(I.target.value)}),c.runtimeDraft.revision&&h.jsxs(h.Fragment,{children:[h.jsx(od,{visible:c.runtimeDraft.hasConflict,onReload:c.runtimeDraft.reset}),h.jsx(ul,{schema:c.runtimeDraft.revision,values:c.newRuntimeProfileValues,onValuesChange:c.setNewRuntimeProfileValues,fieldIdPrefix:"new-runtime-profile-"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>{c.setShowNewRuntimeProfileForm(!1),c.setNewRuntimeProfileName(""),c.setNewRuntimeProfileSlug(""),c.setNewRuntimeProfileValues({})},children:"Cancel"}),h.jsxs(ke,{type:"button",size:"sm",disabled:!c.runtimeDraft.canSubmit||c.createAuthProfile.isPending||Object.keys(c.normalizeStringValues(c.newRuntimeProfileValues)).length===0,onClick:()=>void c.handleCreateRuntimeProfile(),children:[c.createAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Create"]})]})]})]}),c.activeMethod?.type==="browser"&&!c.liveBrowser&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Browser Auth Profile"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs(Ws,{value:c.selectedAuthProfileSlug,onValueChange:I=>{if(I===XC){c.setShowNewBrowserProfileForm(!0);return}c.setSelectedAuthProfileSlug(I),c.setShowNewBrowserProfileForm(!1)},children:[h.jsx(Fi,{className:"h-8 flex-1 min-w-0",children:h.jsx(Ks,{placeholder:"Select browser auth profile"})}),h.jsxs($i,{children:[h.jsxs(Hr,{value:XC,children:[h.jsx(ia,{className:"mr-1.5 inline h-3.5 w-3.5"}),"Create new browser profile"]}),c.browserProfiles.map(I=>{const D=I.device_worker_id?c.devices.find(H=>H.id===I.device_worker_id)?.label:null;return h.jsxs(Hr,{value:I.slug,children:[I.display_name," (",I.slug,")",D?` — on ${D}`:""]},I.slug)})]})]}),c.selectedAuthProfileSlug&&(c.confirmingDeleteProfileSlug===c.selectedAuthProfileSlug?h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",className:"h-8 text-xs px-2",disabled:c.deleteAuthProfileMutation.isPending,onClick:()=>void c.handleDeleteAuthProfile(c.selectedAuthProfileSlug,"browser"),children:c.deleteAuthProfileMutation.isPending?h.jsx(Dt,{size:"sm"}):"Delete"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs px-2",onClick:()=>c.setConfirmingDeleteProfileSlug(null),children:"Cancel"})]}):h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>c.setConfirmingDeleteProfileSlug(c.selectedAuthProfileSlug),children:h.jsx(Zs,{className:"h-3.5 w-3.5"})}))]}),c.browserProfiles.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground",children:"No browser auth profiles yet for this connector."})]}),c.selectedAuthProfileSlug&&(()=>{const I=c.browserProfiles.find(D=>D.slug===c.selectedAuthProfileSlug);return I?h.jsxs("div",{className:"space-y-2 rounded-md border bg-background p-3",children:[h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsx(Qn,{variant:I.status==="active"?"default":"secondary",children:I.status}),typeof I.cookie_count=="number"&&h.jsxs(Qn,{variant:"outline",children:[I.cookie_count," cookies"]}),I.auth_cookie_name&&h.jsx(Qn,{variant:"outline",children:I.auth_cookie_name})]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Follow the connector’s authorization instructions to refresh this session."})]}):null})(),h.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:()=>c.setShowNewBrowserProfileForm(I=>!I),children:[h.jsx(ia,{className:"mr-1.5 h-3.5 w-3.5"}),c.showNewBrowserProfileForm?"Hide New Profile":"Create Browser Profile"]}),c.showNewBrowserProfileForm&&h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx(yn,{placeholder:"Profile name",value:c.newBrowserProfileName,onChange:I=>c.setNewBrowserProfileName(I.target.value)}),h.jsx(yn,{placeholder:"profile-slug (optional)",value:c.newBrowserProfileSlug,onChange:I=>c.setNewBrowserProfileSlug(I.target.value)}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Create the session profile, then follow the connector’s authorization instructions."}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>{c.setShowNewBrowserProfileForm(!1),c.setNewBrowserProfileName(""),c.setNewBrowserProfileSlug("")},children:"Cancel"}),h.jsxs(ke,{type:"button",size:"sm",disabled:c.createAuthProfile.isPending,onClick:()=>void c.handleCreateBrowserProfile(),children:[c.createAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Create"]})]})]})]}),c.activeMethod?.type==="interactive"&&c.isEditMode&&r&&r.auth_profile_kind==="interactive"&&h.jsx(TBe,{connection:r,activeAuthRunId:c.pendingAuthRunId,onStart:()=>{d.mutate({connection_id:r.id},{onSuccess:I=>{c.setPendingAuthRunId(I.auth_run_id??null)}})},onClear:()=>c.setPendingAuthRunId(null),onRecover:I=>c.setPendingAuthRunId(I),isStarting:d.isPending}),c.activeMethod?.type==="oauth"&&h.jsxs("div",{className:"space-y-4",children:[!c.isEditMode&&c.appOAuthProfiles.length>0&&c.selectedAppAuthProfileSlug?h.jsxs("div",{className:"space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Workspace app"}),c.isAdmin&&s&&c.selectedConnector&&h.jsx(nn,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:c.selectedConnector.key},search:{setup:"oauth_app"},hash:"connector-oauth-apps",className:"text-xs text-muted-foreground hover:text-foreground",children:"Manage app"})]}),c.appOAuthProfiles.length===1||!c.isAdmin?(()=>{const I=c.appOAuthProfiles.find(D=>D.slug===c.selectedAppAuthProfileSlug);return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("p",{className:"text-sm",children:I?.display_name??"Ask an administrator to set the workspace-default app."}),I?.is_default_for_connector&&I.connector_key===c.selectedConnector?.key&&h.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Org default"})]})})():h.jsxs(Ws,{value:c.selectedAppAuthProfileSlug,onValueChange:c.setSelectedAppAuthProfileSlug,children:[h.jsx(Fi,{className:"h-8",children:h.jsx(Ks,{placeholder:"Choose an app"})}),h.jsx($i,{children:c.appOAuthProfiles.map(I=>h.jsxs(Hr,{value:I.slug,children:[I.display_name,I.is_default_for_connector&&I.connector_key===c.selectedConnector?.key?" (default)":""]},I.slug))})]})]}):h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Workspace app"}),c.isAdmin&&s&&c.selectedConnector&&c.appOAuthProfiles.length>0&&h.jsx(nn,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:c.selectedConnector.key},className:"text-xs text-muted-foreground hover:text-foreground",children:"Manage"})]}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs(Ws,{value:c.selectedAppAuthProfileSlug,onValueChange:I=>{if(I===ZC){c.setShowNewAppProfileForm(!0);return}c.setSelectedAppAuthProfileSlug(I),c.setShowNewAppProfileForm(!1)},children:[h.jsx(Fi,{className:"h-8 flex-1 min-w-0",children:h.jsx(Ks,{placeholder:`Select ${c.activeMethod.provider} app profile`})}),h.jsxs($i,{children:[c.isAdmin&&h.jsxs(Hr,{value:ZC,children:[h.jsx(ia,{className:"mr-1.5 inline h-3.5 w-3.5"}),"Create new app profile"]}),c.appOAuthProfiles.map(I=>h.jsxs(Hr,{value:I.slug,children:[I.display_name," (",I.slug,")",I.is_default_for_connector&&I.connector_key===c.selectedConnector?.key?" — default":""]},I.slug))]})]}),c.selectedAppAuthProfileSlug&&(c.confirmingDeleteProfileSlug===c.selectedAppAuthProfileSlug?h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",className:"h-8 text-xs px-2",disabled:c.deleteAuthProfileMutation.isPending,onClick:()=>void c.handleDeleteAuthProfile(c.selectedAppAuthProfileSlug,"app"),children:c.deleteAuthProfileMutation.isPending?h.jsx(Dt,{size:"sm"}):"Delete"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs px-2",onClick:()=>c.setConfirmingDeleteProfileSlug(null),children:"Cancel"})]}):h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>c.setConfirmingDeleteProfileSlug(c.selectedAppAuthProfileSlug),children:h.jsx(Zs,{className:"h-3.5 w-3.5"})}))]}),c.appOAuthProfiles.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground",children:c.isAdmin?"To use your own app, configure its client credentials here. You can also use a managed app when available.":`Choose a managed option if available, or ask an admin to configure your own ${c.activeMethod.provider} app.`}),c.showNewAppProfileForm&&h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx(ABe,{method:c.activeMethod}),h.jsx(yn,{placeholder:"App profile name",value:c.newAppProfileName,onChange:I=>c.setNewAppProfileName(I.target.value)}),h.jsx(yn,{placeholder:"app-profile-slug (optional)",value:c.newAppProfileSlug,onChange:I=>c.setNewAppProfileSlug(I.target.value)}),c.appDraft.revision&&h.jsxs(h.Fragment,{children:[h.jsx(od,{visible:c.appDraft.hasConflict,onReload:c.appDraft.reset}),h.jsx(ul,{schema:c.appDraft.revision,values:c.newAppProfileValues,onValuesChange:c.setNewAppProfileValues,fieldIdPrefix:"new-app-profile-"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>{c.setShowNewAppProfileForm(!1),c.setNewAppProfileName(""),c.setNewAppProfileSlug(""),c.setNewAppProfileValues({})},children:"Cancel"}),h.jsxs(ke,{type:"button",size:"sm",disabled:!c.appDraft.canSubmit||c.createAuthProfile.isPending||Object.keys(c.normalizeStringValues(c.newAppProfileValues)).length===0,onClick:()=>void c.handleCreateAppProfile(),children:[c.createAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Create"]})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Your account"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs(Ws,{value:c.selectedAuthProfileSlug,onValueChange:I=>{if(I===QC){c.setShowNewOAuthAccountForm(!0);return}c.setSelectedAuthProfileSlug(I),c.setShowNewOAuthAccountForm(!1)},children:[h.jsx(Fi,{className:"h-8 flex-1 min-w-0",children:h.jsx(Ks,{placeholder:`Select ${c.activeMethod.provider} account profile`})}),h.jsxs($i,{children:[h.jsxs(Hr,{value:QC,children:[h.jsx(ia,{className:"mr-1.5 inline h-3.5 w-3.5"}),"Add new account"]}),c.runtimeOAuthProfiles.map(I=>h.jsxs(Hr,{value:I.slug,children:[I.display_name," (",I.slug,") [",I.status,"]"]},I.slug))]})]}),c.selectedAuthProfileSlug&&(c.confirmingDeleteProfileSlug===c.selectedAuthProfileSlug?h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",className:"h-8 text-xs px-2",disabled:c.deleteAuthProfileMutation.isPending,onClick:()=>void c.handleDeleteAuthProfile(c.selectedAuthProfileSlug,"account"),children:c.deleteAuthProfileMutation.isPending?h.jsx(Dt,{size:"sm"}):"Delete"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs px-2",onClick:()=>c.setConfirmingDeleteProfileSlug(null),children:"Cancel"})]}):h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>c.setConfirmingDeleteProfileSlug(c.selectedAuthProfileSlug),children:h.jsx(Zs,{className:"h-3.5 w-3.5"})}))]}),(()=>{const I=c.runtimeOAuthProfiles.find(D=>D.slug===c.selectedAuthProfileSlug);return h.jsxs("div",{className:"space-y-2",children:[h.jsx(fx,{requiredScopes:Bh(c.activeMethod),optionalScopes:c.availableOAuthOptionalScopes,selectedOptionalScopes:c.selectedOAuthOptionalScopes,grantedScopes:I?.granted_scopes,onToggleOptionalScope:(D,H)=>{c.setSelectedOAuthOptionalScopes(K=>H?[...new Set([...K,D])]:K.filter(W=>W!==D))}}),I?h.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-8",disabled:c.reconnectAuthProfile.isPending,onClick:()=>void c.handleReconnect(I.slug),children:[c.reconnectAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):h.jsx(ap,{className:"mr-1.5 h-3.5 w-3.5"}),"Review permissions"]}):null]})})(),c.runtimeOAuthProfiles.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground",children:"No OAuth account profiles yet for this connector."}),c.showNewOAuthAccountForm&&h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx(yn,{placeholder:"Account profile name",value:c.newOAuthAccountName,onChange:I=>c.setNewOAuthAccountName(I.target.value)}),h.jsx(yn,{placeholder:"account-profile-slug (optional)",value:c.newOAuthAccountSlug,onChange:I=>c.setNewOAuthAccountSlug(I.target.value)}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Creating the profile will open the OAuth authorization page in a new tab. When it finishes, the profile becomes reusable for future connections."}),h.jsx(fx,{requiredScopes:Bh(c.activeMethod),optionalScopes:c.availableOAuthOptionalScopes,selectedOptionalScopes:c.selectedOAuthOptionalScopes,onToggleOptionalScope:(I,D)=>{c.setSelectedOAuthOptionalScopes(H=>D?[...new Set([...H,I])]:H.filter(K=>K!==I))}}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>{c.setShowNewOAuthAccountForm(!1),c.setNewOAuthAccountName(""),c.setNewOAuthAccountSlug("")},children:"Cancel"}),h.jsxs(ke,{type:"button",size:"sm",disabled:c.createAuthProfile.isPending,onClick:()=>void c.handleCreateOAuthAccountProfile(),children:[c.createAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Continue"]})]})]})]})]})]}),!E&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-sm font-medium",htmlFor:"conn-display-name",children:"Display Name"}),h.jsx(yn,{id:"conn-display-name",placeholder:`e.g. Work ${c.selectedConnector.name}`,value:c.displayName,onChange:I=>c.setDisplayName(I.target.value)})]}),!E&&!c.isEditMode&&c.isAdmin&&!c.liveBrowser&&h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{className:"text-sm font-medium",children:["Assign to Member"," ",h.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"(optional)"})]}),h.jsx(qHe,{organizationId:n,value:c.selectedMemberUserId,onValueChange:c.setSelectedMemberUserId}),h.jsx("p",{className:"text-xs text-muted-foreground",children:c.selectedMemberUserId?"Only the selected member will use this connection.":"Leave empty to make this connection available to everyone in the organization."}),c.existingNoAuthConnection&&h.jsx("div",{className:"rounded-md bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 p-3",children:h.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["This user already has a ",c.selectedConnector.name," ","connection. No-auth connectors are limited to one per user."]})})]}),c.hasUniqueOptionsFields&&h.jsxs("div",{className:"rounded-lg border bg-muted/30 p-4 space-y-3",children:[h.jsx("p",{className:"text-sm font-medium",children:"Connection Options"}),h.jsx(od,{visible:c.configDraft.hasConflict,onReload:c.configDraft.reset}),h.jsx(ul,{schema:c.configDraft.revision??void 0,values:c.configValues,onValuesChange:c.handleValuesChange})]})]})]}),N=c.selectedConnector&&!c.previewConnector?h.jsxs(h.Fragment,{children:[c.authorizationUrl&&h.jsx("a",{className:"text-sm underline",href:c.authorizationUrl,target:"_blank",rel:"noreferrer",children:"Continue authorization in your browser"}),c.saveError&&h.jsx("div",{className:"w-full mb-3 rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm text-red-600 dark:text-red-400",children:c.saveError}),h.jsxs("div",{className:"flex items-center w-full",children:[c.isEditMode&&h.jsx("div",{className:"mr-auto",children:c.showDeleteConfirm?h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ke,{variant:"destructive",size:"sm",disabled:c.deleteConnection.isPending,onClick:()=>{c.deleteConnection.mutate(r.id,{onSuccess:()=>c.handleOpenChange(!1)})},children:c.deleteConnection.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"md",className:"mr-1.5"}),"Deleting..."]}):"Confirm"}),h.jsx(ke,{variant:"outline",size:"sm",onClick:()=>c.setShowDeleteConfirm(!1),disabled:c.deleteConnection.isPending,children:"Cancel"})]}):h.jsxs(ke,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>c.setShowDeleteConfirm(!0),children:[h.jsx(Zs,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete"]})}),!(!c.isEditMode&&c.activeMethod?.type==="app_installation")&&h.jsx(ke,{onClick:c.handleSave,disabled:!c.configDraft.canSubmit||c.isSaving||!!c.existingNoAuthConnection,children:c.isSaving?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"}),c.isEditMode?"Saving...":"Creating..."]}):c.isEditMode?h.jsx(h.Fragment,{children:"Save Changes"}):h.jsxs(h.Fragment,{children:[h.jsx(ia,{className:"mr-2 h-4 w-4"}),c.pendingBrowserConnectionId?"Verify connection":"Add connection"]})})]})]}):null,P=N?h.jsx("div",{className:"mt-6",children:N}):null,L=h.jsx(EUe,{runId:c.isEditMode&&c.activeMethod?.type==="interactive"?null:c.pendingAuthRunId,onClose:c.handleAuthClose});return h.jsxs(h.Fragment,{children:[R,O,P,L]})}function jBe({providerKind:e,credentialFields:t,isProviderCatalogLoading:n,ownerSlug:r,onBack:a}){const i=cr(),s=fke(),u=Uh(e);return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ke,{variant:"ghost",size:"sm",onClick:a,className:"h-7 px-2 text-xs",children:"← Back"}),h.jsx(Zu,{connector:{key:`${np}${e}`,name:u,favicon_domain:LL(e)},showDescription:!1,className:"gap-2"}),h.jsx(ix,{facets:lx()})]}),n?h.jsx(zL,{rows:4,className:"max-w-md"}):t?h.jsx(VHe,{providerKind:e,credentialFields:t,pending:s.isPending,onCancel:a,onCreate:c=>s.mutate(c,{onSuccess:d=>{const p=d?.sandbox?.id;i({to:p?"/$owner/connectors/$connectorKey":"/$owner/connectors",params:p?{owner:r,connectorKey:`sandbox:${p}`}:{owner:r}})}})}):h.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:"This runtime provider is not available from the gateway."})]})}function IBe({ownerSlug:e,organizationId:t,connections:n,initialConnectorKey:r}){const a=cr();return h.jsx(NBe,{onCreated:(i,s)=>{a({to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:s,connectionId:String(i)},search:{}})},onClose:()=>{a({to:"/$owner/connectors",params:{owner:e}})},organizationId:t,connections:n,initialConnectorKey:r,ownerSlug:e,onDeepLinkBack:r?()=>{a({to:"/$owner/connectors/$connectorKey",params:{owner:e,connectorKey:r}})}:void 0})}function PBe({owner:e,children:t}){const{data:n,isLoading:r,error:a}=vn(e,{slug:e}),{session:i,isReady:s}=wr(),u=FV(a),c=$V(a)&&!u&&!n?.workspace;n3e({active:!r&&!c&&s&&!i&&!n?.workspace,owner:e});const d=n?.workspace;return r?h.jsx(h.Fragment,{children:t({organizationId:null,ownerSlug:e,isWorkspaceLoading:!0})}):c?h.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-1 py-12 text-center",children:[h.jsx("p",{className:"text-muted-foreground",children:"This workspace could not be loaded."}),h.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Please try again in a moment."})]}):u||!d?h.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Organization not found"}):d.type!=="organization"?h.jsx("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 py-16 text-center",children:h.jsx("p",{className:"text-muted-foreground max-w-md",children:"Select an organization to view this page."})}):h.jsx(h.Fragment,{children:t({organizationId:d.id,ownerSlug:d.slug,isWorkspaceLoading:!1})})}const DBe=()=>Te(()=>import("./create-CBGwASon.js"),[]),LBe=Ce("/$owner/connectors/create")({component:Oe(DBe,"component")});function eJe({owner:e,initialConnectorKey:t}){return h.jsx(PBe,{owner:e,children:n=>h.jsx(zBe,{ownerSlug:n.ownerSlug,organizationId:n.organizationId,initialConnectorKey:t})})}function zBe({ownerSlug:e,organizationId:t,initialConnectorKey:n}){const{data:r=[]}=sy(t??"");return h.jsxs(xL,{className:"flex flex-1 flex-col gap-6",children:[h.jsx(mHe,{breadcrumb:h.jsx(yHe,{crumbs:[h.jsx(nn,{to:"/$owner/connectors",params:{owner:e},search:{},className:pHe,children:"Connectors"},"connectors")]}),icon:h.jsx(Xt.connectors.icon,{className:"h-6 w-6"}),title:"Add a connection",caption:"Pick a connector from the catalog or drop in an MCP URL — Lobu handles auth and brings the data into memory."}),t?h.jsx(IBe,{ownerSlug:e,organizationId:t,connections:r,initialConnectorKey:n}):h.jsx("div",{className:"max-w-3xl",children:h.jsx(zL,{rows:4})})]})}const FBe=()=>Te(()=>import("./_agentId-DWUFSrVp.js"),__vite__mapDeps([56,57,40,16,58,35,10,11,12,13,14])),$Be=Ce("/$owner/chat/$agentId")({validateSearch:e=>{const t={};(e.new===!0||e.new==="1"||e.new==="true")&&(t.new=!0),typeof e.prompt=="string"&&e.prompt.length>0&&(t.prompt=e.prompt);const n=typeof e.message_id=="string"&&e.message_id.trim()||typeof e.message=="string"&&e.message.trim()||"";return n&&(t.message_id=n),Object.assign(t,Em(e)),t},loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))},component:Oe(FBe,"component")});function bz(e){const t=n=>typeof e[n]=="string"?e[n]:void 0;return Vn({listen:t("listen"),platform:t("platform"),team:t("team"),label:t("label"),connection:t("connection"),resource_type:t("resource_type"),resource:t("resource"),events:t("events"),agent:t("agent")})}const qBe=()=>Te(()=>import("./new-DWp3deoW.js"),__vite__mapDeps([59,60,45,61,8,62,63,36,34,35,58])),HBe=Ce("/$owner/automations/new")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:e=>bz(e),component:Oe(qBe,"component")});function wz(e){const t=typeof e=="string"?Number(e):e;if(!(typeof t!="number"||!Number.isInteger(t)||t<=0))return t}function tJe(e){return e.isReview?e.status==="pending"?"active":e.status==="gone"?"gone":e.isError?"error":"loading":"none"}function nJe(e){const t={};return e&&(typeof e.name=="string"&&(t.name=e.name),typeof e.description=="string"&&(t.description=e.description),typeof e.identity_md=="string"&&(t.identityMd=e.identity_md)),t}const UBe=()=>Te(()=>import("./_automationId-BnHqdXOC.js"),__vite__mapDeps([64,65,60,45,61,8,62,63,36,34,35,58,66,33,67,10,11,12,13,14]));function BBe(e){return e==="definition"?"definition":"activity"}const VBe=Ce("/$owner/automations/$automationId")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:e=>({run_id:wz(e.run_id),view:BBe(e.view)}),component:Oe(UBe,"component")}),WBe=()=>Te(()=>import("./new-BMrFy5Qa.js"),__vite__mapDeps([68,69,62])),KBe=Ce("/$owner/agents/new")({component:Oe(WBe,"component"),validateSearch:bz}),GBe=()=>Te(()=>import("./connect-4zqtnDHb.js"),[]),YBe=Ce("/$owner/agents/connect")({component:Oe(GBe,"component")}),ZBe=()=>Te(()=>import("./_agentId-MENLoohA.js"),__vite__mapDeps([70,71,69,62,66])),QBe=Ce("/$owner/agents/$agentId")({beforeLoad:({params:e,location:t})=>{const n=`/${e.owner}/agents/${e.agentId}`;(t.pathname===n||t.pathname===`${n}/`)&&gke(e.owner,e.agentId)},loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))},component:Oe(ZBe,"component")}),XBe=Ce("/$owner/events/$eventId/")({}),JBe=()=>Te(()=>import("./index-Da6CrGEu.js"),__vite__mapDeps([72,73,67])),eVe=Ce("/$owner/connectors/deployments/")({component:Oe(JBe,"component")}),tVe=()=>Te(()=>import("./index-ZNlrDc_f.js"),[]),nVe=Ce("/$owner/connectors/create/")({validateSearch:e=>Vn({connector:typeof e.connector=="string"&&e.connector.length>0?e.connector:void 0,install:typeof e.install=="string"&&e.install.length>0?e.install:void 0}),component:Oe(tVe,"component")});function rVe(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const aVe={},uh={};function dc(e,t){try{const r=(aVe[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in uh?uh[r]:eE(r,r.split(":"))}catch{if(e in uh)return uh[e];const n=e?.match(oVe);return n?eE(e,n.slice(1)):NaN}}const oVe=/([+-]\d\d):?(\d\d)?/;function eE(e,t){const n=+(t[0]||0),r=+(t[1]||0),a=+(t[2]||0)/60;return uh[e]=n*60+r>0?n*60+r+a:n*60-r-a}class Jo extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(dc(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),Mz(this),yx(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new Jo(...n,t):new Jo(Date.now(),t)}withTimeZone(t){return new Jo(+this,t)}getTimezoneOffset(){const t=-dc(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),yx(this),+this}[Symbol.for("constructDateFrom")](t){return new Jo(+new Date(t),this.timeZone)}}const tE=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!tE.test(e))return;const t=e.replace(tE,"$1UTC");Jo.prototype[t]&&(e.startsWith("get")?Jo.prototype[e]=function(){return this.internal[t]()}:(Jo.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),iVe(this),+this},Jo.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),yx(this),+this}))});function yx(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-dc(e.timeZone,e)*60))}function iVe(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Mz(e)}function Mz(e){const t=dc(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),s=a-i,u=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();s&&u&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+s);const c=a-n;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const p=a>0?d.getSeconds():(d.getSeconds()-60)%60,y=Math.round(-(dc(e.timeZone,e)*60))%60;(y||p)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+y),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+y+p));const v=dc(e.timeZone,e),k=v>0?Math.floor(v):Math.ceil(v),M=-new Date(+e).getTimezoneOffset()-k,_=k!==n,C=M-c;if(_&&C){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+C);const E=dc(e.timeZone,e),A=E>0?Math.floor(E):Math.ceil(E),R=k-A;R&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+R),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+R))}}class Tr extends Jo{static tz(t,...n){return n.length?new Tr(...n,t):new Tr(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),a=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,a]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,a]=this.tzComponents();return`${t} GMT${n}${r}${a} (${rVe(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[n,r,a]}withTimeZone(t){return new Tr(+this,t)}[Symbol.for("constructDateFrom")](t){return new Tr(+new Date(t),this.timeZone)}}const nE=5,sVe=4;function lVe(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,a=t.addDays(e,-r+1),i=t.addDays(a,nE*7-1);return t.getMonth(e)===t.getMonth(i)?nE:sVe}function Sz(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function cVe(e,t){const n=Sz(e,t),r=lVe(e,t);return t.addDays(n,r*7-1)}const _z={...sc,labels:{labelDayButton:(e,t,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(s,u)=>uc(s,u,{locale:sc,...n});let i=a(e,"PPPP");return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,i)=>uc(a,i,{locale:sc,...t}),r(e,"LLLL yyyy")},labelGridcell:(e,t,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(s,u)=>uc(s,u,{locale:sc,...n});let i=a(e,"PPPP");return t?.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,i)=>uc(a,i,{locale:sc,...t}),r(e,"cccc")}}};class za{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Tr.tz(this.options.timeZone):new this.Date,this.newDate=(r,a,i)=>this.overrides?.newDate?this.overrides.newDate(r,a,i):this.options.timeZone?new Tr(r,a,i,this.options.timeZone):new Date(r,a,i),this.addDays=(r,a)=>this.overrides?.addDays?this.overrides.addDays(r,a):XN(r,a),this.addMonths=(r,a)=>this.overrides?.addMonths?this.overrides.addMonths(r,a):JN(r,a),this.addWeeks=(r,a)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,a):zwe(r,a),this.addYears=(r,a)=>this.overrides?.addYears?this.overrides.addYears(r,a):Fwe(r,a),this.differenceInCalendarDays=(r,a)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,a):Y3(r,a),this.differenceInCalendarMonths=(r,a)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,a):Z3(r,a),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Qwe(r),this.eachYearOfInterval=r=>{const a=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):e8e(r),i=new Set(a.map(u=>this.getYear(u)));if(i.size===a.length)return a;const s=[];return i.forEach(u=>{s.push(new Date(u,0,1))}),s},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):cVe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):t8e(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):nj(r),this.endOfWeek=(r,a)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,a):oj(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Jwe(r),this.format=(r,a,i)=>{const s=this.overrides?.format?this.overrides.format(r,a,this.options):uc(r,a,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(s):s},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):Q3(r),this.getMonth=(r,a)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):eMe(r,this.options),this.getYear=(r,a)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):tMe(r,this.options),this.getWeek=(r,a)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):X3(r,this.options),this.isAfter=(r,a)=>this.overrides?.isAfter?this.overrides.isAfter(r,a):nMe(r,a),this.isBefore=(r,a)=>this.overrides?.isBefore?this.overrides.isBefore(r,a):rMe(r,a),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):tj(r),this.isSameDay=(r,a)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,a):Uwe(r,a),this.isSameMonth=(r,a)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,a):aMe(r,a),this.isSameYear=(r,a)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,a):oMe(r,a),this.max=r=>this.overrides?.max?this.overrides.max(r):$we(r),this.min=r=>this.overrides?.min?this.overrides.min(r):qwe(r),this.setMonth=(r,a)=>this.overrides?.setMonth?this.overrides.setMonth(r,a):iMe(r,a),this.setYear=(r,a)=>this.overrides?.setYear?this.overrides.setYear(r,a):sMe(r,a),this.startOfBroadcastWeek=(r,a)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):jh(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Nh(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Xwe(r),this.startOfWeek=(r,a)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):fd(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):aj(r),this.options={locale:_z,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let a=0;a<10;a++)r[a.toString()]=n.format(a);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&za.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:a}=this.options,i=n?.code;if(i&&za.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:a}).format(t)}catch{}const s=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,s)}}za.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const ui=new za;class Cz{constructor(t,n,r=ui){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r,this.isoDate=r.format(t,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class uVe{constructor(t,n){this.date=t,this.weeks=n}}class dVe{constructor(t,n){this.days=n,this.weekNumber=t}}function hVe(e){return X.createElement("button",{...e})}function fVe(e){return X.createElement("span",{...e})}function pVe(e){const{size:t=24,orientation:n="left",className:r}=e;return X.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&X.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&X.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&X.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&X.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function yVe(e){const{day:t,modifiers:n,...r}=e;return X.createElement("td",{...r})}function mVe(e){const{day:t,modifiers:n,...r}=e,a=X.useRef(null);return X.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),X.createElement("button",{ref:a,...r})}var He;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(He||(He={}));var mn;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(mn||(mn={}));var bo;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(bo||(bo={}));var Aa;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Aa||(Aa={}));function gVe(e){const{options:t,className:n,components:r,classNames:a,...i}=e,s=[a[He.Dropdown],n].join(" "),u=t?.find(({value:c})=>c===i.value);return X.createElement("span",{"data-disabled":i.disabled,className:a[He.DropdownRoot]},X.createElement(r.Select,{className:s,...i},t?.map(({value:c,label:d,disabled:p})=>X.createElement(r.Option,{key:c,value:c,disabled:p},d))),X.createElement("span",{className:a[He.CaptionLabel],"aria-hidden":!0},u?.label,X.createElement(r.Chevron,{orientation:"down",size:18,className:a[He.Chevron]})))}function vVe(e){return X.createElement("div",{...e})}function kVe(e){return X.createElement("div",{...e})}function xVe(e){const{calendarMonth:t,displayIndex:n,...r}=e;return X.createElement("div",{...r},e.children)}function bVe(e){const{calendarMonth:t,displayIndex:n,...r}=e;return X.createElement("div",{...r})}function wVe(e){return X.createElement("table",{...e})}function MVe(e){return X.createElement("div",{...e})}const Ez=x.createContext(void 0);function Pf(){const e=x.useContext(Ez);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function SVe(e){const{components:t}=Pf();return X.createElement(t.Dropdown,{...e})}function _Ve(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:a,...i}=e,{components:s,classNames:u,labels:{labelPrevious:c,labelNext:d}}=Pf(),p=x.useCallback(v=>{a&&n?.(v)},[a,n]),y=x.useCallback(v=>{r&&t?.(v)},[r,t]);return X.createElement("nav",{...i},X.createElement(s.PreviousMonthButton,{type:"button",className:u[He.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:y},X.createElement(s.Chevron,{disabled:r?void 0:!0,className:u[He.Chevron],orientation:"left"})),X.createElement(s.NextMonthButton,{type:"button",className:u[He.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":d(a),onClick:p},X.createElement(s.Chevron,{disabled:a?void 0:!0,orientation:"right",className:u[He.Chevron]})))}function CVe(e){const{components:t}=Pf();return X.createElement(t.Button,{...e})}function EVe(e){return X.createElement("option",{...e})}function AVe(e){const{components:t}=Pf();return X.createElement(t.Button,{...e})}function RVe(e){const{rootRef:t,...n}=e;return X.createElement("div",{...n,ref:t})}function OVe(e){return X.createElement("select",{...e})}function TVe(e){const{week:t,...n}=e;return X.createElement("tr",{...n})}function NVe(e){return X.createElement("th",{...e})}function jVe(e){return X.createElement("thead",{"aria-hidden":!0},X.createElement("tr",{...e}))}function IVe(e){const{week:t,...n}=e;return X.createElement("th",{...n})}function PVe(e){return X.createElement("th",{...e})}function DVe(e){return X.createElement("tbody",{...e})}function LVe(e){const{components:t}=Pf();return X.createElement(t.Dropdown,{...e})}const zVe=Object.freeze(Object.defineProperty({__proto__:null,Button:hVe,CaptionLabel:fVe,Chevron:pVe,Day:yVe,DayButton:mVe,Dropdown:gVe,DropdownNav:vVe,Footer:kVe,Month:xVe,MonthCaption:bVe,MonthGrid:wVe,Months:MVe,MonthsDropdown:SVe,Nav:_Ve,NextMonthButton:CVe,Option:EVe,PreviousMonthButton:AVe,Root:RVe,Select:OVe,Week:TVe,WeekNumber:IVe,WeekNumberHeader:PVe,Weekday:NVe,Weekdays:jVe,Weeks:DVe,YearsDropdown:LVe},Symbol.toStringTag,{value:"Module"}));function Vi(e,t,n=!1,r=ui){let{from:a,to:i}=e;const{differenceInCalendarDays:s,isSameDay:u}=r;return a&&i?(s(i,a)<0&&([a,i]=[i,a]),s(t,a)>=(n?1:0)&&s(i,t)>=(n?1:0)):!n&&i?u(i,t):!n&&a?u(a,t):!1}function A6(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function jm(e){return!!(e&&typeof e=="object"&&"from"in e)}function R6(e){return!!(e&&typeof e=="object"&&"after"in e)}function O6(e){return!!(e&&typeof e=="object"&&"before"in e)}function Az(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Rz(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Wi(e,t,n=ui){const r=Array.isArray(t)?t:[t],{isSameDay:a,differenceInCalendarDays:i,isAfter:s}=n;return r.some(u=>{if(typeof u=="boolean")return u;if(n.isDate(u))return a(e,u);if(Rz(u,n))return u.some(c=>a(e,c));if(jm(u))return Vi(u,e,!1,n);if(Az(u))return Array.isArray(u.dayOfWeek)?u.dayOfWeek.includes(e.getDay()):u.dayOfWeek===e.getDay();if(A6(u)){const c=i(u.before,e),d=i(u.after,e),p=c>0,y=d<0;return s(u.before,u.after)?y&&p:p||y}return R6(u)?i(e,u.after)>0:O6(u)?i(u.before,e)>0:typeof u=="function"?u(e):!1})}function FVe(e,t,n,r,a){const{disabled:i,hidden:s,modifiers:u,showOutsideDays:c,broadcastCalendar:d,today:p=a.today()}=t,{isSameDay:y,isSameMonth:v,startOfMonth:k,isBefore:b,endOfMonth:M,isAfter:_}=a,C=n&&k(n),E=r&&M(r),A={[mn.focused]:[],[mn.outside]:[],[mn.disabled]:[],[mn.hidden]:[],[mn.today]:[]},R={};for(const O of e){const{date:N,displayMonth:P}=O,L=!!(P&&!v(N,P)),I=!!(C&&b(N,C)),D=!!(E&&_(N,E)),H=!!(i&&Wi(N,i,a)),K=!!(s&&Wi(N,s,a))||I||D||!d&&!c&&L||d&&c===!1&&L,W=y(N,p);L&&A.outside.push(O),H&&A.disabled.push(O),K&&A.hidden.push(O),W&&A.today.push(O),u&&Object.keys(u).forEach(Y=>{const q=u?.[Y];q&&Wi(N,q,a)&&(R[Y]?R[Y].push(O):R[Y]=[O])})}return O=>{const N={[mn.focused]:!1,[mn.disabled]:!1,[mn.hidden]:!1,[mn.outside]:!1,[mn.today]:!1},P={};for(const L in A){const I=A[L];N[L]=I.some(D=>D===O)}for(const L in R)P[L]=R[L].some(I=>I===O);return{...N,...P}}}function $Ve(e,t,n={}){return Object.entries(e).filter(([,a])=>a===!0).reduce((a,[i])=>(n[i]?a.push(n[i]):t[mn[i]]?a.push(t[mn[i]]):t[bo[i]]&&a.push(t[bo[i]]),a),[t[He.Day]])}function qVe(e){return{...zVe,...e}}function HVe(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function UVe(){const e={};for(const t in He)e[He[t]]=`rdp-${He[t]}`;for(const t in mn)e[mn[t]]=`rdp-${mn[t]}`;for(const t in bo)e[bo[t]]=`rdp-${bo[t]}`;for(const t in Aa)e[Aa[t]]=`rdp-${Aa[t]}`;return e}function Oz(e,t,n){return(n??new za(t)).formatMonthYear(e)}const BVe=Oz;function VVe(e,t,n){return(n??new za(t)).format(e,"d")}function WVe(e,t=ui){return t.format(e,"LLLL")}function KVe(e,t,n){return(n??new za(t)).format(e,"cccccc")}function GVe(e,t=ui){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function YVe(){return""}function Tz(e,t=ui){return t.format(e,"yyyy")}const ZVe=Tz,QVe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Oz,formatDay:VVe,formatMonthCaption:BVe,formatMonthDropdown:WVe,formatWeekNumber:GVe,formatWeekNumberHeader:YVe,formatWeekdayName:KVe,formatYearCaption:ZVe,formatYearDropdown:Tz},Symbol.toStringTag,{value:"Module"}));function XVe(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...QVe,...e}}function T6(e,t,n,r){let a=(r??new za(n)).format(e,"PPPP");return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a}const JVe=T6;function N6(e,t,n){return(n??new za(t)).formatMonthYear(e)}const eWe=N6;function Nz(e,t,n,r){let a=(r??new za(n)).format(e,"PPPP");return t?.today&&(a=`Today, ${a}`),a}function jz(e){return"Choose the Month"}function Iz(){return""}const tWe="Go to the Next Month";function Pz(e,t){return tWe}function Dz(e){return"Go to the Previous Month"}function Lz(e,t,n){return(n??new za(t)).format(e,"cccc")}function zz(e,t){return`Week ${e}`}function Fz(e){return"Week Number"}function $z(e){return"Choose the Year"}const nWe=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:eWe,labelDay:JVe,labelDayButton:T6,labelGrid:N6,labelGridcell:Nz,labelMonthDropdown:jz,labelNav:Iz,labelNext:Pz,labelPrevious:Dz,labelWeekNumber:zz,labelWeekNumberHeader:Fz,labelWeekday:Lz,labelYearDropdown:$z},Symbol.toStringTag,{value:"Module"})),vo=(e,t,n)=>t||(n?typeof n=="function"?n:(...r)=>n:e);function rWe(e,t){const n=t.locale?.labels??{};return{...nWe,...e??{},labelDayButton:vo(T6,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:vo(jz,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:vo(Pz,e?.labelNext,n.labelNext),labelPrevious:vo(Dz,e?.labelPrevious,n.labelPrevious),labelWeekNumber:vo(zz,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:vo($z,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:vo(N6,e?.labelGrid,n.labelGrid),labelGridcell:vo(Nz,e?.labelGridcell,n.labelGridcell),labelNav:vo(Iz,e?.labelNav,n.labelNav),labelWeekNumberHeader:vo(Fz,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:vo(Lz,e?.labelWeekday,n.labelWeekday)}}function aWe(e,t,n,r,a){const{startOfMonth:i,startOfYear:s,endOfYear:u,eachMonthOfInterval:c,getMonth:d}=a;return c({start:s(e),end:u(e)}).map(v=>{const k=r.formatMonthDropdown(v,a),b=d(v),M=t&&v<i(t)||n&&v>i(n)||!1;return{value:b,label:k,disabled:M}})}function oWe(e,t={},n={}){let r={...t?.[He.Day]};return Object.entries(e).filter(([,a])=>a===!0).forEach(([a])=>{r={...r,...n?.[a]}}),r}function iWe(e,t,n,r){const a=r??e.today(),i=n?e.startOfBroadcastWeek(a,e):t?e.startOfISOWeek(a):e.startOfWeek(a),s=[];for(let u=0;u<7;u++){const c=e.addDays(i,u);s.push(c)}return s}function sWe(e,t,n,r,a=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:s,eachYearOfInterval:u,getYear:c}=r,d=i(e),p=s(t),y=u({start:d,end:p});return a&&y.reverse(),y.map(v=>{const k=n.formatYearDropdown(v,r);return{value:c(v),label:k,disabled:!1}})}function lWe(e,t={}){const{weekStartsOn:n,locale:r}=t,a=n??r?.options?.weekStartsOn??0,i=u=>{const c=typeof u=="number"||typeof u=="string"?new Date(u):u;return new Tr(c.getFullYear(),c.getMonth(),c.getDate(),12,0,0,e)},s=u=>{const c=i(u);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>i(Tr.tz(e)),newDate:(u,c,d)=>new Tr(u,c,d,12,0,0,e),startOfDay:u=>i(u),startOfWeek:(u,c)=>{const d=i(u),p=c?.weekStartsOn??a,y=(d.getDay()-p+7)%7;return d.setDate(d.getDate()-y),d},startOfISOWeek:u=>{const c=i(u),d=(c.getDay()-1+7)%7;return c.setDate(c.getDate()-d),c},startOfMonth:u=>{const c=i(u);return c.setDate(1),c},startOfYear:u=>{const c=i(u);return c.setMonth(0,1),c},endOfWeek:(u,c)=>{const d=i(u),v=(((c?.weekStartsOn??a)+6)%7-d.getDay()+7)%7;return d.setDate(d.getDate()+v),d},endOfISOWeek:u=>{const c=i(u),d=(7-c.getDay())%7;return c.setDate(c.getDate()+d),c},endOfMonth:u=>{const c=i(u);return c.setMonth(c.getMonth()+1,0),c},endOfYear:u=>{const c=i(u);return c.setMonth(11,31),c},eachMonthOfInterval:u=>{const c=i(u.start),d=i(u.end),p=[],y=new Tr(c.getFullYear(),c.getMonth(),1,12,0,0,e),v=d.getFullYear()*12+d.getMonth();for(;y.getFullYear()*12+y.getMonth()<=v;)p.push(new Tr(y,e)),y.setMonth(y.getMonth()+1,1);return p},addDays:(u,c)=>{const d=i(u);return d.setDate(d.getDate()+c),d},addWeeks:(u,c)=>{const d=i(u);return d.setDate(d.getDate()+c*7),d},addMonths:(u,c)=>{const d=i(u);return d.setMonth(d.getMonth()+c),d},addYears:(u,c)=>{const d=i(u);return d.setFullYear(d.getFullYear()+c),d},eachYearOfInterval:u=>{const c=i(u.start),d=i(u.end),p=[],y=new Tr(c.getFullYear(),0,1,12,0,0,e);for(;y.getFullYear()<=d.getFullYear();)p.push(new Tr(y,e)),y.setFullYear(y.getFullYear()+1,0,1);return p},getWeek:(u,c)=>{const d=s(u);return X3(d,{weekStartsOn:c?.weekStartsOn??a,firstWeekContainsDate:c?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:u=>{const c=s(u);return Q3(c)},differenceInCalendarDays:(u,c)=>{const d=s(u),p=s(c);return Y3(d,p)},differenceInCalendarMonths:(u,c)=>{const d=s(u),p=s(c);return Z3(d,p)}}}const Df=e=>e instanceof HTMLElement?e:null,P4=e=>[...e.querySelectorAll("[data-animated-month]")??[]],cWe=e=>Df(e.querySelector("[data-animated-month]")),D4=e=>Df(e.querySelector("[data-animated-caption]")),L4=e=>Df(e.querySelector("[data-animated-weeks]")),uWe=e=>Df(e.querySelector("[data-animated-nav]")),dWe=e=>Df(e.querySelector("[data-animated-weekdays]"));function hWe(e,t,{classNames:n,months:r,focused:a,dateLib:i}){const s=x.useRef(null),u=x.useRef(r),c=x.useRef(!1);x.useLayoutEffect(()=>{const d=u.current;if(u.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||d.length===0||r.length!==d.length)return;const p=i.isSameMonth(r[0].date,d[0].date),y=i.isAfter(r[0].date,d[0].date),v=y?n[Aa.caption_after_enter]:n[Aa.caption_before_enter],k=y?n[Aa.weeks_after_enter]:n[Aa.weeks_before_enter],b=s.current,M=e.current.cloneNode(!0);if(M instanceof HTMLElement?(P4(M).forEach(A=>{if(!(A instanceof HTMLElement))return;const R=cWe(A);R&&A.contains(R)&&A.removeChild(R);const O=D4(A);O&&O.classList.remove(v);const N=L4(A);N&&N.classList.remove(k)}),s.current=M):s.current=null,c.current||p||a)return;const _=b instanceof HTMLElement?P4(b):[],C=P4(e.current);if(C?.every(E=>E instanceof HTMLElement)&&_&&_.every(E=>E instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const E=uWe(e.current);E&&(E.style.zIndex="1"),C.forEach((A,R)=>{const O=_[R];if(!O)return;A.style.position="relative",A.style.overflow="hidden";const N=D4(A);N&&N.classList.add(v);const P=L4(A);P&&P.classList.add(k);const L=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),E&&(E.style.zIndex=""),N&&N.classList.remove(v),P&&P.classList.remove(k),A.style.position="",A.style.overflow="",A.contains(O)&&A.removeChild(O)};O.style.pointerEvents="none",O.style.position="absolute",O.style.overflow="hidden",O.setAttribute("aria-hidden","true");const I=dWe(O);I&&(I.style.opacity="0");const D=D4(O);D&&(D.classList.add(y?n[Aa.caption_before_exit]:n[Aa.caption_after_exit]),D.addEventListener("animationend",L));const H=L4(O);H&&H.classList.add(y?n[Aa.weeks_before_exit]:n[Aa.weeks_after_exit]),A.insertBefore(O,A.firstChild)})}})}function fWe(e,t,n,r){const a=e[0],i=e[e.length-1],{ISOWeek:s,fixedWeeks:u,broadcastCalendar:c}=n??{},{addDays:d,differenceInCalendarDays:p,differenceInCalendarMonths:y,endOfBroadcastWeek:v,endOfISOWeek:k,endOfMonth:b,endOfWeek:M,isAfter:_,startOfBroadcastWeek:C,startOfISOWeek:E,startOfWeek:A}=r,R=c?C(a,r):s?E(a):A(a),O=c?v(i):s?k(b(i)):M(b(i)),N=t&&(c?v(t):s?k(t):M(t)),P=N&&_(O,N)?N:O,L=p(P,R),I=y(i,a)+1,D=[];for(let W=0;W<=L;W++){const Y=d(R,W);D.push(Y)}const K=(c?35:42)*I;if(u&&D.length<K){const W=K-D.length;for(let Y=0;Y<W;Y++){const q=d(D[D.length-1],1);D.push(q)}}return D}function pWe(e){const t=[];return e.reduce((n,r)=>{const a=r.weeks.reduce((i,s)=>i.concat(s.days.slice()),t.slice());return n.concat(a.slice())},t.slice())}function yWe(e,t,n,r){const{numberOfMonths:a=1}=n,i=[];for(let s=0;s<a;s++){const u=r.addMonths(e,s);if(t&&u>t)break;i.push(u)}return i}function rE(e,t,n,r){const{month:a,defaultMonth:i,today:s=r.today(),numberOfMonths:u=1}=e;let c=a||i||s;const{differenceInCalendarMonths:d,addMonths:p,startOfMonth:y}=r;if(n&&d(n,c)<u-1){const v=-1*(u-1);c=p(n,v)}return t&&d(c,t)<0&&(c=t),y(c)}function mWe(e,t,n,r){const{addDays:a,endOfBroadcastWeek:i,endOfISOWeek:s,endOfMonth:u,endOfWeek:c,getISOWeek:d,getWeek:p,startOfBroadcastWeek:y,startOfISOWeek:v,startOfWeek:k}=r,b=e.reduce((M,_)=>{const C=n.broadcastCalendar?y(_,r):n.ISOWeek?v(_):k(_),E=n.broadcastCalendar?i(_):n.ISOWeek?s(u(_)):c(u(_)),A=t.filter(P=>P>=C&&P<=E),R=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length<R){const P=t.filter(L=>{const I=R-A.length;return L>E&&L<=a(E,I)});A.push(...P)}const O=A.reduce((P,L)=>{const I=n.ISOWeek?d(L):p(L),D=P.find(K=>K.weekNumber===I),H=new Cz(L,_,r);return D?D.days.push(H):P.push(new dVe(I,[H])),P},[]),N=new uVe(_,O);return M.push(N),M},[]);return n.reverseMonths?b.reverse():b}function gWe(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:a,startOfDay:i,startOfMonth:s,endOfMonth:u,addYears:c,endOfYear:d,newDate:p,today:y}=t,{fromYear:v,toYear:k,fromMonth:b,toMonth:M}=e;!n&&b&&(n=b),!n&&v&&(n=t.newDate(v,0,1)),!r&&M&&(r=M),!r&&k&&(r=p(k,11,31));const _=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=s(n):v?n=p(v,0,1):!n&&_&&(n=a(c(e.today??y(),-100))),r?r=u(r):k?r=p(k,11,31):!r&&_&&(r=d(e.today??y())),[n&&i(n),r&&i(r)]}function vWe(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:i=1}=n,{startOfMonth:s,addMonths:u,differenceInCalendarMonths:c}=r,d=a?i:1,p=s(e);if(!t)return u(p,d);if(!(c(t,e)<i))return u(p,d)}function kWe(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:i}=n,{startOfMonth:s,addMonths:u,differenceInCalendarMonths:c}=r,d=a?i??1:1,p=s(e);if(!t)return u(p,-d);if(!(c(p,t)<=0))return u(p,-d)}function xWe(e){const t=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),t.slice())}function Im(e,t){const[n,r]=x.useState(e);return[t===void 0?n:t,r]}function bWe(e,t){const[n,r]=gWe(e,t),{startOfMonth:a,endOfMonth:i}=t,s=rE(e,n,r,t),[u,c]=Im(s,e.month?s:void 0);x.useEffect(()=>{const R=rE(e,n,r,t);c(R)},[e.timeZone]);const{months:d,weeks:p,days:y,previousMonth:v,nextMonth:k}=x.useMemo(()=>{const R=yWe(u,r,{numberOfMonths:e.numberOfMonths},t),O=fWe(R,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),N=mWe(R,O,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),P=xWe(N),L=pWe(N),I=kWe(u,n,e,t),D=vWe(u,r,e,t);return{months:N,weeks:P,days:L,previousMonth:I,nextMonth:D}},[t,u.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:b,onMonthChange:M}=e,_=R=>p.some(O=>O.days.some(N=>N.isEqualTo(R))),C=R=>{if(b)return;let O=a(R);n&&O<a(n)&&(O=a(n)),r&&O>a(r)&&(O=a(r)),c(O),M?.(O)};return{months:d,weeks:p,days:y,navStart:n,navEnd:r,previousMonth:v,nextMonth:k,goToMonth:C,goToDay:R=>{_(R)||C(R.date)}}}var Ko;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Ko||(Ko={}));function aE(e){return!e[mn.disabled]&&!e[mn.hidden]&&!e[mn.outside]}function wWe(e,t,n,r){let a,i=-1;for(const s of e){const u=t(s);aE(u)&&(u[mn.focused]&&i<Ko.FocusedModifier?(a=s,i=Ko.FocusedModifier):r?.isEqualTo(s)&&i<Ko.LastFocused?(a=s,i=Ko.LastFocused):n(s.date)&&i<Ko.Selected?(a=s,i=Ko.Selected):u[mn.today]&&i<Ko.Today&&(a=s,i=Ko.Today))}return a||(a=e.find(s=>aE(t(s)))),a}function MWe(e,t,n,r,a,i,s){const{ISOWeek:u,broadcastCalendar:c}=i,{addDays:d,addMonths:p,addWeeks:y,addYears:v,endOfBroadcastWeek:k,endOfISOWeek:b,endOfWeek:M,max:_,min:C,startOfBroadcastWeek:E,startOfISOWeek:A,startOfWeek:R}=s;let N={day:d,week:y,month:p,year:v,startOfWeek:P=>c?E(P,s):u?A(P):R(P),endOfWeek:P=>c?k(P):u?b(P):M(P)}[e](n,t==="after"?1:-1);return t==="before"&&r?N=_([r,N]):t==="after"&&a&&(N=C([a,N])),N}function qz(e,t,n,r,a,i,s,u=0){if(u>365)return;const c=MWe(e,t,n.date,r,a,i,s),d=!!(i.disabled&&Wi(c,i.disabled,s)),p=!!(i.hidden&&Wi(c,i.hidden,s)),y=c,v=new Cz(c,y,s);return!d&&!p?v:qz(e,t,v,r,a,i,s,u+1)}function SWe(e,t,n,r,a){const{autoFocus:i}=e,[s,u]=x.useState(),c=wWe(t.days,n,r||(()=>!1),s),[d,p]=x.useState(i?c:void 0);return{isFocusTarget:M=>!!c?.isEqualTo(M),setFocused:p,focused:d,blur:()=>{u(d),p(void 0)},moveFocus:(M,_)=>{if(!d)return;const C=qz(M,_,d,t.navStart,t.navEnd,e,a);C&&(e.disableNavigation&&!t.days.some(A=>A.isEqualTo(C))||(t.goToDay(C),p(C)))}}}function _We(e,t){const{selected:n,required:r,onSelect:a}=e,[i,s]=Im(n,a?n:void 0),u=a?n:i,{isSameDay:c}=t,d=k=>u?.some(b=>c(b,k))??!1,{min:p,max:y}=e;return{selected:u,select:(k,b,M)=>{let _=[...u??[]];if(d(k)){if(u?.length===p||r&&u?.length===1)return;_=u?.filter(C=>!c(C,k))}else u?.length===y?_=[k]:_=[..._,k];return a||s(_),a?.(_,k,b,M),_},isSelected:d}}function CWe(e,t,n=0,r=0,a=!1,i=ui){const{from:s,to:u}=t||{},{isSameDay:c,isAfter:d,isBefore:p}=i;let y;if(!s&&!u)y={from:e,to:n>0?void 0:e};else if(s&&!u)c(s,e)?n===0?y={from:s,to:e}:a?y={from:s,to:void 0}:y=void 0:p(e,s)?y={from:e,to:s}:y={from:s,to:e};else if(s&&u)if(c(s,e)&&c(u,e))a?y={from:s,to:u}:y=void 0;else if(c(s,e))y={from:s,to:n>0?void 0:e};else if(c(u,e))y={from:e,to:n>0?void 0:e};else if(p(e,s))y={from:e,to:u};else if(d(e,s))y={from:s,to:e};else if(d(e,u))y={from:s,to:e};else throw new Error("Invalid range");if(y?.from&&y?.to){const v=i.differenceInCalendarDays(y.to,y.from);r>0&&v>r?y={from:e,to:void 0}:n>1&&v<n&&(y={from:e,to:void 0})}return y}function EWe(e,t,n=ui){const r=Array.isArray(t)?t:[t];let a=e.from;const i=n.differenceInCalendarDays(e.to,e.from),s=Math.min(i,6);for(let u=0;u<=s;u++){if(r.includes(a.getDay()))return!0;a=n.addDays(a,1)}return!1}function oE(e,t,n=ui){return Vi(e,t.from,!1,n)||Vi(e,t.to,!1,n)||Vi(t,e.from,!1,n)||Vi(t,e.to,!1,n)}function AWe(e,t,n=ui){const r=Array.isArray(t)?t:[t];if(r.filter(u=>typeof u!="function").some(u=>typeof u=="boolean"?u:n.isDate(u)?Vi(e,u,!1,n):Rz(u,n)?u.some(c=>Vi(e,c,!1,n)):jm(u)?u.from&&u.to?oE(e,{from:u.from,to:u.to},n):!1:Az(u)?EWe(e,u.dayOfWeek,n):A6(u)?n.isAfter(u.before,u.after)?oE(e,{from:n.addDays(u.after,1),to:n.addDays(u.before,-1)},n):Wi(e.from,u,n)||Wi(e.to,u,n):R6(u)||O6(u)?Wi(e.from,u,n)||Wi(e.to,u,n):!1))return!0;const s=r.filter(u=>typeof u=="function");if(s.length){let u=e.from;const c=n.differenceInCalendarDays(e.to,e.from);for(let d=0;d<=c;d++){if(s.some(p=>p(u)))return!0;u=n.addDays(u,1)}}return!1}function RWe(e,t){const{disabled:n,excludeDisabled:r,resetOnSelect:a,selected:i,required:s,onSelect:u}=e,[c,d]=Im(i,u?i:void 0),p=u?i:c;return{selected:p,select:(k,b,M)=>{const{min:_,max:C}=e;let E;if(k){const A=p?.from,R=p?.to,O=!!A&&!!R,N=!!A&&!!R&&t.isSameDay(A,R)&&t.isSameDay(k,A);a&&(O||!p?.from)?!s&&N?E=void 0:E={from:k,to:void 0}:E=CWe(k,p,_,C,s,t)}return r&&n&&E?.from&&E.to&&AWe({from:E.from,to:E.to},n,t)&&(E.from=k,E.to=void 0),u||d(E),u?.(E,k,b,M),E},isSelected:k=>p&&Vi(p,k,!1,t)}}function OWe(e,t){const{selected:n,required:r,onSelect:a}=e,[i,s]=Im(n,a?n:void 0),u=a?n:i,{isSameDay:c}=t;return{selected:u,select:(y,v,k)=>{let b=y;return!r&&u&&u&&c(y,u)&&(b=void 0),a||s(b),a?.(b,y,v,k),b},isSelected:y=>u?c(u,y):!1}}function TWe(e,t){const n=OWe(e,t),r=_We(e,t),a=RWe(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return a;default:return}}function Xa(e,t){return e instanceof Tr&&e.timeZone===t?e:new Tr(e,t)}function Uu(e,t,n){return Xa(e,t)}function iE(e,t,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Uu(e,t):Array.isArray(e)?e.map(r=>r instanceof Date?Uu(r,t):r):jm(e)?{...e,from:e.from?Xa(e.from,t):e.from,to:e.to?Xa(e.to,t):e.to}:A6(e)?{before:Uu(e.before,t),after:Uu(e.after,t)}:R6(e)?{after:Uu(e.after,t)}:O6(e)?{before:Uu(e.before,t)}:e}function z4(e,t,n){return e&&(Array.isArray(e)?e.map(r=>iE(r,t)):iE(e,t))}function NWe(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=Xa(t.today,n)),t.month&&(t.month=Xa(t.month,n)),t.defaultMonth&&(t.defaultMonth=Xa(t.defaultMonth,n)),t.startMonth&&(t.startMonth=Xa(t.startMonth,n)),t.endMonth&&(t.endMonth=Xa(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=Xa(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(qe=>Xa(qe,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?Xa(t.selected.from,n):t.selected.from,to:t.selected.to?Xa(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=z4(t.disabled,n)),t.hidden!==void 0&&(t.hidden=z4(t.hidden,n)),t.modifiers)){const qe={};Object.keys(t.modifiers).forEach(at=>{qe[at]=z4(t.modifiers?.[at],n)}),t.modifiers=qe}const{components:r,formatters:a,labels:i,dateLib:s,locale:u,classNames:c}=x.useMemo(()=>{const qe={..._z,...t.locale},at=t.broadcastCalendar?1:t.weekStartsOn,Ie=t.noonSafe&&t.timeZone?lWe(t.timeZone,{weekStartsOn:at,locale:qe}):void 0,Ze=t.dateLib&&Ie?{...Ie,...t.dateLib}:t.dateLib??Ie,sn=new za({locale:qe,weekStartsOn:at,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},Ze);return{dateLib:sn,components:qVe(t.components),formatters:XVe(t.formatters),labels:rWe(t.labels,sn.options),locale:qe,classNames:{...UVe(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:s.today()});const{captionLayout:d,mode:p,navLayout:y,numberOfMonths:v=1,onDayBlur:k,onDayClick:b,onDayFocus:M,onDayKeyDown:_,onDayMouseEnter:C,onDayMouseLeave:E,onNextClick:A,onPrevClick:R,showWeekNumber:O,styles:N}=t,{formatCaption:P,formatDay:L,formatMonthDropdown:I,formatWeekNumber:D,formatWeekNumberHeader:H,formatWeekdayName:K,formatYearDropdown:W}=a,Y=bWe(t,s),{days:q,months:$,navStart:B,navEnd:J,previousMonth:te,nextMonth:z,goToMonth:U}=Y,V=FVe(q,t,B,J,s),{isSelected:j,select:Z,selected:ee}=TWe(t,s)??{},{blur:le,focused:se,isFocusTarget:pe,moveFocus:fe,setFocused:_e}=SWe(t,Y,V,j??(()=>!1),s),{labelDayButton:me,labelGridcell:Re,labelGrid:Nt,labelMonthDropdown:we,labelNav:Fe,labelPrevious:lt,labelNext:gt,labelWeekday:Tt,labelWeekNumber:Ge,labelWeekNumberHeader:dt,labelYearDropdown:jn}=i,ct=x.useMemo(()=>iWe(s,t.ISOWeek,t.broadcastCalendar,t.today),[s,t.ISOWeek,t.broadcastCalendar,t.today]),Jt=p!==void 0||b!==void 0,ut=x.useCallback(()=>{te&&(U(te),R?.(te))},[te,U,R]),Xe=x.useCallback(()=>{z&&(U(z),A?.(z))},[U,z,A]),oe=x.useCallback((qe,at)=>Ie=>{Ie.preventDefault(),Ie.stopPropagation(),_e(qe),!at.disabled&&(Z?.(qe.date,at,Ie),b?.(qe.date,at,Ie))},[Z,b,_e]),ge=x.useCallback((qe,at)=>Ie=>{_e(qe),M?.(qe.date,at,Ie)},[M,_e]),ze=x.useCallback((qe,at)=>Ie=>{le(),k?.(qe.date,at,Ie)},[le,k]),Ye=x.useCallback((qe,at)=>Ie=>{const Ze={ArrowLeft:[Ie.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[Ie.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[Ie.shiftKey?"year":"week","after"],ArrowUp:[Ie.shiftKey?"year":"week","before"],PageUp:[Ie.shiftKey?"year":"month","before"],PageDown:[Ie.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ze[Ie.key]){Ie.preventDefault(),Ie.stopPropagation();const[sn,Me]=Ze[Ie.key];fe(sn,Me)}_?.(qe.date,at,Ie)},[fe,_,t.dir]),Je=x.useCallback((qe,at)=>Ie=>{C?.(qe.date,at,Ie)},[C]),hn=x.useCallback((qe,at)=>Ie=>{E?.(qe.date,at,Ie)},[E]),on=x.useCallback(qe=>at=>{const Ie=Number(at.target.value),Ze=s.setMonth(s.startOfMonth(qe),Ie);U(Ze)},[s,U]),Ht=x.useCallback(qe=>at=>{const Ie=Number(at.target.value),Ze=s.setYear(s.startOfMonth(qe),Ie);U(Ze)},[s,U]),{className:jt,style:cn}=x.useMemo(()=>({className:[c[He.Root],t.className].filter(Boolean).join(" "),style:{...N?.[He.Root],...t.style}}),[c,t.className,t.style,N]),vt=HVe(t),dr=x.useRef(null);hWe(dr,!!t.animate,{classNames:c,months:$,focused:se,dateLib:s});const Cn={dayPickerProps:t,selected:ee,select:Z,isSelected:j,months:$,nextMonth:z,previousMonth:te,goToMonth:U,getModifiers:V,components:r,classNames:c,styles:N,labels:i,formatters:a};return X.createElement(Ez.Provider,{value:Cn},X.createElement(r.Root,{rootRef:t.animate?dr:void 0,className:jt,style:cn,dir:t.dir,id:t.id,lang:t.lang??u.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...vt},X.createElement(r.Months,{className:c[He.Months],style:N?.[He.Months]},!t.hideNavigation&&!y&&X.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[He.Nav],style:N?.[He.Nav],"aria-label":Fe(),onPreviousClick:ut,onNextClick:Xe,previousMonth:te,nextMonth:z}),$.map((qe,at)=>X.createElement(r.Month,{"data-animated-month":t.animate?"true":void 0,className:c[He.Month],style:N?.[He.Month],key:at,displayIndex:at,calendarMonth:qe},y==="around"&&!t.hideNavigation&&at===0&&X.createElement(r.PreviousMonthButton,{type:"button",className:c[He.PreviousMonthButton],tabIndex:te?void 0:-1,"aria-disabled":te?void 0:!0,"aria-label":lt(te),onClick:ut,"data-animated-button":t.animate?"true":void 0},X.createElement(r.Chevron,{disabled:te?void 0:!0,className:c[He.Chevron],orientation:t.dir==="rtl"?"right":"left"})),X.createElement(r.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[He.MonthCaption],style:N?.[He.MonthCaption],calendarMonth:qe,displayIndex:at},d?.startsWith("dropdown")?X.createElement(r.DropdownNav,{className:c[He.Dropdowns],style:N?.[He.Dropdowns]},(()=>{const Ie=d==="dropdown"||d==="dropdown-months"?X.createElement(r.MonthsDropdown,{key:"month",className:c[He.MonthsDropdown],"aria-label":we(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:on(qe.date),options:aWe(qe.date,B,J,a,s),style:N?.[He.Dropdown],value:s.getMonth(qe.date)}):X.createElement("span",{key:"month"},I(qe.date,s)),Ze=d==="dropdown"||d==="dropdown-years"?X.createElement(r.YearsDropdown,{key:"year",className:c[He.YearsDropdown],"aria-label":jn(s.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Ht(qe.date),options:sWe(B,J,a,s,!!t.reverseYears),style:N?.[He.Dropdown],value:s.getYear(qe.date)}):X.createElement("span",{key:"year"},W(qe.date,s));return s.getMonthYearOrder()==="year-first"?[Ze,Ie]:[Ie,Ze]})(),X.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},P(qe.date,s.options,s))):X.createElement(r.CaptionLabel,{className:c[He.CaptionLabel],role:"status","aria-live":"polite"},P(qe.date,s.options,s))),y==="around"&&!t.hideNavigation&&at===v-1&&X.createElement(r.NextMonthButton,{type:"button",className:c[He.NextMonthButton],tabIndex:z?void 0:-1,"aria-disabled":z?void 0:!0,"aria-label":gt(z),onClick:Xe,"data-animated-button":t.animate?"true":void 0},X.createElement(r.Chevron,{disabled:z?void 0:!0,className:c[He.Chevron],orientation:t.dir==="rtl"?"left":"right"})),at===v-1&&y==="after"&&!t.hideNavigation&&X.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[He.Nav],style:N?.[He.Nav],"aria-label":Fe(),onPreviousClick:ut,onNextClick:Xe,previousMonth:te,nextMonth:z}),X.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":p==="multiple"||p==="range","aria-label":Nt(qe.date,s.options,s)||void 0,className:c[He.MonthGrid],style:N?.[He.MonthGrid]},!t.hideWeekdays&&X.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[He.Weekdays],style:N?.[He.Weekdays]},O&&X.createElement(r.WeekNumberHeader,{"aria-label":dt(s.options),className:c[He.WeekNumberHeader],style:N?.[He.WeekNumberHeader],scope:"col"},H()),ct.map(Ie=>X.createElement(r.Weekday,{"aria-label":Tt(Ie,s.options,s),className:c[He.Weekday],key:String(Ie),style:N?.[He.Weekday],scope:"col"},K(Ie,s.options,s)))),X.createElement(r.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[He.Weeks],style:N?.[He.Weeks]},qe.weeks.map(Ie=>X.createElement(r.Week,{className:c[He.Week],key:Ie.weekNumber,style:N?.[He.Week],week:Ie},O&&X.createElement(r.WeekNumber,{week:Ie,style:N?.[He.WeekNumber],"aria-label":Ge(Ie.weekNumber,{locale:u}),className:c[He.WeekNumber],scope:"row",role:"rowheader"},D(Ie.weekNumber,s)),Ie.days.map(Ze=>{const{date:sn}=Ze,Me=V(Ze);if(Me[mn.focused]=!Me.hidden&&!!se?.isEqualTo(Ze),Me[bo.selected]=j?.(sn)||Me.selected,jm(ee)){const{from:hr,to:$t}=ee;Me[bo.range_start]=!!(hr&&$t&&s.isSameDay(sn,hr)),Me[bo.range_end]=!!(hr&&$t&&s.isSameDay(sn,$t)),Me[bo.range_middle]=Vi(ee,sn,!0,s)}const Gt=oWe(Me,N,t.modifiersStyles),Ct=$Ve(Me,c,t.modifiersClassNames),In=!Jt&&!Me.hidden?Re(sn,Me,s.options,s):void 0;return X.createElement(r.Day,{key:`${Ze.isoDate}_${Ze.displayMonthId}`,day:Ze,modifiers:Me,className:Ct.join(" "),style:Gt,role:"gridcell","aria-selected":Me.selected||void 0,"aria-label":In,"data-day":Ze.isoDate,"data-month":Ze.outside?Ze.dateMonthId:void 0,"data-selected":Me.selected||void 0,"data-disabled":Me.disabled||void 0,"data-hidden":Me.hidden||void 0,"data-outside":Ze.outside||void 0,"data-focused":Me.focused||void 0,"data-today":Me.today||void 0},!Me.hidden&&Jt?X.createElement(r.DayButton,{className:c[He.DayButton],style:N?.[He.DayButton],type:"button",day:Ze,modifiers:Me,disabled:!Me.focused&&Me.disabled||void 0,"aria-disabled":Me.focused&&Me.disabled||void 0,tabIndex:pe(Ze)?0:-1,"aria-label":me(sn,Me,s.options,s),onClick:oe(Ze,Me),onBlur:ze(Ze,Me),onFocus:ge(Ze,Me),onKeyDown:Ye(Ze,Me),onMouseEnter:Je(Ze,Me),onMouseLeave:hn(Ze,Me)},L(sn,s.options,s)):!Me.hidden&&L(Ze.date,s.options,s))})))))))),t.footer&&X.createElement(r.Footer,{className:c[He.Footer],style:N?.[He.Footer],role:"status","aria-live":"polite"},t.footer)))}function jWe({className:e,classNames:t,showOutsideDays:n=!0,...r}){return h.jsx(NWe,{showOutsideDays:n,className:ve("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",month_caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",button_previous:ve(L0({variant:"outline"}),"absolute left-1 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:ve(L0({variant:"outline"}),"absolute right-1 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse space-y-1",weekdays:"flex",weekday:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",week:"flex w-full mt-2",day:"relative p-0 text-center text-sm focus-within:relative focus-within:z-20",day_button:ve(L0({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),range_start:"day-range-start",range_end:"day-range-end",selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",today:"bg-accent text-accent-foreground",outside:"text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",disabled:"text-muted-foreground opacity-50",range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",hidden:"invisible",...t},components:{Chevron:({orientation:a})=>{const i=a==="left"?YA:Br;return h.jsx(i,{className:"h-4 w-4"})}},...r})}jWe.displayName="Calendar";const IWe=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{className:"relative w-full overflow-auto",children:h.jsx("table",{ref:n,className:ve("w-full caption-bottom text-sm",e),...t})}));IWe.displayName="Table";const PWe=x.forwardRef(({className:e,...t},n)=>h.jsx("thead",{ref:n,className:ve("[&_tr]:border-b",e),...t}));PWe.displayName="TableHeader";const DWe=x.forwardRef(({className:e,...t},n)=>h.jsx("tbody",{ref:n,className:ve("[&_tr:last-child]:border-0",e),...t}));DWe.displayName="TableBody";const LWe=x.forwardRef(({className:e,...t},n)=>h.jsx("tr",{ref:n,className:ve("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));LWe.displayName="TableRow";const zWe=x.forwardRef(({className:e,...t},n)=>h.jsx("th",{ref:n,className:ve("h-10 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));zWe.displayName="TableHead";const FWe=x.forwardRef(({className:e,...t},n)=>h.jsx("td",{ref:n,className:ve("p-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));FWe.displayName="TableCell";function $We(e){const t=sUe(e);if(t!==null)return{kind:"inference",id:t};const n=UHe(e);if(n!==null)return{kind:"sandbox",id:n};const r=V0(e);return r!==null?{kind:"sandbox-provider",id:r}:{kind:"connector",id:null}}function qWe(e){return $We(e).kind==="connector"}const HWe=()=>Te(()=>import("./_connectorKey.index-C1QPGf9E.js"),__vite__mapDeps([74,75,8,76,77,7,78])),UWe=Ce("/$owner/connectors/$connectorKey/")({validateSearch:e=>Vn({addAccount:e.addAccount===!0||e.addAccount==="true"?!0:void 0,instances:e.instances===!0||e.instances==="true"?!0:void 0,setup:e.setup==="oauth_app"?"oauth_app":void 0,model:typeof e.model=="string"?e.model:void 0,reason:typeof e.reason=="string"?e.reason:void 0,agentId:typeof e.agentId=="string"?e.agentId:void 0}),loader:({context:{queryClient:e},params:t})=>{e.fetchQuery(vn.queryOptions(t.owner,{slug:t.owner})).then(n=>{const r=n?.workspace?.id;r&&qWe(t.connectorKey)&&(e.prefetchQuery(n3.queryOptions(r)),e.prefetchQuery(sy.queryOptions(r,{connectorKey:t.connectorKey})))}).catch(()=>{})},component:Oe(HWe,"component")}),BWe=()=>Te(()=>import("./index-rrnUF981.js"),[]),VWe=Ce("/$owner/chat/$agentId/")({component:Oe(BWe,"component")}),WWe=()=>Te(()=>import("./index-BgkhXElB.js"),__vite__mapDeps([79,80,47,12,15])),KWe=Ce("/$owner/agents/connect/")({component:Oe(WWe,"component")}),GWe=()=>Te(()=>import("./device._deviceId-BDerBfD9.js"),__vite__mapDeps([81,82,77,7,78,83,8,22])),YWe=Ce("/$owner/connectors/device/$deviceId")({validateSearch:e=>({connection:typeof e.connection=="number"?e.connection:typeof e.connection=="string"&&/^\d+$/.test(e.connection)?Number(e.connection):void 0,settings:e.settings===!0||e.settings==="true"?!0:void 0}),loader:({context:{queryClient:e}})=>e.prefetchQuery(ef.queryOptions()),component:Oe(GWe,"component")}),ZWe=()=>Te(()=>import("./_deploymentId-BeyzVjRm.js"),__vite__mapDeps([84,73,67,33,34,35])),QWe=Ce("/$owner/connectors/deployments/$deploymentId")({component:Oe(ZWe,"component")}),XWe=()=>Te(()=>import("./create._connectorKey-sNHQHNpg.js"),[]),JWe=Ce("/$owner/connectors/create/$connectorKey")({component:Oe(XWe,"component")}),eKe=()=>Te(()=>import("./app._appId-Cl1fTuIt.js"),__vite__mapDeps([85,75,8])),tKe=Ce("/$owner/connectors/app/$appId")({component:Oe(eKe,"component")}),nKe=()=>Te(()=>import("./_connectorKey._connectionId-CefXIqy2.js"),__vite__mapDeps([86,82,77,7,78,83,76,87,61,8])),rKe=Ce("/$owner/connectors/$connectorKey/$connectionId")({validateSearch:e=>Vn({settings:e.settings===!0||e.settings==="true"?!0:void 0,auth_result:e.auth_result==="connected"||e.auth_result==="cancelled"||e.auth_result==="failed"?e.auth_result:void 0,addFeed:e.addFeed===!0||e.addFeed==="true"?!0:void 0,feedId:typeof e.feedId=="number"?e.feedId:typeof e.feedId=="string"&&/^\d+$/.test(e.feedId)?Number(e.feedId):void 0}),loaderDeps:({search:{feedId:e}})=>({feedId:e}),loader:({context:{queryClient:e},params:t,deps:n})=>{e.fetchQuery(vn.queryOptions(t.owner,{slug:t.owner})).then(r=>{const a=r?.workspace?.id;a&&(e.prefetchQuery(sy.queryOptions(a,{connectorKey:t.connectorKey,connectionIds:[Number(t.connectionId)]})),e.prefetchQuery(KR.queryOptions(a)),n.feedId!==void 0&&e.prefetchQuery(YR.queryOptions(Number(t.connectionId))))}).catch(()=>{})},component:Oe(nKe,"component")}),aKe=()=>Te(()=>import("./connected._clientId-sgtocSvf.js"),[]),oKe=Ce("/$owner/agents/connected/$clientId")({component:Oe(aKe,"component")}),iKe=()=>Te(()=>import("./connect._clientId-Dj0SqgbE.js"),__vite__mapDeps([88,80,47,12,15])),sKe=Ce("/$owner/agents/connect/$clientId")({component:Oe(iKe,"component")}),lKe=()=>Te(()=>import("./skills-Drw5tcZw.js"),__vite__mapDeps([89,90,38,63])),cKe=Ce("/$owner/agents/$agentId/skills")({component:Oe(lKe,"component")}),Hz={validateSearch:e=>({run_id:wz(e.run_id)}),loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))}},uKe=()=>Te(()=>import("./settings-DgX1-xo7.js"),__vite__mapDeps([91,71,69,62,66])),dKe=Ce("/$owner/agents/$agentId/settings")({...Hz,component:Oe(uKe,"component")}),hKe=()=>Te(()=>import("./permissions-C_auqxfP.js"),__vite__mapDeps([92,51,93])),fKe=Ce("/$owner/agents/$agentId/permissions")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))},component:Oe(hKe,"component")}),pKe=()=>Te(()=>import("./models-D7aED5Sa.js"),__vite__mapDeps([94,71,69,62,66])),yKe=Ce("/$owner/agents/$agentId/models")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))},component:Oe(pKe,"component")}),mKe=()=>Te(()=>import("./identity-B0nH4yiC.js"),__vite__mapDeps([95,71,69,62,66])),gKe=Ce("/$owner/agents/$agentId/identity")({...Hz,component:Oe(mKe,"component")}),vKe=()=>Te(()=>import("./guardrails-B8Rs1be3.js"),[]),kKe=Ce("/$owner/agents/$agentId/guardrails")({component:Oe(vKe,"component")}),xKe=()=>Te(()=>import("./_shape-DtVfRFz_.js"),__vite__mapDeps([96,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),bKe=new Set(["table","board"]),wKe=Ce("/$owner/$entityType/-/$shape")({validateSearch:e=>({$collection:yc(e.$collection),$preset:yc(e.$preset),$table:yc(e.$table),segment:typeof e.segment=="string"&&e.segment?e.segment:void 0}),beforeLoad:({params:e})=>{if(ai(e.entityType)||!bKe.has(e.shape))throw Zi()},component:Oe(xKe,"component")}),MKe=()=>Te(()=>import("./connected._clientId.index-h9X5H1x8.js"),__vite__mapDeps([97,11,12,15])),SKe=Ce("/$owner/agents/connected/$clientId/")({component:Oe(MKe,"component")}),_Ke=()=>Te(()=>import("./index-CoW4Bz3w.js"),__vite__mapDeps([98,99,93,90,38,63,16,100])),CKe=Ce("/$owner/agents/$agentId/skills/")({component:Oe(_Ke,"component")}),EKe=()=>Te(()=>import("./index-DneshLbf.js"),__vite__mapDeps([101,102,62,93,16,100])),AKe=Ce("/$owner/agents/$agentId/guardrails/")({component:Oe(EKe,"component")}),RKe=()=>Te(()=>import("./_viewKey-DHQY9A8u.js"),__vite__mapDeps([103,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),OKe=Ce("/$owner/data/-/views/$viewKey")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:Ib,component:Oe(RKe,"component")}),TKe=()=>Te(()=>import("./_threadId-DtqBFgK5.js"),[]),NKe=Ce("/$owner/chat/$agentId/c/$threadId")({validateSearch:e=>{const t={...Em(e)},n=typeof e.message_id=="string"&&e.message_id.trim()||typeof e.message=="string"&&e.message.trim()||"";return n&&(t.message_id=n),t},component:Oe(TKe,"component")}),jKe=()=>Te(()=>import("./connected._clientId.activity-DTpSW1Xy.js"),__vite__mapDeps([104,11,10,12,13,14,15])),IKe=Ce("/$owner/agents/connected/$clientId/activity")({validateSearch:e=>Vn(e),component:Oe(jKe,"component")}),PKe=()=>Te(()=>import("./create-CwThQtd3.js"),__vite__mapDeps([105,99,93,90,38,63,16,100])),DKe=Ce("/$owner/agents/$agentId/skills/create")({component:Oe(PKe,"component")}),LKe=()=>Te(()=>import("./_skillKey-CqLHzm7L.js"),__vite__mapDeps([106,99,93,90,38,63,16,100])),zKe=Ce("/$owner/agents/$agentId/skills/$skillKey")({component:Oe(LKe,"component")}),FKe=()=>Te(()=>import("./create-Cf5hp6Z8.js"),__vite__mapDeps([107,102,62,93,16,100])),$Ke=Ce("/$owner/agents/$agentId/guardrails/create")({component:Oe(FKe,"component")}),qKe=()=>Te(()=>import("./_name-Dgedji78.js"),__vite__mapDeps([108,102,62,93,16,100])),HKe=Ce("/$owner/agents/$agentId/guardrails/$name")({component:Oe(qKe,"component")}),UKe=()=>Te(()=>import("./_conversationId-DinuPCUp.js"),__vite__mapDeps([109,16,57,40,58,35,10,11,12,13,14])),BKe=Ce("/$owner/agents/$agentId/conversations/$conversationId")({component:Oe(UKe,"component")}),VKe=()=>Te(()=>import("./_viewKey-3CH5w8mr.js"),__vite__mapDeps([110,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),WKe=Ce("/$owner/$entityType/-/views/$viewKey")({validateSearch:AI,beforeLoad:({params:e})=>{if(ai(e.entityType))throw Zi()},component:Oe(VKe,"component")}),KKe=Ce("/$owner/events/$eventId/-/views/$viewKey")({validateSearch:Ib}),xn=V$e.update({id:"/$owner",path:"/$owner",getParentRoute:()=>ga}),GKe=K$e.update({id:"/",path:"/",getParentRoute:()=>ga}),YKe=Y$e.update({id:"/",path:"/",getParentRoute:()=>xn}),ZKe=Q$e.update({id:"/slack/claim",path:"/slack/claim",getParentRoute:()=>ga}),QKe=J$e.update({id:"/orgs/new",path:"/orgs/new",getParentRoute:()=>ga}),XKe=nqe.update({id:"/oauth/device",path:"/oauth/device",getParentRoute:()=>ga}),JKe=aqe.update({id:"/oauth/consent",path:"/oauth/consent",getParentRoute:()=>ga}),eGe=iqe.update({id:"/auth/reset-password",path:"/auth/reset-password",getParentRoute:()=>ga}),tGe=lqe.update({id:"/auth/logout",path:"/auth/logout",getParentRoute:()=>ga}),nGe=uqe.update({id:"/auth/login",path:"/auth/login",getParentRoute:()=>ga}),rGe=hqe.update({id:"/auth/callback",path:"/auth/callback",getParentRoute:()=>ga}),aGe=pqe.update({id:"/auth/accept-invitation",path:"/auth/accept-invitation",getParentRoute:()=>ga}),oGe=mqe.update({id:"/account/settings",path:"/account/settings",getParentRoute:()=>ga}),iGe=vqe.update({id:"/recent",path:"/recent",getParentRoute:()=>xn}),Pl=xqe.update({id:"/connectors",path:"/connectors",getParentRoute:()=>xn}),Pm=wqe.update({id:"/automations",path:"/automations",getParentRoute:()=>xn}),Vd=Sqe.update({id:"/agents",path:"/agents",getParentRoute:()=>xn}),sGe=Aqe.update({id:"/$",path:"/$",getParentRoute:()=>xn}),lGe=Tqe.update({id:"/memory/",path:"/memory/",getParentRoute:()=>xn}),cGe=jqe.update({id:"/members/",path:"/members/",getParentRoute:()=>xn}),uGe=Pqe.update({id:"/events/",path:"/events/",getParentRoute:()=>xn}),dGe=Lqe.update({id:"/data/",path:"/data/",getParentRoute:()=>xn}),hGe=Bqe.update({id:"/",path:"/",getParentRoute:()=>Pl}),fGe=Wqe.update({id:"/chat/",path:"/chat/",getParentRoute:()=>xn}),pGe=Gqe.update({id:"/",path:"/",getParentRoute:()=>Pm}),yGe=Zqe.update({id:"/",path:"/",getParentRoute:()=>Vd}),mGe=Xqe.update({id:"/$entityType/",path:"/$entityType/",getParentRoute:()=>xn}),gGe=eHe.update({id:"/connector/$name/connection",path:"/connector/$name/connection",getParentRoute:()=>ga}),vGe=nHe.update({id:"/settings/organization",path:"/settings/organization",getParentRoute:()=>xn}),kGe=aHe.update({id:"/memory/$",path:"/memory/$",getParentRoute:()=>xn}),j6=iHe.update({id:"/events/$eventId",path:"/events/$eventId",getParentRoute:()=>xn}),xGe=lHe.update({id:"/events/$",path:"/events/$",getParentRoute:()=>xn}),bGe=cHe.update({id:"/entity-types/new",path:"/entity-types/new",getParentRoute:()=>xn}),wGe=dHe.update({id:"/entity-types/$slug",path:"/entity-types/$slug",getParentRoute:()=>xn}),I6=fHe.update({id:"/deployments",path:"/deployments",getParentRoute:()=>Pl}),P6=LBe.update({id:"/create",path:"/create",getParentRoute:()=>Pl}),D6=$Be.update({id:"/chat/$agentId",path:"/chat/$agentId",getParentRoute:()=>xn}),MGe=HBe.update({id:"/new",path:"/new",getParentRoute:()=>Pm}),SGe=VBe.update({id:"/$automationId",path:"/$automationId",getParentRoute:()=>Pm}),_Ge=KBe.update({id:"/new",path:"/new",getParentRoute:()=>Vd}),L6=YBe.update({id:"/connect",path:"/connect",getParentRoute:()=>Vd}),Dl=QBe.update({id:"/$agentId",path:"/$agentId",getParentRoute:()=>Vd}),CGe=XBe.update({id:"/",path:"/",getParentRoute:()=>j6}),EGe=eVe.update({id:"/",path:"/",getParentRoute:()=>I6}),AGe=nVe.update({id:"/",path:"/",getParentRoute:()=>P6}),RGe=UWe.update({id:"/$connectorKey/",path:"/$connectorKey/",getParentRoute:()=>Pl}),OGe=VWe.update({id:"/",path:"/",getParentRoute:()=>D6}),TGe=KWe.update({id:"/",path:"/",getParentRoute:()=>L6}),NGe=YWe.update({id:"/device/$deviceId",path:"/device/$deviceId",getParentRoute:()=>Pl}),jGe=QWe.update({id:"/$deploymentId",path:"/$deploymentId",getParentRoute:()=>I6}),IGe=JWe.update({id:"/$connectorKey",path:"/$connectorKey",getParentRoute:()=>P6}),PGe=tKe.update({id:"/app/$appId",path:"/app/$appId",getParentRoute:()=>Pl}),DGe=rKe.update({id:"/$connectorKey/$connectionId",path:"/$connectorKey/$connectionId",getParentRoute:()=>Pl}),z6=oKe.update({id:"/connected/$clientId",path:"/connected/$clientId",getParentRoute:()=>Vd}),LGe=sKe.update({id:"/$clientId",path:"/$clientId",getParentRoute:()=>L6}),Dm=cKe.update({id:"/skills",path:"/skills",getParentRoute:()=>Dl}),zGe=dKe.update({id:"/settings",path:"/settings",getParentRoute:()=>Dl}),FGe=fKe.update({id:"/permissions",path:"/permissions",getParentRoute:()=>Dl}),$Ge=yKe.update({id:"/models",path:"/models",getParentRoute:()=>Dl}),qGe=gKe.update({id:"/identity",path:"/identity",getParentRoute:()=>Dl}),Lm=kKe.update({id:"/guardrails",path:"/guardrails",getParentRoute:()=>Dl}),HGe=wKe.update({id:"/$entityType/-/$shape",path:"/$entityType/-/$shape",getParentRoute:()=>xn}),UGe=SKe.update({id:"/",path:"/",getParentRoute:()=>z6}),BGe=CKe.update({id:"/",path:"/",getParentRoute:()=>Dm}),VGe=AKe.update({id:"/",path:"/",getParentRoute:()=>Lm}),WGe=OKe.update({id:"/data/-/views/$viewKey",path:"/data/-/views/$viewKey",getParentRoute:()=>xn}),KGe=NKe.update({id:"/c/$threadId",path:"/c/$threadId",getParentRoute:()=>D6}),GGe=IKe.update({id:"/activity",path:"/activity",getParentRoute:()=>z6}),YGe=DKe.update({id:"/create",path:"/create",getParentRoute:()=>Dm}),ZGe=zKe.update({id:"/$skillKey",path:"/$skillKey",getParentRoute:()=>Dm}),QGe=$Ke.update({id:"/create",path:"/create",getParentRoute:()=>Lm}),XGe=HKe.update({id:"/$name",path:"/$name",getParentRoute:()=>Lm}),JGe=BKe.update({id:"/conversations/$conversationId",path:"/conversations/$conversationId",getParentRoute:()=>Dl}),eYe=WKe.update({id:"/$entityType/-/views/$viewKey",path:"/$entityType/-/views/$viewKey",getParentRoute:()=>xn}),tYe=KKe.update({id:"/-/views/$viewKey",path:"/-/views/$viewKey",getParentRoute:()=>j6}),nYe={OwnerAgentsAgentIdGuardrailsNameRoute:XGe,OwnerAgentsAgentIdGuardrailsCreateRoute:QGe,OwnerAgentsAgentIdGuardrailsIndexRoute:VGe},rYe=Lm._addFileChildren(nYe),aYe={OwnerAgentsAgentIdSkillsSkillKeyRoute:ZGe,OwnerAgentsAgentIdSkillsCreateRoute:YGe,OwnerAgentsAgentIdSkillsIndexRoute:BGe},oYe=Dm._addFileChildren(aYe),iYe={OwnerAgentsAgentIdGuardrailsRoute:rYe,OwnerAgentsAgentIdIdentityRoute:qGe,OwnerAgentsAgentIdModelsRoute:$Ge,OwnerAgentsAgentIdPermissionsRoute:FGe,OwnerAgentsAgentIdSettingsRoute:zGe,OwnerAgentsAgentIdSkillsRoute:oYe,OwnerAgentsAgentIdConversationsConversationIdRoute:JGe},sYe=Dl._addFileChildren(iYe),lYe={OwnerAgentsConnectClientIdRoute:LGe,OwnerAgentsConnectIndexRoute:TGe},cYe=L6._addFileChildren(lYe),uYe={OwnerAgentsConnectedClientIdActivityRoute:GGe,OwnerAgentsConnectedClientIdIndexRoute:UGe},dYe=z6._addFileChildren(uYe),hYe={OwnerAgentsAgentIdRoute:sYe,OwnerAgentsConnectRoute:cYe,OwnerAgentsNewRoute:_Ge,OwnerAgentsIndexRoute:yGe,OwnerAgentsConnectedClientIdRoute:dYe},fYe=Vd._addFileChildren(hYe),pYe={OwnerAutomationsAutomationIdRoute:SGe,OwnerAutomationsNewRoute:MGe,OwnerAutomationsIndexRoute:pGe},yYe=Pm._addFileChildren(pYe),mYe={OwnerConnectorsCreateConnectorKeyRoute:IGe,OwnerConnectorsCreateIndexRoute:AGe},gYe=P6._addFileChildren(mYe),vYe={OwnerConnectorsDeploymentsDeploymentIdRoute:jGe,OwnerConnectorsDeploymentsIndexRoute:EGe},kYe=I6._addFileChildren(vYe),xYe={OwnerConnectorsCreateRoute:gYe,OwnerConnectorsDeploymentsRoute:kYe,OwnerConnectorsIndexRoute:hGe,OwnerConnectorsConnectorKeyConnectionIdRoute:DGe,OwnerConnectorsAppAppIdRoute:PGe,OwnerConnectorsDeviceDeviceIdRoute:NGe,OwnerConnectorsConnectorKeyIndexRoute:RGe},bYe=Pl._addFileChildren(xYe),wYe={OwnerChatAgentIdIndexRoute:OGe,OwnerChatAgentIdCThreadIdRoute:KGe},MYe=D6._addFileChildren(wYe),SYe={OwnerEventsEventIdIndexRoute:CGe,OwnerEventsEventIdChar91Char93ViewsViewKeyRoute:tYe},_Ye=j6._addFileChildren(SYe),CYe={OwnerSplatRoute:sGe,OwnerAgentsRoute:fYe,OwnerAutomationsRoute:yYe,OwnerConnectorsRoute:bYe,OwnerRecentRoute:iGe,OwnerIndexRoute:YKe,OwnerChatAgentIdRoute:MYe,OwnerEntityTypesSlugRoute:wGe,OwnerEntityTypesNewRoute:bGe,OwnerEventsSplatRoute:xGe,OwnerEventsEventIdRoute:_Ye,OwnerMemorySplatRoute:kGe,OwnerSettingsOrganizationRoute:vGe,OwnerEntityTypeIndexRoute:mGe,OwnerChatIndexRoute:fGe,OwnerDataIndexRoute:dGe,OwnerEventsIndexRoute:uGe,OwnerMembersIndexRoute:cGe,OwnerMemoryIndexRoute:lGe,OwnerEntityTypeChar91Char93ShapeRoute:HGe,OwnerEntityTypeChar91Char93ViewsViewKeyRoute:eYe,OwnerDataChar91Char93ViewsViewKeyRoute:WGe},EYe=xn._addFileChildren(CYe),AYe={IndexRoute:GKe,OwnerRoute:EYe,AccountSettingsRoute:oGe,AuthAcceptInvitationRoute:aGe,AuthCallbackRoute:rGe,AuthLoginRoute:nGe,AuthLogoutRoute:tGe,AuthResetPasswordRoute:eGe,OauthConsentRoute:JKe,OauthDeviceRoute:XKe,OrgsNewRoute:QKe,SlackClaimRoute:ZKe,ConnectorNameConnectionRoute:gGe},RYe=ga._addFileChildren(AYe)._addFileTypes(),Uz=new Sq({defaultOptions:{queries:{staleTime:1e3*60*5,retry:1}}}),sE=Kh(),OYe=gU({routeTree:RYe,context:{queryClient:Uz},history:sE?Bge(sE):void 0,parseSearch:Lge,stringifySearch:zge,defaultPreload:"intent",defaultPreloadStaleTime:0,defaultErrorComponent:Pge,defaultNotFoundComponent:Nge,defaultPendingComponent:()=>x.createElement(FR),defaultPendingMs:150,defaultPendingMinMs:300});qA();const lE=JV(window.location.search);lE!==window.location.search&&window.history.replaceState(window.history.state,"",`${window.location.pathname}${lE}${window.location.hash}`);{const e=EV(window.location.pathname);e!==window.location.pathname&&window.history.replaceState(window.history.state,"",`${e}${window.location.search}${window.location.hash}`)}const cE=new URLSearchParams(window.location.search).get("lobu_token");if(cE){const e=new URL(window.location.href);e.searchParams.delete("lobu_token");const t=e.pathname+e.search+e.hash;window.location.replace(`/api/exchange-token?token=${encodeURIComponent(cE)}&next=${encodeURIComponent(t)}`),await new Promise(()=>{})}const Bz=document.getElementById("root");if(!Bz)throw new Error("Root element not found");const G0=Bz;CU.createRoot(G0).render(h.jsx(X.StrictMode,{children:h.jsx(Cq,{client:Uz,children:h.jsx(ZV,{children:h.jsx(xU,{router:OYe})})})}));const T0=document.getElementById("ssr-hydrate-shell");if(T0){let e=function(){r||(r=new MutationObserver(()=>{M9(G0)&&s()}),r.observe(G0,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))},t=function(){if(M9(G0)){s();return}e()},n=!1,r=null;const a=()=>{window.removeEventListener(r5,t),r?.disconnect()},i=()=>{T0.remove(),document.getElementById("public-boot-status")?.remove(),document.documentElement.classList.remove("public-app-loading"),a()},s=()=>{n||(n=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(document.documentElement.classList.contains("public-app-loading")){i();return}T0.classList.add("is-hidden"),T0.addEventListener("transitionend",i,{once:!0}),window.setTimeout(i,400)})}))};window.addEventListener(r5,t),window.setTimeout(t,5e3)}else document.getElementById("public-boot-status")?.remove(),document.documentElement.classList.remove("public-app-loading");export{Tn as $,VK as A,ke as B,YA as C,h3 as D,hh as E,DA as F,nqe as G,eqe as H,yn as I,At as J,aqe as K,nn as L,HYe as M,uXe as N,J4 as O,Qn as P,ve as Q,V$e as R,Ft as S,E6 as T,cy as U,iqe as V,Ke as W,ol as X,Jn as Y,SA as Z,Te as _,eD as a,Zs as a$,yO as a0,qYe as a1,Dt as a2,gje as a3,Dx as a4,zYe as a5,BV as a6,FYe as a7,MA as a8,$Ye as a9,ef as aA,qL as aB,xL as aC,NXe as aD,Ys as aE,gXe as aF,np as aG,Uh as aH,IXe as aI,jXe as aJ,fBe as aK,Hqe as aL,Fqe as aM,T4 as aN,TXe as aO,v6 as aP,zqe as aQ,Tge as aR,ZN as aS,LL as aT,yL as aU,Nf as aV,yf as aW,ix as aX,kO as aY,Wqe as aZ,No as a_,pqe as aa,JA as ab,sXe as ac,iXe as ad,nXe as ae,Qh as af,Xt as ag,vqe as ah,PBe as ai,zx as aj,SMe as ak,Aqe as al,Cp as am,_qe as an,uy as ao,FR as ap,Pqe as aq,IZe as ar,Lqe as as,Bqe as at,_ve as au,n3 as av,r3 as aw,xXe as ax,ZHe as ay,hke as az,p3 as b,PC as b$,gS as b0,fj as b1,qQe as b2,Ude as b3,Ske as b4,noe as b5,EZ as b6,Gx as b7,zpe as b8,$ue as b9,HHe as bA,Ihe as bB,lz as bC,GYe as bD,YYe as bE,XYe as bF,bve as bG,UR as bH,Fa as bI,gn as bJ,JYe as bK,eZe as bL,VYe as bM,GUe as bN,T1e as bO,qXe as bP,vh as bQ,FXe as bR,kse as bS,yte as bT,od as bU,QZe as bV,Kh as bW,IA as bX,Hge as bY,nHe as bZ,ry as b_,Gle as ba,BA as bb,Wx as bc,mf as bd,eR as be,Ux as bf,Gqe as bg,sf as bh,Mke as bi,ay as bj,hj as bk,Zqe as bl,Xqe as bm,Ch as bn,Tc as bo,Ws as bp,Fi as bq,Ks as br,$i as bs,Hr as bt,ZYe as bu,KYe as bv,QYe as bw,tZe as bx,Ox as by,Oge as bz,my as c,uae as c$,Ib as c0,iHe as c1,uL as c2,lHe as c3,WN as c4,H0 as c5,bl as c6,Vwe as c7,bp as c8,sc as c9,RQe as cA,s3 as cB,w9 as cC,Mme as cD,eo as cE,ar as cF,lke as cG,TQe as cH,OQe as cI,ai as cJ,Ewe as cK,Uxe as cL,eQe as cM,aR as cN,IQe as cO,YR as cP,cye as cQ,fR as cR,g3 as cS,ia as cT,Owe as cU,AV as cV,Zh as cW,YK as cX,LZ as cY,yR as cZ,$x as c_,DS as ca,k0 as cb,DQe as cc,Td as cd,PQe as ce,Hwe as cf,KR as cg,rt as ch,MZe as ci,EZe as cj,Dje as ck,Lje as cl,Pje as cm,zje as cn,Bx as co,hXe as cp,Ad as cq,Tje as cr,CV as cs,JY as ct,GA as cu,O$e as cv,ZG as cw,br as cx,tr as cy,Yh as cz,gy as d,ey as d$,GZe as d0,uc as d1,Vr as d2,LZe as d3,DZe as d4,oO as d5,bZe as d6,sy as d7,kMe as d8,YZe as d9,jh as dA,Kwe as dB,Xwe as dC,Wr as dD,lMe as dE,Br as dF,TA as dG,ZQe as dH,Oq as dI,ir as dJ,gwe as dK,vwe as dL,Joe as dM,HN as dN,e3 as dO,gQe as dP,tQe as dQ,vQe as dR,Gs as dS,EJ as dT,mae as dU,jx as dV,G2e as dW,cXe as dX,cMe as dY,Fje as dZ,ZA as d_,ZZe as da,BZe as db,VZe as dc,WZe as dd,KZe as de,iO as df,O0e as dg,qN as dh,Goe as di,PZe as dj,rO as dk,bQ as dl,AQe as dm,BYe as dn,Kx as dp,XN as dq,zHe as dr,PL as ds,FHe as dt,af as du,My as dv,Sy as dw,_y as dx,ja as dy,jWe as dz,vy as e,G3 as e$,ty as e0,Ix as e1,fpe as e2,x$e as e3,p6 as e4,H9 as e5,hR as e6,FQe as e7,AZe as e8,RZe as e9,pz as eA,nBe as eB,hx as eC,eBe as eD,$He as eE,aee as eF,QA as eG,HZ as eH,xQe as eI,bQe as eJ,xR as eK,jYe as eL,ni as eM,iQe as eN,pQe as eO,yQe as eP,oQe as eQ,SHe as eR,PUe as eS,gT as eT,vT as eU,CQe as eV,rQe as eW,TYe as eX,ns as eY,sQe as eZ,Fy as e_,Nve as ea,jve as eb,cl as ec,ul as ed,id as ee,M6 as ef,S6 as eg,_6 as eh,zZe as ei,FZe as ej,UZe as ek,$Ze as el,qZe as em,HZe as en,ny as eo,IWe as ep,PWe as eq,LWe as er,zWe as es,AK as et,$K as eu,DWe as ev,FWe as ew,X as ex,rBe as ey,ua as ez,Am as f,YXe as f$,_ke as f0,jfe as f1,dQe as f2,UYe as f3,zL as f4,LAe as f5,fm as f6,KQe as f7,VAe as f8,zAe as f9,Tbe as fA,Ne as fB,lo as fC,HT as fD,Kr as fE,EI as fF,lXe as fG,QQe as fH,mQe as fI,DK as fJ,rR as fK,AJ as fL,lQe as fM,hz as fN,uQe as fO,aQe as fP,EV as fQ,fXe as fR,GQe as fS,yfe as fT,BXe as fU,xve as fV,VXe as fW,GXe as fX,KXe as fY,WXe as fZ,ZXe as f_,WQe as fa,yc as fb,WAe as fc,VQe as fd,KAe as fe,PAe as ff,Jie as fg,PJ as fh,of as fi,Vae as fj,hQe as fk,_V as fl,QAe as fm,JZe as fn,GAe as fo,cQe as fp,XQe as fq,_0e as fr,Hi as fs,VA as ft,_A as fu,A3 as fv,Xi as fw,Qe as fx,ao as fy,Obe as fz,OMe as g,Eh as g$,C6 as g0,Bp as g1,ZUe as g2,QUe as g3,HXe as g4,dx as g5,UXe as g6,JQe as g7,dHe as g8,mHe as g9,K3e as gA,ebe as gB,$H as gC,QE as gD,nA as gE,Lae as gF,Cye as gG,Wie as gH,$ie as gI,XZe as gJ,NK as gK,HBe as gL,nQe as gM,Vh as gN,Kp as gO,M3 as gP,wy as gQ,S3 as gR,_3 as gS,C3 as gT,uZe as gU,HQe as gV,UQe as gW,BQe as gX,$Qe as gY,zQe as gZ,Iie as g_,yHe as ga,pHe as gb,IBe as gc,nZe as gd,vke as ge,vO as gf,VR as gg,$Be as gh,rZe as gi,iZe as gj,WV as gk,SQe as gl,nR as gm,aZ as gn,ete as go,lZe as gp,Cue as gq,Nhe as gr,yke as gs,jW as gt,Cme as gu,QG as gv,gZe as gw,vZe as gx,G3e as gy,Z3e as gz,vn as h,kL as h$,yXe as h0,mXe as h1,VBe as h2,oZe as h3,wQe as h4,tJe as h5,Wh as h6,KBe as h7,fZe as h8,pZe as h9,SXe as hA,EXe as hB,CXe as hC,MXe as hD,_Xe as hE,wXe as hF,AXe as hG,RXe as hH,MQe as hI,Ehe as hJ,sx as hK,qUe as hL,Tve as hM,Rve as hN,vz as hO,fx as hP,Om as hQ,Bh as hR,Ave as hS,SZe as hT,IUe as hU,jUe as hV,UWe as hW,$We as hX,ch as hY,$Xe as hZ,AUe as h_,yZe as ha,mZe as hb,nJe as hc,QBe as hd,K6e as he,G6e as hf,AN as hg,b5 as hh,Afe as hi,Hhe as hj,tR as hk,pR as hl,eVe as hm,C1e as hn,nne as ho,nVe as hp,eJe as hq,n5 as hr,PYe as hs,pXe as ht,bXe as hu,kXe as hv,vXe as hw,YHe as hx,dZe as hy,hZe as hz,wr as i,HKe as i$,ox as i0,BC as i1,Zu as i2,OZe as i3,YN as i4,VUe as i5,S5 as i6,uW as i7,MR as i8,NQe as i9,JWe as iA,PXe as iB,tKe as iC,rKe as iD,_Ze as iE,soe as iF,wZe as iG,CZe as iH,Oue as iI,sKe as iJ,cKe as iK,dKe as iL,fKe as iM,yKe as iN,gKe as iO,wKe as iP,SKe as iQ,CKe as iR,gHe as iS,AKe as iT,sZe as iU,cZe as iV,OKe as iW,IKe as iX,DKe as iY,zKe as iZ,$Ke as i_,jQe as ia,LQe as ib,KWe as ic,Cve as id,NZe as ie,pL as ig,m6 as ih,DUe as ii,jZe as ij,TZe as ik,dXe as il,dUe as im,OXe as io,g$e as ip,v$e as iq,X8e as ir,YWe as is,QXe as it,XXe as iu,bBe as iv,zXe as iw,JXe as ix,a3 as iy,QWe as iz,h as j,aZe as j0,BKe as j1,WKe as j2,kZe as j3,xZe as j4,WC as j5,WUe as j6,WHe as j7,Vp as j8,KHe as j9,Eve as ja,kQe as jb,YQe as jc,_$e as jd,u$e as je,zC as jf,Yse as jg,_je as jh,eXe as ji,fQe as jj,tXe as jk,$V as k,WYe as l,n3e as m,Mr as n,cr as o,Ed as p,ri as q,x as r,GR as s,lf as t,y6 as u,Y$e as v,Nc as w,IYe as x,J$e as y,la as z};
|
|
7950
|
-
//# sourceMappingURL=index-
|
|
7949
|
+
*/var fUe={L:Ju.QrCode.Ecc.LOW,M:Ju.QrCode.Ecc.MEDIUM,Q:Ju.QrCode.Ecc.QUARTILE,H:Ju.QrCode.Ecc.HIGH},BL=128,VL="L",WL="#FFFFFF",KL="#000000",GL=!1,YL=1,pUe=4,yUe=0,mUe=.1;function ZL(e,t=0){const n=[];return e.forEach(function(r,a){let i=null;r.forEach(function(s,u){if(!s&&i!==null){n.push(`M${i+t} ${a+t}h${u-i}v1H${i+t}z`),i=null;return}if(u===r.length-1){if(!s)return;i===null?n.push(`M${u+t},${a+t} h1v1H${u+t}z`):n.push(`M${i+t},${a+t} h${u+1-i}v1H${i+t}z`);return}s&&i===null&&(i=u)})}),n.join("")}function QL(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((a,i)=>i<t.x||i>=t.x+t.w?a:!1))}function gUe(e,t,n,r){if(r==null)return null;const a=e.length+n*2,i=Math.floor(t*mUe),s=a/t,u=(r.width||i)*s,c=(r.height||i)*s,d=r.x==null?e.length/2-u/2:r.x*s,p=r.y==null?e.length/2-c/2:r.y*s,y=r.opacity==null?1:r.opacity;let v=null;if(r.excavate){let b=Math.floor(d),M=Math.floor(p),_=Math.ceil(u+d-b),C=Math.ceil(c+p-M);v={x:b,y:M,w:_,h:C}}const k=r.crossOrigin;return{x:d,y:p,h:c,w:u,excavation:v,opacity:y,crossOrigin:k}}function vUe(e,t){return t!=null?Math.max(Math.floor(t),0):e?pUe:yUe}function XL({value:e,level:t,minVersion:n,includeMargin:r,marginSize:a,imageSettings:i,size:s,boostLevel:u}){let c=X.useMemo(()=>{const b=(Array.isArray(e)?e:[e]).reduce((M,_)=>(M.push(...Ju.QrSegment.makeSegments(_)),M),[]);return Ju.QrCode.encodeSegments(b,fUe[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:d,margin:p,numCells:y,calculatedImageSettings:v}=X.useMemo(()=>{let k=c.getModules();const b=vUe(r,a),M=k.length+b*2,_=gUe(k,s,b,i);return{cells:k,margin:b,numCells:M,calculatedImageSettings:_}},[c,s,i,r,a]);return{qrcode:c,margin:p,cells:d,numCells:y,calculatedImageSettings:v}}var kUe=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),xUe=X.forwardRef(function(t,n){const r=t,{value:a,size:i=BL,level:s=VL,bgColor:u=WL,fgColor:c=KL,includeMargin:d=GL,minVersion:p=YL,boostLevel:y,marginSize:v,imageSettings:k}=r,M=ux(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:_}=M,C=ux(M,["style"]),E=k?.src,A=X.useRef(null),R=X.useRef(null),O=X.useCallback(Y=>{A.current=Y,typeof n=="function"?n(Y):n&&(n.current=Y)},[n]),[N,P]=X.useState(!1),{margin:L,cells:I,numCells:D,calculatedImageSettings:H}=XL({value:a,level:s,minVersion:p,boostLevel:y,includeMargin:d,marginSize:v,imageSettings:k,size:i});X.useEffect(()=>{if(A.current!=null){const Y=A.current,q=Y.getContext("2d");if(!q)return;let $=I;const B=R.current,J=H!=null&&B!==null&&B.complete&&B.naturalHeight!==0&&B.naturalWidth!==0;J&&H.excavation!=null&&($=QL(I,H.excavation));const te=window.devicePixelRatio||1;Y.height=Y.width=i*te;const z=i/D*te;q.scale(z,z),q.fillStyle=u,q.fillRect(0,0,D,D),q.fillStyle=c,kUe?q.fill(new Path2D(ZL($,L))):I.forEach(function(U,V){U.forEach(function(j,Z){j&&q.fillRect(Z+L,V+L,1,1)})}),H&&(q.globalAlpha=H.opacity),J&&q.drawImage(B,H.x+L,H.y+L,H.w,H.h)}}),X.useEffect(()=>{P(!1)},[E]);const K=cx({height:i,width:i},_);let W=null;return E!=null&&(W=X.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{P(!0)},ref:R,crossOrigin:H?.crossOrigin})),X.createElement(X.Fragment,null,X.createElement("canvas",cx({style:K,height:i,width:i,ref:O,role:"img"},C)),W)});xUe.displayName="QRCodeCanvas";var JL=X.forwardRef(function(t,n){const r=t,{value:a,size:i=BL,level:s=VL,bgColor:u=WL,fgColor:c=KL,includeMargin:d=GL,minVersion:p=YL,boostLevel:y,title:v,marginSize:k,imageSettings:b}=r,M=ux(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:_,cells:C,numCells:E,calculatedImageSettings:A}=XL({value:a,level:s,minVersion:p,boostLevel:y,includeMargin:d,marginSize:k,imageSettings:b,size:i});let R=C,O=null;b!=null&&A!=null&&(A.excavation!=null&&(R=QL(C,A.excavation)),O=X.createElement("image",{href:b.src,height:A.h,width:A.w,x:A.x+_,y:A.y+_,preserveAspectRatio:"none",opacity:A.opacity,crossOrigin:A.crossOrigin}));const N=ZL(R,_);return X.createElement("svg",cx({height:i,width:i,viewBox:`0 0 ${E} ${E}`,ref:n,role:"img"},M),!!v&&X.createElement("title",null,v),X.createElement("path",{fill:u,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),X.createElement("path",{fill:c,d:N,shapeRendering:"crispEdges"}),O)});JL.displayName="QRCodeSVG";function bUe(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`}function ez({expiresAt:e}){const[t,n]=x.useState(()=>Date.now());x.useEffect(()=>{const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[]);const a=new Date(e).getTime()-t,i=a<=0;return h.jsx("span",{className:`text-xs font-mono ${i?"text-destructive":"text-muted-foreground"}`,children:i?"Expired — waiting for refresh…":`Expires in ${bUe(a)}`})}function wUe({artifact:e}){return h.jsxs("div",{className:"space-y-3",children:[h.jsx("div",{className:"flex justify-center",children:h.jsx("div",{className:"rounded-md bg-white p-3 border",children:h.jsx(JL,{value:e.value,size:220,level:"M"})})}),e.expiresAt&&h.jsx("div",{className:"flex justify-center",children:h.jsx(ez,{expiresAt:e.expiresAt})}),e.instructions&&h.jsx("p",{className:"text-sm text-muted-foreground text-center",children:e.instructions})]})}function MUe({artifact:e}){const[t,n]=x.useState(!1),r=x.useCallback(async()=>{try{await navigator.clipboard.writeText(e.value.replace(/[^A-Za-z0-9]/g,"")),n(!0),setTimeout(()=>n(!1),1500)}catch{}},[e.value]);return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-center gap-2",children:[h.jsx("code",{className:"font-mono text-2xl tracking-widest px-4 py-2 rounded bg-muted border",children:e.value}),h.jsx(ke,{variant:"outline",size:"sm",onClick:()=>void r(),children:t?h.jsxs(h.Fragment,{children:[h.jsx(ja,{className:"h-3.5 w-3.5 mr-1.5"})," Copied"]}):h.jsxs(h.Fragment,{children:[h.jsx(Eh,{className:"h-3.5 w-3.5 mr-1.5"})," Copy"]})})]}),e.expiresAt&&h.jsx("div",{className:"flex justify-center",children:h.jsx(ez,{expiresAt:e.expiresAt})}),e.instructions&&h.jsx("p",{className:"text-sm text-muted-foreground text-center",children:e.instructions})]})}function SUe({artifact:e,runId:t}){const n=eO(),[r,a]=x.useState(!1),i=x.useCallback(()=>{e.mode==="popup"?window.open(e.url,"_blank","noopener,noreferrer,width=600,height=700"):window.location.href=e.url,a(!0)},[e.mode,e.url]),s=x.useCallback(()=>{n.mutateAsync({run_id:t,name:e.awaitSignal,payload:{}})},[n,t,e.awaitSignal]);return h.jsxs("div",{className:"space-y-3",children:[e.instructions&&h.jsx("p",{className:"text-sm text-muted-foreground",children:e.instructions}),h.jsxs("div",{className:"flex flex-col items-stretch gap-2",children:[h.jsxs(ke,{onClick:i,children:[h.jsx(Yh,{className:"h-4 w-4 mr-2"}),r?"Re-open authorization page":"Open authorization page"]}),r&&h.jsx(ke,{variant:"outline",onClick:s,disabled:n.isPending,children:n.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"})," Notifying…"]}):"I have completed authorization"})]})]})}function _Ue({artifact:e,runId:t}){const n=eO(),[r,a]=x.useState({}),i=x.useCallback(u=>{u.preventDefault(),n.mutateAsync({run_id:t,name:e.submitSignal,payload:r})},[n,t,e.submitSignal,r]),s=e.fields.every(u=>!u.required||(r[u.key]??"").trim().length>0);return h.jsxs("form",{onSubmit:i,className:"space-y-3",children:[e.instructions&&h.jsx("p",{className:"text-sm text-muted-foreground",children:e.instructions}),e.fields.map(u=>h.jsxs("div",{className:"space-y-1",children:[h.jsxs("label",{htmlFor:`auth-field-${u.key}`,className:"text-xs font-medium",children:[u.label,u.required&&h.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),h.jsx(yn,{id:`auth-field-${u.key}`,type:u.kind==="password"?"password":"text",inputMode:u.kind==="otp"?"numeric":void 0,autoComplete:u.kind==="otp"?"one-time-code":void 0,value:r[u.key]??"",onChange:c=>a(d=>({...d,[u.key]:c.target.value}))})]},u.key)),h.jsx(ke,{type:"submit",disabled:!s||n.isPending,className:"w-full",children:n.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"})," Submitting…"]}):"Submit"})]})}function CUe({artifact:e}){return h.jsxs("div",{className:"flex items-center gap-3 py-2",children:[h.jsx(Dt,{size:"xl",className:"text-muted-foreground"}),h.jsx("span",{className:"text-sm text-muted-foreground",children:e.message})]})}function tz({artifact:e,runId:t}){switch(e.type){case"qr":return h.jsx(wUe,{artifact:e});case"code":return h.jsx(MUe,{artifact:e});case"redirect":return h.jsx(SUe,{artifact:e,runId:t});case"prompt":return h.jsx(_Ue,{artifact:e,runId:t});case"status":return h.jsx(CUe,{artifact:e})}}function EUe({runId:e,onClose:t}){const{data:n,isLoading:r}=JR(e),a=x.useMemo(()=>n?.status==="completed"||n?.status==="failed"||n?.status==="cancelled",[n?.status]);x.useEffect(()=>{if(n?.status==="completed"){const s=setTimeout(()=>t(!0),1500);return()=>clearTimeout(s)}},[n?.status,t]);const i=e!=null;return h.jsx(M3,{open:i,onOpenChange:s=>{s||t(n?.status==="completed")},children:h.jsxs(wy,{className:"sm:max-w-md",children:[h.jsxs(S3,{children:[h.jsx(_3,{children:n?.status==="completed"?"Connection authorized":n?.status==="failed"?"Authorization failed":n?.status==="cancelled"?"Authorization cancelled":"Connect your account"}),h.jsx(C3,{children:n?.connector_key?`Complete sign-in for ${n.connector_key} to finish setup. You can add feeds later if you want scheduled syncs.`:"Complete sign-in to finish setup. You can add feeds later if you want scheduled syncs."})]}),h.jsxs("div",{className:"py-2 space-y-4",children:[r&&!n&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(Dt,{size:"lg"})," Preparing…"]}),n?.status==="completed"&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-emerald-600",children:[h.jsx(Ix,{className:"h-5 w-5"})," Success — closing…"]}),n?.status==="failed"&&h.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive flex items-start gap-2",children:[h.jsx(JA,{className:"h-4 w-4 mt-0.5 shrink-0"}),h.jsx("span",{children:n.error_message||"Authentication failed."})]}),n?.status==="cancelled"&&h.jsxs("div",{className:"rounded-md border p-3 text-sm text-muted-foreground flex items-start gap-2",children:[h.jsx(ty,{className:"h-4 w-4 mt-0.5 shrink-0"}),h.jsx("span",{children:"Authorization was cancelled."})]}),!a&&n&&!n.artifact&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(Dt,{size:"lg"})," Waiting for connector…"]}),!a&&n?.artifact&&e!=null&&h.jsx(tz,{artifact:n.artifact,runId:e})]}),h.jsx("div",{className:"flex justify-end gap-2",children:h.jsx(ke,{variant:"outline",onClick:()=>t(n?.status==="completed"),children:a?"Close":"Cancel"})})]})})}function AUe(e){return k6(e).find(t=>t.type==="app_installation")}function RUe(e){const t=e.provider.toUpperCase();return{clientIdKey:e.clientIdKey||`${t}_CLIENT_ID`,clientSecretKey:e.clientSecretKey||`${t}_CLIENT_SECRET`}}function OUe(e){if(e)return e}function k6(e){return OUe(e)?.methods??[]}function nz(e,t){if(!(e.auth_profile_slug||e.auth_profile_kind||e.app_auth_profile_slug||e.config?.managedBy||e.config?.installation_ref||e.config?.consent_only))return k6(t).find(n=>n.type==="none")}function ch(e,t){const n=k6(e),r=n.some(a=>a.type!=="none");return n.filter(a=>a.type!=="none"||r).filter(a=>{if(a.type==="oauth"){const i=a,s=Bh(i),u=Om(i);return!(s.length===0&&u.length===0)}return a.type==="env_keys",!0})}function Bh(e){return Array.isArray(e?.requiredScopes)?e.requiredScopes.filter(t=>typeof t=="string"):[]}function Om(e){return Array.isArray(e?.optionalScopes)?e.optionalScopes.filter(t=>typeof t=="string"):[]}function BC(e,t){const n=Bh(e),r=new Set(Om(e)),a=(t??[]).filter(i=>r.has(i));return Array.from(new Set([...n,...a]))}function W0(e){return e.type==="app_installation"?`${e.provider.charAt(0).toUpperCase()+e.provider.slice(1)} App`:e.type==="oauth"?`OAuth (${e.provider.charAt(0).toUpperCase()+e.provider.slice(1)})`:e.type==="env_keys"?"API Key / Token":e.type==="browser"?"Browser":e.type==="none"?e.label??"No Authentication":e.type==="interactive"?"Interactive pairing":e.type}function TUe(e,t){const n=e.fields;if(n.length===0)return;const r=Object.fromEntries(n.map(i=>[i.key,{type:"string",title:i.label||i.key,description:i.description,example:i.example,...i.secret?{format:"password"}:{}}])),a=n.filter(i=>i.required!==!1).map(i=>i.key);return{type:"object",properties:r,...a.length>0?{required:a}:{}}}function NUe(e){if(e.type==="env_keys"){const t=e.required!==!1;return e.fields.map(n=>({key:n.key,label:n.label,description:n.description,example:n.example,secret:n.secret,required:t&&n.required!==!1}))}if(e.type==="oauth"){const t=e.required!==!1,n=e.provider?e.provider.charAt(0).toUpperCase()+e.provider.slice(1):"OAuth",{clientIdKey:r,clientSecretKey:a}=RUe(e);return[{key:r,label:`${n} Client ID`,description:`${n} OAuth client ID`,secret:!1,required:t},{key:a,label:`${n} Client Secret`,description:`${n} OAuth client secret`,secret:!0,required:t}]}return[]}function jUe(e){if(!e||e.type==="none")return;const t=NUe(e);if(t.length===0)return;const n=Object.fromEntries(t.map(a=>[a.key,{type:"string",title:a.required?a.label||a.key:`${a.label||a.key} (Optional)`,description:a.description,example:a.example,...a.secret?{format:"password"}:{}}])),r=t.filter(a=>a.required).map(a=>a.key);return{type:"object",properties:n,...r.length>0?{required:r}:{}}}function IUe(){return v6()}function PUe({checked:e,onCheckedChange:t,disabled:n,className:r,...a}){return h.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:n,onClick:()=>t(!e),className:ve("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e?"bg-primary":"bg-input",r),...a,children:h.jsx("span",{className:ve("pointer-events-none block h-4 w-4 rounded-full bg-background ring-0 transition-transform",e?"translate-x-4":"translate-x-0")})})}function DUe({connection:e}){const t=x.useId(),{session:n}=wr(),{data:r}=cy(),a=Jh(),[i,s]=x.useState(!1),[u,c]=x.useState(null),d=r?.find(b=>b.id===e.organization_id),p=d?.name??"this workspace",y=!!(n?.user?.id&&n.user.id===e.created_by),v=e.visibility==="org";if(!y||d?.is_personal)return h.jsxs("p",{className:"text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Access: "}),v?`Shared with ${p}`:"Private"]});const k=b=>{c(null),a.mutate({connection_id:e.id,visibility:b},{onSuccess:()=>s(!1),onError:M=>c(M.message||"Could not change who can use this.")})};return h.jsxs("div",{className:"space-y-2 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(PUe,{"aria-labelledby":t,checked:v||i,disabled:a.isPending,onCheckedChange:b=>{c(null),b?s(!0):i?s(!1):k("private")}}),h.jsxs("span",{id:t,children:["Share with ",p]})]}),i&&!v?h.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-xs",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:["Everyone in ",p," will be able to see this connection's data and run actions through it."]}),h.jsx(ke,{size:"sm",disabled:a.isPending,onClick:()=>k("org"),children:"Share"}),h.jsx(ke,{size:"sm",variant:"ghost",disabled:a.isPending,onClick:()=>s(!1),children:"Cancel"})]}):null,u?h.jsx("p",{role:"alert",className:"text-sm text-destructive",children:u}):null]})}var Tm="Collapsible",[LUe]=lo(Tm),[zUe,x6]=LUe(Tm),rz=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:i,onOpenChange:s,...u}=e,[c,d]=Xi({prop:r,defaultProp:a??!1,onChange:s,caller:Tm});return h.jsx(zUe,{scope:n,disabled:i,contentId:ao(),open:c,onOpenToggle:x.useCallback(()=>d(p=>!p),[d]),children:h.jsx(Qe.div,{"data-state":w6(c),"data-disabled":i?"":void 0,...u,ref:t})})});rz.displayName=Tm;var az="CollapsibleTrigger",oz=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,a=x6(az,n);return h.jsx(Qe.button,{type:"button","aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open||!1,"data-state":w6(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...r,ref:t,onClick:Ne(e.onClick,a.onOpenToggle)})});oz.displayName=az;var b6="CollapsibleContent",iz=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=x6(b6,e.__scopeCollapsible);return h.jsx(Kr,{present:n||a.open,children:({present:i})=>h.jsx(FUe,{...r,ref:t,present:i})})});iz.displayName=b6;var FUe=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:a,...i}=e,s=x6(b6,n),[u,c]=x.useState(r),d=x.useRef(null),p=Rt(t,d),y=x.useRef(0),v=y.current,k=x.useRef(0),b=k.current,M=s.open||u,_=x.useRef(M),C=x.useRef(void 0);return x.useEffect(()=>{const E=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(E)},[]),Hn(()=>{const E=d.current;if(E){C.current=C.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const A=E.getBoundingClientRect();y.current=A.height,k.current=A.width,_.current||(E.style.transitionDuration=C.current.transitionDuration,E.style.animationName=C.current.animationName),c(r)}},[s.open,r]),h.jsx(Qe.div,{"data-state":w6(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!M,...i,ref:p,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:M&&a})});function w6(e){return e?"open":"closed"}var $Ue=rz;const M6=$Ue,S6=oz,_6=iz;function qUe({id:e,title:t,count:n,action:r,muted:a,children:i}){return h.jsxs("section",{id:e,className:"min-w-0 scroll-mt-24",children:[h.jsxs("div",{className:"mb-2.5 flex items-center justify-between gap-3 border-b pb-2",children:[h.jsxs("h2",{className:ve("text-[13px] font-semibold tracking-[-0.005em]",a&&"text-muted-foreground"),children:[t,n?h.jsx("span",{className:"ml-1.5 text-[11.5px] font-normal text-muted-foreground",children:n}):null]}),r]}),i]})}function zXe({title:e,summary:t,open:n,onOpenChange:r,children:a}){return h.jsxs(M6,{open:n,onOpenChange:r,className:"min-w-0",children:[h.jsxs(S6,{className:"group flex w-full items-center gap-2 border-b pb-2 text-left transition-colors hover:border-muted-foreground",children:[h.jsx(Br,{className:ve("size-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}),h.jsx("span",{className:"text-[13px] font-semibold tracking-[-0.005em]",children:e}),h.jsx("span",{className:"ml-auto truncate text-[11.5px] text-muted-foreground transition-colors group-hover:text-foreground",children:n?"Hide":t})]}),h.jsx(_6,{className:"pt-3",children:a})]})}class ir{constructor(t,n,r,a=null){this.kind=t,this.text=n,this.value=r,this.error=a}toJSON(){if(this.error)throw new Error(this.error);return this.value}}function Vh(e){return e instanceof ir?e.error!==null:Array.isArray(e)?e.some(Vh):e!==null&&typeof e=="object"?Object.values(e).some(Vh):!1}function id(e){return e instanceof ir?id(e.toJSON()):Array.isArray(e)?e.map(id):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,id(n)])):e}function K0(e){return e instanceof ir?{kind:e.kind,text:e.text,value:K0(e.value),error:e.error}:Array.isArray(e)?e.map(K0):e!==null&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,K0(e[t])])):e}function Gs(e){return JSON.stringify(K0(e))??""}function Hp(e,t){return{source:e,token:t,baseline:e.initial,values:e.initial,acceptedKey:void 0}}function sz(e,t){return e.source.initialKey!==t.initialKey||e.source.revisionKey!==t.revisionKey}function HUe(e,t){if(t.sessionKey!==e.source.sessionKey)return Hp(t,{});if(!sz(e,t))return e;const n=Gs(e.values);return n===Gs(e.baseline)||n===t.initialKey?Hp(t,e.token):e.acceptedKey===t.initialKey&&e.source.revisionKey===t.revisionKey?{...e,source:t,baseline:t.initial,acceptedKey:void 0}:e}function vh(e,t,n){const r=x.useMemo(()=>Gs(n),[n]),a={sessionKey:e,initial:t,initialKey:Gs(t),revision:n,revisionKey:r},[i,s]=x.useState(()=>Hp(a,{})),u=HUe(i,a);u!==i&&s(u);const c=u.token,d=x.useCallback(A=>{s(R=>R.token===c?A(R):R)},[c]),p=x.useCallback(A=>d(R=>({...R,values:typeof A=="function"?A(R.values):A})),[d]),y=()=>d(A=>Hp(a,A.token)),v=x.useCallback((A,R)=>d(O=>({...O,baseline:A,acceptedKey:Gs(R)})),[d]),k=x.useCallback((A,R)=>d(O=>({...O,...A(O),acceptedKey:Gs(R)})),[d]),b=x.useMemo(()=>Gs(u.values),[u.values]),M=x.useMemo(()=>Gs(u.baseline),[u.baseline]),_=b!==M,C=_&&sz(u,a),E=x.useMemo(()=>Vh(u.values),[u.values]);return{values:u.values,revision:u.source.revision,baseline:u.baseline,setValues:p,reset:y,accept:v,commit:k,field(A){return[u.values[A],R=>p(O=>({...O,[A]:typeof R=="function"?R(O[A]):R}))]},canSubmit:!C&&!E,hasInvalidInput:E,dirty:_,hasConflict:C}}function FXe(e,t){const[n,r]=x.useState(()=>({sessionKey:e,token:{},value:t}));let a=n;e!==n.sessionKey&&(a={sessionKey:e,token:{},value:t},r(a));const i=a.token,s=x.useCallback(u=>{r(c=>c.token!==i?c:{...c,value:typeof u=="function"?u(c.value):u})},[i]);return[a.value,s]}const UUe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:"false",VITE_GATEWAY_URL:""};function BUe(e,t=UUe,n=typeof window<"u"?window.location.origin:void 0){const r=e.startsWith("agentconn-")?e.slice(10):e;return`${v6(t,n)}/lobu/api/v1/webhooks/${encodeURIComponent(r)}`}function $Xe({title:e,summary:t,onOpen:n}){return h.jsxs("button",{type:"button",onClick:n,className:"group flex w-full items-center justify-between gap-4 rounded-lg border border-border px-4 py-3 text-left transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[h.jsxs("span",{className:"min-w-0",children:[h.jsx("span",{className:"block text-sm font-medium",children:e}),h.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:t})]}),h.jsx(Br,{"aria-hidden":"true",className:"h-4 w-4 shrink-0 text-muted-foreground"})]})}function VUe({label:e,query:t,onQueryChange:n,count:r,action:a}){return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"relative min-w-0 flex-1",children:[h.jsx(Zh,{"aria-hidden":"true",className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(yn,{type:"search","aria-label":`Search ${e}`,placeholder:`Search ${e}…`,value:t,onChange:i=>n(i.target.value),className:"pl-9"})]}),a]}),h.jsxs("p",{className:"text-xs text-muted-foreground",role:"status",children:[r," ",r===1?e.replace(/s$/,""):e,t.trim()?" found":""]})]})}function WUe({entries:e,label:t,action:n,renderControl:r,renderDetail:a}){const[i,s]=x.useState(""),u=new Set(e.filter(c=>`${c.name} ${c.description??""}`.toLowerCase().includes(i.trim().toLowerCase())).map(c=>c.id));return h.jsxs("div",{className:"space-y-4",children:[h.jsx(VUe,{label:t,query:i,onQueryChange:s,count:u.size,action:n}),h.jsx("ul",{children:e.map(c=>h.jsx(KUe,{entry:c,hidden:!u.has(c.id),control:r?.(c),renderDetail:()=>a(c)},c.id))}),u.size===0&&h.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:i?"No matches. Try another search.":`No ${t} yet.`})]})}function KUe({entry:e,hidden:t,control:n,renderDetail:r}){const[a,i]=x.useState(!1),[s,u]=x.useState(!1);return h.jsx("li",{hidden:t,className:"border-b border-border last:border-b-0",children:h.jsxs(M6,{open:a,onOpenChange:c=>{i(c),c&&u(!0)},children:[h.jsxs("div",{className:"flex items-center gap-3 py-3",children:[h.jsxs(S6,{className:"group flex min-w-0 flex-1 items-start gap-2 rounded-sm text-left hover:text-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[h.jsx(Br,{"aria-hidden":"true",className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none"}),h.jsxs("span",{className:"min-w-0",children:[h.jsx("span",{className:"block text-sm font-medium",children:e.name}),e.status&&h.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:e.status})]})]}),n&&h.jsx("div",{className:"shrink-0",children:n})]}),s&&h.jsxs(_6,{forceMount:!0,hidden:!a,className:"space-y-4 pb-4 pl-6",children:[e.description&&h.jsx("p",{className:"text-sm text-muted-foreground",children:e.description}),r()]})]})})}const C6={entity:["read","create","update","delete"],agent_config:["read","create","update","delete"],entity_schema:["create_type","update_type","delete_type","create_relationship_type","update_relationship_type","delete_relationship_type"]},GUe={entity:{read:"auto",create:"auto",update:"auto",delete:"approval"},agent_config:{read:"auto",create:"approval",update:"approval",delete:"deny"},entity_schema:{create_type:"auto",update_type:"auto",delete_type:"auto",create_relationship_type:"auto",update_relationship_type:"auto",delete_relationship_type:"auto"}};function qXe(e,t){return(e==="entity"||e==="agent_config")&&t==="read"?["auto","deny"]:["auto","approval","deny"]}const lz={auto:"Auto",approval:"Ask",deny:"Block"};function Nm(e,t){return e.effects?.[t]}function YUe(e,t){return ip[e]<ip[t]}function dx(e,t){return ip[e]>=ip[t]?e:t}function ZUe(e,t,n,r,a=null){let i=null;for(const s of e){if(s.resource_class!==t||s.field_path!==null||s.entity_id!==null||s.entity_type_slug!==null&&s.entity_type_slug!==r||s.operation_key!==null||s.target_agent_id!==null&&s.target_agent_id!==a)continue;const u=Nm(s,n);u&&(i=i===null?u:dx(i,u))}return i??GUe[t]?.[n]??"deny"}function QUe(e,t,n,r,a=null){return e.some(i=>i.resource_class!==t||i.field_path!==null||i.entity_id!==null||i.entity_type_slug!==null&&i.entity_type_slug!==r||i.operation_key!==null||i.target_agent_id!==null&&i.target_agent_id!==a?!1:Nm(i,n)!==void 0)}function HXe(e,t,n){const r=Up(e,t,null);return r?Nm(r,n)!==void 0:!1}function Up(e,t,n,r=null){return e.find(a=>a.resource_class===t&&(a.entity_type_slug??null)===n&&a.operation_key===null&&(a.target_agent_id??null)===r)}function UXe(e,t,n,r=null){const a=Up(e.agent,t,n,r),i={};if(!a?.effects)return i;for(const s of C6[t]){const u=a.effects[s];u&&(i[s]=u)}return i}function Bp(e,t,n,r,a=null){const i=ZUe(e.floor,t,n,r,a),s=QUe(e.floor,t,n,r,a),u=r!==null||a!==null?Up(e.agent,t,r,a):void 0,c=Up(e.agent,t,null);let d=null;for(const p of[c,u]){const y=p&&Nm(p,n);y&&(d=d===null?y:dx(d,y))}return d===null?i:s?dx(d,i):d}function BXe(e){const{option:t,floor:n}=e;return YUe(t,n)?{disabled:!0,reason:`Below org floor (${lz[n]})`}:{disabled:!1}}function VXe(e){const t=new Set;for(const r of e.agent)r.resource_class==="entity"&&r.entity_type_slug&&t.add(r.entity_type_slug);for(const r of e.floor)r.resource_class==="entity"&&r.entity_type_slug&&r.field_path===null&&r.entity_id===null&&t.add(r.entity_type_slug);const n=new Map(e.entity_types.map(r=>[r.slug,r]));return[...t].map(r=>n.get(r)??{slug:r,name:r})}function WXe(e,t){return e.agent.some(n=>n.resource_class==="entity"&&n.entity_type_slug===t)}function KXe(e,t){let n=0;for(const r of C6.entity){const a=Bp(e,"entity",r,null);Bp(e,"entity",r,t)!==a&&(n+=1)}return n}function GXe(e){const t=new Set;for(const r of e.agent)r.resource_class==="agent_config"&&r.target_agent_id&&t.add(r.target_agent_id);for(const r of e.floor)r.resource_class==="agent_config"&&r.target_agent_id&&t.add(r.target_agent_id);const n=new Map(e.agents.map(r=>[r.id,r]));return[...t].map(r=>n.get(r)??{id:r,name:r})}function YXe(e,t){return e.agent.some(n=>n.resource_class==="agent_config"&&n.target_agent_id===t)}function ZXe(e,t){let n=0;for(const r of C6.agent_config){const a=Bp(e,"agent_config",r,null);Bp(e,"agent_config",r,null,t)!==a&&(n+=1)}return n}function VC({effect:e}){return h.jsx("span",{className:"text-xs text-muted-foreground",children:e?lz[e]:"Policy unavailable"})}function Vp({ownerSlug:e,connectorKey:t,connectionId:n}){return e?h.jsx(nn,{to:"/$owner/settings/organization",params:{owner:e},search:{connector:t,connection:n},hash:"policies",className:"text-xs underline underline-offset-2",children:"Policies"}):null}function cz({name:e,description:t,onInspect:n,leading:r,trailing:a,badge:i}){return h.jsxs("div",{className:ve(Qh,"flex items-start gap-3 p-3"),children:[r,h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n?h.jsx("button",{type:"button",onClick:n,className:"text-sm font-medium text-left hover:underline",children:e}):h.jsx("span",{className:"text-sm font-medium",children:e}),i]}),t&&h.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:t})]}),a]})}function uz({feedsSchema:e,enabledFeeds:t,onToggleFeed:n,onInspect:r}){if(!e)return null;const a=Object.entries(e);if(a.length===0)return null;const i=!!t&&!!n;return h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Feeds"}),h.jsx("div",{className:"space-y-1.5",children:a.map(([s,u])=>h.jsx(cz,{name:u.name??s,description:u.description,onInspect:r?()=>r(s,u):void 0,leading:i?h.jsx("input",{type:"checkbox",checked:t.has(s),onChange:c=>n(s,c.target.checked),className:"rounded border-input mt-0.5","aria-label":`Enable ${u.name??s}`}):void 0},s))})]})}function dz({actionsSchema:e,onInspect:t,ownerSlug:n,connectorKey:r}){if(!e)return null;const a=Object.entries(e);return a.length===0?null:h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Actions"}),h.jsx("div",{className:"space-y-1.5",children:a.map(([i,s])=>h.jsx(cz,{name:s.name??i,description:s.description,onInspect:t?()=>t(i,s):void 0,trailing:h.jsx(Vp,{ownerSlug:n,connectorKey:r}),badge:h.jsx("span",{className:"text-xs text-muted-foreground",children:"Policy depends on connection"})},i))})]})}const E6=x.forwardRef(({className:e,...t},n)=>h.jsx(Lb,{ref:n,className:ve("peer h-4 w-4 shrink-0 rounded-sm border border-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:h.jsx(BI,{className:ve("flex items-center justify-center text-current"),children:h.jsx(ja,{className:"h-4 w-4"})})}));E6.displayName=Lb.displayName;const hz=x.forwardRef(({className:e,...t},n)=>h.jsx("textarea",{className:ve("flex min-h-[60px] w-full rounded-md border border-input bg-muted px-3 py-2 text-base placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));hz.displayName="Textarea";function ua(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof ir)}function XUe(e){return Array.isArray(e)?e.map(t=>String(t)).join(", "):""}function JUe(e,t,n,r,a){const i=e.split(",").map(u=>u.trim()).filter(Boolean);let s;if(t==="number"||t==="integer"){const u=i.map(Number);if(!u.every(d=>t==="integer"?Number.isInteger(d):Number.isFinite(d)))return{error:`Enter comma-separated ${t==="integer"?"integers":"numbers"}`};s=u}else if(t==="boolean"){if(i.some(u=>u!=="true"&&u!=="false"))return{error:"Enter comma-separated true or false values"};s=i.map(u=>u==="true")}else s=i;return n&&s.some(u=>!n.some(c=>Object.is(u,c)))?{error:"Enter only the allowed values"}:r!==void 0&&s.length<r?{error:`Enter at least ${r} ${r===1?"item":"items"}`}:a!==void 0&&s.length>a?{error:`Enter at most ${a} ${a===1?"item":"items"}`}:{values:s}}function eBe({id:e,value:t,itemType:n,itemEnum:r,minItems:a,maxItems:i,ariaLabel:s,ariaDescribedBy:u,placeholder:c,readOnly:d=!1,showHelp:p=!0,onChange:y}){const v=t instanceof ir?t.text:XUe(t),k=t instanceof ir?t.error:null;return h.jsxs(h.Fragment,{children:[h.jsx(yn,{id:e,"aria-label":s,type:"text",value:v,onChange:b=>{const M=b.target.value,_=JUe(M,n,r,a,i);y(new ir("primitive-array",M,_.values,_.error??null))},placeholder:c||"Enter comma-separated values",readOnly:d,disabled:d,"aria-invalid":k?!0:void 0,"aria-describedby":[k?`${e}-error`:p?`${e}-help`:void 0,u].filter(Boolean).join(" ")||void 0}),k?h.jsx("p",{id:`${e}-error`,role:"alert",className:"text-xs text-destructive",children:k}):p?h.jsx("p",{id:`${e}-help`,className:"text-xs text-muted-foreground",children:"Enter values separated by commas"}):null]})}function tBe(e,t){switch(t){case"array":return Array.isArray(e);case"object":return ua(e);case"integer":return typeof e=="number"&&Number.isInteger(e);case"number":return typeof e=="number"&&Number.isFinite(e);case"boolean":return typeof e=="boolean";case"string":return typeof e=="string";default:return!0}}function nBe(e){return e instanceof ir?e.kind==="primitive-array":Array.isArray(e)&&e.every(t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean")}function fz({id:e,value:t,expectedType:n,itemType:r,itemEnum:a,minItems:i,maxItems:s,ariaLabel:u,ariaDescribedBy:c,readOnly:d=!1,onChange:p}){const y=x.useMemo(()=>{if(t instanceof ir)return t.text;try{return JSON.stringify(t,null,2)??""}catch{return""}},[t]),v=t instanceof ir?t.error:null;return h.jsxs(h.Fragment,{children:[h.jsx(hz,{id:e,"aria-label":u,value:y,onChange:k=>{const b=k.target.value;try{const M=JSON.parse(b);if(!(n==="array"?Array.isArray(M):ua(M)))throw new Error(`Value must be a JSON ${n}`);if(n==="array"&&M.some(C=>!tBe(C,r)))throw new Error(`Every item must be a JSON ${String(r)}`);if(n==="array"&&a&&M.some(C=>!a.some(E=>Object.is(C,E))))throw new Error("Enter only the allowed values");if(n==="array"&&i!==void 0&&M.length<i)throw new Error(`Enter at least ${i} ${i===1?"item":"items"}`);if(n==="array"&&s!==void 0&&M.length>s)throw new Error(`Enter at most ${s} ${s===1?"item":"items"}`);p(new ir(`json-${n}`,b,M))}catch(M){p(new ir(`json-${n}`,b,void 0,M instanceof SyntaxError?`Enter a valid JSON ${n}`:M instanceof Error?M.message:`Enter a valid JSON ${n}`))}},readOnly:d,disabled:d,"aria-invalid":v?!0:void 0,"aria-describedby":[v?`${e}-error`:void 0,c].filter(Boolean).join(" ")||void 0,className:"min-h-24 font-mono text-xs"}),v?h.jsx("p",{id:`${e}-error`,role:"alert",className:"text-xs text-destructive",children:v}):null]})}function pz({id:e,value:t,ariaLabel:n="JSON object",ariaDescribedBy:r,readOnly:a=!1,onChange:i}){return h.jsx(fz,{id:e,value:t,expectedType:"object",ariaLabel:n,ariaDescribedBy:r,readOnly:a,onChange:i})}function hx({id:e,value:t,ariaLabel:n="JSON array",ariaDescribedBy:r,readOnly:a=!1,itemType:i,itemEnum:s,minItems:u,maxItems:c,onChange:d}){return h.jsx(fz,{id:e,value:t,expectedType:"array",itemType:i,itemEnum:s,minItems:u,maxItems:c,ariaLabel:n,ariaDescribedBy:r,readOnly:a,onChange:d})}function rBe({id:e,value:t,onChange:n,readOnly:r=!1,integer:a=!1,ariaLabel:i,ariaDescribedBy:s,placeholder:u}){const c=t instanceof ir?t.text:String(t??""),d=t instanceof ir?t.error:null;return h.jsxs(h.Fragment,{children:[h.jsx(yn,{id:e,type:"text",inputMode:"decimal","aria-label":i,value:c,readOnly:r,disabled:r,placeholder:u,"aria-invalid":d?!0:void 0,"aria-describedby":[d?`${e}-error`:void 0,s].filter(Boolean).join(" ")||void 0,onChange:p=>{const y=p.target.value,v=Number(y),k=/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(y.trim())&&Number.isFinite(v)&&(!a||Number.isInteger(v));n(new ir("number",y,y.trim()!==""&&k?v:void 0,y.trim()===""||k?null:`Enter a valid ${a?"integer":"number"}`))}}),d&&h.jsx("p",{id:`${e}-error`,role:"alert",className:"text-xs text-destructive",children:d})]})}function aBe(e){const t=[],n=/<a\b[^>]*href=['"]([^'"]+)['"][^>]*>(.*?)<\/a>/gi;let r=0,a=n.exec(e);for(;a!==null;){const[i,s,u]=a,c=a.index;c>r&&t.push({id:`text-${r}-${c}`,type:"text",value:e.slice(r,c)}),t.push({id:`link-${c}-${c+i.length}`,type:"link",href:s.trim(),label:u.replace(/<[^>]*>/g,"").trim()||s.trim()}),r=c+i.length,a=n.exec(e)}return r<e.length&&t.push({id:`text-${r}-${e.length}`,type:"text",value:e.slice(r)}),t.length>0?t:[{id:`text-0-${e.length}`,type:"text",value:e}]}function oBe({text:e,onOpenLink:t}){const n=aBe(e);return h.jsx("p",{className:"text-xs text-muted-foreground",children:n.map(r=>r.type==="text"?h.jsx("span",{children:r.value},r.id):t?h.jsx("button",{type:"button",className:"text-blue-600 hover:underline",onClick:()=>t(r.href),children:r.label},r.id):h.jsx("a",{href:r.href,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:r.label},r.id))})}function Wp(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function iBe(e,t){if(!e)return Wp(t);const n=e.replace(/\s*\(e\.g\.,?\s.*?\)/gis,"").trim();return n.split(/(?<![A-Za-z0-9])\.(?=\s|$)|\.(?=\s+[A-Z])/)[0].trim().replace(/\.$/,"")||n||Wp(t)}function sBe(e){if(e!=null){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const t=e.map(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean"?String(n):null).filter(n=>n!==null);if(t.length>0)return t.join(", ")}try{return JSON.stringify(e)}catch{return}}}function O0(e){const t=e.map(r=>Wp(String(r))),n=new Map;return t.forEach((r,a)=>{const i=n.get(r)??new Set;i.add(typeof e[a]),n.set(r,i)}),e.map((r,a)=>{const i=t[a],s=(n.get(i)?.size??0)>1;return{id:`option-${a}`,value:r,label:s?`${i} (${typeof r=="string"?"text":typeof r})`:i}})}function yz(e,t,n){const r=t.anyOf;if(r&&r.length>0&&r.find(u=>u.type==="null")){const u=r.filter(c=>c.type!=="null");if(u.length===1){const c=Object.fromEntries(Object.entries(t).filter(([d])=>d!=="anyOf"));return yz(e,{...u[0],...c},n)}}const a={name:e,label:t.title||iBe(t.description,e),type:"text",required:n,description:t.description,defaultValue:t.default,example:t.example,schema:t},i=sBe(t.example);if(t.type==="object"||ua(t.properties))a.type="object";else if(t.type==="string")a.type=t.format==="password"?"password":"text",a.placeholder=i||`Enter ${Wp(e).toLowerCase()}`,a.validation={minLength:t.minLength,maxLength:t.maxLength};else if(t.type==="number"||t.type==="integer")a.type="number",a.placeholder=i,a.validation={min:t.minimum,max:t.maximum};else if(t.type==="boolean")a.type="boolean";else if(t.type==="array"){const s=t.items;if(a.itemSchema=s,s?.type==="object"||s?.properties)a.type="object-array";else if(s?.enum&&Array.isArray(s.enum))a.type="multi-select",a.options=O0(s.enum);else if(s?.anyOf||s?.oneOf){const u=s.anyOf||s.oneOf,c=u.filter(d=>d.const!==void 0).map(d=>d.const);c.length>0&&c.length===u.length?(a.type="multi-select",a.options=O0(c)):s?.type==="string"||s?.type==="number"||s?.type==="integer"||s?.type==="boolean"?(a.type="array",a.placeholder=i??"Add items..."):a.type="json-array"}else s?.type==="string"||s?.type==="number"||s?.type==="integer"||s?.type==="boolean"?(a.type="array",a.placeholder=i??"Add items..."):a.type="json-array";a.validation={minItems:t.minItems,maxItems:t.maxItems}}else if(r){const s=r.filter(u=>u.const!==void 0).map(u=>u.const);s.length>0&&(a.type="select",a.options=O0(s),a.placeholder=i)}return t.enum&&Array.isArray(t.enum)&&(a.type="select",a.options=O0(t.enum),a.placeholder=i),a}function mz(e){if(!e?.properties)return[];const t=[],n=e.properties,r=e.required||[];for(const[a,i]of Object.entries(n)){const s=yz(a,i,r.includes(a));s&&t.push(s)}return t}function lBe({id:e,label:t,value:n,schema:r,readOnly:a,onOpenLink:i,onChange:s}){const u=ua(r.properties)?r.properties:null,c=ua(n)?n:{};if(!u||Object.keys(u).length===0||!ua(n)&&n!==void 0&&n!==null)return h.jsx(pz,{id:e,value:n,ariaLabel:`${t} JSON object`,readOnly:a,onChange:s});const d=new Set(Object.keys(u));return h.jsx("fieldset",{"aria-label":t,className:"rounded-md border p-3",children:h.jsx(ul,{schema:{type:"object",properties:u,required:r.required},values:c,onValuesChange:p=>{const y=Object.fromEntries(Object.entries(c).filter(([v])=>!d.has(v)));s({...y,...p})},onOpenLink:i,fieldIdPrefix:`${e}-`,readOnly:a})})}function cBe({id:e,label:t,value:n,itemSchema:r,validation:a,readOnly:i,onOpenLink:s,onChange:u}){if(!Array.isArray(n)&&n!==void 0&&n!==null)return h.jsx(hx,{id:e,value:n,ariaLabel:`${t} JSON array`,readOnly:i,itemType:"object",minItems:a?.minItems,maxItems:a?.maxItems,onChange:u});const c=Array.isArray(n)?n:[],d=ua(r?.properties)?r.properties:null,p=new Set(Object.keys(d??{})),y=a?.maxItems===void 0||c.length<a.maxItems,v=a?.minItems===void 0||c.length>a.minItems;return h.jsxs("div",{className:"space-y-3",children:[c.length===0?h.jsx("p",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:"No rows"}):c.map((k,b)=>{const M=`${e}-${b}`;return h.jsxs("fieldset",{className:"rounded-md border p-3",children:[h.jsxs("legend",{className:"px-1 text-xs font-medium text-muted-foreground",children:[t," row ",b+1]}),d&&Object.keys(d).length>0&&ua(k)?h.jsx(ul,{schema:{type:"object",properties:d,required:r?.required},values:k,onValuesChange:_=>{const C=Object.fromEntries(Object.entries(k).filter(([A])=>!p.has(A))),E=[...c];E[b]={...C,..._},u(E)},onOpenLink:s,fieldIdPrefix:`${M}-`,readOnly:i}):h.jsx(pz,{id:`${M}-json`,value:k,ariaLabel:`${t} row ${b+1} JSON object`,readOnly:i,onChange:_=>{const C=[...c];C[b]=_,u(C)}}),i?null:h.jsx("div",{className:"mt-2 flex justify-end",children:h.jsxs(ke,{type:"button",variant:"ghost",size:"sm","aria-label":`Remove ${t} row ${b+1}`,disabled:!v,onClick:()=>u(c.filter((_,C)=>C!==b)),children:[h.jsx(Zs,{className:"mr-1.5 h-4 w-4"}),"Remove"]})})]},b)}),i?null:h.jsxs(ke,{type:"button",variant:"outline",size:"sm","aria-label":`Add ${t} row`,disabled:!y,onClick:()=>u([...c,cl(r)]),children:[h.jsx(ia,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]})}function cl(e,t={},n=!1){const r={...t};for(const a of mz(e??void 0)){a.name in r||(n&&a.example!==void 0?r[a.name]=a.example:a.defaultValue!==void 0?r[a.name]=a.defaultValue:a.type==="boolean"?r[a.name]=!1:a.type==="object"&&ua(a.schema.properties)&&(r[a.name]={}));const i=r[a.name];a.type==="object"&&ua(i)?r[a.name]=ua(a.schema.properties)&&Object.keys(a.schema.properties).length>0?cl(a.schema,i,n):new ir("json-object",JSON.stringify(i,null,2),i):a.type==="object-array"&&Array.isArray(i)&&(r[a.name]=i.map(s=>ua(s)?cl(a.itemSchema,s,n):s))}return r}function Kp(e){const t={};for(const[n,r]of Object.entries(e))if(r instanceof ir){const a=id(r);a!==""&&a!==void 0&&a!==null&&(t[n]=a)}else Array.isArray(r)?t[n]=r.map(a=>a instanceof ir?id(a):ua(a)?Kp(a):a):ua(r)?t[n]=Kp(r):r!==""&&r!==void 0&&r!==null&&(t[n]=r);return t}function ul({connectorType:e,schema:t,values:n,onValuesChange:r,onOpenLink:a,fieldIdPrefix:i="",readOnly:s=!1,nativeSelects:u=!1}){const c=x.useMemo(()=>mz(t??e?.options_schema),[t,e]),d=(p,y)=>{r?.({...n,[p]:y})};return c.length===0?h.jsx("p",{className:"text-sm text-muted-foreground",children:"No configuration required."}):h.jsx("div",{className:"space-y-4",children:c.map(p=>{const y=`${i}${p.name}`;return h.jsxs("div",{className:"space-y-1.5",children:[p.type==="object"||p.type==="object-array"?h.jsxs("p",{className:"text-sm font-medium",children:[p.label,p.required&&!s&&h.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}):h.jsxs("label",{htmlFor:y,className:"text-sm font-medium",children:[p.label,p.required&&!s&&h.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.description&&h.jsx(oBe,{text:p.description,onOpenLink:a}),(p.type==="text"||p.type==="password")&&h.jsx(yn,{id:y,type:p.type,value:n[p.name]??"",onChange:v=>d(p.name,v.target.value),placeholder:p.placeholder,readOnly:s,disabled:s}),p.type==="number"&&h.jsx(rBe,{id:y,value:n[p.name],integer:p.schema.type==="integer",onChange:v=>d(p.name,v),placeholder:p.placeholder,readOnly:s}),p.type==="boolean"&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(E6,{id:y,checked:n[p.name]??!1,onCheckedChange:v=>d(p.name,v),disabled:s}),h.jsx("label",{htmlFor:y,className:"text-sm",children:"Enable"})]}),p.type==="select"&&p.options&&u&&h.jsxs("select",{id:y,className:"h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",value:p.options.find(v=>Object.is(v.value,n[p.name]))?.id??"",onChange:v=>{const k=p.options?.find(b=>b.id===v.target.value);k&&d(p.name,k.value)},required:p.required,disabled:s,children:[h.jsx("option",{value:"",disabled:!0,children:p.placeholder||`Select ${p.label.toLowerCase()}...`}),p.options.map(v=>h.jsx("option",{value:v.id,children:v.label},v.id))]}),p.type==="select"&&p.options&&!u&&h.jsxs(Ws,{value:p.options.find(v=>Object.is(v.value,n[p.name]))?.id??"",onValueChange:v=>{const k=p.options?.find(b=>b.id===v);k&&d(p.name,k.value)},disabled:s,children:[h.jsx(Fi,{id:y,"aria-required":p.required||void 0,children:h.jsx(Ks,{placeholder:p.placeholder||`Select ${p.label.toLowerCase()}...`})}),h.jsx($i,{children:p.options.map(v=>h.jsx(Hr,{value:v.id,children:v.label},v.id))})]}),p.type==="multi-select"&&p.options&&h.jsx("div",{className:"flex flex-wrap gap-2 p-2 border rounded-md",children:p.options.map(v=>{const k=Array.isArray(n[p.name])?n[p.name].some(b=>Object.is(b,v.value)):!1;return h.jsx("button",{type:"button",disabled:s,onClick:()=>{const b=n[p.name]||[];k?d(p.name,b.filter(M=>!Object.is(M,v.value))):d(p.name,[...b,v.value])},className:`px-2.5 py-1 text-xs rounded-md border transition-colors ${k?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted border-border"}`,children:v.label},v.id)})}),p.type==="array"&&(n[p.name]!==void 0&&n[p.name]!==null&&!nBe(n[p.name])?h.jsx(hx,{id:y,value:n[p.name],ariaLabel:`${p.label} JSON array`,readOnly:s,itemType:p.itemSchema?.type,itemEnum:p.itemSchema?.enum,minItems:p.validation?.minItems,maxItems:p.validation?.maxItems,onChange:v=>d(p.name,v)}):h.jsx(eBe,{id:y,value:n[p.name],itemType:p.itemSchema?.type,itemEnum:p.itemSchema?.enum,minItems:p.validation?.minItems,maxItems:p.validation?.maxItems,placeholder:p.placeholder,readOnly:s,onChange:v=>d(p.name,v)})),p.type==="json-array"&&h.jsx(hx,{id:y,value:n[p.name],ariaLabel:`${p.label} JSON array`,readOnly:s,itemType:p.itemSchema?.type,itemEnum:p.itemSchema?.enum,minItems:p.validation?.minItems,maxItems:p.validation?.maxItems,onChange:v=>d(p.name,v)}),p.type==="object"&&h.jsx(lBe,{id:y,label:p.label,value:n[p.name],schema:p.schema,readOnly:s,onOpenLink:a,onChange:v=>d(p.name,v)}),p.type==="object-array"&&h.jsx(cBe,{id:y,label:p.label,value:n[p.name],itemSchema:p.itemSchema,validation:p.validation,readOnly:s,onOpenLink:a,onChange:v=>d(p.name,v)})]},p.name)})})}function uBe({connectionId:e,ownerSlug:t,connectorKey:n,policyOperations:r,browse:a=!1,onReviewPermissions:i}){const{data:s}=a3(e),u=x.useMemo(()=>(s??[]).filter(L=>L.kind==="write"),[s]),c=x.useMemo(()=>new Map(u.map(L=>[L.operation_key,L])),[u]),d=x.useMemo(()=>r?r.map(L=>c.get(L.operation_key)??L):u,[r,u,c]),p=x.useMemo(()=>Object.fromEntries(d.map(L=>[L.operation_key,cl(L.output_schema,{},!0)])),[d]),{initialInputs:y,inputSchemas:v}=x.useMemo(()=>({initialInputs:Object.fromEntries(d.map(L=>[L.operation_key,cl(L.input_schema)])),inputSchemas:Object.fromEntries(d.map(L=>[L.operation_key,L.input_schema]))}),[d]),k=vh(e,y,v),{values:b,setValues:M}=k,[_,C]=x.useState({}),[E,A]=x.useState(null),R=ZR(),O=(L,I)=>{M(D=>({...D,[L]:I}))},N=async L=>{if(!(k.hasConflict||Vh(b[L]))){A(L),C(I=>{const D={...I};return delete D[L],D});try{const I=await R.mutateAsync({connection_id:e,operation_key:L,input:id(b[L]??{})});C(D=>({...D,[L]:I}))}catch(I){C(D=>({...D,[L]:{run_id:0,status:"failed",error_message:I instanceof Error?I.message:String(I)}}))}finally{A(null)}}};if(d.length===0)return null;const P=(L,I=!1)=>{const D=L.operation_key,H=E===D,K=_[D],W=s?.find(q=>q.operation_key===D),Y=W?.readiness==="scope_upgrade_required"||W?.readiness==="auth_required";return h.jsxs(M6,{open:I?!0:void 0,children:[I&&h.jsxs("div",{className:"mb-5 space-y-2",children:[h.jsx("h3",{className:"text-sm font-medium",children:"Provider permissions"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:Y?"Additional access is needed before this action can run.":W?.readiness&&W.readiness!=="ready"&&W.readiness!=="blocked"?`Availability: ${W.readiness.replaceAll("_"," ")}`:W?.readiness==="ready"?"Provider access is ready.":"Provider access is checked when the action runs."}),Y&&i&&h.jsx(ke,{variant:"outline",size:"sm",onClick:i,children:"Review permissions"})]}),h.jsxs("div",{className:"flex flex-wrap items-start gap-2 sm:flex-nowrap",children:[!I&&h.jsxs(S6,{className:"flex min-w-0 flex-[1_1_12rem] items-start gap-1.5 text-sm text-left group",children:[h.jsx(Br,{className:"h-3 w-3 mt-1 text-muted-foreground shrink-0 transition-transform group-data-[state=open]:rotate-90"}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block font-medium",children:L.name??D}),L.description&&h.jsx("span",{className:"line-clamp-2 text-xs text-muted-foreground group-data-[state=open]:line-clamp-none",children:L.description})]})]}),!I&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(VC,{effect:L.policy?.effect}),h.jsx(Vp,{ownerSlug:t,connectorKey:n,connectionId:e})]})]}),h.jsx(_6,{children:h.jsxs("div",{className:I?"mt-5 space-y-3":"ml-4 mt-1.5 space-y-3",children:[k.revision?.[D]&&h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Input"}),h.jsx(ul,{schema:k.revision[D],values:b[D],onValuesChange:q=>O(D,q),fieldIdPrefix:`action-${e}-${D}-`})]}),L.output_schema&&h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Output Schema"}),h.jsx(ul,{schema:L.output_schema,values:p[D],fieldIdPrefix:`action-${e}-${D}-output-`,readOnly:!0})]}),c.has(D)?h.jsx(ke,{size:"sm",variant:"outline",onClick:()=>N(D),disabled:Y||!L.policy||L.policy.effect==="deny"||k.hasConflict||Vh(b[D])||H||E!==null,children:H?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"md",className:"mr-1.5"}),"Running..."]}):h.jsxs(h.Fragment,{children:[h.jsx(hR,{className:"mr-1.5 h-3.5 w-3.5"}),"Run"]})}):null,K&&h.jsx(dBe,{result:K})]})})]},D)};return a?h.jsxs("div",{className:"space-y-3",children:[h.jsx(od,{visible:k.hasConflict,onReload:k.reset}),h.jsx(WUe,{entries:d.map(L=>({id:L.operation_key,name:L.name??L.operation_key,description:L.description,operation:L,status:s?.find(I=>I.operation_key===L.operation_key)?.readiness==="scope_upgrade_required"?"Additional provider access needed":void 0})),label:"actions",renderControl:({operation:L})=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(VC,{effect:L.policy?.effect}),h.jsx(Vp,{ownerSlug:t,connectorKey:n,connectionId:e})]}),renderDetail:({operation:L})=>P(L,!0)})]}):h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(od,{visible:k.hasConflict,onReload:k.reset}),h.jsx("div",{className:"space-y-2",children:d.map(L=>P(L))})]})}function dBe({result:e}){return e.status==="completed"?h.jsxs("div",{className:"rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm space-y-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium",children:[h.jsx(Ix,{className:"h-3.5 w-3.5"}),"Completed",h.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-auto",children:["Run #",e.run_id]})]}),e.output&&Object.keys(e.output).length>0&&h.jsx("pre",{className:"text-xs text-green-800 dark:text-green-300 font-mono whitespace-pre-wrap mt-1",children:JSON.stringify(e.output,null,2)})]}):e.status==="pending_approval"?h.jsxs("div",{className:"rounded-md bg-yellow-50 dark:bg-yellow-950/30 p-3 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-yellow-700 dark:text-yellow-400 font-medium",children:[h.jsx(eR,{className:"h-3.5 w-3.5"}),"Pending Approval",h.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-auto",children:["Run #",e.run_id]})]}),e.message&&h.jsx("p",{className:"text-xs text-yellow-800 dark:text-yellow-300 mt-1",children:e.message})]}):h.jsxs("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-red-700 dark:text-red-400 font-medium",children:[h.jsx(ty,{className:"h-3.5 w-3.5"}),"Failed",e.run_id>0&&h.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-auto",children:["Run #",e.run_id]})]}),e.error_message&&h.jsx("p",{className:"text-xs text-red-800 dark:text-red-300 font-mono mt-1",children:e.error_message})]})}function hBe(e){if(e)return e}function fBe(e){return hBe(e)?.methods??[]}function fx({requiredScopes:e,optionalScopes:t,selectedOptionalScopes:n,grantedScopes:r=[],onToggleOptionalScope:a}){const i=x.useId();return!e.length&&!t.length&&!r.length?null:h.jsxs("div",{className:"space-y-3 text-sm",children:[r.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"font-medium",children:"Already granted"}),h.jsx("p",{className:"text-muted-foreground",children:"These permissions are included when you authorize again."}),h.jsx("ul",{className:"mt-1 space-y-1",children:r.map(s=>h.jsx("li",{className:"break-all",children:s},s))})]}),e.some(s=>!r.includes(s))&&h.jsxs("div",{children:[h.jsx("p",{className:"font-medium",children:"Required permissions"}),h.jsx("ul",{className:"mt-1 space-y-1",children:e.filter(s=>!r.includes(s)).map(s=>h.jsx("li",{className:"break-all",children:s},s))})]}),t.some(s=>!r.includes(s))&&h.jsxs("fieldset",{className:"space-y-2",children:[h.jsx("legend",{className:"font-medium",children:"Additional permissions"}),t.filter(s=>!r.includes(s)).map(s=>h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(E6,{id:`${i}-${s}`,className:"mt-0.5",checked:n.includes(s),onCheckedChange:u=>a(s,u===!0)}),h.jsx("label",{htmlFor:`${i}-${s}`,className:"min-w-0 cursor-pointer break-all",children:s})]},s))]})]})}function px(e){return e.invalidateQueries({predicate:t=>t.queryKey.some(n=>["auth-profiles","connections","feeds","available-operations","connector-operations",...Oo].includes(String(n)))})}function QXe({result:e}){const t=Tn();return x.useEffect(()=>{e&&px(t)},[e,t]),e?h.jsx("p",{role:e==="failed"?"alert":"status",className:"rounded-md border p-3 text-sm",children:e==="connected"?"Account authorization updated. Review your permissions below.":e==="cancelled"?"Authorization cancelled. No permissions were added.":"Authorization did not finish. Review your account below to try again."}):null}function gz(e,t){const{data:n=[]}=r3(e.organization_id,{connectorKey:e.connector_key}),{data:r=[],isLoading:a,isError:i}=a3(e.id),{data:s=[]}=YR(e.id),u=n.find(p=>p.slug===e.auth_profile_slug),c=ch(t?.auth_schema).find(p=>p.type==="oauth"),d=r.filter(p=>p.readiness==="scope_upgrade_required").map(p=>({key:p.operation_key,name:p.name,scopes:p.next_action?.requested_scopes??[]}));if(u?.granted_scopes){const p=Object.entries(t?.feeds_schema??{});for(const y of s){const k=(p.find(([b,M])=>b===y.feed_key||M?.key===y.feed_key)?.[1]?.requiredScopes??[]).filter(b=>!u.granted_scopes?.includes(b));k.length&&d.push({key:`feed:${y.id}`,name:y.display_name??y.feed_key,scopes:k})}}return{profile:u,method:c,affected:d,missing:[...new Set(d.flatMap(p=>p.scopes))],isLoading:a,isError:i}}function XXe({connection:e,connectorDef:t,onReview:n}){const{affected:r}=gz(e,t),a=r.filter(i=>i.key.startsWith("feed:"));return!a.length||e.status!=="active"?null:h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-md border p-3",children:[h.jsxs("div",{className:"min-w-0 text-sm",children:[h.jsx("p",{className:"font-medium",children:"Some sources need additional permissions"}),h.jsxs("p",{className:"text-muted-foreground",children:[a.slice(0,3).map(i=>i.name).join(", "),a.length>3?` and ${a.length-3} more`:""]})]}),h.jsx(ke,{variant:"outline",size:"sm",onClick:n,children:"Review permissions"})]})}function vz(){const e=Tn(),t=x.useRef(void 0),[n,r]=x.useState(!1),[a,i]=x.useState(null),[s,u]=x.useState(null);return x.useEffect(()=>()=>t.current?.(),[]),{begin:async d=>{t.current?.();const p=window.open("about:blank","_blank");p&&(p.opener=null);let y=!0;t.current=()=>{y=!1},r(!0),i(null),u(null);try{const v=await d();if(!y){p?.close();return}const k=v.connect_url;if(!k){if(p?.close(),v.status==="active"){px(e);return}i(v.instructions??"Authorization could not start. Review the app configuration and try again."),u(v.setup_url??null);return}u(k);const b=()=>{px(e),(!p||p.closed)&&(t.current?.(),u(null))},M=p?window.setInterval(()=>{p.closed&&b()},500):void 0;window.addEventListener("focus",b),t.current=()=>{y=!1,window.removeEventListener("focus",b),M&&window.clearInterval(M)},p&&(p.location.href=k)}catch(v){if(p?.close(),!y)return;i(v instanceof Error?v.message:"Authorization could not start. Try again.")}finally{y&&r(!1)}},pending:n,error:a,continueUrl:s}}function WC({connection:e,connectorDef:t}){const{profile:n,method:r,affected:a,missing:i,isLoading:s,isError:u}=gz(e,t),{session:c}=wr(),d=QR(),p=Tve(),y=vz(),[v,k]=x.useState(!1),[b,M]=x.useState([]),_=!!c?.user?.id&&c.user.id===e.created_by&&(!e.auth_profile_slug||n?.created_by===c?.user?.id);if(!r)return null;const C=a.filter(O=>O.key.startsWith("feed:")).length,E=a.length-C,A=[C?`${C} configured ${C===1?"feed":"feeds"}`:null,E?`${E} ${E===1?"action":"actions"}`:null].filter(Boolean).join(" and "),R=O=>e.auth_profile_slug?d.mutateAsync({connection_id:e.id,requested_scopes:O}):p.mutateAsync({connector_key:e.connector_key,slug:e.slug,app_auth_profile_slug:e.app_auth_profile_slug??void 0,requested_scopes:O});return h.jsxs("div",{className:"space-y-3",children:[a.length>0&&h.jsxs("p",{role:"status",className:"text-sm text-muted-foreground",children:[A," ",a.length===1?"requires":"require"," ","additional permissions from ",t.name||r.provider,"."]}),s&&h.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking permissions…"}),u&&h.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not check capability permissions. Refresh and try again."}),_?h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsx(ke,{variant:"outline",size:"sm",disabled:y.pending,onClick:()=>void y.begin(()=>R()),children:e.auth_profile_slug?"Reconnect":"Connect account"}),h.jsx(ke,{variant:"outline",size:"sm",onClick:()=>{k(!v),M(i)},children:"Review permissions"})]}):h.jsx("p",{className:"text-sm text-muted-foreground",children:"Only the account owner can reconnect this account."}),v&&_&&h.jsxs("div",{className:"space-y-3",children:[a.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-sm font-medium",children:C?"Feeds and actions needing access":"Actions needing access"}),h.jsx("ul",{className:"mt-1 list-disc pl-5 text-sm text-muted-foreground",children:a.map(O=>h.jsx("li",{children:O.name},O.key))})]}),h.jsx(fx,{requiredScopes:Bh(r),optionalScopes:Om(r),selectedOptionalScopes:b,grantedScopes:n?.granted_scopes,onToggleOptionalScope:(O,N)=>M(P=>N?[...new Set([...P,O])]:P.filter(L=>L!==O))}),h.jsxs(ke,{size:"sm",disabled:y.pending,onClick:()=>void y.begin(()=>R(b)),children:["Continue to ",r.provider]})]}),y.error&&h.jsx("p",{role:"alert",className:"text-sm text-destructive",children:y.error}),y.continueUrl&&h.jsx("a",{className:"text-sm underline",href:y.continueUrl,target:"_blank",rel:"noreferrer",children:"Continue authorization in your browser"})]})}const N4="__serverless__",KC="__add_device__";function pBe(e){const{session:t}=wr();return e.auth_profile_kind!=="oauth_account"||!!(t?.user?.id&&t.user.id===e.created_by)}function JXe({connection:e,connectorDef:t,ownerSlug:n,showShare:r=!0}){const a=cr(),i=x.useId(),s=Jh(),u=XR(),[c,d]=x.useState(e.display_name??""),[p,y]=x.useState(!1),v=c!==(e.display_name??""),k=e.facets?.chat??!1,b=()=>{s.mutate({connection_id:e.id,display_name:c.trim()||void 0})},M=()=>{u.mutate(e.id,{onSuccess:()=>{a({to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:e.connector_key}})}})};return h.jsxs("div",{className:"space-y-6",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("dl",{className:"text-sm",children:[h.jsx("dt",{className:"text-muted-foreground",children:"Owner"}),h.jsx("dd",{children:e.created_by_username??"Unknown owner"})]}),r&&h.jsx(DUe,{connection:e})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(la,{htmlFor:i,children:"Display name"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(yn,{id:i,value:c,onChange:_=>d(_.target.value),placeholder:t?.name??e.connector_key,className:"max-w-md"}),h.jsx(ke,{onClick:b,disabled:!v||s.isPending,children:s.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})]})]}),!k&&h.jsx(mBe,{connection:e,connectorDef:t,ownerSlug:n}),k&&h.jsx(yBe,{connection:e,connectorDef:t}),!k&&h.jsx(kBe,{connection:e,connectorDef:t,ownerSlug:n}),h.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[h.jsx("p",{className:"text-sm font-medium",children:"Delete this connection"}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:k?"Disconnects this connection. Past messages stay in your workspace.":"Removes the connection and stops its feeds. Past events stay in your workspace."}),h.jsx("div",{className:"mt-3",children:p?h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(ke,{variant:"destructive",size:"sm",disabled:u.isPending,onClick:M,children:[u.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Confirm delete"]}),h.jsx(ke,{variant:"ghost",size:"sm",onClick:()=>y(!1),disabled:u.isPending,children:"Cancel"})]}):h.jsxs(ke,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>y(!0),children:[h.jsx(Zs,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete connection"]})})]})]})}function yBe({connection:e,connectorDef:t}){const n=Jh(),[r,a]=x.useState(null),i=BUe(e.slug),s=t?.options_schema,u=s&&typeof s=="object"&&Object.keys(s.properties??s).length>0?s:null,c=vh(e.id,{},u),{values:d,setValues:p}=c,y=c.hasInvalidInput?{}:Kp(d),v=e.effective_credential_mode==="managed",k=(t?.auth_schema?.methods??[]).find(E=>E.type==="app_installation"),b=k?.permissions??[],M=k?.events??[],_=e.connector_key==="slack"&&b.length>0?JSON.stringify({display_information:{name:e.display_name??"Lobu bot"},features:{bot_user:{display_name:e.display_name??"Lobu bot",always_online:!0},slash_commands:[{command:"/lobu",url:i,description:"Talk to Lobu"}]},oauth_config:{scopes:{bot:b}},settings:{event_subscriptions:{request_url:i,bot_events:M},interactivity:{is_enabled:!0,request_url:i},socket_mode_enabled:!1}},null,2):null,C=async(E,A)=>{await navigator.clipboard.writeText(A),a(E),window.setTimeout(()=>a(null),1500)};return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(la,{children:"Webhook URL"}),h.jsxs("div",{className:"flex max-w-2xl gap-2",children:[h.jsx(yn,{value:i,readOnly:!0,className:"font-mono text-xs"}),h.jsx(ke,{variant:"outline",size:"icon",onClick:()=>void C("webhook",i),children:r==="webhook"?h.jsx(ja,{className:"h-4 w-4"}):h.jsx(Eh,{className:"h-4 w-4"})})]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure this as the provider's events, commands, and interactivity endpoint."})]}),_?h.jsxs("div",{className:"space-y-2",children:[h.jsx(la,{children:"Slack app manifest"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Create a Slack app from this manifest, or copy it into Slack's app manifest editor to configure events, scopes, commands, and interactivity together. Then install the app and paste its bot token + signing secret back into the connection credentials."}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(ke,{asChild:!0,variant:"outline",size:"sm",children:h.jsxs("a",{href:`https://api.slack.com/apps?new_app=1&manifest_json=${encodeURIComponent(_)}`,target:"_blank",rel:"noreferrer",children:[h.jsx(Yh,{className:"mr-1.5 h-3.5 w-3.5"}),"Create app in Slack"]})}),h.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>void C("manifest",_),children:[r==="manifest"?h.jsx(ja,{className:"mr-1.5 h-3.5 w-3.5"}):h.jsx(Eh,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy manifest"]})]})]}):null,!v&&c.revision?h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx(la,{children:"Rotate credentials"}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Enter only values you want to replace. Stored secrets are never shown here."})]}),h.jsx(ul,{schema:c.revision??void 0,values:d,onValuesChange:p}),h.jsx(od,{visible:c.hasConflict,onReload:c.reset}),h.jsxs(ke,{disabled:!c.canSubmit||Object.keys(y).length===0||n.isPending,onClick:()=>n.mutate({connection_id:e.id,config:y}),children:[n.isPending?h.jsx(Dt,{size:"md",className:"mr-2"}):null,"Update credentials"]})]}):null]})}function mBe({connection:e,connectorDef:t,ownerSlug:n}){const r=cr(),a=pBe(e),i=Jh(),{data:s=[],refetch:u,isFetching:c}=ef(),d=t?.required_capability??null,p=e.device_worker_id,y=x.useMemo(()=>{const b=s.filter(M=>M.organization_id===e.organization_id&&(!d||M.capabilities.includes(d)));return p&&!b.some(M=>M.id===p)?[{id:p,worker_id:e.device_worker_handle??p,platform:e.device_platform??null,app_version:null,capabilities:[],label:e.device_label??null,last_seen_at:"",online:e.device_online??!1,organization_id:e.organization_id,organization_name:null,organization_slug:null,connector_count:0,connector_error_count:0,last_sync_at:null,connectors:[],update_required:[]},...b]:b},[s,d,e,p]),v=b=>{if(b===KC){r({to:"/$owner/connectors/create",params:{owner:n}});return}const M=b===N4?null:b;M!==(p??null)&&i.mutate({connection_id:e.id,device_worker_id:M})},k=p??(d?"":N4);return h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(la,{children:["Run on",d?h.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),i.isPending?h.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[h.jsx(Dt,{size:"sm"}),"Saving…"]}):null]}),h.jsxs("div",{className:"flex items-center gap-2 max-w-md",children:[h.jsxs(Ws,{value:k,onValueChange:v,disabled:!a||i.isPending,children:[h.jsx(Fi,{className:"h-8 flex-1",children:h.jsx(Ks,{placeholder:"Select a device"})}),h.jsxs($i,{children:[!d&&h.jsx(Hr,{value:N4,children:"Serverless (default)"}),y.map(b=>h.jsx(ML,{device:b},b.id)),h.jsx(Hr,{value:KC,children:h.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[h.jsx(ia,{className:"h-3.5 w-3.5"}),"Add device"]})})]})]}),h.jsxs("button",{type:"button",onClick:()=>void u(),disabled:c,className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground hover:text-foreground disabled:opacity-50",children:[h.jsx(Bx,{className:`h-3 w-3 ${c?"animate-spin":""}`}),"Refresh"]})]}),d&&y.length===0?h.jsxs("p",{className:"text-xs text-muted-foreground",children:["No device has granted the “",pL[d]??d,"” permission. Open the Lobu app on a device and grant it, then"," ",h.jsx("button",{type:"button",onClick:()=>void u(),className:"underline hover:text-foreground",children:"refresh"}),"."]}):p&&e.device_online===!1?h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Device offline — sync runs wait for it to check in",e.device_last_seen_at?` (last seen ${mf(e.device_last_seen_at)})`:"","."]}):null]})}const gBe={env:"Environment variable",oauth_app:"OAuth app (workspace-wide)",oauth_account:"OAuth account",browser_session:"Browser session (local)",interactive:"Interactive credential"},vBe={env:"A secret pulled from the worker process env. Update by changing the env var on whichever device runs this connector.",oauth_app:"Shared client configuration managed by workspace administrators. Account owners grant consent separately.",oauth_account:"The account owner can reconnect to renew access or grant additional permissions.",browser_session:"Reuses your local browser cookies on a device. Sign in again using the browser pairing flow on that device.",interactive:"A credential the agent fills in at run-time (e.g. a one-time code). Nothing stored long-term."};function kz({heading:e,name:t,kind:n,status:r,isDefault:a,headerRight:i,footer:s}){const u=n?gBe[n]:null,c=n?vBe[n]:null;return h.jsxs("div",{className:ve(Qh,"space-y-1.5 p-4"),children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:e}),i]}),h.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[h.jsx("span",{className:"text-sm font-medium",children:t}),u?h.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",u]}):null,r?h.jsxs("span",{className:r==="active"?"text-xs text-green-500":"text-xs text-amber-500",children:["· ",r]}):null,a?h.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Org default"}):null]}),c?h.jsx("p",{className:"text-xs text-muted-foreground",children:c}):null,s]})}function kBe({connection:e,connectorDef:t,ownerSlug:n}){const r=AUe(t?.auth_schema),a=fBe(t?.auth_schema).some(p=>p.type==="oauth"),i=r?r.provider.charAt(0).toUpperCase()+r.provider.slice(1):null,s=e.config?.managedBy;if(s&&typeof s=="object"&&"org"in s&&typeof s.org=="string")return h.jsxs("div",{className:"space-y-2",children:[h.jsx(la,{children:"Auth"}),h.jsxs("p",{className:"text-sm text-muted-foreground",children:["Managed authorization from ",s.org,". This runtime uses its cloud login to access your grant."]})]});const u=nz(e,t?.auth_schema);if(u)return h.jsxs("div",{id:"connection-auth",className:"space-y-2 scroll-mt-6",children:[h.jsx(la,{children:"Auth"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:W0(u)})]});if(!e.auth_profile_name)return h.jsxs("div",{id:"connection-auth",className:"space-y-2 scroll-mt-6",children:[h.jsx(sx,{organizationId:e.organization_id,connectorKey:e.connector_key}),h.jsx(la,{children:"Auth"}),r?h.jsxs("div",{className:"space-y-2",children:[h.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",i," App installation linked yet."]}),h.jsx(ox,{organizationId:e.organization_id,connectorKey:e.connector_key,provider:r.provider,providerLabel:t?.name,installShape:r.installShape,recovery:!0,variant:"outline"})]}):h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:a?"No account is connected yet.":"No auth profile attached."}),a&&t&&h.jsx(WC,{connection:e,connectorDef:t})]})]});const c=e.auth_profile_kind==="oauth_account"&&!!e.app_auth_profile_name,d=c?"Account":"Profile";return h.jsxs("div",{id:"connection-auth",className:"space-y-2 scroll-mt-6",children:[h.jsx(la,{children:"Auth"}),h.jsxs("div",{className:"space-y-2",children:[c&&e.app_auth_profile_name?h.jsx(xBe,{connection:e,ownerSlug:n}):null,h.jsx(kz,{heading:d,name:e.auth_profile_name,kind:e.auth_profile_kind,status:e.auth_profile_status,footer:e.auth_profile_kind==="oauth_account"&&t?h.jsx(WC,{connection:e,connectorDef:t}):void 0}),t?.key?h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connector slug:"," ",h.jsx("code",{className:"font-mono",children:t.key})]}):null,r?h.jsxs("div",{className:"space-y-1.5 pt-1",children:[h.jsx(sx,{organizationId:e.organization_id,connectorKey:e.connector_key}),h.jsx(ox,{organizationId:e.organization_id,connectorKey:e.connector_key,provider:r.provider,providerLabel:t?.name,installShape:r.installShape,recovery:!0,variant:"outline"})]}):null]})]})}function xBe({connection:e,ownerSlug:t}){const{isAdmin:n}=Fy(e.organization_id),{data:r=[]}=r3(e.organization_id,{connectorKey:e.connector_key,profileKind:"oauth_app"}),a=e.app_auth_profile_slug??void 0,i=r.find(u=>u.slug===a)??null,s=!!i?.is_default_for_connector&&i.connector_key===e.connector_key;return h.jsx(kz,{heading:"Workspace app",name:e.app_auth_profile_name??"—",kind:e.app_auth_profile_kind??"oauth_app",status:e.app_auth_profile_status,isDefault:s,headerRight:n?h.jsx(nn,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:e.connector_key},search:{setup:"oauth_app"},hash:"connector-oauth-apps",className:"text-xs text-muted-foreground hover:text-foreground",children:"Manage app"}):null,footer:n?h.jsx("p",{className:"text-xs text-muted-foreground",children:"This account stays linked to the app used to authorize it. To use another app, connect a new account."}):void 0})}function bBe({connection:e,ownerSlug:t,inPeek:n=!1,onReviewPermissions:r}){const{data:a=[],isLoading:i,isError:s}=a3(e.id);if(i)return h.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading actions…"});if(s)return h.jsx("p",{role:"alert",className:"text-sm",children:"Could not load actions. Close the pane and try again."});if(a.length===0)return h.jsx("p",{className:"text-sm text-muted-foreground",children:"No actions available."});const u=h.jsxs("div",{className:"space-y-3",children:[h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Approval is managed in organization settings."," ",h.jsx(Vp,{ownerSlug:t,connectorKey:e.connector_key,connectionId:e.id})]}),h.jsx(uBe,{connectionId:e.id,connectorKey:e.connector_key,ownerSlug:t,browse:n,onReviewPermissions:r,policyOperations:a})]});return n?u:h.jsx(qUe,{title:"Actions",count:`${a.length} ${a.length===1?"action":"actions"}`,children:u})}const wBe="verify_browser";function MBe(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid browser requirement");const t=e;if(!Array.isArray(t.origins)||t.origins.length===0)throw new Error("Browser origins must not be empty");for(const n of t.origins){const r=new URL(n);if(r.protocol!=="https:"||r.origin!==n||r.username||r.password||r.hostname.includes("*"))throw new Error("Browser origins must be exact HTTPS origins")}if(t.authMethods&&(!Array.isArray(t.authMethods)||!t.authMethods.length||t.authMethods.some(n=>!["none","browser","oauth","env_keys","app_installation","interactive"].includes(n))))throw new Error("Invalid browser authMethods");if(t.accountProbe&&(!t.origins.includes(new URL(t.accountProbe.url).origin)||typeof t.accountProbe.expression!="string"||!t.accountProbe.expression.trim()))throw new Error("Browser account probe must target a declared origin and provide an expression")}function SBe(e,t){return e==null?null:(MBe(e),!e.authMethods||e.authMethods.includes(t)?e:null)}function _Be({isInstalling:e,installConnectorFromSourceUri:t,reloadConnectorCatalog:n,resetConnectorConfiguration:r,selectConnector:a,clearSaveError:i,setInstallError:s}){const[u,c]=x.useState(null),[d,p]=x.useState(null),y=x.useCallback(async b=>{if(!e){if(s(null),i(),b.installed===!1&&b.installable){p(b);return}a(b),r()}},[i,e,r,a,s]),v=x.useCallback(async()=>{if(!d||e)return null;if(!d.source_uri)return s(`Connector '${d.name}' is missing a source URI.`),null;c(d.key);try{await t(d.source_uri);const M=(await n()).find(_=>_.key===d.key&&_.installed!==!1)??null;if(!M)throw new Error(`Installed connector '${d.name}' could not be reloaded.`);return p(null),M}catch(b){return s(b instanceof Error?b.message:"Failed to install connector"),null}finally{c(null)}},[t,e,d,n,s]),k=x.useCallback(()=>{p(null),s(null)},[s]);return{installingConnectorKey:u,setInstallingConnectorKey:c,previewConnector:d,handleConnectorSelect:y,handleInstallPreviewedConnector:v,clearPreview:k}}const GC="No paired Chrome browser is available. Open the Lobu Chrome extension, connect it to this workspace, and enable browser access.";function CBe({open:e,onOpenChange:t,onCreated:n,organizationId:r,editingConnection:a,connections:i=[],initialConnectorKey:s,onDeepLinkBack:u}){const c=Cve(),d=vz(),{session:p}=wr(),y=Jh(),v=Ave(),k=Ove(),b=Rve(),{data:M=[],isLoading:_,refetch:C}=n3(r),E=!!a,A=XR(),R=Pve(),[O,N]=x.useState(!1),[P,L]=x.useState(null),[I,D]=x.useState(!1),[H,K]=x.useState(""),[W,Y]=x.useState(null),[q,$]=x.useState(""),[B,J]=x.useState(null),[te,z]=x.useState(""),[U,V]=x.useState(null),j=ZR(),Z=vh(`${a?.id??"new"}:${B?.key??""}:${e}`,cl(B?.options_schema,a?a.config??{}:B?.default_connection_config??{}),B?.options_schema),{values:ee,setValues:le}=Z,[se,pe]=x.useState(0),[fe,_e]=x.useState(void 0),[me,Re]=x.useState(void 0),[Nt,we]=x.useState(!1),[Fe,lt]=x.useState(""),[gt,Tt]=x.useState(""),[Ge,dt]=x.useState(!1),[jn,ct]=x.useState(""),[Jt,ut]=x.useState(""),[Xe,oe]=x.useState(!1),[ge,ze]=x.useState(""),[Ye,Je]=x.useState(""),[hn,on]=x.useState([]),[Ht,jt]=x.useState(!1),[cn,vt]=x.useState(""),[dr,Cn]=x.useState(""),[qe,at]=x.useState(void 0),[Ie,Ze]=x.useState(a?.device_worker_id??void 0),[sn,Me]=x.useState(!1),[Gt,Ct]=x.useState(null),[In,hr]=x.useState(null),[$t,fr]=x.useState(null),{isAdmin:va}=Fy(r),Cr=x.useMemo(()=>ch(B?.auth_schema).find(tt=>tt.type==="oauth")?.provider??void 0,[B?.auth_schema]),{data:en=[]}=r3(r,{connectorKey:B?.key,provider:Cr});x.useEffect(()=>{if(!a||!e||B||_)return;const Ae=M.find(pr=>pr.key===a.connector_key)??{key:a.connector_key,name:a.connector_name||a.connector_key,description:null,version:"",auth_schema:null,feeds_schema:null,actions_schema:null,options_schema:null,status:"active",login_enabled:!1};J(Ae),z(a.display_name??""),_e(a.auth_profile_slug??void 0),Re(a.app_auth_profile_slug??void 0),Ze(a.device_worker_id??void 0);const Lt=ch(Ae.auth_schema).findIndex(pr=>a.auth_profile_kind==="browser_session"?pr.type==="browser":a.auth_profile_kind==="oauth_account"||a.app_auth_profile_slug?pr.type==="oauth":a.auth_profile_kind==="env"?pr.type==="env_keys":nz(a,Ae.auth_schema)?pr.type==="none":!1);pe(Lt>=0?Lt:0)},[a,e,M,B,_]);const di=x.useMemo(()=>ch(B?.auth_schema),[B]),Ee=di[se]??null,ls=x.useMemo(()=>en.filter(xe=>xe.profile_kind==="env"),[en]),hi=x.useMemo(()=>{if(!Ee||Ee.type!=="oauth")return[];const xe=Ee.provider.toLowerCase();return en.filter(Ae=>Ae.profile_kind==="oauth_account"&&Ae.provider?.toLowerCase()===xe&&(va||Ae.created_by===p?.user?.id))},[Ee,en,va,p?.user?.id]),zr=x.useMemo(()=>{if(!Ee||Ee.type!=="oauth")return[];const xe=Ee.provider.toLowerCase();return en.filter(Ae=>Ae.profile_kind==="oauth_app"&&Ae.status==="active"&&Ae.provider?.toLowerCase()===xe)},[Ee,en]),bn=x.useMemo(()=>en.filter(xe=>xe.profile_kind==="browser_session"),[en]),nr=x.useMemo(()=>{if(!(!Ee||Ee.type!=="env_keys"))return TUe(Ee)},[Ee]),Lo=x.useMemo(()=>jUe(Ee),[Ee]),cs=vh(`${B?.key}:${se}:${Nt}`,cl(nr),nr),Xc=vh(`${B?.key}:${se}:${Ge}`,cl(Lo),Lo),{values:Wd,setValues:Lf}=cs,{values:fi,setValues:Kd}=Xc,ho=x.useMemo(()=>Ee?.type==="oauth"?Om(Ee):[],[Ee]);x.useEffect(()=>{if(!(E||!B||!Ee))if(Ee.type==="oauth"){if(!me&&zr.length>0){const Ae=zr.find(tt=>tt.is_default_for_connector&&tt.connector_key===B.key)??(va&&zr.length===1?zr[0]:void 0);Ae&&Re(Ae.slug)}!fe&&hi.length>0&&_e(hi[0].slug)}else Ee.type==="env_keys"?!fe&&ls.length>0&&_e(ls[0].slug):Ee.type==="browser"&&Ee.mode!=="live"&&!fe&&bn.length>0&&_e(bn[0].slug)},[va,E,B,Ee,me,fe,zr,hi,ls,bn]),x.useEffect(()=>{if(Ee?.type!=="oauth"||ho.length===0){on(tt=>tt.length===0?tt:[]);return}const Ae=(hi.find(tt=>tt.slug===fe)?.requested_scopes??[]).filter(tt=>ho.includes(tt));on(tt=>tt.length===Ae.length&&tt.every((Lt,pr)=>Lt===Ae[pr])?tt:Ae)},[Ee,ho,hi,fe]);const pi=x.useCallback(()=>{we(!1),lt(""),Tt(""),dt(!1),ct(""),ut(""),oe(!1),ze(""),Je(""),on([]),jt(!1),vt(""),Cn("")},[]),yi=x.useCallback(()=>{pe(0),_e(void 0),Re(void 0),pi()},[pi]),{data:zo=[],refetch:Pn,isFetching:zf}=ef(),mi=!!SBe(B?.browser,Ee?.type??"none"),Fr=Ee?.type==="browser"&&Ee.mode==="live",$r=mi?"browser.debugger":B?.required_capability??null,us=x.useMemo(()=>{const xe=zo.filter(tt=>tt.organization_id===r&&(!mi||tt.platform==="chrome-extension")&&(!$r||tt.capabilities.includes($r))),Ae=a?.device_worker_id;return Ae&&!xe.some(tt=>tt.id===Ae)?[{id:Ae,worker_id:a?.device_worker_handle??Ae,platform:a?.device_platform??null,app_version:null,capabilities:[],label:a?.device_label??null,last_seen_at:"",online:a?.device_online??!1,organization_id:r,organization_name:null,organization_slug:null,connector_count:0,connector_error_count:0,last_sync_at:null,connectors:[],update_required:[]},...xe]:xe},[zo,$r,mi,a,r]);x.useEffect(()=>{E||Ze(void 0)},[B?.key,E]),x.useEffect(()=>{if(Ie&&!us.some(xe=>xe.id===Ie)&&Ie!==a?.device_worker_id){Ze(void 0);return}E||!$r||Ie||us.length===1&&Ze(us[0].id)},[E,$r,Ie,us,a]);const ds=x.useMemo(()=>fe?en.find(xe=>xe.slug===fe&&xe.profile_kind==="browser_session"):void 0,[en,fe])?.device_worker_id??null;x.useEffect(()=>{ds&&Ie!==ds&&Ze(ds)},[ds,Ie]);const Fm=x.useCallback(async()=>(await C()).data??[],[C]),{installingConnectorKey:Jc,setInstallingConnectorKey:eu,previewConnector:Ha,handleConnectorSelect:Er,handleInstallPreviewedConnector:Ff,clearPreview:Gd}=_Be({isInstalling:R.isPending,installConnectorFromSourceUri:async xe=>{await R.mutateAsync({source_uri:xe})},reloadConnectorCatalog:Fm,resetConnectorConfiguration:yi,selectConnector:J,clearSaveError:()=>Ct(null),setInstallError:Y}),gi=xe=>{xe||(J(null),V(null),z(""),yi(),at(void 0),Ct(null),N(!1),L(null),D(!1),K(""),Y(null),eu(null),$(""),hr(null),fr(null),Gd()),t(xe)},$f=(xe=!1)=>{hr(null),!E&&(xe&&$t&&B&&n?n($t,B.key):gi(!1))},tu=()=>{if(B&&s&&u){u();return}B?(J(null),V(null),yi(),at(void 0),Ct(null),Y(null)):Ha&&Gd()},qf=x.useRef(!1);x.useEffect(()=>{if(qf.current||E||!s||B)return;const xe=M.find(Ae=>Ae.key===s);xe&&(qf.current=!0,Er(xe))},[e,E,s,M,B,Er]);const Yr=x.useMemo(()=>{if(!B||!Z.revision||Ee&&Ee.type!=="none")return!1;const xe=Z.revision.properties;if(!xe)return!1;const Ae=new Set,tt=B.feeds_schema;if(tt){for(const Lt of Object.values(tt))if(Lt.configSchema?.properties)for(const pr of Object.keys(Lt.configSchema.properties))Ae.add(pr)}return Object.keys(xe).some(Lt=>!Ae.has(Lt))},[B,Ee,Z.revision]),Ll=x.useMemo(()=>{const xe=ch(B?.auth_schema),Ae=B?.auth_schema?.methods??[];return xe.length===0&&Ae.length>0&&Ae.every(tt=>tt.type==="none")},[B]),Hf=x.useMemo(()=>!Ll||!B||!qe?null:i.find(xe=>xe.connector_key===B.key&&xe.created_by===qe)??null,[Ll,B,qe,i]),vi=x.useCallback(xe=>Object.fromEntries(Object.entries(xe).filter(([,Ae])=>typeof Ae=="string"&&Ae.trim().length>0).map(([Ae,tt])=>[Ae,String(tt).trim()])),[]),hs=xe=>{d.begin(async()=>({connect_url:xe}))},ki=x.useCallback(async xe=>{if(!(!B||!Ee))try{const Ae=await v.mutateAsync({connector_key:B.key,profile_kind:xe.profileKind,display_name:xe.displayName,slug:xe.slug||void 0,...xe.credentials?{credentials:xe.credentials}:{},...xe.authData?{auth_data:xe.authData}:{},...xe.requestedScopes?{requested_scopes:xe.requestedScopes}:{}});await xe.onSuccess(Ae)}catch(Ae){Ct(Ae instanceof Error?Ae.message:"Failed to create auth profile")}},[Ee,v,B]),Uf=x.useCallback(async()=>{if(!cs.canSubmit||!Ee||Ee.type!=="env_keys")return;const xe=vi(Wd);await ki({profileKind:"env",displayName:Fe.trim()||`${B?.name} Auth`,slug:gt.trim(),credentials:xe,onSuccess:Ae=>{_e(Ae.auth_profile.slug),we(!1),lt(""),Tt("")}})},[Ee,ki,Fe,gt,Wd,cs.canSubmit,vi,B?.name]),fs=x.useCallback(async()=>{if(!Xc.canSubmit||!Ee||Ee.type!=="oauth")return;const xe=vi(fi);await ki({profileKind:"oauth_app",displayName:jn.trim()||`${B?.name} ${Ee.provider} App`,slug:Jt.trim(),credentials:xe,onSuccess:Ae=>{Re(Ae.auth_profile.slug),dt(!1),ct(""),ut("")}})},[Ee,ki,jn,Jt,fi,Xc.canSubmit,vi,B?.name]),$m=async()=>{if(!(!B||Ee?.type!=="oauth")){if(!me){Ct("Choose an OAuth app before connecting your account.");return}Ct(null),await d.begin(async()=>{const xe=await v.mutateAsync({connector_key:B.key,profile_kind:"oauth_account",display_name:ge.trim()||`${B.name} ${Ee.provider} Account`,slug:Ye.trim()||void 0,app_auth_profile_slug:me,requested_scopes:BC(Ee,hn)}),Ae=xe.auth_profile?.slug??xe.pending_slug;return Ae&&_e(Ae),oe(!1),ze(""),Je(""),{...xe,status:xe.auth_profile?.status}})}},Bf=x.useCallback(async()=>{!Ee||Ee.type!=="browser"||await ki({profileKind:"browser_session",displayName:cn.trim()||`${B?.name||"Connector"} Browser Session`,slug:dr.trim(),onSuccess:xe=>{xe.auth_profile?.slug&&_e(xe.auth_profile.slug),jt(!1),vt(""),Cn("")}})},[Ee,ki,cn,dr,B?.name]),Yd=async xe=>{const Ae=await j.mutateAsync({connection_id:xe,operation_key:wBe,input:{}});if(Ae.status!=="completed")throw new Error(Ae.error_message??Ae.message??"Finish sign-in or approve the account check in Lobu, then try again.");gn.success(Fr?`${B?.name} connected`:"Browser verified",{duration:1/0,closeButton:!0})},Zd=async()=>{if(B){if(!Z.canSubmit){Ct("Reload the latest connection values before saving.");return}Me(!0),Ct(null);try{if(U){await Yd(U),n?n(U,B.key):gi(!1);return}const xe=Kp(ee);let Ae,tt;if(Ee?.type==="env_keys"&&(Ae=fe?.trim()||void 0,!Ae))throw new Error("Select or create an auth profile before creating the connection.");if(Ee?.type==="oauth"){if(Ae=fe?.trim()||void 0,tt=me?.trim()||void 0,!tt)throw new Error(`Select or create an ${Ee.provider} app profile first.`);if(!Ae)throw new Error(`Select or create an ${Ee.provider} account profile first.`)}if(Ee?.type==="browser"&&!Fr&&(Ae=fe?.trim()||void 0,!Ae))throw new Error("Select or create a browser auth profile before creating the connection.");if($r&&!Ie)throw new Error(us.length===0?mi?`${GC} Then refresh.`:`No device with the "${$r}" permission. Open the Lobu app on a device and grant it, then refresh.`:"Choose a device to run this connector on.");if(E){const Lt=a.device_worker_id??void 0;await y.mutateAsync({connection_id:a.id,display_name:te||void 0,auth_profile_slug:Ee?.type==="oauth"||Ee?.type==="env_keys"||Ee?.type==="browser"?Ae??void 0:Ee?.type==="none"?null:void 0,app_auth_profile_slug:Ee?.type==="oauth"?tt??void 0:Ee?.type==="none"?null:void 0,config:Object.keys(xe).length>0?xe:void 0,device_worker_id:Ie===Lt&&!(Fr&&!a.auth_profile_slug)?void 0:Ie??null}),Fr&&await Yd(a.id),gi(!1)}else{const Lt=await c.mutateAsync({connector_key:B.key,display_name:te||void 0,auth_profile_slug:Ee?.type==="none"?null:Ae,app_auth_profile_slug:Ee?.type==="none"?null:tt,config:Object.keys(xe).length>0?xe:void 0,created_by:Fr?void 0:qe,device_worker_id:Ie??null});Lt.auth_run_id?(hr(Lt.auth_run_id),fr(Lt.connection_id??Lt.connection.id)):Lt.status==="setup_required"&&Lt.setup_family==="browser"?(V(Lt.connection_id??null),Ct(Lt.instructions??"Finish browser setup, then verify the connection.")):(mi&&Lt.connection.status==="active"&&gn.success(Fr?`${B.name} connected`:"Browser verified",{duration:1/0,closeButton:!0}),n?n(Lt.connection.id,B.key):gi(!1))}}catch(xe){Ct(xe instanceof Error?xe.message:E?"Failed to update connection":"Failed to create connection")}finally{Me(!1)}}},qm=xe=>{E||Ze(void 0),pe(xe),_e(void 0),Re(void 0),we(!1),dt(!1),oe(!1),jt(!1),on([])},Hm=async(xe,Ae)=>{try{await k.mutateAsync(xe),L(null),Ae==="app"?Re(""):_e("")}catch(tt){Ct(tt instanceof Error?tt.message:`Failed to delete ${Ae==="app"?"app":"auth"} profile`)}},nu=async xe=>{Ct(null);const Ae=en.find(Lt=>Lt.slug===xe),tt=Ae?.status==="pending_auth"&&!Ae.granted_scopes?.length;await d.begin(()=>b.mutateAsync({auth_profile_slug:xe,app_auth_profile_slug:tt?me:void 0,requested_scopes:BC(Ee?.type==="oauth"?Ee:null,hn)}))};return{pendingBrowserConnectionId:U,configDraft:Z,runtimeDraft:cs,appDraft:Xc,createAuthProfile:v,deleteAuthProfileMutation:k,reconnectAuthProfile:b,deleteConnection:A,installConnectorMutation:R,connectorDefs:M,isLoadingDefs:_,isEditMode:E,showDeleteConfirm:O,setShowDeleteConfirm:N,confirmingDeleteProfileSlug:P,setConfirmingDeleteProfileSlug:L,showInstallForm:I,setShowInstallForm:D,installSourceUrl:H,setInstallSourceUrl:K,installError:W,setInstallError:Y,installingConnectorKey:Jc,searchQuery:q,setSearchQuery:$,previewConnector:Ha,handleInstallPreviewedConnector:Ff,clearPreview:Gd,selectedConnector:B,displayName:te,setDisplayName:z,configValues:ee,selectedAuthMethodIndex:se,selectedAuthProfileSlug:fe,setSelectedAuthProfileSlug:_e,selectedAppAuthProfileSlug:me,setSelectedAppAuthProfileSlug:Re,showNewRuntimeProfileForm:Nt,setShowNewRuntimeProfileForm:we,newRuntimeProfileName:Fe,setNewRuntimeProfileName:lt,newRuntimeProfileSlug:gt,setNewRuntimeProfileSlug:Tt,newRuntimeProfileValues:Wd,setNewRuntimeProfileValues:Lf,showNewAppProfileForm:Ge,setShowNewAppProfileForm:dt,newAppProfileName:jn,setNewAppProfileName:ct,newAppProfileSlug:Jt,setNewAppProfileSlug:ut,newAppProfileValues:fi,setNewAppProfileValues:Kd,showNewOAuthAccountForm:Xe,setShowNewOAuthAccountForm:oe,newOAuthAccountName:ge,setNewOAuthAccountName:ze,newOAuthAccountSlug:Ye,setNewOAuthAccountSlug:Je,showNewBrowserProfileForm:Ht,setShowNewBrowserProfileForm:jt,newBrowserProfileName:cn,setNewBrowserProfileName:vt,newBrowserProfileSlug:dr,setNewBrowserProfileSlug:Cn,isSaving:sn,saveError:Gt??d.error,authorizationUrl:d.continueUrl,setSaveError:Ct,handleAuthClose:$f,pendingAuthRunId:In,setPendingAuthRunId:hr,authProfiles:en,selectableMethods:di,activeMethod:Ee,runtimeEnvProfiles:ls,runtimeOAuthProfiles:hi,appOAuthProfiles:zr,browserProfiles:bn,runtimeProfileSchema:nr,appProfileSchema:Lo,availableOAuthOptionalScopes:ho,selectedOAuthOptionalScopes:hn,setSelectedOAuthOptionalScopes:on,hasUniqueOptionsFields:Yr,connections:i,isNoAuthConnector:Ll,existingNoAuthConnection:Hf,selectedMemberUserId:qe,setSelectedMemberUserId:at,isAdmin:va,devices:zo,deviceOptions:us,lockedDeviceWorkerIdFromProfile:ds,browserRequired:mi,browserSetupHint:GC,liveBrowser:Fr,requiredCapability:$r,selectedDeviceWorkerId:Ie,setSelectedDeviceWorkerId:Ze,refreshDevices:Pn,devicesRefreshing:zf,handleOpenChange:gi,handleConnectorSelect:Er,handleBack:tu,handleValuesChange:le,normalizeStringValues:vi,navigateOAuthPopup:hs,handleCreateRuntimeProfile:Uf,handleCreateAppProfile:fs,handleCreateOAuthAccountProfile:$m,handleCreateBrowserProfile:Bf,handleSave:Zd,handleMethodChange:qm,handleDeleteAuthProfile:Hm,handleReconnect:nu}}const EBe=["all","data","chat","actions","inference","runtime","device"],YC={data:!1,chat:!1,actions:!1,audience:!1,inference:!0,runtime:!1},ZC="__create_oauth_app_profile__",QC="__create_oauth_account_profile__",XC="__create_browser_profile__",j4="__serverless__",JC="__add_device__",xz=IUe(),I4=`${xz}/connect/oauth/callback`;function ABe({method:e}){const[t,n]=x.useState(!1),r=e.setupInstructions||e.description,a=r?r.replace(/\{\{redirect_uri\}\}/g,I4):null;return h.jsxs("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[a&&h.jsx("p",{className:"text-xs text-muted-foreground",children:a}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Redirect URI"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("code",{className:"flex-1 rounded bg-muted px-2 py-1 text-xs font-mono break-all",children:I4}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-7 shrink-0 p-0",onClick:()=>{navigator.clipboard.writeText(I4),n(!0),setTimeout(()=>n(!1),2e3)},children:t?h.jsx(ja,{className:"h-3.5 w-3.5"}):h.jsx(Eh,{className:"h-3.5 w-3.5"})})]})]})]})}function RBe({connector:e,ownerSlug:t,existingConnectionCount:n=0,onInstall:r,onBack:a,isInstalling:i,installError:s}){const u=GN(e.auth_schema),c=KN(e.runtime?.platforms),d=e.runtime?.scopes??[],{data:p=[]}=ef(),y=e.required_capability??null,v=y?p.find(C=>(!t||qL(C,t))&&C.online&&C.capabilities.includes(y)):void 0,{inspectFeed:k,inspectAction:b}=FL(),M=e.feeds_schema??{},_=e.actions_schema??{};return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(ke,{variant:"ghost",size:"sm",onClick:a,className:"h-7 px-2 text-xs",children:"← Back"}),h.jsx(Zu,{connector:e,showDescription:!1,className:"gap-2"}),e.version&&h.jsxs(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px] font-mono",children:["v",e.version]}),e.catalog_origin==="org"&&h.jsx(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:"Org-installed"})]}),(c||e.required_capability||u.length>0||n>0)&&h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n>0&&h.jsxs(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:[n," existing connection",n===1?"":"s"]}),c&&h.jsxs(Qn,{variant:"secondary",className:"h-4 gap-1 px-1.5 py-0 text-[10px]",children:[h.jsx(Lx,{className:"h-2.5 w-2.5"}),"Requires ",c]}),e.required_capability&&h.jsxs(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:["Needs ",e.required_capability]}),u.map(C=>h.jsx(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:C},C))]}),e.description&&h.jsx("div",{className:ve(Qh,"p-3"),children:h.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})}),(e.source_uri||d.length>0)&&h.jsxs("div",{className:"space-y-1 rounded-lg border bg-muted/30 p-3 text-xs",children:[e.source_uri&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"font-medium text-muted-foreground uppercase tracking-wider text-[10px]",children:"Source"}),h.jsxs("a",{href:e.source_uri,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 break-all font-mono text-primary hover:underline",children:[e.source_uri,h.jsx(Yh,{className:"h-3 w-3 shrink-0"})]})]}),d.length>0&&h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[h.jsx("span",{className:"font-medium text-muted-foreground uppercase tracking-wider text-[10px]",children:"Scopes"}),d.map(C=>h.jsx(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px] font-mono",children:C},C))]})]}),h.jsx(uz,{feedsSchema:M,onInspect:k}),h.jsx(dz,{actionsSchema:_,ownerSlug:t,connectorKey:e.key,onInspect:b}),s&&h.jsx("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm text-red-600 dark:text-red-400",children:s}),e.required_capability?v?h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"rounded-lg border bg-muted/30 px-3 py-2 text-sm text-muted-foreground",children:["Available on ",m6(v),v.last_seen_at?` · last seen ${mf(v.last_seen_at)}`:""]}),t?h.jsx(ke,{asChild:!0,variant:"secondary",className:"w-full",children:h.jsx(nn,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:v.id},children:"Open device"})}):null]}):h.jsxs(ke,{onClick:()=>{window.location.href=eW(`grant/${e.required_capability}`)},className:"w-full",children:[h.jsx(Fx,{className:"mr-2 h-4 w-4"}),"Connect on this Mac"]}):h.jsx(ke,{onClick:r,disabled:i,className:"w-full",children:i?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"}),"Installing..."]}):"Install & Configure"})]})}function OBe({connector:e,ownerSlug:t}){const{data:n=[]}=Eve(e.installed?e.key:null),r=n.length>0?Object.fromEntries(n.map(s=>[s.operation_key,{...e.actions_schema?.[s.operation_key],name:s.name,description:s.description}])):e.actions_schema,{inspectFeed:a,inspectAction:i}=FL();return h.jsxs(h.Fragment,{children:[h.jsx(uz,{feedsSchema:e.feeds_schema,onInspect:a}),h.jsx(dz,{actionsSchema:r,onInspect:i,ownerSlug:t,connectorKey:e.key})]})}function TBe({connection:e,activeAuthRunId:t,onStart:n,onClear:r,onRecover:a,isStarting:i}){const{data:s}=Dve(t==null?e.id:null);x.useEffect(()=>{const v=s?.run_id;t==null&&v&&a(v)},[t,s?.run_id,a]);const{data:u,isLoading:c}=JR(t),d=u?.status==="completed"||u?.status==="failed"||u?.status==="cancelled",p=e.status==="pending_auth"||e.status==="error"||e.auth_profile_status!=null&&e.auth_profile_status!=="active",y=t!=null&&!d;return h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx("p",{className:"text-xs text-muted-foreground",children:"This connector pairs interactively (e.g. QR code or device link). Artifacts are only shown to the person who initiates the pairing."}),!y&&h.jsx(ke,{type:"button",variant:p?"default":"outline",size:"sm",className:"h-8",disabled:i,onClick:n,children:i?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"md",className:"mr-1.5"}),"Starting…"]}):p?"Pair device":"Reset pairing"}),y&&h.jsxs("div",{className:"space-y-3",children:[c&&!u&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(Dt,{size:"lg"})," Preparing…"]}),u&&!u.artifact&&!d&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(Dt,{size:"lg"})," Waiting for connector…"]}),u?.artifact&&!d&&t!=null&&h.jsx(tz,{artifact:u.artifact,runId:t}),h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:u?.status==="pending"?"Starting…":u?.status==="running"?"Waiting for you…":""}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:r,children:"Cancel"})]})]}),d&&u?.status==="completed"&&h.jsx("div",{className:"text-sm text-emerald-600",children:"Paired successfully."}),d&&u?.status==="failed"&&h.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-2 text-sm text-destructive",children:u.error_message||"Authentication failed."})]})}function NBe({onClose:e,onCreated:t,organizationId:n,editingConnection:r,connections:a=[],initialConnectorKey:i,ownerSlug:s,onDeepLinkBack:u}){const c=CBe({open:!0,onCreated:t,onOpenChange:I=>{I||e()},organizationId:n,editingConnection:r,connections:a,initialConnectorKey:i,onDeepLinkBack:u}),d=QR(),p=cr(),{data:y=[]}=ZHe(),{data:v,isLoading:k}=hke({enabled:!!s}),[b,M]=x.useState("all"),[_,C]=x.useState(()=>V0(i??"")),E=!c.isEditMode&&c.activeMethod?.type==="app_installation",R=r?.device_worker_id?h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connected through"," ",r.device_worker_id&&s?h.jsx(nn,{to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:r.device_worker_id},className:"text-foreground hover:underline",children:r.device_label||r.device_platform||"this device"}):h.jsx("span",{className:"text-foreground",children:r.device_label||r.device_platform||"this device"}),r.device_online===!1?" · offline":r.device_last_seen_at?` · last seen ${mf(r.device_last_seen_at)}`:""]}):null,O=h.jsxs("div",{className:"space-y-6 pb-6",children:[!c.selectedConnector&&c.previewConnector&&h.jsx(RBe,{ownerSlug:s,connector:c.previewConnector,existingConnectionCount:a.filter(I=>I.connector_key===c.previewConnector?.key).length,onInstall:()=>{c.handleInstallPreviewedConnector().then(I=>{!I||!s||p({to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:I.key}})})},onBack:c.handleBack,isInstalling:c.installConnectorMutation.isPending,installError:c.installError}),_&&h.jsx(jBe,{providerKind:_,credentialFields:v?.providerCatalog.find(I=>I.id===_)?.credentialFields,isProviderCatalogLoading:k,ownerSlug:s??"",onBack:()=>C(null)}),!_&&!c.selectedConnector&&!c.previewConnector&&h.jsxs("div",{className:"space-y-3",children:[h.jsx("div",{className:ve(Qh,"w-full"),children:c.showInstallForm?h.jsxs("div",{className:"p-3 space-y-3",children:[h.jsx("p",{className:"text-sm font-medium",children:"Install from URL"}),h.jsx(yn,{placeholder:"https://… (TypeScript source or MCP server URL)",value:c.installSourceUrl,onChange:I=>{c.setInstallSourceUrl(I.target.value),c.setInstallError(null)},className:"text-xs font-mono"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"URLs ending in .ts/.js are installed as source connectors. Other URLs are probed as MCP servers."}),c.installError&&h.jsx("p",{className:"text-xs text-destructive",children:c.installError}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{c.setShowInstallForm(!1),c.setInstallSourceUrl(""),c.setInstallError(null)},children:"Cancel"}),h.jsxs(ke,{size:"sm",className:"h-7 text-xs",disabled:c.installConnectorMutation.isPending||!c.installSourceUrl.trim(),onClick:()=>{c.setInstallError(null);const I=c.installSourceUrl.trim(),D=/\.(ts|js|mjs)(\?|$)/i.test(I);c.installConnectorMutation.mutate(D?{source_url:I}:{mcp_url:I},{onSuccess:()=>{c.setShowInstallForm(!1),c.setInstallSourceUrl("")},onError:H=>{c.setInstallError(H instanceof Error?H.message:"Failed to install connector")}})},children:[c.installConnectorMutation.isPending?h.jsx(Dt,{size:"sm",className:"mr-1"}):null,"Install"]})]})]}):h.jsxs("button",{type:"button",className:"flex items-center gap-3 p-3 w-full text-left text-muted-foreground hover:text-foreground transition-colors",onClick:()=>c.setShowInstallForm(!0),children:[h.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:h.jsx(kR,{className:"h-4 w-4"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm font-medium",children:"Install Custom Connector"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Install from a source file URL or MCP server URL"})]})]})}),h.jsxs("div",{className:"relative",children:[h.jsx(Zh,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(yn,{placeholder:"Search connectors...",value:c.searchQuery,onChange:I=>c.setSearchQuery(I.target.value),className:"pl-9"})]}),h.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:EBe.map(I=>h.jsx(ke,{type:"button",variant:b===I?"secondary":"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>M(I),children:zqe[I]},I))}),!c.showInstallForm&&c.installError&&h.jsx("p",{className:"text-xs text-destructive",children:c.installError}),c.isLoadingDefs?h.jsx(kHe,{}):(()=>{const I=c.searchQuery.toLowerCase().trim(),D=new Map;for(const j of a)D.set(j.connector_key,(D.get(j.connector_key)??0)+1);const H=c.connectorDefs.filter(j=>!I||j.name.toLowerCase().includes(I)||j.key.toLowerCase().includes(I)||j.description?.toLowerCase().includes(I)?T4({connector:j,facets:Hqe(j)},b):!1).sort((j,Z)=>j.name.localeCompare(Z.name)),K=j=>j.installed||(D.get(j.key)??0)>0,W=H.filter(K),Y=H.filter(j=>!K(j)),q=s?y.filter(j=>!I||j.displayName.toLowerCase().includes(I)||j.slug.toLowerCase().includes(I)?T4({connector:{key:`${Ys}${j.slug}`,name:j.displayName,auth_schema:null},facets:YC},b):!1).sort((j,Z)=>j.displayName.localeCompare(Z.displayName)):[],$=s?BHe(v?.availableProviders??[]).filter(j=>!I||j.name.toLowerCase().includes(I)||j.key.toLowerCase().includes(I)||j.description?.toLowerCase().includes(I)?T4({connector:j,facets:lx()},b):!1).sort((j,Z)=>j.name.localeCompare(Z.name)):[],B=s&&b==="all"?If(s,v6()).filter(j=>!I||j.name.toLowerCase().includes(I)||j.tagline.toLowerCase().includes(I)):[],J=q.length+$.length+B.length,te=j=>(Z,ee)=>{const le=c.installConnectorMutation.isPending&&c.installingConnectorKey===Z.key,se=KN(Z.runtime?.platforms),pe=GN(Z.auth_schema);return h.jsxs("button",{type:"button",className:`flex w-full items-center gap-3 bg-card px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60 ${ee===j-1?"":"border-b"}`,onClick:()=>{if(s&&Z.installed!==!1&&!V0(Z.key)&&!Z.key.startsWith(Ys)){p({to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:Z.key}});return}c.handleConnectorSelect(Z)},disabled:c.installConnectorMutation.isPending&&c.installingConnectorKey!==Z.key,children:[h.jsx(Zu,{connector:Z,className:"min-w-0 flex-1"}),h.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[le?h.jsxs(Qn,{variant:"secondary",className:"h-4 shrink-0 gap-1 px-1.5 py-0 text-[10px]",children:[h.jsx(Dt,{size:"xs"}),"Installing"]}):null,se&&h.jsxs(Qn,{variant:"secondary",className:"h-4 shrink-0 gap-1 px-1.5 py-0 text-[10px]",children:[h.jsx(Lx,{className:"h-2.5 w-2.5"}),"Requires ",se]}),pe.map(fe=>h.jsx(Qn,{variant:"secondary",className:"h-4 shrink-0 px-1.5 py-0 text-[10px]",children:fe},fe)),Z.login_enabled&&h.jsxs(Qn,{variant:"secondary",className:"h-4 shrink-0 gap-1 px-1.5 py-0 text-[10px]",children:[h.jsx(ap,{className:"h-2.5 w-2.5"}),"Login"]})]}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},Z.key)},z=(j,Z)=>h.jsxs(nn,{to:"/$owner/connectors/$connectorKey",search:{addAccount:!0},params:{owner:s??"",connectorKey:`${Ys}${j.slug}`},className:`flex w-full items-center gap-3 bg-card px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${Z===q.length-1&&$.length+B.length===0?"":"border-b"}`,children:[h.jsx(Zu,{connector:{key:`${Ys}${j.slug}`,name:j.displayName,iconUrl:j.iconUrl},className:"min-w-0 flex-1"}),h.jsx("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:h.jsx(ix,{facets:YC})}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`${Ys}${j.slug}`),U=(j,Z)=>h.jsxs("button",{type:"button",onClick:()=>C(V0(j.key)??null),className:`flex w-full items-center gap-3 bg-card px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${Z===$.length-1&&B.length===0?"":"border-b"}`,children:[h.jsx(Zu,{connector:j,className:"min-w-0 flex-1"}),h.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[h.jsx(ix,{facets:lx()}),h.jsx(Qn,{variant:"secondary",className:"h-4 shrink-0 px-1.5 py-0 text-[10px] text-muted-foreground",children:"Available"})]}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},j.key),V=(j,Z)=>h.jsxs(nn,{to:"/$owner/connectors/app/$appId",params:{owner:s??"",appId:j.id},className:`flex w-full items-center gap-3 bg-card px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${Z===B.length-1?"":"border-b"}`,children:[h.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-dashed",children:j.icon}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"truncate text-sm font-medium",children:j.name}),h.jsx("p",{className:"truncate text-xs text-muted-foreground",children:j.tagline})]}),h.jsx(Br,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},j.id);return H.length===0&&q.length===0&&$.length===0&&B.length===0?h.jsxs("div",{className:"space-y-3 py-4 text-center",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-sm font-medium",children:I?`No connectors match "${c.searchQuery}"`:b!=="all"?"No connectors match this filter":"No connectors found"}),h.jsx("p",{className:"mx-auto max-w-sm text-xs text-muted-foreground",children:"Install a custom connector from URL, or create an agent that links the connector your workflow needs."})]}),s?h.jsx(ke,{asChild:!0,variant:"outline",size:"sm",children:h.jsxs(nn,{to:`/${s}/agents`,search:{create:!0},children:[h.jsx(ia,{className:"mr-2 h-4 w-4"}),"Create with an agent"]})}):null]}):h.jsxs("div",{className:"space-y-4",children:[W.length>0?h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("h3",{className:"text-[11.5px] font-medium text-muted-foreground",children:"Already in this workspace"}),h.jsx("div",{className:"overflow-hidden rounded-lg border",children:W.map(te(W.length))})]}):null,Y.length+J>0?h.jsxs("div",{className:"space-y-1.5",children:[W.length>0?h.jsx("h3",{className:"text-[11.5px] font-medium text-muted-foreground",children:"From the catalog"}):null,h.jsxs("div",{className:"overflow-hidden rounded-lg border",children:[Y.map(te(Y.length+J)),q.map(z),$.map(U),B.map(V)]})]}):null]})})()]}),c.selectedConnector&&h.jsxs("div",{className:"space-y-4",children:[!c.isEditMode&&h.jsx(sx,{organizationId:n,connectorKey:c.selectedConnector.key}),h.jsxs("div",{className:"flex items-center gap-2",children:[!c.isEditMode&&h.jsx(ke,{variant:"ghost",size:"sm",onClick:c.handleBack,className:"h-7 px-2 text-xs",children:"← Back"}),h.jsx(Zu,{connector:c.selectedConnector,showDescription:!1,className:"gap-2"}),c.selectedConnector.version&&h.jsxs(Qn,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-4 font-mono",children:["v",c.selectedConnector.version]})]}),c.isEditMode&&r?.status==="pending_auth"&&r.connect_token&&h.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 p-4 space-y-3",children:[h.jsx("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-200",children:"Authorization required"}),h.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:"This connection is waiting for OAuth authorization to complete."}),h.jsxs(ke,{size:"sm",onClick:()=>{const I=`${xz}/connect/${r.connect_token}/oauth/start`;c.navigateOAuthPopup(I)},children:[h.jsx(Yh,{className:"mr-1.5 h-3.5 w-3.5"}),"Authorize"]})]}),c.isEditMode&&r?.status==="pending_auth"&&r.auth_profile_kind==="browser_session"&&r.auth_profile_slug&&h.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 p-4 space-y-3",children:[h.jsx("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-200",children:"Browser auth required"}),h.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:c.liveBrowser?"Sign in to this account in the selected Chrome profile, then save changes to verify it.":"Capture or refresh the browser session for this auth profile, then the connection will resume automatically."}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Follow the connector’s authorization instructions to refresh this session."})]}),!E&&(c.requiredCapability||c.deviceOptions.length>0)&&h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("label",{className:"text-sm font-medium",children:[c.browserRequired?"Browser":"Run on",c.requiredCapability?h.jsx("span",{className:"text-destructive ml-1",children:"*"}):h.jsx("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:"(optional)"})]}),h.jsx("div",{className:"flex items-center gap-3",children:h.jsxs("button",{type:"button",onClick:()=>void c.refreshDevices(),disabled:c.devicesRefreshing,className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground disabled:opacity-50",children:[h.jsx(Bx,{className:`h-3 w-3 ${c.devicesRefreshing?"animate-spin":""}`}),"Refresh"]})})]}),h.jsxs(Ws,{value:c.selectedDeviceWorkerId??(c.requiredCapability?"":j4),onValueChange:I=>{if(I===JC){s&&p({to:"/$owner/connectors/create",params:{owner:s}});return}c.setSelectedDeviceWorkerId(I===j4?void 0:I)},disabled:!!c.lockedDeviceWorkerIdFromProfile||!!c.pendingBrowserConnectionId,children:[h.jsx(Fi,{className:"h-8",children:h.jsx(Ks,{placeholder:c.browserRequired?"Select a Chrome browser":"Select a device"})}),h.jsxs($i,{children:[!c.requiredCapability&&h.jsx(Hr,{value:j4,children:"Serverless (default)"}),c.deviceOptions.map(I=>h.jsx(ML,{device:I},I.id)),s?h.jsx(Hr,{value:JC,children:h.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[h.jsx(ia,{className:"h-3.5 w-3.5"}),"Add device"]})}):null]})]}),c.requiredCapability&&c.deviceOptions.length===0?h.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.browserRequired?`${c.browserSetupHint} Then `:h.jsxs(h.Fragment,{children:["No device has granted the “",pL[c.requiredCapability]??c.requiredCapability,"” permission. Open the Lobu app on a device and grant it, then"," "]}),h.jsx("button",{type:"button",onClick:()=>void c.refreshDevices(),className:"underline hover:text-foreground",children:"refresh"}),"."]}):c.selectedDeviceWorkerId?h.jsx("p",{className:"text-xs text-muted-foreground",children:c.browserRequired?"Lobu uses this Chrome profile and its signed-in account. Keep this browser open when using the connection.":"Syncs and actions run on this device — with its credentials and network, not the Lobu server."}):h.jsx("p",{className:"text-xs text-muted-foreground",children:"Runs serverless, in the Lobu server."})]}),c.isEditMode&&r?.has_operations&&h.jsx("div",{className:"rounded-lg border bg-muted/30 p-4 space-y-4",children:h.jsx(bBe,{connection:r,ownerSlug:s})}),!E&&!c.isEditMode&&h.jsx(OBe,{connector:c.selectedConnector,ownerSlug:s}),c.selectableMethods.length>0&&h.jsxs("section",{className:"space-y-3",children:[h.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Authentication"}),c.selectableMethods.length>1?h.jsx("div",{className:"flex gap-2",children:c.selectableMethods.map((I,D)=>h.jsx("button",{type:"button",onClick:()=>c.handleMethodChange(D),disabled:!!c.pendingBrowserConnectionId,className:`rounded-md border px-3 py-1.5 text-sm transition-colors ${c.selectedAuthMethodIndex===D?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:text-foreground"}`,children:W0(I)},`${I.type}-${W0(I)}`))}):h.jsx("p",{className:"text-xs text-muted-foreground",children:W0(c.selectableMethods[0])}),c.activeMethod?.type!=="none"&&c.activeMethod?.description&&h.jsx("p",{className:"text-xs text-muted-foreground",children:c.activeMethod.description}),c.activeMethod?.type==="app_installation"&&h.jsxs("div",{className:"space-y-3",children:[c.activeMethod.permissions&&c.activeMethod.permissions.length>0&&h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[h.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Grants"}),c.activeMethod.permissions.map(I=>h.jsx(Qn,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px]",children:I},I))]}),h.jsx(ox,{organizationId:n,connectorKey:c.selectedConnector.key,provider:c.activeMethod.provider,providerLabel:c.selectedConnector?.name,installShape:c.activeMethod.installShape,variant:"default",size:"default",className:"w-full",label:`Install ${c.selectedConnector?.name??"App"}`}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:["You'll be sent to"," ",c.activeMethod.provider.charAt(0).toUpperCase()+c.activeMethod.provider.slice(1)," ","to choose what to grant. The connection and its feeds are created automatically when you return."]})]}),c.activeMethod?.type==="env_keys"&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Auth Profile"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs(Ws,{value:c.selectedAuthProfileSlug,onValueChange:c.setSelectedAuthProfileSlug,children:[h.jsx(Fi,{className:"h-8 flex-1 min-w-0",children:h.jsx(Ks,{placeholder:"Select auth profile"})}),h.jsx($i,{children:c.runtimeEnvProfiles.map(I=>h.jsxs(Hr,{value:I.slug,children:[I.display_name," (",I.slug,")"]},I.slug))})]}),c.selectedAuthProfileSlug&&(c.confirmingDeleteProfileSlug===c.selectedAuthProfileSlug?h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",className:"h-8 text-xs px-2",disabled:c.deleteAuthProfileMutation.isPending,onClick:()=>void c.handleDeleteAuthProfile(c.selectedAuthProfileSlug,"env"),children:c.deleteAuthProfileMutation.isPending?h.jsx(Dt,{size:"sm"}):"Delete"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs px-2",onClick:()=>c.setConfirmingDeleteProfileSlug(null),children:"Cancel"})]}):h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>c.setConfirmingDeleteProfileSlug(c.selectedAuthProfileSlug),children:h.jsx(Zs,{className:"h-3.5 w-3.5"})}))]}),c.runtimeEnvProfiles.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground",children:"No auth profiles yet for this connector."})]}),h.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:()=>c.setShowNewRuntimeProfileForm(I=>!I),children:[h.jsx(ia,{className:"mr-1.5 h-3.5 w-3.5"}),c.showNewRuntimeProfileForm?"Hide New Profile":"Create Auth Profile"]}),c.showNewRuntimeProfileForm&&h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx(yn,{placeholder:"Profile name",value:c.newRuntimeProfileName,onChange:I=>c.setNewRuntimeProfileName(I.target.value)}),h.jsx(yn,{placeholder:"profile-slug (optional)",value:c.newRuntimeProfileSlug,onChange:I=>c.setNewRuntimeProfileSlug(I.target.value)}),c.runtimeDraft.revision&&h.jsxs(h.Fragment,{children:[h.jsx(od,{visible:c.runtimeDraft.hasConflict,onReload:c.runtimeDraft.reset}),h.jsx(ul,{schema:c.runtimeDraft.revision,values:c.newRuntimeProfileValues,onValuesChange:c.setNewRuntimeProfileValues,fieldIdPrefix:"new-runtime-profile-"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>{c.setShowNewRuntimeProfileForm(!1),c.setNewRuntimeProfileName(""),c.setNewRuntimeProfileSlug(""),c.setNewRuntimeProfileValues({})},children:"Cancel"}),h.jsxs(ke,{type:"button",size:"sm",disabled:!c.runtimeDraft.canSubmit||c.createAuthProfile.isPending||Object.keys(c.normalizeStringValues(c.newRuntimeProfileValues)).length===0,onClick:()=>void c.handleCreateRuntimeProfile(),children:[c.createAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Create"]})]})]})]}),c.activeMethod?.type==="browser"&&!c.liveBrowser&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Browser Auth Profile"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs(Ws,{value:c.selectedAuthProfileSlug,onValueChange:I=>{if(I===XC){c.setShowNewBrowserProfileForm(!0);return}c.setSelectedAuthProfileSlug(I),c.setShowNewBrowserProfileForm(!1)},children:[h.jsx(Fi,{className:"h-8 flex-1 min-w-0",children:h.jsx(Ks,{placeholder:"Select browser auth profile"})}),h.jsxs($i,{children:[h.jsxs(Hr,{value:XC,children:[h.jsx(ia,{className:"mr-1.5 inline h-3.5 w-3.5"}),"Create new browser profile"]}),c.browserProfiles.map(I=>{const D=I.device_worker_id?c.devices.find(H=>H.id===I.device_worker_id)?.label:null;return h.jsxs(Hr,{value:I.slug,children:[I.display_name," (",I.slug,")",D?` — on ${D}`:""]},I.slug)})]})]}),c.selectedAuthProfileSlug&&(c.confirmingDeleteProfileSlug===c.selectedAuthProfileSlug?h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",className:"h-8 text-xs px-2",disabled:c.deleteAuthProfileMutation.isPending,onClick:()=>void c.handleDeleteAuthProfile(c.selectedAuthProfileSlug,"browser"),children:c.deleteAuthProfileMutation.isPending?h.jsx(Dt,{size:"sm"}):"Delete"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs px-2",onClick:()=>c.setConfirmingDeleteProfileSlug(null),children:"Cancel"})]}):h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>c.setConfirmingDeleteProfileSlug(c.selectedAuthProfileSlug),children:h.jsx(Zs,{className:"h-3.5 w-3.5"})}))]}),c.browserProfiles.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground",children:"No browser auth profiles yet for this connector."})]}),c.selectedAuthProfileSlug&&(()=>{const I=c.browserProfiles.find(D=>D.slug===c.selectedAuthProfileSlug);return I?h.jsxs("div",{className:"space-y-2 rounded-md border bg-background p-3",children:[h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsx(Qn,{variant:I.status==="active"?"default":"secondary",children:I.status}),typeof I.cookie_count=="number"&&h.jsxs(Qn,{variant:"outline",children:[I.cookie_count," cookies"]}),I.auth_cookie_name&&h.jsx(Qn,{variant:"outline",children:I.auth_cookie_name})]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Follow the connector’s authorization instructions to refresh this session."})]}):null})(),h.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:()=>c.setShowNewBrowserProfileForm(I=>!I),children:[h.jsx(ia,{className:"mr-1.5 h-3.5 w-3.5"}),c.showNewBrowserProfileForm?"Hide New Profile":"Create Browser Profile"]}),c.showNewBrowserProfileForm&&h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx(yn,{placeholder:"Profile name",value:c.newBrowserProfileName,onChange:I=>c.setNewBrowserProfileName(I.target.value)}),h.jsx(yn,{placeholder:"profile-slug (optional)",value:c.newBrowserProfileSlug,onChange:I=>c.setNewBrowserProfileSlug(I.target.value)}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Create the session profile, then follow the connector’s authorization instructions."}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>{c.setShowNewBrowserProfileForm(!1),c.setNewBrowserProfileName(""),c.setNewBrowserProfileSlug("")},children:"Cancel"}),h.jsxs(ke,{type:"button",size:"sm",disabled:c.createAuthProfile.isPending,onClick:()=>void c.handleCreateBrowserProfile(),children:[c.createAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Create"]})]})]})]}),c.activeMethod?.type==="interactive"&&c.isEditMode&&r&&r.auth_profile_kind==="interactive"&&h.jsx(TBe,{connection:r,activeAuthRunId:c.pendingAuthRunId,onStart:()=>{d.mutate({connection_id:r.id},{onSuccess:I=>{c.setPendingAuthRunId(I.auth_run_id??null)}})},onClear:()=>c.setPendingAuthRunId(null),onRecover:I=>c.setPendingAuthRunId(I),isStarting:d.isPending}),c.activeMethod?.type==="oauth"&&h.jsxs("div",{className:"space-y-4",children:[!c.isEditMode&&c.appOAuthProfiles.length>0&&c.selectedAppAuthProfileSlug?h.jsxs("div",{className:"space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Workspace app"}),c.isAdmin&&s&&c.selectedConnector&&h.jsx(nn,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:c.selectedConnector.key},search:{setup:"oauth_app"},hash:"connector-oauth-apps",className:"text-xs text-muted-foreground hover:text-foreground",children:"Manage app"})]}),c.appOAuthProfiles.length===1||!c.isAdmin?(()=>{const I=c.appOAuthProfiles.find(D=>D.slug===c.selectedAppAuthProfileSlug);return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("p",{className:"text-sm",children:I?.display_name??"Ask an administrator to set the workspace-default app."}),I?.is_default_for_connector&&I.connector_key===c.selectedConnector?.key&&h.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Org default"})]})})():h.jsxs(Ws,{value:c.selectedAppAuthProfileSlug,onValueChange:c.setSelectedAppAuthProfileSlug,children:[h.jsx(Fi,{className:"h-8",children:h.jsx(Ks,{placeholder:"Choose an app"})}),h.jsx($i,{children:c.appOAuthProfiles.map(I=>h.jsxs(Hr,{value:I.slug,children:[I.display_name,I.is_default_for_connector&&I.connector_key===c.selectedConnector?.key?" (default)":""]},I.slug))})]})]}):h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Workspace app"}),c.isAdmin&&s&&c.selectedConnector&&c.appOAuthProfiles.length>0&&h.jsx(nn,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:c.selectedConnector.key},className:"text-xs text-muted-foreground hover:text-foreground",children:"Manage"})]}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs(Ws,{value:c.selectedAppAuthProfileSlug,onValueChange:I=>{if(I===ZC){c.setShowNewAppProfileForm(!0);return}c.setSelectedAppAuthProfileSlug(I),c.setShowNewAppProfileForm(!1)},children:[h.jsx(Fi,{className:"h-8 flex-1 min-w-0",children:h.jsx(Ks,{placeholder:`Select ${c.activeMethod.provider} app profile`})}),h.jsxs($i,{children:[c.isAdmin&&h.jsxs(Hr,{value:ZC,children:[h.jsx(ia,{className:"mr-1.5 inline h-3.5 w-3.5"}),"Create new app profile"]}),c.appOAuthProfiles.map(I=>h.jsxs(Hr,{value:I.slug,children:[I.display_name," (",I.slug,")",I.is_default_for_connector&&I.connector_key===c.selectedConnector?.key?" — default":""]},I.slug))]})]}),c.selectedAppAuthProfileSlug&&(c.confirmingDeleteProfileSlug===c.selectedAppAuthProfileSlug?h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",className:"h-8 text-xs px-2",disabled:c.deleteAuthProfileMutation.isPending,onClick:()=>void c.handleDeleteAuthProfile(c.selectedAppAuthProfileSlug,"app"),children:c.deleteAuthProfileMutation.isPending?h.jsx(Dt,{size:"sm"}):"Delete"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs px-2",onClick:()=>c.setConfirmingDeleteProfileSlug(null),children:"Cancel"})]}):h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>c.setConfirmingDeleteProfileSlug(c.selectedAppAuthProfileSlug),children:h.jsx(Zs,{className:"h-3.5 w-3.5"})}))]}),c.appOAuthProfiles.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground",children:c.isAdmin?"To use your own app, configure its client credentials here. You can also use a managed app when available.":`Choose a managed option if available, or ask an admin to configure your own ${c.activeMethod.provider} app.`}),c.showNewAppProfileForm&&h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx(ABe,{method:c.activeMethod}),h.jsx(yn,{placeholder:"App profile name",value:c.newAppProfileName,onChange:I=>c.setNewAppProfileName(I.target.value)}),h.jsx(yn,{placeholder:"app-profile-slug (optional)",value:c.newAppProfileSlug,onChange:I=>c.setNewAppProfileSlug(I.target.value)}),c.appDraft.revision&&h.jsxs(h.Fragment,{children:[h.jsx(od,{visible:c.appDraft.hasConflict,onReload:c.appDraft.reset}),h.jsx(ul,{schema:c.appDraft.revision,values:c.newAppProfileValues,onValuesChange:c.setNewAppProfileValues,fieldIdPrefix:"new-app-profile-"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>{c.setShowNewAppProfileForm(!1),c.setNewAppProfileName(""),c.setNewAppProfileSlug(""),c.setNewAppProfileValues({})},children:"Cancel"}),h.jsxs(ke,{type:"button",size:"sm",disabled:!c.appDraft.canSubmit||c.createAuthProfile.isPending||Object.keys(c.normalizeStringValues(c.newAppProfileValues)).length===0,onClick:()=>void c.handleCreateAppProfile(),children:[c.createAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Create"]})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Your account"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs(Ws,{value:c.selectedAuthProfileSlug,onValueChange:I=>{if(I===QC){c.setShowNewOAuthAccountForm(!0);return}c.setSelectedAuthProfileSlug(I),c.setShowNewOAuthAccountForm(!1)},children:[h.jsx(Fi,{className:"h-8 flex-1 min-w-0",children:h.jsx(Ks,{placeholder:`Select ${c.activeMethod.provider} account profile`})}),h.jsxs($i,{children:[h.jsxs(Hr,{value:QC,children:[h.jsx(ia,{className:"mr-1.5 inline h-3.5 w-3.5"}),"Add new account"]}),c.runtimeOAuthProfiles.map(I=>h.jsxs(Hr,{value:I.slug,children:[I.display_name," (",I.slug,") [",I.status,"]"]},I.slug))]})]}),c.selectedAuthProfileSlug&&(c.confirmingDeleteProfileSlug===c.selectedAuthProfileSlug?h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",className:"h-8 text-xs px-2",disabled:c.deleteAuthProfileMutation.isPending,onClick:()=>void c.handleDeleteAuthProfile(c.selectedAuthProfileSlug,"account"),children:c.deleteAuthProfileMutation.isPending?h.jsx(Dt,{size:"sm"}):"Delete"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-xs px-2",onClick:()=>c.setConfirmingDeleteProfileSlug(null),children:"Cancel"})]}):h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>c.setConfirmingDeleteProfileSlug(c.selectedAuthProfileSlug),children:h.jsx(Zs,{className:"h-3.5 w-3.5"})}))]}),(()=>{const I=c.runtimeOAuthProfiles.find(D=>D.slug===c.selectedAuthProfileSlug);return h.jsxs("div",{className:"space-y-2",children:[h.jsx(fx,{requiredScopes:Bh(c.activeMethod),optionalScopes:c.availableOAuthOptionalScopes,selectedOptionalScopes:c.selectedOAuthOptionalScopes,grantedScopes:I?.granted_scopes,onToggleOptionalScope:(D,H)=>{c.setSelectedOAuthOptionalScopes(K=>H?[...new Set([...K,D])]:K.filter(W=>W!==D))}}),I?h.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-8",disabled:c.reconnectAuthProfile.isPending,onClick:()=>void c.handleReconnect(I.slug),children:[c.reconnectAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):h.jsx(ap,{className:"mr-1.5 h-3.5 w-3.5"}),"Review permissions"]}):null]})})(),c.runtimeOAuthProfiles.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground",children:"No OAuth account profiles yet for this connector."}),c.showNewOAuthAccountForm&&h.jsxs("div",{className:"space-y-3 rounded-md border bg-background p-3",children:[h.jsx(yn,{placeholder:"Account profile name",value:c.newOAuthAccountName,onChange:I=>c.setNewOAuthAccountName(I.target.value)}),h.jsx(yn,{placeholder:"account-profile-slug (optional)",value:c.newOAuthAccountSlug,onChange:I=>c.setNewOAuthAccountSlug(I.target.value)}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Creating the profile will open the OAuth authorization page in a new tab. When it finishes, the profile becomes reusable for future connections."}),h.jsx(fx,{requiredScopes:Bh(c.activeMethod),optionalScopes:c.availableOAuthOptionalScopes,selectedOptionalScopes:c.selectedOAuthOptionalScopes,onToggleOptionalScope:(I,D)=>{c.setSelectedOAuthOptionalScopes(H=>D?[...new Set([...H,I])]:H.filter(K=>K!==I))}}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>{c.setShowNewOAuthAccountForm(!1),c.setNewOAuthAccountName(""),c.setNewOAuthAccountSlug("")},children:"Cancel"}),h.jsxs(ke,{type:"button",size:"sm",disabled:c.createAuthProfile.isPending,onClick:()=>void c.handleCreateOAuthAccountProfile(),children:[c.createAuthProfile.isPending?h.jsx(Dt,{size:"md",className:"mr-1.5"}):null,"Continue"]})]})]})]})]})]}),!E&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-sm font-medium",htmlFor:"conn-display-name",children:"Display Name"}),h.jsx(yn,{id:"conn-display-name",placeholder:`e.g. Work ${c.selectedConnector.name}`,value:c.displayName,onChange:I=>c.setDisplayName(I.target.value)})]}),!E&&!c.isEditMode&&c.isAdmin&&!c.liveBrowser&&h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{className:"text-sm font-medium",children:["Assign to Member"," ",h.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"(optional)"})]}),h.jsx(qHe,{organizationId:n,value:c.selectedMemberUserId,onValueChange:c.setSelectedMemberUserId}),h.jsx("p",{className:"text-xs text-muted-foreground",children:c.selectedMemberUserId?"Only the selected member will use this connection.":"Leave empty to make this connection available to everyone in the organization."}),c.existingNoAuthConnection&&h.jsx("div",{className:"rounded-md bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 p-3",children:h.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["This user already has a ",c.selectedConnector.name," ","connection. No-auth connectors are limited to one per user."]})})]}),c.hasUniqueOptionsFields&&h.jsxs("div",{className:"rounded-lg border bg-muted/30 p-4 space-y-3",children:[h.jsx("p",{className:"text-sm font-medium",children:"Connection Options"}),h.jsx(od,{visible:c.configDraft.hasConflict,onReload:c.configDraft.reset}),h.jsx(ul,{schema:c.configDraft.revision??void 0,values:c.configValues,onValuesChange:c.handleValuesChange})]})]})]}),N=c.selectedConnector&&!c.previewConnector?h.jsxs(h.Fragment,{children:[c.authorizationUrl&&h.jsx("a",{className:"text-sm underline",href:c.authorizationUrl,target:"_blank",rel:"noreferrer",children:"Continue authorization in your browser"}),c.saveError&&h.jsx("div",{className:"w-full mb-3 rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm text-red-600 dark:text-red-400",children:c.saveError}),h.jsxs("div",{className:"flex items-center w-full",children:[c.isEditMode&&h.jsx("div",{className:"mr-auto",children:c.showDeleteConfirm?h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ke,{variant:"destructive",size:"sm",disabled:c.deleteConnection.isPending,onClick:()=>{c.deleteConnection.mutate(r.id,{onSuccess:()=>c.handleOpenChange(!1)})},children:c.deleteConnection.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"md",className:"mr-1.5"}),"Deleting..."]}):"Confirm"}),h.jsx(ke,{variant:"outline",size:"sm",onClick:()=>c.setShowDeleteConfirm(!1),disabled:c.deleteConnection.isPending,children:"Cancel"})]}):h.jsxs(ke,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>c.setShowDeleteConfirm(!0),children:[h.jsx(Zs,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete"]})}),!(!c.isEditMode&&c.activeMethod?.type==="app_installation")&&h.jsx(ke,{onClick:c.handleSave,disabled:!c.configDraft.canSubmit||c.isSaving||!!c.existingNoAuthConnection,children:c.isSaving?h.jsxs(h.Fragment,{children:[h.jsx(Dt,{size:"lg",className:"mr-2"}),c.isEditMode?"Saving...":"Creating..."]}):c.isEditMode?h.jsx(h.Fragment,{children:"Save Changes"}):h.jsxs(h.Fragment,{children:[h.jsx(ia,{className:"mr-2 h-4 w-4"}),c.pendingBrowserConnectionId?"Verify connection":"Add connection"]})})]})]}):null,P=N?h.jsx("div",{className:"mt-6",children:N}):null,L=h.jsx(EUe,{runId:c.isEditMode&&c.activeMethod?.type==="interactive"?null:c.pendingAuthRunId,onClose:c.handleAuthClose});return h.jsxs(h.Fragment,{children:[R,O,P,L]})}function jBe({providerKind:e,credentialFields:t,isProviderCatalogLoading:n,ownerSlug:r,onBack:a}){const i=cr(),s=fke(),u=Uh(e);return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ke,{variant:"ghost",size:"sm",onClick:a,className:"h-7 px-2 text-xs",children:"← Back"}),h.jsx(Zu,{connector:{key:`${np}${e}`,name:u,favicon_domain:LL(e)},showDescription:!1,className:"gap-2"}),h.jsx(ix,{facets:lx()})]}),n?h.jsx(zL,{rows:4,className:"max-w-md"}):t?h.jsx(VHe,{providerKind:e,credentialFields:t,pending:s.isPending,onCancel:a,onCreate:c=>s.mutate(c,{onSuccess:d=>{const p=d?.sandbox?.id;i({to:p?"/$owner/connectors/$connectorKey":"/$owner/connectors",params:p?{owner:r,connectorKey:`sandbox:${p}`}:{owner:r}})}})}):h.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:"This runtime provider is not available from the gateway."})]})}function IBe({ownerSlug:e,organizationId:t,connections:n,initialConnectorKey:r}){const a=cr();return h.jsx(NBe,{onCreated:(i,s)=>{a({to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:s,connectionId:String(i)},search:{}})},onClose:()=>{a({to:"/$owner/connectors",params:{owner:e}})},organizationId:t,connections:n,initialConnectorKey:r,ownerSlug:e,onDeepLinkBack:r?()=>{a({to:"/$owner/connectors/$connectorKey",params:{owner:e,connectorKey:r}})}:void 0})}function PBe({owner:e,children:t}){const{data:n,isLoading:r,error:a}=vn(e,{slug:e}),{session:i,isReady:s}=wr(),u=FV(a),c=$V(a)&&!u&&!n?.workspace;n3e({active:!r&&!c&&s&&!i&&!n?.workspace,owner:e});const d=n?.workspace;return r?h.jsx(h.Fragment,{children:t({organizationId:null,ownerSlug:e,isWorkspaceLoading:!0})}):c?h.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-1 py-12 text-center",children:[h.jsx("p",{className:"text-muted-foreground",children:"This workspace could not be loaded."}),h.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Please try again in a moment."})]}):u||!d?h.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Organization not found"}):d.type!=="organization"?h.jsx("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 py-16 text-center",children:h.jsx("p",{className:"text-muted-foreground max-w-md",children:"Select an organization to view this page."})}):h.jsx(h.Fragment,{children:t({organizationId:d.id,ownerSlug:d.slug,isWorkspaceLoading:!1})})}const DBe=()=>Te(()=>import("./create-CCjZxIkK.js"),[]),LBe=Ce("/$owner/connectors/create")({component:Oe(DBe,"component")});function eJe({owner:e,initialConnectorKey:t}){return h.jsx(PBe,{owner:e,children:n=>h.jsx(zBe,{ownerSlug:n.ownerSlug,organizationId:n.organizationId,initialConnectorKey:t})})}function zBe({ownerSlug:e,organizationId:t,initialConnectorKey:n}){const{data:r=[]}=sy(t??"");return h.jsxs(xL,{className:"flex flex-1 flex-col gap-6",children:[h.jsx(mHe,{breadcrumb:h.jsx(yHe,{crumbs:[h.jsx(nn,{to:"/$owner/connectors",params:{owner:e},search:{},className:pHe,children:"Connectors"},"connectors")]}),icon:h.jsx(Xt.connectors.icon,{className:"h-6 w-6"}),title:"Add a connection",caption:"Pick a connector from the catalog or drop in an MCP URL — Lobu handles auth and brings the data into memory."}),t?h.jsx(IBe,{ownerSlug:e,organizationId:t,connections:r,initialConnectorKey:n}):h.jsx("div",{className:"max-w-3xl",children:h.jsx(zL,{rows:4})})]})}const FBe=()=>Te(()=>import("./_agentId-DgRrCE2B.js"),__vite__mapDeps([56,57,40,16,58,35,10,11,12,13,14])),$Be=Ce("/$owner/chat/$agentId")({validateSearch:e=>{const t={};(e.new===!0||e.new==="1"||e.new==="true")&&(t.new=!0),typeof e.prompt=="string"&&e.prompt.length>0&&(t.prompt=e.prompt);const n=typeof e.message_id=="string"&&e.message_id.trim()||typeof e.message=="string"&&e.message.trim()||"";return n&&(t.message_id=n),Object.assign(t,Em(e)),t},loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))},component:Oe(FBe,"component")});function bz(e){const t=n=>typeof e[n]=="string"?e[n]:void 0;return Vn({listen:t("listen"),platform:t("platform"),team:t("team"),label:t("label"),connection:t("connection"),resource_type:t("resource_type"),resource:t("resource"),events:t("events"),agent:t("agent")})}const qBe=()=>Te(()=>import("./new-snm1ctHn.js"),__vite__mapDeps([59,60,45,61,8,62,63,36,34,35,58])),HBe=Ce("/$owner/automations/new")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:e=>bz(e),component:Oe(qBe,"component")});function wz(e){const t=typeof e=="string"?Number(e):e;if(!(typeof t!="number"||!Number.isInteger(t)||t<=0))return t}function tJe(e){return e.isReview?e.status==="pending"?"active":e.status==="gone"?"gone":e.isError?"error":"loading":"none"}function nJe(e){const t={};return e&&(typeof e.name=="string"&&(t.name=e.name),typeof e.description=="string"&&(t.description=e.description),typeof e.identity_md=="string"&&(t.identityMd=e.identity_md)),t}const UBe=()=>Te(()=>import("./_automationId-DSrZIYcs.js"),__vite__mapDeps([64,65,60,45,61,8,62,63,36,34,35,58,66,33,67,10,11,12,13,14]));function BBe(e){return e==="definition"?"definition":"activity"}const VBe=Ce("/$owner/automations/$automationId")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:e=>({run_id:wz(e.run_id),view:BBe(e.view)}),component:Oe(UBe,"component")}),WBe=()=>Te(()=>import("./new-C2av0diq.js"),__vite__mapDeps([68,69,62])),KBe=Ce("/$owner/agents/new")({component:Oe(WBe,"component"),validateSearch:bz}),GBe=()=>Te(()=>import("./connect-wx-qqLir.js"),[]),YBe=Ce("/$owner/agents/connect")({component:Oe(GBe,"component")}),ZBe=()=>Te(()=>import("./_agentId-BrhcaxUk.js"),__vite__mapDeps([70,71,69,62,66])),QBe=Ce("/$owner/agents/$agentId")({beforeLoad:({params:e,location:t})=>{const n=`/${e.owner}/agents/${e.agentId}`;(t.pathname===n||t.pathname===`${n}/`)&&gke(e.owner,e.agentId)},loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))},component:Oe(ZBe,"component")}),XBe=Ce("/$owner/events/$eventId/")({}),JBe=()=>Te(()=>import("./index-8wxsyxqt.js"),__vite__mapDeps([72,73,67])),eVe=Ce("/$owner/connectors/deployments/")({component:Oe(JBe,"component")}),tVe=()=>Te(()=>import("./index-D7gHOpfg.js"),[]),nVe=Ce("/$owner/connectors/create/")({validateSearch:e=>Vn({connector:typeof e.connector=="string"&&e.connector.length>0?e.connector:void 0,install:typeof e.install=="string"&&e.install.length>0?e.install:void 0}),component:Oe(tVe,"component")});function rVe(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const aVe={},uh={};function dc(e,t){try{const r=(aVe[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in uh?uh[r]:eE(r,r.split(":"))}catch{if(e in uh)return uh[e];const n=e?.match(oVe);return n?eE(e,n.slice(1)):NaN}}const oVe=/([+-]\d\d):?(\d\d)?/;function eE(e,t){const n=+(t[0]||0),r=+(t[1]||0),a=+(t[2]||0)/60;return uh[e]=n*60+r>0?n*60+r+a:n*60-r-a}class Jo extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(dc(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),Mz(this),yx(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new Jo(...n,t):new Jo(Date.now(),t)}withTimeZone(t){return new Jo(+this,t)}getTimezoneOffset(){const t=-dc(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),yx(this),+this}[Symbol.for("constructDateFrom")](t){return new Jo(+new Date(t),this.timeZone)}}const tE=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!tE.test(e))return;const t=e.replace(tE,"$1UTC");Jo.prototype[t]&&(e.startsWith("get")?Jo.prototype[e]=function(){return this.internal[t]()}:(Jo.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),iVe(this),+this},Jo.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),yx(this),+this}))});function yx(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-dc(e.timeZone,e)*60))}function iVe(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Mz(e)}function Mz(e){const t=dc(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),s=a-i,u=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();s&&u&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+s);const c=a-n;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const p=a>0?d.getSeconds():(d.getSeconds()-60)%60,y=Math.round(-(dc(e.timeZone,e)*60))%60;(y||p)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+y),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+y+p));const v=dc(e.timeZone,e),k=v>0?Math.floor(v):Math.ceil(v),M=-new Date(+e).getTimezoneOffset()-k,_=k!==n,C=M-c;if(_&&C){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+C);const E=dc(e.timeZone,e),A=E>0?Math.floor(E):Math.ceil(E),R=k-A;R&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+R),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+R))}}class Tr extends Jo{static tz(t,...n){return n.length?new Tr(...n,t):new Tr(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),a=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,a]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,a]=this.tzComponents();return`${t} GMT${n}${r}${a} (${rVe(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[n,r,a]}withTimeZone(t){return new Tr(+this,t)}[Symbol.for("constructDateFrom")](t){return new Tr(+new Date(t),this.timeZone)}}const nE=5,sVe=4;function lVe(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,a=t.addDays(e,-r+1),i=t.addDays(a,nE*7-1);return t.getMonth(e)===t.getMonth(i)?nE:sVe}function Sz(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function cVe(e,t){const n=Sz(e,t),r=lVe(e,t);return t.addDays(n,r*7-1)}const _z={...sc,labels:{labelDayButton:(e,t,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(s,u)=>uc(s,u,{locale:sc,...n});let i=a(e,"PPPP");return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,i)=>uc(a,i,{locale:sc,...t}),r(e,"LLLL yyyy")},labelGridcell:(e,t,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(s,u)=>uc(s,u,{locale:sc,...n});let i=a(e,"PPPP");return t?.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,i)=>uc(a,i,{locale:sc,...t}),r(e,"cccc")}}};class za{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Tr.tz(this.options.timeZone):new this.Date,this.newDate=(r,a,i)=>this.overrides?.newDate?this.overrides.newDate(r,a,i):this.options.timeZone?new Tr(r,a,i,this.options.timeZone):new Date(r,a,i),this.addDays=(r,a)=>this.overrides?.addDays?this.overrides.addDays(r,a):XN(r,a),this.addMonths=(r,a)=>this.overrides?.addMonths?this.overrides.addMonths(r,a):JN(r,a),this.addWeeks=(r,a)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,a):zwe(r,a),this.addYears=(r,a)=>this.overrides?.addYears?this.overrides.addYears(r,a):Fwe(r,a),this.differenceInCalendarDays=(r,a)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,a):Y3(r,a),this.differenceInCalendarMonths=(r,a)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,a):Z3(r,a),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Qwe(r),this.eachYearOfInterval=r=>{const a=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):e8e(r),i=new Set(a.map(u=>this.getYear(u)));if(i.size===a.length)return a;const s=[];return i.forEach(u=>{s.push(new Date(u,0,1))}),s},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):cVe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):t8e(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):nj(r),this.endOfWeek=(r,a)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,a):oj(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Jwe(r),this.format=(r,a,i)=>{const s=this.overrides?.format?this.overrides.format(r,a,this.options):uc(r,a,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(s):s},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):Q3(r),this.getMonth=(r,a)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):eMe(r,this.options),this.getYear=(r,a)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):tMe(r,this.options),this.getWeek=(r,a)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):X3(r,this.options),this.isAfter=(r,a)=>this.overrides?.isAfter?this.overrides.isAfter(r,a):nMe(r,a),this.isBefore=(r,a)=>this.overrides?.isBefore?this.overrides.isBefore(r,a):rMe(r,a),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):tj(r),this.isSameDay=(r,a)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,a):Uwe(r,a),this.isSameMonth=(r,a)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,a):aMe(r,a),this.isSameYear=(r,a)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,a):oMe(r,a),this.max=r=>this.overrides?.max?this.overrides.max(r):$we(r),this.min=r=>this.overrides?.min?this.overrides.min(r):qwe(r),this.setMonth=(r,a)=>this.overrides?.setMonth?this.overrides.setMonth(r,a):iMe(r,a),this.setYear=(r,a)=>this.overrides?.setYear?this.overrides.setYear(r,a):sMe(r,a),this.startOfBroadcastWeek=(r,a)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):jh(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Nh(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Xwe(r),this.startOfWeek=(r,a)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):fd(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):aj(r),this.options={locale:_z,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let a=0;a<10;a++)r[a.toString()]=n.format(a);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&za.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:a}=this.options,i=n?.code;if(i&&za.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:a}).format(t)}catch{}const s=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,s)}}za.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const ui=new za;class Cz{constructor(t,n,r=ui){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r,this.isoDate=r.format(t,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class uVe{constructor(t,n){this.date=t,this.weeks=n}}class dVe{constructor(t,n){this.days=n,this.weekNumber=t}}function hVe(e){return X.createElement("button",{...e})}function fVe(e){return X.createElement("span",{...e})}function pVe(e){const{size:t=24,orientation:n="left",className:r}=e;return X.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&X.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&X.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&X.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&X.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function yVe(e){const{day:t,modifiers:n,...r}=e;return X.createElement("td",{...r})}function mVe(e){const{day:t,modifiers:n,...r}=e,a=X.useRef(null);return X.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),X.createElement("button",{ref:a,...r})}var He;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(He||(He={}));var mn;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(mn||(mn={}));var bo;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(bo||(bo={}));var Aa;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Aa||(Aa={}));function gVe(e){const{options:t,className:n,components:r,classNames:a,...i}=e,s=[a[He.Dropdown],n].join(" "),u=t?.find(({value:c})=>c===i.value);return X.createElement("span",{"data-disabled":i.disabled,className:a[He.DropdownRoot]},X.createElement(r.Select,{className:s,...i},t?.map(({value:c,label:d,disabled:p})=>X.createElement(r.Option,{key:c,value:c,disabled:p},d))),X.createElement("span",{className:a[He.CaptionLabel],"aria-hidden":!0},u?.label,X.createElement(r.Chevron,{orientation:"down",size:18,className:a[He.Chevron]})))}function vVe(e){return X.createElement("div",{...e})}function kVe(e){return X.createElement("div",{...e})}function xVe(e){const{calendarMonth:t,displayIndex:n,...r}=e;return X.createElement("div",{...r},e.children)}function bVe(e){const{calendarMonth:t,displayIndex:n,...r}=e;return X.createElement("div",{...r})}function wVe(e){return X.createElement("table",{...e})}function MVe(e){return X.createElement("div",{...e})}const Ez=x.createContext(void 0);function Pf(){const e=x.useContext(Ez);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function SVe(e){const{components:t}=Pf();return X.createElement(t.Dropdown,{...e})}function _Ve(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:a,...i}=e,{components:s,classNames:u,labels:{labelPrevious:c,labelNext:d}}=Pf(),p=x.useCallback(v=>{a&&n?.(v)},[a,n]),y=x.useCallback(v=>{r&&t?.(v)},[r,t]);return X.createElement("nav",{...i},X.createElement(s.PreviousMonthButton,{type:"button",className:u[He.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:y},X.createElement(s.Chevron,{disabled:r?void 0:!0,className:u[He.Chevron],orientation:"left"})),X.createElement(s.NextMonthButton,{type:"button",className:u[He.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":d(a),onClick:p},X.createElement(s.Chevron,{disabled:a?void 0:!0,orientation:"right",className:u[He.Chevron]})))}function CVe(e){const{components:t}=Pf();return X.createElement(t.Button,{...e})}function EVe(e){return X.createElement("option",{...e})}function AVe(e){const{components:t}=Pf();return X.createElement(t.Button,{...e})}function RVe(e){const{rootRef:t,...n}=e;return X.createElement("div",{...n,ref:t})}function OVe(e){return X.createElement("select",{...e})}function TVe(e){const{week:t,...n}=e;return X.createElement("tr",{...n})}function NVe(e){return X.createElement("th",{...e})}function jVe(e){return X.createElement("thead",{"aria-hidden":!0},X.createElement("tr",{...e}))}function IVe(e){const{week:t,...n}=e;return X.createElement("th",{...n})}function PVe(e){return X.createElement("th",{...e})}function DVe(e){return X.createElement("tbody",{...e})}function LVe(e){const{components:t}=Pf();return X.createElement(t.Dropdown,{...e})}const zVe=Object.freeze(Object.defineProperty({__proto__:null,Button:hVe,CaptionLabel:fVe,Chevron:pVe,Day:yVe,DayButton:mVe,Dropdown:gVe,DropdownNav:vVe,Footer:kVe,Month:xVe,MonthCaption:bVe,MonthGrid:wVe,Months:MVe,MonthsDropdown:SVe,Nav:_Ve,NextMonthButton:CVe,Option:EVe,PreviousMonthButton:AVe,Root:RVe,Select:OVe,Week:TVe,WeekNumber:IVe,WeekNumberHeader:PVe,Weekday:NVe,Weekdays:jVe,Weeks:DVe,YearsDropdown:LVe},Symbol.toStringTag,{value:"Module"}));function Vi(e,t,n=!1,r=ui){let{from:a,to:i}=e;const{differenceInCalendarDays:s,isSameDay:u}=r;return a&&i?(s(i,a)<0&&([a,i]=[i,a]),s(t,a)>=(n?1:0)&&s(i,t)>=(n?1:0)):!n&&i?u(i,t):!n&&a?u(a,t):!1}function A6(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function jm(e){return!!(e&&typeof e=="object"&&"from"in e)}function R6(e){return!!(e&&typeof e=="object"&&"after"in e)}function O6(e){return!!(e&&typeof e=="object"&&"before"in e)}function Az(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Rz(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Wi(e,t,n=ui){const r=Array.isArray(t)?t:[t],{isSameDay:a,differenceInCalendarDays:i,isAfter:s}=n;return r.some(u=>{if(typeof u=="boolean")return u;if(n.isDate(u))return a(e,u);if(Rz(u,n))return u.some(c=>a(e,c));if(jm(u))return Vi(u,e,!1,n);if(Az(u))return Array.isArray(u.dayOfWeek)?u.dayOfWeek.includes(e.getDay()):u.dayOfWeek===e.getDay();if(A6(u)){const c=i(u.before,e),d=i(u.after,e),p=c>0,y=d<0;return s(u.before,u.after)?y&&p:p||y}return R6(u)?i(e,u.after)>0:O6(u)?i(u.before,e)>0:typeof u=="function"?u(e):!1})}function FVe(e,t,n,r,a){const{disabled:i,hidden:s,modifiers:u,showOutsideDays:c,broadcastCalendar:d,today:p=a.today()}=t,{isSameDay:y,isSameMonth:v,startOfMonth:k,isBefore:b,endOfMonth:M,isAfter:_}=a,C=n&&k(n),E=r&&M(r),A={[mn.focused]:[],[mn.outside]:[],[mn.disabled]:[],[mn.hidden]:[],[mn.today]:[]},R={};for(const O of e){const{date:N,displayMonth:P}=O,L=!!(P&&!v(N,P)),I=!!(C&&b(N,C)),D=!!(E&&_(N,E)),H=!!(i&&Wi(N,i,a)),K=!!(s&&Wi(N,s,a))||I||D||!d&&!c&&L||d&&c===!1&&L,W=y(N,p);L&&A.outside.push(O),H&&A.disabled.push(O),K&&A.hidden.push(O),W&&A.today.push(O),u&&Object.keys(u).forEach(Y=>{const q=u?.[Y];q&&Wi(N,q,a)&&(R[Y]?R[Y].push(O):R[Y]=[O])})}return O=>{const N={[mn.focused]:!1,[mn.disabled]:!1,[mn.hidden]:!1,[mn.outside]:!1,[mn.today]:!1},P={};for(const L in A){const I=A[L];N[L]=I.some(D=>D===O)}for(const L in R)P[L]=R[L].some(I=>I===O);return{...N,...P}}}function $Ve(e,t,n={}){return Object.entries(e).filter(([,a])=>a===!0).reduce((a,[i])=>(n[i]?a.push(n[i]):t[mn[i]]?a.push(t[mn[i]]):t[bo[i]]&&a.push(t[bo[i]]),a),[t[He.Day]])}function qVe(e){return{...zVe,...e}}function HVe(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function UVe(){const e={};for(const t in He)e[He[t]]=`rdp-${He[t]}`;for(const t in mn)e[mn[t]]=`rdp-${mn[t]}`;for(const t in bo)e[bo[t]]=`rdp-${bo[t]}`;for(const t in Aa)e[Aa[t]]=`rdp-${Aa[t]}`;return e}function Oz(e,t,n){return(n??new za(t)).formatMonthYear(e)}const BVe=Oz;function VVe(e,t,n){return(n??new za(t)).format(e,"d")}function WVe(e,t=ui){return t.format(e,"LLLL")}function KVe(e,t,n){return(n??new za(t)).format(e,"cccccc")}function GVe(e,t=ui){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function YVe(){return""}function Tz(e,t=ui){return t.format(e,"yyyy")}const ZVe=Tz,QVe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Oz,formatDay:VVe,formatMonthCaption:BVe,formatMonthDropdown:WVe,formatWeekNumber:GVe,formatWeekNumberHeader:YVe,formatWeekdayName:KVe,formatYearCaption:ZVe,formatYearDropdown:Tz},Symbol.toStringTag,{value:"Module"}));function XVe(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...QVe,...e}}function T6(e,t,n,r){let a=(r??new za(n)).format(e,"PPPP");return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a}const JVe=T6;function N6(e,t,n){return(n??new za(t)).formatMonthYear(e)}const eWe=N6;function Nz(e,t,n,r){let a=(r??new za(n)).format(e,"PPPP");return t?.today&&(a=`Today, ${a}`),a}function jz(e){return"Choose the Month"}function Iz(){return""}const tWe="Go to the Next Month";function Pz(e,t){return tWe}function Dz(e){return"Go to the Previous Month"}function Lz(e,t,n){return(n??new za(t)).format(e,"cccc")}function zz(e,t){return`Week ${e}`}function Fz(e){return"Week Number"}function $z(e){return"Choose the Year"}const nWe=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:eWe,labelDay:JVe,labelDayButton:T6,labelGrid:N6,labelGridcell:Nz,labelMonthDropdown:jz,labelNav:Iz,labelNext:Pz,labelPrevious:Dz,labelWeekNumber:zz,labelWeekNumberHeader:Fz,labelWeekday:Lz,labelYearDropdown:$z},Symbol.toStringTag,{value:"Module"})),vo=(e,t,n)=>t||(n?typeof n=="function"?n:(...r)=>n:e);function rWe(e,t){const n=t.locale?.labels??{};return{...nWe,...e??{},labelDayButton:vo(T6,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:vo(jz,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:vo(Pz,e?.labelNext,n.labelNext),labelPrevious:vo(Dz,e?.labelPrevious,n.labelPrevious),labelWeekNumber:vo(zz,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:vo($z,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:vo(N6,e?.labelGrid,n.labelGrid),labelGridcell:vo(Nz,e?.labelGridcell,n.labelGridcell),labelNav:vo(Iz,e?.labelNav,n.labelNav),labelWeekNumberHeader:vo(Fz,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:vo(Lz,e?.labelWeekday,n.labelWeekday)}}function aWe(e,t,n,r,a){const{startOfMonth:i,startOfYear:s,endOfYear:u,eachMonthOfInterval:c,getMonth:d}=a;return c({start:s(e),end:u(e)}).map(v=>{const k=r.formatMonthDropdown(v,a),b=d(v),M=t&&v<i(t)||n&&v>i(n)||!1;return{value:b,label:k,disabled:M}})}function oWe(e,t={},n={}){let r={...t?.[He.Day]};return Object.entries(e).filter(([,a])=>a===!0).forEach(([a])=>{r={...r,...n?.[a]}}),r}function iWe(e,t,n,r){const a=r??e.today(),i=n?e.startOfBroadcastWeek(a,e):t?e.startOfISOWeek(a):e.startOfWeek(a),s=[];for(let u=0;u<7;u++){const c=e.addDays(i,u);s.push(c)}return s}function sWe(e,t,n,r,a=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:s,eachYearOfInterval:u,getYear:c}=r,d=i(e),p=s(t),y=u({start:d,end:p});return a&&y.reverse(),y.map(v=>{const k=n.formatYearDropdown(v,r);return{value:c(v),label:k,disabled:!1}})}function lWe(e,t={}){const{weekStartsOn:n,locale:r}=t,a=n??r?.options?.weekStartsOn??0,i=u=>{const c=typeof u=="number"||typeof u=="string"?new Date(u):u;return new Tr(c.getFullYear(),c.getMonth(),c.getDate(),12,0,0,e)},s=u=>{const c=i(u);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>i(Tr.tz(e)),newDate:(u,c,d)=>new Tr(u,c,d,12,0,0,e),startOfDay:u=>i(u),startOfWeek:(u,c)=>{const d=i(u),p=c?.weekStartsOn??a,y=(d.getDay()-p+7)%7;return d.setDate(d.getDate()-y),d},startOfISOWeek:u=>{const c=i(u),d=(c.getDay()-1+7)%7;return c.setDate(c.getDate()-d),c},startOfMonth:u=>{const c=i(u);return c.setDate(1),c},startOfYear:u=>{const c=i(u);return c.setMonth(0,1),c},endOfWeek:(u,c)=>{const d=i(u),v=(((c?.weekStartsOn??a)+6)%7-d.getDay()+7)%7;return d.setDate(d.getDate()+v),d},endOfISOWeek:u=>{const c=i(u),d=(7-c.getDay())%7;return c.setDate(c.getDate()+d),c},endOfMonth:u=>{const c=i(u);return c.setMonth(c.getMonth()+1,0),c},endOfYear:u=>{const c=i(u);return c.setMonth(11,31),c},eachMonthOfInterval:u=>{const c=i(u.start),d=i(u.end),p=[],y=new Tr(c.getFullYear(),c.getMonth(),1,12,0,0,e),v=d.getFullYear()*12+d.getMonth();for(;y.getFullYear()*12+y.getMonth()<=v;)p.push(new Tr(y,e)),y.setMonth(y.getMonth()+1,1);return p},addDays:(u,c)=>{const d=i(u);return d.setDate(d.getDate()+c),d},addWeeks:(u,c)=>{const d=i(u);return d.setDate(d.getDate()+c*7),d},addMonths:(u,c)=>{const d=i(u);return d.setMonth(d.getMonth()+c),d},addYears:(u,c)=>{const d=i(u);return d.setFullYear(d.getFullYear()+c),d},eachYearOfInterval:u=>{const c=i(u.start),d=i(u.end),p=[],y=new Tr(c.getFullYear(),0,1,12,0,0,e);for(;y.getFullYear()<=d.getFullYear();)p.push(new Tr(y,e)),y.setFullYear(y.getFullYear()+1,0,1);return p},getWeek:(u,c)=>{const d=s(u);return X3(d,{weekStartsOn:c?.weekStartsOn??a,firstWeekContainsDate:c?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:u=>{const c=s(u);return Q3(c)},differenceInCalendarDays:(u,c)=>{const d=s(u),p=s(c);return Y3(d,p)},differenceInCalendarMonths:(u,c)=>{const d=s(u),p=s(c);return Z3(d,p)}}}const Df=e=>e instanceof HTMLElement?e:null,P4=e=>[...e.querySelectorAll("[data-animated-month]")??[]],cWe=e=>Df(e.querySelector("[data-animated-month]")),D4=e=>Df(e.querySelector("[data-animated-caption]")),L4=e=>Df(e.querySelector("[data-animated-weeks]")),uWe=e=>Df(e.querySelector("[data-animated-nav]")),dWe=e=>Df(e.querySelector("[data-animated-weekdays]"));function hWe(e,t,{classNames:n,months:r,focused:a,dateLib:i}){const s=x.useRef(null),u=x.useRef(r),c=x.useRef(!1);x.useLayoutEffect(()=>{const d=u.current;if(u.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||d.length===0||r.length!==d.length)return;const p=i.isSameMonth(r[0].date,d[0].date),y=i.isAfter(r[0].date,d[0].date),v=y?n[Aa.caption_after_enter]:n[Aa.caption_before_enter],k=y?n[Aa.weeks_after_enter]:n[Aa.weeks_before_enter],b=s.current,M=e.current.cloneNode(!0);if(M instanceof HTMLElement?(P4(M).forEach(A=>{if(!(A instanceof HTMLElement))return;const R=cWe(A);R&&A.contains(R)&&A.removeChild(R);const O=D4(A);O&&O.classList.remove(v);const N=L4(A);N&&N.classList.remove(k)}),s.current=M):s.current=null,c.current||p||a)return;const _=b instanceof HTMLElement?P4(b):[],C=P4(e.current);if(C?.every(E=>E instanceof HTMLElement)&&_&&_.every(E=>E instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const E=uWe(e.current);E&&(E.style.zIndex="1"),C.forEach((A,R)=>{const O=_[R];if(!O)return;A.style.position="relative",A.style.overflow="hidden";const N=D4(A);N&&N.classList.add(v);const P=L4(A);P&&P.classList.add(k);const L=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),E&&(E.style.zIndex=""),N&&N.classList.remove(v),P&&P.classList.remove(k),A.style.position="",A.style.overflow="",A.contains(O)&&A.removeChild(O)};O.style.pointerEvents="none",O.style.position="absolute",O.style.overflow="hidden",O.setAttribute("aria-hidden","true");const I=dWe(O);I&&(I.style.opacity="0");const D=D4(O);D&&(D.classList.add(y?n[Aa.caption_before_exit]:n[Aa.caption_after_exit]),D.addEventListener("animationend",L));const H=L4(O);H&&H.classList.add(y?n[Aa.weeks_before_exit]:n[Aa.weeks_after_exit]),A.insertBefore(O,A.firstChild)})}})}function fWe(e,t,n,r){const a=e[0],i=e[e.length-1],{ISOWeek:s,fixedWeeks:u,broadcastCalendar:c}=n??{},{addDays:d,differenceInCalendarDays:p,differenceInCalendarMonths:y,endOfBroadcastWeek:v,endOfISOWeek:k,endOfMonth:b,endOfWeek:M,isAfter:_,startOfBroadcastWeek:C,startOfISOWeek:E,startOfWeek:A}=r,R=c?C(a,r):s?E(a):A(a),O=c?v(i):s?k(b(i)):M(b(i)),N=t&&(c?v(t):s?k(t):M(t)),P=N&&_(O,N)?N:O,L=p(P,R),I=y(i,a)+1,D=[];for(let W=0;W<=L;W++){const Y=d(R,W);D.push(Y)}const K=(c?35:42)*I;if(u&&D.length<K){const W=K-D.length;for(let Y=0;Y<W;Y++){const q=d(D[D.length-1],1);D.push(q)}}return D}function pWe(e){const t=[];return e.reduce((n,r)=>{const a=r.weeks.reduce((i,s)=>i.concat(s.days.slice()),t.slice());return n.concat(a.slice())},t.slice())}function yWe(e,t,n,r){const{numberOfMonths:a=1}=n,i=[];for(let s=0;s<a;s++){const u=r.addMonths(e,s);if(t&&u>t)break;i.push(u)}return i}function rE(e,t,n,r){const{month:a,defaultMonth:i,today:s=r.today(),numberOfMonths:u=1}=e;let c=a||i||s;const{differenceInCalendarMonths:d,addMonths:p,startOfMonth:y}=r;if(n&&d(n,c)<u-1){const v=-1*(u-1);c=p(n,v)}return t&&d(c,t)<0&&(c=t),y(c)}function mWe(e,t,n,r){const{addDays:a,endOfBroadcastWeek:i,endOfISOWeek:s,endOfMonth:u,endOfWeek:c,getISOWeek:d,getWeek:p,startOfBroadcastWeek:y,startOfISOWeek:v,startOfWeek:k}=r,b=e.reduce((M,_)=>{const C=n.broadcastCalendar?y(_,r):n.ISOWeek?v(_):k(_),E=n.broadcastCalendar?i(_):n.ISOWeek?s(u(_)):c(u(_)),A=t.filter(P=>P>=C&&P<=E),R=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length<R){const P=t.filter(L=>{const I=R-A.length;return L>E&&L<=a(E,I)});A.push(...P)}const O=A.reduce((P,L)=>{const I=n.ISOWeek?d(L):p(L),D=P.find(K=>K.weekNumber===I),H=new Cz(L,_,r);return D?D.days.push(H):P.push(new dVe(I,[H])),P},[]),N=new uVe(_,O);return M.push(N),M},[]);return n.reverseMonths?b.reverse():b}function gWe(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:a,startOfDay:i,startOfMonth:s,endOfMonth:u,addYears:c,endOfYear:d,newDate:p,today:y}=t,{fromYear:v,toYear:k,fromMonth:b,toMonth:M}=e;!n&&b&&(n=b),!n&&v&&(n=t.newDate(v,0,1)),!r&&M&&(r=M),!r&&k&&(r=p(k,11,31));const _=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=s(n):v?n=p(v,0,1):!n&&_&&(n=a(c(e.today??y(),-100))),r?r=u(r):k?r=p(k,11,31):!r&&_&&(r=d(e.today??y())),[n&&i(n),r&&i(r)]}function vWe(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:i=1}=n,{startOfMonth:s,addMonths:u,differenceInCalendarMonths:c}=r,d=a?i:1,p=s(e);if(!t)return u(p,d);if(!(c(t,e)<i))return u(p,d)}function kWe(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:i}=n,{startOfMonth:s,addMonths:u,differenceInCalendarMonths:c}=r,d=a?i??1:1,p=s(e);if(!t)return u(p,-d);if(!(c(p,t)<=0))return u(p,-d)}function xWe(e){const t=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),t.slice())}function Im(e,t){const[n,r]=x.useState(e);return[t===void 0?n:t,r]}function bWe(e,t){const[n,r]=gWe(e,t),{startOfMonth:a,endOfMonth:i}=t,s=rE(e,n,r,t),[u,c]=Im(s,e.month?s:void 0);x.useEffect(()=>{const R=rE(e,n,r,t);c(R)},[e.timeZone]);const{months:d,weeks:p,days:y,previousMonth:v,nextMonth:k}=x.useMemo(()=>{const R=yWe(u,r,{numberOfMonths:e.numberOfMonths},t),O=fWe(R,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),N=mWe(R,O,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),P=xWe(N),L=pWe(N),I=kWe(u,n,e,t),D=vWe(u,r,e,t);return{months:N,weeks:P,days:L,previousMonth:I,nextMonth:D}},[t,u.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:b,onMonthChange:M}=e,_=R=>p.some(O=>O.days.some(N=>N.isEqualTo(R))),C=R=>{if(b)return;let O=a(R);n&&O<a(n)&&(O=a(n)),r&&O>a(r)&&(O=a(r)),c(O),M?.(O)};return{months:d,weeks:p,days:y,navStart:n,navEnd:r,previousMonth:v,nextMonth:k,goToMonth:C,goToDay:R=>{_(R)||C(R.date)}}}var Ko;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Ko||(Ko={}));function aE(e){return!e[mn.disabled]&&!e[mn.hidden]&&!e[mn.outside]}function wWe(e,t,n,r){let a,i=-1;for(const s of e){const u=t(s);aE(u)&&(u[mn.focused]&&i<Ko.FocusedModifier?(a=s,i=Ko.FocusedModifier):r?.isEqualTo(s)&&i<Ko.LastFocused?(a=s,i=Ko.LastFocused):n(s.date)&&i<Ko.Selected?(a=s,i=Ko.Selected):u[mn.today]&&i<Ko.Today&&(a=s,i=Ko.Today))}return a||(a=e.find(s=>aE(t(s)))),a}function MWe(e,t,n,r,a,i,s){const{ISOWeek:u,broadcastCalendar:c}=i,{addDays:d,addMonths:p,addWeeks:y,addYears:v,endOfBroadcastWeek:k,endOfISOWeek:b,endOfWeek:M,max:_,min:C,startOfBroadcastWeek:E,startOfISOWeek:A,startOfWeek:R}=s;let N={day:d,week:y,month:p,year:v,startOfWeek:P=>c?E(P,s):u?A(P):R(P),endOfWeek:P=>c?k(P):u?b(P):M(P)}[e](n,t==="after"?1:-1);return t==="before"&&r?N=_([r,N]):t==="after"&&a&&(N=C([a,N])),N}function qz(e,t,n,r,a,i,s,u=0){if(u>365)return;const c=MWe(e,t,n.date,r,a,i,s),d=!!(i.disabled&&Wi(c,i.disabled,s)),p=!!(i.hidden&&Wi(c,i.hidden,s)),y=c,v=new Cz(c,y,s);return!d&&!p?v:qz(e,t,v,r,a,i,s,u+1)}function SWe(e,t,n,r,a){const{autoFocus:i}=e,[s,u]=x.useState(),c=wWe(t.days,n,r||(()=>!1),s),[d,p]=x.useState(i?c:void 0);return{isFocusTarget:M=>!!c?.isEqualTo(M),setFocused:p,focused:d,blur:()=>{u(d),p(void 0)},moveFocus:(M,_)=>{if(!d)return;const C=qz(M,_,d,t.navStart,t.navEnd,e,a);C&&(e.disableNavigation&&!t.days.some(A=>A.isEqualTo(C))||(t.goToDay(C),p(C)))}}}function _We(e,t){const{selected:n,required:r,onSelect:a}=e,[i,s]=Im(n,a?n:void 0),u=a?n:i,{isSameDay:c}=t,d=k=>u?.some(b=>c(b,k))??!1,{min:p,max:y}=e;return{selected:u,select:(k,b,M)=>{let _=[...u??[]];if(d(k)){if(u?.length===p||r&&u?.length===1)return;_=u?.filter(C=>!c(C,k))}else u?.length===y?_=[k]:_=[..._,k];return a||s(_),a?.(_,k,b,M),_},isSelected:d}}function CWe(e,t,n=0,r=0,a=!1,i=ui){const{from:s,to:u}=t||{},{isSameDay:c,isAfter:d,isBefore:p}=i;let y;if(!s&&!u)y={from:e,to:n>0?void 0:e};else if(s&&!u)c(s,e)?n===0?y={from:s,to:e}:a?y={from:s,to:void 0}:y=void 0:p(e,s)?y={from:e,to:s}:y={from:s,to:e};else if(s&&u)if(c(s,e)&&c(u,e))a?y={from:s,to:u}:y=void 0;else if(c(s,e))y={from:s,to:n>0?void 0:e};else if(c(u,e))y={from:e,to:n>0?void 0:e};else if(p(e,s))y={from:e,to:u};else if(d(e,s))y={from:s,to:e};else if(d(e,u))y={from:s,to:e};else throw new Error("Invalid range");if(y?.from&&y?.to){const v=i.differenceInCalendarDays(y.to,y.from);r>0&&v>r?y={from:e,to:void 0}:n>1&&v<n&&(y={from:e,to:void 0})}return y}function EWe(e,t,n=ui){const r=Array.isArray(t)?t:[t];let a=e.from;const i=n.differenceInCalendarDays(e.to,e.from),s=Math.min(i,6);for(let u=0;u<=s;u++){if(r.includes(a.getDay()))return!0;a=n.addDays(a,1)}return!1}function oE(e,t,n=ui){return Vi(e,t.from,!1,n)||Vi(e,t.to,!1,n)||Vi(t,e.from,!1,n)||Vi(t,e.to,!1,n)}function AWe(e,t,n=ui){const r=Array.isArray(t)?t:[t];if(r.filter(u=>typeof u!="function").some(u=>typeof u=="boolean"?u:n.isDate(u)?Vi(e,u,!1,n):Rz(u,n)?u.some(c=>Vi(e,c,!1,n)):jm(u)?u.from&&u.to?oE(e,{from:u.from,to:u.to},n):!1:Az(u)?EWe(e,u.dayOfWeek,n):A6(u)?n.isAfter(u.before,u.after)?oE(e,{from:n.addDays(u.after,1),to:n.addDays(u.before,-1)},n):Wi(e.from,u,n)||Wi(e.to,u,n):R6(u)||O6(u)?Wi(e.from,u,n)||Wi(e.to,u,n):!1))return!0;const s=r.filter(u=>typeof u=="function");if(s.length){let u=e.from;const c=n.differenceInCalendarDays(e.to,e.from);for(let d=0;d<=c;d++){if(s.some(p=>p(u)))return!0;u=n.addDays(u,1)}}return!1}function RWe(e,t){const{disabled:n,excludeDisabled:r,resetOnSelect:a,selected:i,required:s,onSelect:u}=e,[c,d]=Im(i,u?i:void 0),p=u?i:c;return{selected:p,select:(k,b,M)=>{const{min:_,max:C}=e;let E;if(k){const A=p?.from,R=p?.to,O=!!A&&!!R,N=!!A&&!!R&&t.isSameDay(A,R)&&t.isSameDay(k,A);a&&(O||!p?.from)?!s&&N?E=void 0:E={from:k,to:void 0}:E=CWe(k,p,_,C,s,t)}return r&&n&&E?.from&&E.to&&AWe({from:E.from,to:E.to},n,t)&&(E.from=k,E.to=void 0),u||d(E),u?.(E,k,b,M),E},isSelected:k=>p&&Vi(p,k,!1,t)}}function OWe(e,t){const{selected:n,required:r,onSelect:a}=e,[i,s]=Im(n,a?n:void 0),u=a?n:i,{isSameDay:c}=t;return{selected:u,select:(y,v,k)=>{let b=y;return!r&&u&&u&&c(y,u)&&(b=void 0),a||s(b),a?.(b,y,v,k),b},isSelected:y=>u?c(u,y):!1}}function TWe(e,t){const n=OWe(e,t),r=_We(e,t),a=RWe(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return a;default:return}}function Xa(e,t){return e instanceof Tr&&e.timeZone===t?e:new Tr(e,t)}function Uu(e,t,n){return Xa(e,t)}function iE(e,t,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Uu(e,t):Array.isArray(e)?e.map(r=>r instanceof Date?Uu(r,t):r):jm(e)?{...e,from:e.from?Xa(e.from,t):e.from,to:e.to?Xa(e.to,t):e.to}:A6(e)?{before:Uu(e.before,t),after:Uu(e.after,t)}:R6(e)?{after:Uu(e.after,t)}:O6(e)?{before:Uu(e.before,t)}:e}function z4(e,t,n){return e&&(Array.isArray(e)?e.map(r=>iE(r,t)):iE(e,t))}function NWe(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=Xa(t.today,n)),t.month&&(t.month=Xa(t.month,n)),t.defaultMonth&&(t.defaultMonth=Xa(t.defaultMonth,n)),t.startMonth&&(t.startMonth=Xa(t.startMonth,n)),t.endMonth&&(t.endMonth=Xa(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=Xa(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(qe=>Xa(qe,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?Xa(t.selected.from,n):t.selected.from,to:t.selected.to?Xa(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=z4(t.disabled,n)),t.hidden!==void 0&&(t.hidden=z4(t.hidden,n)),t.modifiers)){const qe={};Object.keys(t.modifiers).forEach(at=>{qe[at]=z4(t.modifiers?.[at],n)}),t.modifiers=qe}const{components:r,formatters:a,labels:i,dateLib:s,locale:u,classNames:c}=x.useMemo(()=>{const qe={..._z,...t.locale},at=t.broadcastCalendar?1:t.weekStartsOn,Ie=t.noonSafe&&t.timeZone?lWe(t.timeZone,{weekStartsOn:at,locale:qe}):void 0,Ze=t.dateLib&&Ie?{...Ie,...t.dateLib}:t.dateLib??Ie,sn=new za({locale:qe,weekStartsOn:at,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},Ze);return{dateLib:sn,components:qVe(t.components),formatters:XVe(t.formatters),labels:rWe(t.labels,sn.options),locale:qe,classNames:{...UVe(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:s.today()});const{captionLayout:d,mode:p,navLayout:y,numberOfMonths:v=1,onDayBlur:k,onDayClick:b,onDayFocus:M,onDayKeyDown:_,onDayMouseEnter:C,onDayMouseLeave:E,onNextClick:A,onPrevClick:R,showWeekNumber:O,styles:N}=t,{formatCaption:P,formatDay:L,formatMonthDropdown:I,formatWeekNumber:D,formatWeekNumberHeader:H,formatWeekdayName:K,formatYearDropdown:W}=a,Y=bWe(t,s),{days:q,months:$,navStart:B,navEnd:J,previousMonth:te,nextMonth:z,goToMonth:U}=Y,V=FVe(q,t,B,J,s),{isSelected:j,select:Z,selected:ee}=TWe(t,s)??{},{blur:le,focused:se,isFocusTarget:pe,moveFocus:fe,setFocused:_e}=SWe(t,Y,V,j??(()=>!1),s),{labelDayButton:me,labelGridcell:Re,labelGrid:Nt,labelMonthDropdown:we,labelNav:Fe,labelPrevious:lt,labelNext:gt,labelWeekday:Tt,labelWeekNumber:Ge,labelWeekNumberHeader:dt,labelYearDropdown:jn}=i,ct=x.useMemo(()=>iWe(s,t.ISOWeek,t.broadcastCalendar,t.today),[s,t.ISOWeek,t.broadcastCalendar,t.today]),Jt=p!==void 0||b!==void 0,ut=x.useCallback(()=>{te&&(U(te),R?.(te))},[te,U,R]),Xe=x.useCallback(()=>{z&&(U(z),A?.(z))},[U,z,A]),oe=x.useCallback((qe,at)=>Ie=>{Ie.preventDefault(),Ie.stopPropagation(),_e(qe),!at.disabled&&(Z?.(qe.date,at,Ie),b?.(qe.date,at,Ie))},[Z,b,_e]),ge=x.useCallback((qe,at)=>Ie=>{_e(qe),M?.(qe.date,at,Ie)},[M,_e]),ze=x.useCallback((qe,at)=>Ie=>{le(),k?.(qe.date,at,Ie)},[le,k]),Ye=x.useCallback((qe,at)=>Ie=>{const Ze={ArrowLeft:[Ie.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[Ie.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[Ie.shiftKey?"year":"week","after"],ArrowUp:[Ie.shiftKey?"year":"week","before"],PageUp:[Ie.shiftKey?"year":"month","before"],PageDown:[Ie.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ze[Ie.key]){Ie.preventDefault(),Ie.stopPropagation();const[sn,Me]=Ze[Ie.key];fe(sn,Me)}_?.(qe.date,at,Ie)},[fe,_,t.dir]),Je=x.useCallback((qe,at)=>Ie=>{C?.(qe.date,at,Ie)},[C]),hn=x.useCallback((qe,at)=>Ie=>{E?.(qe.date,at,Ie)},[E]),on=x.useCallback(qe=>at=>{const Ie=Number(at.target.value),Ze=s.setMonth(s.startOfMonth(qe),Ie);U(Ze)},[s,U]),Ht=x.useCallback(qe=>at=>{const Ie=Number(at.target.value),Ze=s.setYear(s.startOfMonth(qe),Ie);U(Ze)},[s,U]),{className:jt,style:cn}=x.useMemo(()=>({className:[c[He.Root],t.className].filter(Boolean).join(" "),style:{...N?.[He.Root],...t.style}}),[c,t.className,t.style,N]),vt=HVe(t),dr=x.useRef(null);hWe(dr,!!t.animate,{classNames:c,months:$,focused:se,dateLib:s});const Cn={dayPickerProps:t,selected:ee,select:Z,isSelected:j,months:$,nextMonth:z,previousMonth:te,goToMonth:U,getModifiers:V,components:r,classNames:c,styles:N,labels:i,formatters:a};return X.createElement(Ez.Provider,{value:Cn},X.createElement(r.Root,{rootRef:t.animate?dr:void 0,className:jt,style:cn,dir:t.dir,id:t.id,lang:t.lang??u.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...vt},X.createElement(r.Months,{className:c[He.Months],style:N?.[He.Months]},!t.hideNavigation&&!y&&X.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[He.Nav],style:N?.[He.Nav],"aria-label":Fe(),onPreviousClick:ut,onNextClick:Xe,previousMonth:te,nextMonth:z}),$.map((qe,at)=>X.createElement(r.Month,{"data-animated-month":t.animate?"true":void 0,className:c[He.Month],style:N?.[He.Month],key:at,displayIndex:at,calendarMonth:qe},y==="around"&&!t.hideNavigation&&at===0&&X.createElement(r.PreviousMonthButton,{type:"button",className:c[He.PreviousMonthButton],tabIndex:te?void 0:-1,"aria-disabled":te?void 0:!0,"aria-label":lt(te),onClick:ut,"data-animated-button":t.animate?"true":void 0},X.createElement(r.Chevron,{disabled:te?void 0:!0,className:c[He.Chevron],orientation:t.dir==="rtl"?"right":"left"})),X.createElement(r.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[He.MonthCaption],style:N?.[He.MonthCaption],calendarMonth:qe,displayIndex:at},d?.startsWith("dropdown")?X.createElement(r.DropdownNav,{className:c[He.Dropdowns],style:N?.[He.Dropdowns]},(()=>{const Ie=d==="dropdown"||d==="dropdown-months"?X.createElement(r.MonthsDropdown,{key:"month",className:c[He.MonthsDropdown],"aria-label":we(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:on(qe.date),options:aWe(qe.date,B,J,a,s),style:N?.[He.Dropdown],value:s.getMonth(qe.date)}):X.createElement("span",{key:"month"},I(qe.date,s)),Ze=d==="dropdown"||d==="dropdown-years"?X.createElement(r.YearsDropdown,{key:"year",className:c[He.YearsDropdown],"aria-label":jn(s.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Ht(qe.date),options:sWe(B,J,a,s,!!t.reverseYears),style:N?.[He.Dropdown],value:s.getYear(qe.date)}):X.createElement("span",{key:"year"},W(qe.date,s));return s.getMonthYearOrder()==="year-first"?[Ze,Ie]:[Ie,Ze]})(),X.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},P(qe.date,s.options,s))):X.createElement(r.CaptionLabel,{className:c[He.CaptionLabel],role:"status","aria-live":"polite"},P(qe.date,s.options,s))),y==="around"&&!t.hideNavigation&&at===v-1&&X.createElement(r.NextMonthButton,{type:"button",className:c[He.NextMonthButton],tabIndex:z?void 0:-1,"aria-disabled":z?void 0:!0,"aria-label":gt(z),onClick:Xe,"data-animated-button":t.animate?"true":void 0},X.createElement(r.Chevron,{disabled:z?void 0:!0,className:c[He.Chevron],orientation:t.dir==="rtl"?"left":"right"})),at===v-1&&y==="after"&&!t.hideNavigation&&X.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[He.Nav],style:N?.[He.Nav],"aria-label":Fe(),onPreviousClick:ut,onNextClick:Xe,previousMonth:te,nextMonth:z}),X.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":p==="multiple"||p==="range","aria-label":Nt(qe.date,s.options,s)||void 0,className:c[He.MonthGrid],style:N?.[He.MonthGrid]},!t.hideWeekdays&&X.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[He.Weekdays],style:N?.[He.Weekdays]},O&&X.createElement(r.WeekNumberHeader,{"aria-label":dt(s.options),className:c[He.WeekNumberHeader],style:N?.[He.WeekNumberHeader],scope:"col"},H()),ct.map(Ie=>X.createElement(r.Weekday,{"aria-label":Tt(Ie,s.options,s),className:c[He.Weekday],key:String(Ie),style:N?.[He.Weekday],scope:"col"},K(Ie,s.options,s)))),X.createElement(r.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[He.Weeks],style:N?.[He.Weeks]},qe.weeks.map(Ie=>X.createElement(r.Week,{className:c[He.Week],key:Ie.weekNumber,style:N?.[He.Week],week:Ie},O&&X.createElement(r.WeekNumber,{week:Ie,style:N?.[He.WeekNumber],"aria-label":Ge(Ie.weekNumber,{locale:u}),className:c[He.WeekNumber],scope:"row",role:"rowheader"},D(Ie.weekNumber,s)),Ie.days.map(Ze=>{const{date:sn}=Ze,Me=V(Ze);if(Me[mn.focused]=!Me.hidden&&!!se?.isEqualTo(Ze),Me[bo.selected]=j?.(sn)||Me.selected,jm(ee)){const{from:hr,to:$t}=ee;Me[bo.range_start]=!!(hr&&$t&&s.isSameDay(sn,hr)),Me[bo.range_end]=!!(hr&&$t&&s.isSameDay(sn,$t)),Me[bo.range_middle]=Vi(ee,sn,!0,s)}const Gt=oWe(Me,N,t.modifiersStyles),Ct=$Ve(Me,c,t.modifiersClassNames),In=!Jt&&!Me.hidden?Re(sn,Me,s.options,s):void 0;return X.createElement(r.Day,{key:`${Ze.isoDate}_${Ze.displayMonthId}`,day:Ze,modifiers:Me,className:Ct.join(" "),style:Gt,role:"gridcell","aria-selected":Me.selected||void 0,"aria-label":In,"data-day":Ze.isoDate,"data-month":Ze.outside?Ze.dateMonthId:void 0,"data-selected":Me.selected||void 0,"data-disabled":Me.disabled||void 0,"data-hidden":Me.hidden||void 0,"data-outside":Ze.outside||void 0,"data-focused":Me.focused||void 0,"data-today":Me.today||void 0},!Me.hidden&&Jt?X.createElement(r.DayButton,{className:c[He.DayButton],style:N?.[He.DayButton],type:"button",day:Ze,modifiers:Me,disabled:!Me.focused&&Me.disabled||void 0,"aria-disabled":Me.focused&&Me.disabled||void 0,tabIndex:pe(Ze)?0:-1,"aria-label":me(sn,Me,s.options,s),onClick:oe(Ze,Me),onBlur:ze(Ze,Me),onFocus:ge(Ze,Me),onKeyDown:Ye(Ze,Me),onMouseEnter:Je(Ze,Me),onMouseLeave:hn(Ze,Me)},L(sn,s.options,s)):!Me.hidden&&L(Ze.date,s.options,s))})))))))),t.footer&&X.createElement(r.Footer,{className:c[He.Footer],style:N?.[He.Footer],role:"status","aria-live":"polite"},t.footer)))}function jWe({className:e,classNames:t,showOutsideDays:n=!0,...r}){return h.jsx(NWe,{showOutsideDays:n,className:ve("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",month_caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",button_previous:ve(L0({variant:"outline"}),"absolute left-1 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:ve(L0({variant:"outline"}),"absolute right-1 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse space-y-1",weekdays:"flex",weekday:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",week:"flex w-full mt-2",day:"relative p-0 text-center text-sm focus-within:relative focus-within:z-20",day_button:ve(L0({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),range_start:"day-range-start",range_end:"day-range-end",selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",today:"bg-accent text-accent-foreground",outside:"text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",disabled:"text-muted-foreground opacity-50",range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",hidden:"invisible",...t},components:{Chevron:({orientation:a})=>{const i=a==="left"?YA:Br;return h.jsx(i,{className:"h-4 w-4"})}},...r})}jWe.displayName="Calendar";const IWe=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{className:"relative w-full overflow-auto",children:h.jsx("table",{ref:n,className:ve("w-full caption-bottom text-sm",e),...t})}));IWe.displayName="Table";const PWe=x.forwardRef(({className:e,...t},n)=>h.jsx("thead",{ref:n,className:ve("[&_tr]:border-b",e),...t}));PWe.displayName="TableHeader";const DWe=x.forwardRef(({className:e,...t},n)=>h.jsx("tbody",{ref:n,className:ve("[&_tr:last-child]:border-0",e),...t}));DWe.displayName="TableBody";const LWe=x.forwardRef(({className:e,...t},n)=>h.jsx("tr",{ref:n,className:ve("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));LWe.displayName="TableRow";const zWe=x.forwardRef(({className:e,...t},n)=>h.jsx("th",{ref:n,className:ve("h-10 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));zWe.displayName="TableHead";const FWe=x.forwardRef(({className:e,...t},n)=>h.jsx("td",{ref:n,className:ve("p-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));FWe.displayName="TableCell";function $We(e){const t=sUe(e);if(t!==null)return{kind:"inference",id:t};const n=UHe(e);if(n!==null)return{kind:"sandbox",id:n};const r=V0(e);return r!==null?{kind:"sandbox-provider",id:r}:{kind:"connector",id:null}}function qWe(e){return $We(e).kind==="connector"}const HWe=()=>Te(()=>import("./_connectorKey.index-BTP5ijdT.js"),__vite__mapDeps([74,75,8,76,77,7,78])),UWe=Ce("/$owner/connectors/$connectorKey/")({validateSearch:e=>Vn({addAccount:e.addAccount===!0||e.addAccount==="true"?!0:void 0,instances:e.instances===!0||e.instances==="true"?!0:void 0,setup:e.setup==="oauth_app"?"oauth_app":void 0,model:typeof e.model=="string"?e.model:void 0,reason:typeof e.reason=="string"?e.reason:void 0,agentId:typeof e.agentId=="string"?e.agentId:void 0}),loader:({context:{queryClient:e},params:t})=>{e.fetchQuery(vn.queryOptions(t.owner,{slug:t.owner})).then(n=>{const r=n?.workspace?.id;r&&qWe(t.connectorKey)&&(e.prefetchQuery(n3.queryOptions(r)),e.prefetchQuery(sy.queryOptions(r,{connectorKey:t.connectorKey})))}).catch(()=>{})},component:Oe(HWe,"component")}),BWe=()=>Te(()=>import("./index-rrnUF981.js"),[]),VWe=Ce("/$owner/chat/$agentId/")({component:Oe(BWe,"component")}),WWe=()=>Te(()=>import("./index-B3c-0eZG.js"),__vite__mapDeps([79,80,47,12,15])),KWe=Ce("/$owner/agents/connect/")({component:Oe(WWe,"component")}),GWe=()=>Te(()=>import("./device._deviceId-Bn37UpWH.js"),__vite__mapDeps([81,82,77,7,78,83,8,22])),YWe=Ce("/$owner/connectors/device/$deviceId")({validateSearch:e=>({connection:typeof e.connection=="number"?e.connection:typeof e.connection=="string"&&/^\d+$/.test(e.connection)?Number(e.connection):void 0,settings:e.settings===!0||e.settings==="true"?!0:void 0}),loader:({context:{queryClient:e}})=>e.prefetchQuery(ef.queryOptions()),component:Oe(GWe,"component")}),ZWe=()=>Te(()=>import("./_deploymentId-B1UWPY0i.js"),__vite__mapDeps([84,73,67,33,34,35])),QWe=Ce("/$owner/connectors/deployments/$deploymentId")({component:Oe(ZWe,"component")}),XWe=()=>Te(()=>import("./create._connectorKey-D6Kc-YQ3.js"),[]),JWe=Ce("/$owner/connectors/create/$connectorKey")({component:Oe(XWe,"component")}),eKe=()=>Te(()=>import("./app._appId-Cp78oEZ9.js"),__vite__mapDeps([85,75,8])),tKe=Ce("/$owner/connectors/app/$appId")({component:Oe(eKe,"component")}),nKe=()=>Te(()=>import("./_connectorKey._connectionId-DWxv1uoi.js"),__vite__mapDeps([86,82,77,7,78,83,76,87,61,8])),rKe=Ce("/$owner/connectors/$connectorKey/$connectionId")({validateSearch:e=>Vn({settings:e.settings===!0||e.settings==="true"?!0:void 0,auth_result:e.auth_result==="connected"||e.auth_result==="cancelled"||e.auth_result==="failed"?e.auth_result:void 0,addFeed:e.addFeed===!0||e.addFeed==="true"?!0:void 0,feedId:typeof e.feedId=="number"?e.feedId:typeof e.feedId=="string"&&/^\d+$/.test(e.feedId)?Number(e.feedId):void 0}),loaderDeps:({search:{feedId:e}})=>({feedId:e}),loader:({context:{queryClient:e},params:t,deps:n})=>{e.fetchQuery(vn.queryOptions(t.owner,{slug:t.owner})).then(r=>{const a=r?.workspace?.id;a&&(e.prefetchQuery(sy.queryOptions(a,{connectorKey:t.connectorKey,connectionIds:[Number(t.connectionId)]})),e.prefetchQuery(KR.queryOptions(a)),n.feedId!==void 0&&e.prefetchQuery(YR.queryOptions(Number(t.connectionId))))}).catch(()=>{})},component:Oe(nKe,"component")}),aKe=()=>Te(()=>import("./connected._clientId-QR8o-7M5.js"),[]),oKe=Ce("/$owner/agents/connected/$clientId")({component:Oe(aKe,"component")}),iKe=()=>Te(()=>import("./connect._clientId-kk0_4Svo.js"),__vite__mapDeps([88,80,47,12,15])),sKe=Ce("/$owner/agents/connect/$clientId")({component:Oe(iKe,"component")}),lKe=()=>Te(()=>import("./skills-DgDGscm5.js"),__vite__mapDeps([89,90,38,63])),cKe=Ce("/$owner/agents/$agentId/skills")({component:Oe(lKe,"component")}),Hz={validateSearch:e=>({run_id:wz(e.run_id)}),loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))}},uKe=()=>Te(()=>import("./settings-CgZ5Z7wD.js"),__vite__mapDeps([91,71,69,62,66])),dKe=Ce("/$owner/agents/$agentId/settings")({...Hz,component:Oe(uKe,"component")}),hKe=()=>Te(()=>import("./permissions-Dv39zWKt.js"),__vite__mapDeps([92,51,93])),fKe=Ce("/$owner/agents/$agentId/permissions")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))},component:Oe(hKe,"component")}),pKe=()=>Te(()=>import("./models-BAVeysNq.js"),__vite__mapDeps([94,71,69,62,66])),yKe=Ce("/$owner/agents/$agentId/models")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner})),e.prefetchQuery(No.queryOptions(t.owner))},component:Oe(pKe,"component")}),mKe=()=>Te(()=>import("./identity-HCFWtdaI.js"),__vite__mapDeps([95,71,69,62,66])),gKe=Ce("/$owner/agents/$agentId/identity")({...Hz,component:Oe(mKe,"component")}),vKe=()=>Te(()=>import("./guardrails-BiJollCA.js"),[]),kKe=Ce("/$owner/agents/$agentId/guardrails")({component:Oe(vKe,"component")}),xKe=()=>Te(()=>import("./_shape-Ep6JpyFX.js"),__vite__mapDeps([96,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),bKe=new Set(["table","board"]),wKe=Ce("/$owner/$entityType/-/$shape")({validateSearch:e=>({$collection:yc(e.$collection),$preset:yc(e.$preset),$table:yc(e.$table),segment:typeof e.segment=="string"&&e.segment?e.segment:void 0}),beforeLoad:({params:e})=>{if(ai(e.entityType)||!bKe.has(e.shape))throw Zi()},component:Oe(xKe,"component")}),MKe=()=>Te(()=>import("./connected._clientId.index-DhRoSzBr.js"),__vite__mapDeps([97,11,12,15])),SKe=Ce("/$owner/agents/connected/$clientId/")({component:Oe(MKe,"component")}),_Ke=()=>Te(()=>import("./index-DMNzF8Lf.js"),__vite__mapDeps([98,99,93,90,38,63,16,100])),CKe=Ce("/$owner/agents/$agentId/skills/")({component:Oe(_Ke,"component")}),EKe=()=>Te(()=>import("./index-BX0EA_oB.js"),__vite__mapDeps([101,102,62,93,16,100])),AKe=Ce("/$owner/agents/$agentId/guardrails/")({component:Oe(EKe,"component")}),RKe=()=>Te(()=>import("./_viewKey-DDUxjjFD.js"),__vite__mapDeps([103,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),OKe=Ce("/$owner/data/-/views/$viewKey")({loader:({context:{queryClient:e},params:t})=>{e.prefetchQuery(vn.queryOptions(t.owner,{slug:t.owner}))},validateSearch:Ib,component:Oe(RKe,"component")}),TKe=()=>Te(()=>import("./_threadId-DtqBFgK5.js"),[]),NKe=Ce("/$owner/chat/$agentId/c/$threadId")({validateSearch:e=>{const t={...Em(e)},n=typeof e.message_id=="string"&&e.message_id.trim()||typeof e.message=="string"&&e.message.trim()||"";return n&&(t.message_id=n),t},component:Oe(TKe,"component")}),jKe=()=>Te(()=>import("./connected._clientId.activity-BqprYeOX.js"),__vite__mapDeps([104,11,10,12,13,14,15])),IKe=Ce("/$owner/agents/connected/$clientId/activity")({validateSearch:e=>Vn(e),component:Oe(jKe,"component")}),PKe=()=>Te(()=>import("./create-DkgUQAbB.js"),__vite__mapDeps([105,99,93,90,38,63,16,100])),DKe=Ce("/$owner/agents/$agentId/skills/create")({component:Oe(PKe,"component")}),LKe=()=>Te(()=>import("./_skillKey-B24alBfT.js"),__vite__mapDeps([106,99,93,90,38,63,16,100])),zKe=Ce("/$owner/agents/$agentId/skills/$skillKey")({component:Oe(LKe,"component")}),FKe=()=>Te(()=>import("./create-C4lptGWj.js"),__vite__mapDeps([107,102,62,93,16,100])),$Ke=Ce("/$owner/agents/$agentId/guardrails/create")({component:Oe(FKe,"component")}),qKe=()=>Te(()=>import("./_name-BUfFO_A0.js"),__vite__mapDeps([108,102,62,93,16,100])),HKe=Ce("/$owner/agents/$agentId/guardrails/$name")({component:Oe(qKe,"component")}),UKe=()=>Te(()=>import("./_conversationId-98Y3RuRO.js"),__vite__mapDeps([109,16,57,40,58,35,10,11,12,13,14])),BKe=Ce("/$owner/agents/$agentId/conversations/$conversationId")({component:Oe(UKe,"component")}),VKe=()=>Te(()=>import("./_viewKey-hdpq3RoX.js"),__vite__mapDeps([110,31,18,32,33,34,35,36,13,14,37,7,38,39,40,17,41])),WKe=Ce("/$owner/$entityType/-/views/$viewKey")({validateSearch:AI,beforeLoad:({params:e})=>{if(ai(e.entityType))throw Zi()},component:Oe(VKe,"component")}),KKe=Ce("/$owner/events/$eventId/-/views/$viewKey")({validateSearch:Ib}),xn=V$e.update({id:"/$owner",path:"/$owner",getParentRoute:()=>ga}),GKe=K$e.update({id:"/",path:"/",getParentRoute:()=>ga}),YKe=Y$e.update({id:"/",path:"/",getParentRoute:()=>xn}),ZKe=Q$e.update({id:"/slack/claim",path:"/slack/claim",getParentRoute:()=>ga}),QKe=J$e.update({id:"/orgs/new",path:"/orgs/new",getParentRoute:()=>ga}),XKe=nqe.update({id:"/oauth/device",path:"/oauth/device",getParentRoute:()=>ga}),JKe=aqe.update({id:"/oauth/consent",path:"/oauth/consent",getParentRoute:()=>ga}),eGe=iqe.update({id:"/auth/reset-password",path:"/auth/reset-password",getParentRoute:()=>ga}),tGe=lqe.update({id:"/auth/logout",path:"/auth/logout",getParentRoute:()=>ga}),nGe=uqe.update({id:"/auth/login",path:"/auth/login",getParentRoute:()=>ga}),rGe=hqe.update({id:"/auth/callback",path:"/auth/callback",getParentRoute:()=>ga}),aGe=pqe.update({id:"/auth/accept-invitation",path:"/auth/accept-invitation",getParentRoute:()=>ga}),oGe=mqe.update({id:"/account/settings",path:"/account/settings",getParentRoute:()=>ga}),iGe=vqe.update({id:"/recent",path:"/recent",getParentRoute:()=>xn}),Pl=xqe.update({id:"/connectors",path:"/connectors",getParentRoute:()=>xn}),Pm=wqe.update({id:"/automations",path:"/automations",getParentRoute:()=>xn}),Vd=Sqe.update({id:"/agents",path:"/agents",getParentRoute:()=>xn}),sGe=Aqe.update({id:"/$",path:"/$",getParentRoute:()=>xn}),lGe=Tqe.update({id:"/memory/",path:"/memory/",getParentRoute:()=>xn}),cGe=jqe.update({id:"/members/",path:"/members/",getParentRoute:()=>xn}),uGe=Pqe.update({id:"/events/",path:"/events/",getParentRoute:()=>xn}),dGe=Lqe.update({id:"/data/",path:"/data/",getParentRoute:()=>xn}),hGe=Bqe.update({id:"/",path:"/",getParentRoute:()=>Pl}),fGe=Wqe.update({id:"/chat/",path:"/chat/",getParentRoute:()=>xn}),pGe=Gqe.update({id:"/",path:"/",getParentRoute:()=>Pm}),yGe=Zqe.update({id:"/",path:"/",getParentRoute:()=>Vd}),mGe=Xqe.update({id:"/$entityType/",path:"/$entityType/",getParentRoute:()=>xn}),gGe=eHe.update({id:"/connector/$name/connection",path:"/connector/$name/connection",getParentRoute:()=>ga}),vGe=nHe.update({id:"/settings/organization",path:"/settings/organization",getParentRoute:()=>xn}),kGe=aHe.update({id:"/memory/$",path:"/memory/$",getParentRoute:()=>xn}),j6=iHe.update({id:"/events/$eventId",path:"/events/$eventId",getParentRoute:()=>xn}),xGe=lHe.update({id:"/events/$",path:"/events/$",getParentRoute:()=>xn}),bGe=cHe.update({id:"/entity-types/new",path:"/entity-types/new",getParentRoute:()=>xn}),wGe=dHe.update({id:"/entity-types/$slug",path:"/entity-types/$slug",getParentRoute:()=>xn}),I6=fHe.update({id:"/deployments",path:"/deployments",getParentRoute:()=>Pl}),P6=LBe.update({id:"/create",path:"/create",getParentRoute:()=>Pl}),D6=$Be.update({id:"/chat/$agentId",path:"/chat/$agentId",getParentRoute:()=>xn}),MGe=HBe.update({id:"/new",path:"/new",getParentRoute:()=>Pm}),SGe=VBe.update({id:"/$automationId",path:"/$automationId",getParentRoute:()=>Pm}),_Ge=KBe.update({id:"/new",path:"/new",getParentRoute:()=>Vd}),L6=YBe.update({id:"/connect",path:"/connect",getParentRoute:()=>Vd}),Dl=QBe.update({id:"/$agentId",path:"/$agentId",getParentRoute:()=>Vd}),CGe=XBe.update({id:"/",path:"/",getParentRoute:()=>j6}),EGe=eVe.update({id:"/",path:"/",getParentRoute:()=>I6}),AGe=nVe.update({id:"/",path:"/",getParentRoute:()=>P6}),RGe=UWe.update({id:"/$connectorKey/",path:"/$connectorKey/",getParentRoute:()=>Pl}),OGe=VWe.update({id:"/",path:"/",getParentRoute:()=>D6}),TGe=KWe.update({id:"/",path:"/",getParentRoute:()=>L6}),NGe=YWe.update({id:"/device/$deviceId",path:"/device/$deviceId",getParentRoute:()=>Pl}),jGe=QWe.update({id:"/$deploymentId",path:"/$deploymentId",getParentRoute:()=>I6}),IGe=JWe.update({id:"/$connectorKey",path:"/$connectorKey",getParentRoute:()=>P6}),PGe=tKe.update({id:"/app/$appId",path:"/app/$appId",getParentRoute:()=>Pl}),DGe=rKe.update({id:"/$connectorKey/$connectionId",path:"/$connectorKey/$connectionId",getParentRoute:()=>Pl}),z6=oKe.update({id:"/connected/$clientId",path:"/connected/$clientId",getParentRoute:()=>Vd}),LGe=sKe.update({id:"/$clientId",path:"/$clientId",getParentRoute:()=>L6}),Dm=cKe.update({id:"/skills",path:"/skills",getParentRoute:()=>Dl}),zGe=dKe.update({id:"/settings",path:"/settings",getParentRoute:()=>Dl}),FGe=fKe.update({id:"/permissions",path:"/permissions",getParentRoute:()=>Dl}),$Ge=yKe.update({id:"/models",path:"/models",getParentRoute:()=>Dl}),qGe=gKe.update({id:"/identity",path:"/identity",getParentRoute:()=>Dl}),Lm=kKe.update({id:"/guardrails",path:"/guardrails",getParentRoute:()=>Dl}),HGe=wKe.update({id:"/$entityType/-/$shape",path:"/$entityType/-/$shape",getParentRoute:()=>xn}),UGe=SKe.update({id:"/",path:"/",getParentRoute:()=>z6}),BGe=CKe.update({id:"/",path:"/",getParentRoute:()=>Dm}),VGe=AKe.update({id:"/",path:"/",getParentRoute:()=>Lm}),WGe=OKe.update({id:"/data/-/views/$viewKey",path:"/data/-/views/$viewKey",getParentRoute:()=>xn}),KGe=NKe.update({id:"/c/$threadId",path:"/c/$threadId",getParentRoute:()=>D6}),GGe=IKe.update({id:"/activity",path:"/activity",getParentRoute:()=>z6}),YGe=DKe.update({id:"/create",path:"/create",getParentRoute:()=>Dm}),ZGe=zKe.update({id:"/$skillKey",path:"/$skillKey",getParentRoute:()=>Dm}),QGe=$Ke.update({id:"/create",path:"/create",getParentRoute:()=>Lm}),XGe=HKe.update({id:"/$name",path:"/$name",getParentRoute:()=>Lm}),JGe=BKe.update({id:"/conversations/$conversationId",path:"/conversations/$conversationId",getParentRoute:()=>Dl}),eYe=WKe.update({id:"/$entityType/-/views/$viewKey",path:"/$entityType/-/views/$viewKey",getParentRoute:()=>xn}),tYe=KKe.update({id:"/-/views/$viewKey",path:"/-/views/$viewKey",getParentRoute:()=>j6}),nYe={OwnerAgentsAgentIdGuardrailsNameRoute:XGe,OwnerAgentsAgentIdGuardrailsCreateRoute:QGe,OwnerAgentsAgentIdGuardrailsIndexRoute:VGe},rYe=Lm._addFileChildren(nYe),aYe={OwnerAgentsAgentIdSkillsSkillKeyRoute:ZGe,OwnerAgentsAgentIdSkillsCreateRoute:YGe,OwnerAgentsAgentIdSkillsIndexRoute:BGe},oYe=Dm._addFileChildren(aYe),iYe={OwnerAgentsAgentIdGuardrailsRoute:rYe,OwnerAgentsAgentIdIdentityRoute:qGe,OwnerAgentsAgentIdModelsRoute:$Ge,OwnerAgentsAgentIdPermissionsRoute:FGe,OwnerAgentsAgentIdSettingsRoute:zGe,OwnerAgentsAgentIdSkillsRoute:oYe,OwnerAgentsAgentIdConversationsConversationIdRoute:JGe},sYe=Dl._addFileChildren(iYe),lYe={OwnerAgentsConnectClientIdRoute:LGe,OwnerAgentsConnectIndexRoute:TGe},cYe=L6._addFileChildren(lYe),uYe={OwnerAgentsConnectedClientIdActivityRoute:GGe,OwnerAgentsConnectedClientIdIndexRoute:UGe},dYe=z6._addFileChildren(uYe),hYe={OwnerAgentsAgentIdRoute:sYe,OwnerAgentsConnectRoute:cYe,OwnerAgentsNewRoute:_Ge,OwnerAgentsIndexRoute:yGe,OwnerAgentsConnectedClientIdRoute:dYe},fYe=Vd._addFileChildren(hYe),pYe={OwnerAutomationsAutomationIdRoute:SGe,OwnerAutomationsNewRoute:MGe,OwnerAutomationsIndexRoute:pGe},yYe=Pm._addFileChildren(pYe),mYe={OwnerConnectorsCreateConnectorKeyRoute:IGe,OwnerConnectorsCreateIndexRoute:AGe},gYe=P6._addFileChildren(mYe),vYe={OwnerConnectorsDeploymentsDeploymentIdRoute:jGe,OwnerConnectorsDeploymentsIndexRoute:EGe},kYe=I6._addFileChildren(vYe),xYe={OwnerConnectorsCreateRoute:gYe,OwnerConnectorsDeploymentsRoute:kYe,OwnerConnectorsIndexRoute:hGe,OwnerConnectorsConnectorKeyConnectionIdRoute:DGe,OwnerConnectorsAppAppIdRoute:PGe,OwnerConnectorsDeviceDeviceIdRoute:NGe,OwnerConnectorsConnectorKeyIndexRoute:RGe},bYe=Pl._addFileChildren(xYe),wYe={OwnerChatAgentIdIndexRoute:OGe,OwnerChatAgentIdCThreadIdRoute:KGe},MYe=D6._addFileChildren(wYe),SYe={OwnerEventsEventIdIndexRoute:CGe,OwnerEventsEventIdChar91Char93ViewsViewKeyRoute:tYe},_Ye=j6._addFileChildren(SYe),CYe={OwnerSplatRoute:sGe,OwnerAgentsRoute:fYe,OwnerAutomationsRoute:yYe,OwnerConnectorsRoute:bYe,OwnerRecentRoute:iGe,OwnerIndexRoute:YKe,OwnerChatAgentIdRoute:MYe,OwnerEntityTypesSlugRoute:wGe,OwnerEntityTypesNewRoute:bGe,OwnerEventsSplatRoute:xGe,OwnerEventsEventIdRoute:_Ye,OwnerMemorySplatRoute:kGe,OwnerSettingsOrganizationRoute:vGe,OwnerEntityTypeIndexRoute:mGe,OwnerChatIndexRoute:fGe,OwnerDataIndexRoute:dGe,OwnerEventsIndexRoute:uGe,OwnerMembersIndexRoute:cGe,OwnerMemoryIndexRoute:lGe,OwnerEntityTypeChar91Char93ShapeRoute:HGe,OwnerEntityTypeChar91Char93ViewsViewKeyRoute:eYe,OwnerDataChar91Char93ViewsViewKeyRoute:WGe},EYe=xn._addFileChildren(CYe),AYe={IndexRoute:GKe,OwnerRoute:EYe,AccountSettingsRoute:oGe,AuthAcceptInvitationRoute:aGe,AuthCallbackRoute:rGe,AuthLoginRoute:nGe,AuthLogoutRoute:tGe,AuthResetPasswordRoute:eGe,OauthConsentRoute:JKe,OauthDeviceRoute:XKe,OrgsNewRoute:QKe,SlackClaimRoute:ZKe,ConnectorNameConnectionRoute:gGe},RYe=ga._addFileChildren(AYe)._addFileTypes(),Uz=new Sq({defaultOptions:{queries:{staleTime:1e3*60*5,retry:1}}}),sE=Kh(),OYe=gU({routeTree:RYe,context:{queryClient:Uz},history:sE?Bge(sE):void 0,parseSearch:Lge,stringifySearch:zge,defaultPreload:"intent",defaultPreloadStaleTime:0,defaultErrorComponent:Pge,defaultNotFoundComponent:Nge,defaultPendingComponent:()=>x.createElement(FR),defaultPendingMs:150,defaultPendingMinMs:300});qA();const lE=JV(window.location.search);lE!==window.location.search&&window.history.replaceState(window.history.state,"",`${window.location.pathname}${lE}${window.location.hash}`);{const e=EV(window.location.pathname);e!==window.location.pathname&&window.history.replaceState(window.history.state,"",`${e}${window.location.search}${window.location.hash}`)}const cE=new URLSearchParams(window.location.search).get("lobu_token");if(cE){const e=new URL(window.location.href);e.searchParams.delete("lobu_token");const t=e.pathname+e.search+e.hash;window.location.replace(`/api/exchange-token?token=${encodeURIComponent(cE)}&next=${encodeURIComponent(t)}`),await new Promise(()=>{})}const Bz=document.getElementById("root");if(!Bz)throw new Error("Root element not found");const G0=Bz;CU.createRoot(G0).render(h.jsx(X.StrictMode,{children:h.jsx(Cq,{client:Uz,children:h.jsx(ZV,{children:h.jsx(xU,{router:OYe})})})}));const T0=document.getElementById("ssr-hydrate-shell");if(T0){let e=function(){r||(r=new MutationObserver(()=>{M9(G0)&&s()}),r.observe(G0,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))},t=function(){if(M9(G0)){s();return}e()},n=!1,r=null;const a=()=>{window.removeEventListener(r5,t),r?.disconnect()},i=()=>{T0.remove(),document.getElementById("public-boot-status")?.remove(),document.documentElement.classList.remove("public-app-loading"),a()},s=()=>{n||(n=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(document.documentElement.classList.contains("public-app-loading")){i();return}T0.classList.add("is-hidden"),T0.addEventListener("transitionend",i,{once:!0}),window.setTimeout(i,400)})}))};window.addEventListener(r5,t),window.setTimeout(t,5e3)}else document.getElementById("public-boot-status")?.remove(),document.documentElement.classList.remove("public-app-loading");export{Tn as $,VK as A,ke as B,YA as C,h3 as D,hh as E,DA as F,nqe as G,eqe as H,yn as I,At as J,aqe as K,nn as L,HYe as M,uXe as N,J4 as O,Qn as P,ve as Q,V$e as R,Ft as S,E6 as T,cy as U,iqe as V,Ke as W,ol as X,Jn as Y,SA as Z,Te as _,eD as a,Zs as a$,yO as a0,qYe as a1,Dt as a2,gje as a3,Dx as a4,zYe as a5,BV as a6,FYe as a7,MA as a8,$Ye as a9,ef as aA,qL as aB,xL as aC,NXe as aD,Ys as aE,gXe as aF,np as aG,Uh as aH,IXe as aI,jXe as aJ,fBe as aK,Hqe as aL,Fqe as aM,T4 as aN,TXe as aO,v6 as aP,zqe as aQ,Tge as aR,ZN as aS,LL as aT,yL as aU,Nf as aV,yf as aW,ix as aX,kO as aY,Wqe as aZ,No as a_,pqe as aa,JA as ab,sXe as ac,iXe as ad,nXe as ae,Qh as af,Xt as ag,vqe as ah,PBe as ai,zx as aj,SMe as ak,Aqe as al,Cp as am,_qe as an,uy as ao,FR as ap,Pqe as aq,IZe as ar,Lqe as as,Bqe as at,_ve as au,n3 as av,r3 as aw,xXe as ax,ZHe as ay,hke as az,p3 as b,PC as b$,gS as b0,fj as b1,qQe as b2,Ude as b3,Ske as b4,noe as b5,EZ as b6,Gx as b7,zpe as b8,$ue as b9,HHe as bA,Ihe as bB,lz as bC,GYe as bD,YYe as bE,XYe as bF,bve as bG,UR as bH,Fa as bI,gn as bJ,JYe as bK,eZe as bL,VYe as bM,GUe as bN,T1e as bO,qXe as bP,vh as bQ,FXe as bR,kse as bS,yte as bT,od as bU,QZe as bV,Kh as bW,IA as bX,Hge as bY,nHe as bZ,ry as b_,Gle as ba,BA as bb,Wx as bc,mf as bd,eR as be,Ux as bf,Gqe as bg,sf as bh,Mke as bi,ay as bj,hj as bk,Zqe as bl,Xqe as bm,Ch as bn,Tc as bo,Ws as bp,Fi as bq,Ks as br,$i as bs,Hr as bt,ZYe as bu,KYe as bv,QYe as bw,tZe as bx,Ox as by,Oge as bz,my as c,uae as c$,Ib as c0,iHe as c1,uL as c2,lHe as c3,WN as c4,H0 as c5,bl as c6,Vwe as c7,bp as c8,sc as c9,RQe as cA,s3 as cB,w9 as cC,Mme as cD,eo as cE,ar as cF,lke as cG,TQe as cH,OQe as cI,ai as cJ,Ewe as cK,Uxe as cL,eQe as cM,aR as cN,IQe as cO,YR as cP,cye as cQ,fR as cR,g3 as cS,ia as cT,Owe as cU,AV as cV,Zh as cW,YK as cX,LZ as cY,yR as cZ,$x as c_,DS as ca,k0 as cb,DQe as cc,Td as cd,PQe as ce,Hwe as cf,KR as cg,rt as ch,MZe as ci,EZe as cj,Dje as ck,Lje as cl,Pje as cm,zje as cn,Bx as co,hXe as cp,Ad as cq,Tje as cr,CV as cs,JY as ct,GA as cu,O$e as cv,ZG as cw,br as cx,tr as cy,Yh as cz,gy as d,ey as d$,GZe as d0,uc as d1,Vr as d2,LZe as d3,DZe as d4,oO as d5,bZe as d6,sy as d7,kMe as d8,YZe as d9,jh as dA,Kwe as dB,Xwe as dC,Wr as dD,lMe as dE,Br as dF,TA as dG,ZQe as dH,Oq as dI,ir as dJ,gwe as dK,vwe as dL,Joe as dM,HN as dN,e3 as dO,gQe as dP,tQe as dQ,vQe as dR,Gs as dS,EJ as dT,mae as dU,jx as dV,G2e as dW,cXe as dX,cMe as dY,Fje as dZ,ZA as d_,ZZe as da,BZe as db,VZe as dc,WZe as dd,KZe as de,iO as df,O0e as dg,qN as dh,Goe as di,PZe as dj,rO as dk,bQ as dl,AQe as dm,BYe as dn,Kx as dp,XN as dq,zHe as dr,PL as ds,FHe as dt,af as du,My as dv,Sy as dw,_y as dx,ja as dy,jWe as dz,vy as e,G3 as e$,ty as e0,Ix as e1,fpe as e2,x$e as e3,p6 as e4,H9 as e5,hR as e6,FQe as e7,AZe as e8,RZe as e9,pz as eA,nBe as eB,hx as eC,eBe as eD,$He as eE,aee as eF,QA as eG,HZ as eH,xQe as eI,bQe as eJ,xR as eK,jYe as eL,ni as eM,iQe as eN,pQe as eO,yQe as eP,oQe as eQ,SHe as eR,PUe as eS,gT as eT,vT as eU,CQe as eV,rQe as eW,TYe as eX,ns as eY,sQe as eZ,Fy as e_,Nve as ea,jve as eb,cl as ec,ul as ed,id as ee,M6 as ef,S6 as eg,_6 as eh,zZe as ei,FZe as ej,UZe as ek,$Ze as el,qZe as em,HZe as en,ny as eo,IWe as ep,PWe as eq,LWe as er,zWe as es,AK as et,$K as eu,DWe as ev,FWe as ew,X as ex,rBe as ey,ua as ez,Am as f,YXe as f$,_ke as f0,jfe as f1,dQe as f2,UYe as f3,zL as f4,LAe as f5,fm as f6,KQe as f7,VAe as f8,zAe as f9,Tbe as fA,Ne as fB,lo as fC,HT as fD,Kr as fE,EI as fF,lXe as fG,QQe as fH,mQe as fI,DK as fJ,rR as fK,AJ as fL,lQe as fM,hz as fN,uQe as fO,aQe as fP,EV as fQ,fXe as fR,GQe as fS,yfe as fT,BXe as fU,xve as fV,VXe as fW,GXe as fX,KXe as fY,WXe as fZ,ZXe as f_,WQe as fa,yc as fb,WAe as fc,VQe as fd,KAe as fe,PAe as ff,Jie as fg,PJ as fh,of as fi,Vae as fj,hQe as fk,_V as fl,QAe as fm,JZe as fn,GAe as fo,cQe as fp,XQe as fq,_0e as fr,Hi as fs,VA as ft,_A as fu,A3 as fv,Xi as fw,Qe as fx,ao as fy,Obe as fz,OMe as g,Eh as g$,C6 as g0,Bp as g1,ZUe as g2,QUe as g3,HXe as g4,dx as g5,UXe as g6,JQe as g7,dHe as g8,mHe as g9,K3e as gA,ebe as gB,$H as gC,QE as gD,nA as gE,Lae as gF,Cye as gG,Wie as gH,$ie as gI,XZe as gJ,NK as gK,HBe as gL,nQe as gM,Vh as gN,Kp as gO,M3 as gP,wy as gQ,S3 as gR,_3 as gS,C3 as gT,uZe as gU,HQe as gV,UQe as gW,BQe as gX,$Qe as gY,zQe as gZ,Iie as g_,yHe as ga,pHe as gb,IBe as gc,nZe as gd,vke as ge,vO as gf,VR as gg,$Be as gh,rZe as gi,iZe as gj,WV as gk,SQe as gl,nR as gm,aZ as gn,ete as go,lZe as gp,Cue as gq,Nhe as gr,yke as gs,jW as gt,Cme as gu,QG as gv,gZe as gw,vZe as gx,G3e as gy,Z3e as gz,vn as h,kL as h$,yXe as h0,mXe as h1,VBe as h2,oZe as h3,wQe as h4,tJe as h5,Wh as h6,KBe as h7,fZe as h8,pZe as h9,SXe as hA,EXe as hB,CXe as hC,MXe as hD,_Xe as hE,wXe as hF,AXe as hG,RXe as hH,MQe as hI,Ehe as hJ,sx as hK,qUe as hL,Tve as hM,Rve as hN,vz as hO,fx as hP,Om as hQ,Bh as hR,Ave as hS,SZe as hT,IUe as hU,jUe as hV,UWe as hW,$We as hX,ch as hY,$Xe as hZ,AUe as h_,yZe as ha,mZe as hb,nJe as hc,QBe as hd,K6e as he,G6e as hf,AN as hg,b5 as hh,Afe as hi,Hhe as hj,tR as hk,pR as hl,eVe as hm,C1e as hn,nne as ho,nVe as hp,eJe as hq,n5 as hr,PYe as hs,pXe as ht,bXe as hu,kXe as hv,vXe as hw,YHe as hx,dZe as hy,hZe as hz,wr as i,HKe as i$,ox as i0,BC as i1,Zu as i2,OZe as i3,YN as i4,VUe as i5,S5 as i6,uW as i7,MR as i8,NQe as i9,JWe as iA,PXe as iB,tKe as iC,rKe as iD,_Ze as iE,soe as iF,wZe as iG,CZe as iH,Oue as iI,sKe as iJ,cKe as iK,dKe as iL,fKe as iM,yKe as iN,gKe as iO,wKe as iP,SKe as iQ,CKe as iR,gHe as iS,AKe as iT,sZe as iU,cZe as iV,OKe as iW,IKe as iX,DKe as iY,zKe as iZ,$Ke as i_,jQe as ia,LQe as ib,KWe as ic,Cve as id,NZe as ie,pL as ig,m6 as ih,DUe as ii,jZe as ij,TZe as ik,dXe as il,dUe as im,OXe as io,g$e as ip,v$e as iq,X8e as ir,YWe as is,QXe as it,XXe as iu,bBe as iv,zXe as iw,JXe as ix,a3 as iy,QWe as iz,h as j,aZe as j0,BKe as j1,WKe as j2,kZe as j3,xZe as j4,WC as j5,WUe as j6,WHe as j7,Vp as j8,KHe as j9,Eve as ja,kQe as jb,YQe as jc,_$e as jd,u$e as je,zC as jf,Yse as jg,_je as jh,eXe as ji,fQe as jj,tXe as jk,$V as k,WYe as l,n3e as m,Mr as n,cr as o,Ed as p,ri as q,x as r,GR as s,lf as t,y6 as u,Y$e as v,Nc as w,IYe as x,J$e as y,la as z};
|
|
7950
|
+
//# sourceMappingURL=index-9YuSRymd.js.map
|