@lobu/runtime-server 20.2.0 → 21.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/dist/catalogs/automations.json +0 -8
  2. package/dist/component.json +1 -1
  3. package/dist/connectors/README.md +15 -16
  4. package/dist/connectors/github.ts +274 -193
  5. package/dist/connectors/google_calendar.ts +54 -160
  6. package/dist/connectors/google_drive.ts +106 -131
  7. package/dist/connectors/google_gmail.ts +53 -30
  8. package/dist/connectors/hackernews.ts +2 -5
  9. package/dist/connectors/jira.ts +71 -27
  10. package/dist/connectors/linear.ts +55 -21
  11. package/dist/connectors/microsoft_outlook.ts +151 -110
  12. package/dist/connectors/postgres.ts +19 -11
  13. package/dist/connectors/producthunt.ts +11 -7
  14. package/dist/connectors/reddit.ts +36 -6
  15. package/dist/connectors/rss.ts +2 -2
  16. package/dist/connectors/whatsapp_web.ts +5 -4
  17. package/dist/connectors/x.ts +32 -17
  18. package/dist/connectors/youtube.ts +18 -5
  19. package/dist/db/migrations/20260917000000_views.sql +271 -0
  20. package/dist/db/migrations/20260917000001_views_attach_index.sql +14 -0
  21. package/dist/db/migrations/20260918000000_runs_turn_tool_event_uniq.sql +51 -0
  22. package/dist/db/migrations/20260923230000_runs_connector_artifact_hash.sql +32 -0
  23. package/dist/db/migrations/20260924000000_resource_source_files.sql +17 -0
  24. package/dist/db/migrations/20260928120000_classification_consolidation.sql +51 -0
  25. package/dist/dependencies.bun.lock +113 -102
  26. package/dist/guest.bundle.js +78 -10
  27. package/dist/owletto/dist/assets/_-00GgOtdu.js +1 -0
  28. package/dist/owletto/dist/assets/_-XlUwOWCI.js +2 -0
  29. package/dist/owletto/dist/assets/_agentId-B2DrawIk.js +1 -0
  30. package/dist/owletto/dist/assets/_agentId-CS0AcWH2.js +1 -0
  31. package/dist/owletto/dist/assets/_automationId-BLnqLtUv.js +1 -0
  32. package/dist/owletto/dist/assets/{_connectorKey._connectionId-BAJGfcy7.js → _connectorKey._connectionId-DcUWoZ-C.js} +1 -1
  33. package/dist/owletto/dist/assets/{_connectorKey.index-BBF8vGJS.js → _connectorKey.index-C_yKycN_.js} +1 -1
  34. package/dist/owletto/dist/assets/_conversationId-CpuEvflw.js +1 -0
  35. package/dist/owletto/dist/assets/_deploymentId-BL9tnDFl.js +1 -0
  36. package/dist/owletto/dist/assets/_name-DlxjWkKk.js +1 -0
  37. package/dist/owletto/dist/assets/_owner-Cg50UU6m.js +1 -0
  38. package/dist/owletto/dist/assets/_shape-BWZW4mj8.js +1 -0
  39. package/dist/owletto/dist/assets/_skillKey-B25fO0_O.js +1 -0
  40. package/dist/owletto/dist/assets/_slug-DbD-wv2m.js +1 -0
  41. package/dist/owletto/dist/assets/_viewKey-BcTEvQ3N.js +1 -0
  42. package/dist/owletto/dist/assets/_viewKey-W4RjiUWL.js +1 -0
  43. package/dist/owletto/dist/assets/_viewKey-iGPCKSda.js +1 -0
  44. package/dist/owletto/dist/assets/accept-invitation-BmQKbQem.js +1 -0
  45. package/dist/owletto/dist/assets/activity-route-view-BvtAoGVt.js +1 -0
  46. package/dist/owletto/dist/assets/{agent-card-controls-CZO6GI0s.js → agent-card-controls-bhTMPoVi.js} +1 -1
  47. package/dist/owletto/dist/assets/{agent-client-setup-list-_chLOorY.js → agent-client-setup-list-BBbq_2B1.js} +1 -1
  48. package/dist/owletto/dist/assets/{agent-connect-pages-DWBgSIYT.js → agent-connect-pages-DkDlFVY5.js} +1 -1
  49. package/dist/owletto/dist/assets/{agent-editor-form-BTNlg0kQ.js → agent-editor-form-DwHD9j1Y.js} +1 -1
  50. package/dist/owletto/dist/assets/{agent-guardrails-route-B5uoMC6o.js → agent-guardrails-route-0PsTrqMC.js} +1 -1
  51. package/dist/owletto/dist/assets/{agent-loading-shells-CLoLeFcB.js → agent-loading-shells-BQLjzMPy.js} +1 -1
  52. package/dist/owletto/dist/assets/{agent-permissions-matrix-TP00-MYL.js → agent-permissions-matrix-B-Q5rmuB.js} +1 -1
  53. package/dist/owletto/dist/assets/{agent-skill-context-D4a2QCoZ.js → agent-skill-context-s42Q4Wjo.js} +1 -1
  54. package/dist/owletto/dist/assets/{agent-skills-route-KVDDTbJB.js → agent-skills-route-Cwq1QrhW.js} +1 -1
  55. package/dist/owletto/dist/assets/{agent-subpage-shell-DuVYZvBE.js → agent-subpage-shell-DtzoRy6N.js} +1 -1
  56. package/dist/owletto/dist/assets/agent-thread-D7AGGjRV.js +8 -0
  57. package/dist/owletto/dist/assets/agents-BqCKU4CT.js +1 -0
  58. package/dist/owletto/dist/assets/agents-workbench-Cl7FO7b3.js +1 -0
  59. package/dist/owletto/dist/assets/app-bridge-BH3g2mKG.js +127 -0
  60. package/dist/owletto/dist/assets/{app._appId-D0_LQTJU.js → app._appId-CqYz3AOO.js} +1 -1
  61. package/dist/owletto/dist/assets/automation-detail-content-CKSywvzE.js +1 -0
  62. package/dist/owletto/dist/assets/automations-BqCKU4CT.js +1 -0
  63. package/dist/owletto/dist/assets/{calendar-C0XpOHd8.js → calendar-CHXehtu0.js} +1 -1
  64. package/dist/owletto/dist/assets/{callback-CO_K9eR-.js → callback-DZ3YyXeV.js} +1 -1
  65. package/dist/owletto/dist/assets/{card-DeFQuU_J.js → card-4Ull9W6d.js} +1 -1
  66. package/dist/owletto/dist/assets/{claim-CUpWOSie.js → claim-BGLCPLXq.js} +1 -1
  67. package/dist/owletto/dist/assets/clients-C7ubnFsS.js +1 -0
  68. package/dist/owletto/dist/assets/{code-editor-BqGUZFt6.js → code-editor-BHiWR94J.js} +1 -1
  69. package/dist/owletto/dist/assets/connect-BNatqg6j.js +1 -0
  70. package/dist/owletto/dist/assets/connect._clientId-BGG2IqiQ.js +1 -0
  71. package/dist/owletto/dist/assets/connected._clientId-7RU89sVW.js +1 -0
  72. package/dist/owletto/dist/assets/{connection-BgAlYjeV.js → connection-CTaUGXl6.js} +1 -1
  73. package/dist/owletto/dist/assets/{connection-feed-detail-B3ePAinf.js → connection-feed-detail-B1xieiEh.js} +1 -1
  74. package/dist/owletto/dist/assets/{connector-provenance-DgsDg0Z9.js → connector-provenance-DRdUEmQ1.js} +1 -1
  75. package/dist/owletto/dist/assets/{connectors-CqPQPo9U.js → connectors-NBwCLuZg.js} +1 -1
  76. package/dist/owletto/dist/assets/{consent-bswcIzsf.js → consent-fmhPPlpi.js} +1 -1
  77. package/dist/owletto/dist/assets/{core.esm-DsLgjoel.js → core.esm-C-eNiUAl.js} +1 -1
  78. package/dist/owletto/dist/assets/{create-Dwo04oWV.js → create-8bBbQJGY.js} +1 -1
  79. package/dist/owletto/dist/assets/create-Cl6cfNAp.js +1 -0
  80. package/dist/owletto/dist/assets/create-DrVso8O7.js +1 -0
  81. package/dist/owletto/dist/assets/create-automation-form-De8J-JD5.js +2 -0
  82. package/dist/owletto/dist/assets/{create._connectorKey-CCBb2pil.js → create._connectorKey-CHAotlsF.js} +1 -1
  83. package/dist/owletto/dist/assets/{cronstrue-ChFyC9ps.js → cronstrue-C5yTgk5z.js} +1 -1
  84. package/dist/owletto/dist/assets/deployments-C7M3fV5K.js +1 -0
  85. package/dist/owletto/dist/assets/deployments-D1gbQwsy.js +1 -0
  86. package/dist/owletto/dist/assets/deployments-body-DycIGlnL.js +1 -0
  87. package/dist/owletto/dist/assets/device-DyPnQkhO.js +1 -0
  88. package/dist/owletto/dist/assets/{device-pin-tombstone-1ikyqSdb.js → device-pin-tombstone-CwJitllC.js} +1 -1
  89. package/dist/owletto/dist/assets/device-rows-BBhW1C7Y.js +1 -0
  90. package/dist/owletto/dist/assets/{device._deviceId-DTYKGBY8.js → device._deviceId-XswfXHOc.js} +1 -1
  91. package/dist/owletto/dist/assets/entity-options-utGBmFX0.js +1 -0
  92. package/dist/owletto/dist/assets/entity-page-BxwuqqWk.js +1 -0
  93. package/dist/owletto/dist/assets/entity-type-page-BrWqk6so.js +1 -0
  94. package/dist/owletto/dist/assets/event-page-LIm4EDmJ.js +1 -0
  95. package/dist/owletto/dist/assets/events-feed-C4L8mQV7.js +1 -0
  96. package/dist/owletto/dist/assets/{full-page-spinner-BN2G_YiM.js → full-page-spinner-DsU-Cb3L.js} +1 -1
  97. package/dist/owletto/dist/assets/guardrails-CGFWCfbQ.js +1 -0
  98. package/dist/owletto/dist/assets/identity-uPYpPogR.js +1 -0
  99. package/dist/owletto/dist/assets/{index-hSE2E46p.js → index-1YrrvVJ4.js} +1 -1
  100. package/dist/owletto/dist/assets/index-BKMafTe4.js +1 -0
  101. package/dist/owletto/dist/assets/index-BsL1-C2-.js +1 -0
  102. package/dist/owletto/dist/assets/index-C58oW727.js +1 -0
  103. package/dist/owletto/dist/assets/index-C8CR2-Ck.css +1 -0
  104. package/dist/owletto/dist/assets/{index-OUb5Mlez.js → index-CDz3-ieP.js} +10 -10
  105. package/dist/owletto/dist/assets/{index-C6VAJ8Ku.js → index-CQ4s6nzy.js} +1 -1
  106. package/dist/owletto/dist/assets/index-CpWKAAGX.js +1 -0
  107. package/dist/owletto/dist/assets/{index-vdqhlocx.js → index-D2dcENg2.js} +1 -1
  108. package/dist/owletto/dist/assets/{index-C2oCgDX7.js → index-DCK0KhMM.js} +1 -1
  109. package/dist/owletto/dist/assets/{index-C-u4yR8Z.js → index-DXqiRON3.js} +1 -1
  110. package/dist/owletto/dist/assets/index-DgEc5IvT.js +1 -0
  111. package/dist/owletto/dist/assets/index-DtRfQcRH.js +7898 -0
  112. package/dist/owletto/dist/assets/index-DvhM9tuI.js +1 -0
  113. package/dist/owletto/dist/assets/index-DwtfHCHB.js +1 -0
  114. package/dist/owletto/dist/assets/index-DyYFZjh-.js +1 -0
  115. package/dist/owletto/dist/assets/index-nOYvNROJ.js +1 -0
  116. package/dist/owletto/dist/assets/index-oDoJENMF.js +1 -0
  117. package/dist/owletto/dist/assets/index-rPdUEOa3.js +1 -0
  118. package/dist/owletto/dist/assets/{json-diff-DnsW7Pin.js → json-diff-DYeX-xLk.js} +2 -2
  119. package/dist/owletto/dist/assets/{list-skeleton-CHzLN7GK.js → list-skeleton-s4GPSJ8J.js} +1 -1
  120. package/dist/owletto/dist/assets/login-Di5VF2F_.js +1 -0
  121. package/dist/owletto/dist/assets/logout-BuaQGSnw.js +1 -0
  122. package/dist/owletto/dist/assets/member-scope-gate-CJqJZk7T.js +1 -0
  123. package/dist/owletto/dist/assets/memory-browse-page-Bibfs2sK.js +101 -0
  124. package/dist/owletto/dist/assets/missing-view-CD4DOaG8.js +1 -0
  125. package/dist/owletto/dist/assets/{model-selector-DfbmHjLu.js → model-selector-XC5CI2Et.js} +1 -1
  126. package/dist/owletto/dist/assets/models--8mTFOLz.js +1 -0
  127. package/dist/owletto/dist/assets/{new-Df_dY6Z5.js → new-BzkA1sq2.js} +1 -1
  128. package/dist/owletto/dist/assets/new-C3f0BShb.js +1 -0
  129. package/dist/owletto/dist/assets/new-DA5LF6iB.js +1 -0
  130. package/dist/owletto/dist/assets/{oauth-workspace-access-D9GmiMfK.js → oauth-workspace-access-D6epOq0R.js} +1 -1
  131. package/dist/owletto/dist/assets/{organization-uSDYkJpX.js → organization-DOtBRqDQ.js} +1 -1
  132. package/dist/owletto/dist/assets/{permissions-Fe0DP6b8.js → permissions-D8uJHINS.js} +1 -1
  133. package/dist/owletto/dist/assets/{proposal-review-shell-D9HwnDda.js → proposal-review-shell-C3K-JXjb.js} +1 -1
  134. package/dist/owletto/dist/assets/{recent-C03LhMD7.js → recent-CFcWceBl.js} +1 -1
  135. package/dist/owletto/dist/assets/{renderer-CHNejd95.js → renderer-1nRJFMGx.js} +2 -2
  136. package/dist/owletto/dist/assets/{reset-password-CuISnlG_.js → reset-password-9RTWhBEb.js} +1 -1
  137. package/dist/owletto/dist/assets/runs-_yVh6PPB.js +1 -0
  138. package/dist/owletto/dist/assets/{runs-panel-DsdESupx.js → runs-panel-B2852xus.js} +1 -1
  139. package/dist/owletto/dist/assets/runs-table--dnFQatY.js +1 -0
  140. package/dist/owletto/dist/assets/{schema-value-normalization-B--OWDL8.js → schema-value-normalization-BspxVEGy.js} +1 -1
  141. package/dist/owletto/dist/assets/{settings-wGNHtsDP.js → settings-9lDASETT.js} +1 -1
  142. package/dist/owletto/dist/assets/settings-DQo_ZS2P.js +1 -0
  143. package/dist/owletto/dist/assets/skills-a5xQ4RE9.js +1 -0
  144. package/dist/owletto/dist/assets/{switch-Dzse_XFM.js → switch-CxDXvPGE.js} +1 -1
  145. package/dist/owletto/dist/assets/use-applied-views-DvMT3wap.js +1 -0
  146. package/dist/owletto/dist/assets/{use-mention-search-uyW1Uwf6.js → use-mention-search-CeTEE3oE.js} +1 -1
  147. package/dist/owletto/dist/assets/view-frame-HoBawpT2.js +1 -0
  148. package/dist/owletto/dist/index.html +2 -2
  149. package/dist/providers.json +0 -1
  150. package/dist/server-main.bundle.mjs +8997 -7479
  151. package/npm-shrinkwrap.json +543 -485
  152. package/package.json +5 -2
  153. package/vendor/connector-sdk/dist/connector-runtime.d.ts +4 -6
  154. package/vendor/connector-sdk/dist/connector-runtime.js +3 -5
  155. package/vendor/connector-sdk/dist/connector-types.d.ts +28 -15
  156. package/vendor/connector-sdk/dist/define-connector.d.ts +4 -1
  157. package/vendor/connector-sdk/dist/define-connector.js +4 -1
  158. package/vendor/connector-sdk/dist/http-client.d.ts +18 -7
  159. package/vendor/connector-sdk/dist/http-client.js +15 -13
  160. package/vendor/connector-sdk/dist/index.d.ts +1 -1
  161. package/vendor/connector-sdk/dist/retry.d.ts +15 -3
  162. package/vendor/connector-sdk/dist/retry.js +40 -64
  163. package/vendor/connector-sdk/package.json +1 -1
  164. package/vendor/core/dist/agent-policy.js +3 -0
  165. package/vendor/core/dist/connector-query-errors.d.ts +3 -3
  166. package/vendor/core/dist/connector-query-errors.js +8 -3
  167. package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +14 -0
  168. package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +12 -1
  169. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +0 -10
  170. package/vendor/core/dist/contracts/tools/manage-automations.js +0 -33
  171. package/vendor/core/dist/contracts/tools/manage-classifiers.d.ts +4 -34
  172. package/vendor/core/dist/contracts/tools/manage-classifiers.js +13 -44
  173. package/vendor/core/dist/contracts/tools/manage-connections.d.ts +24 -0
  174. package/vendor/core/dist/contracts/tools/manage-connections.js +13 -0
  175. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +15 -25
  176. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +3 -5
  177. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +0 -9
  178. package/vendor/core/dist/contracts/tools/manage-entity.js +0 -6
  179. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +11 -0
  180. package/vendor/core/dist/contracts/tools/manage-feeds.js +12 -1
  181. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +47 -6
  182. package/vendor/core/dist/contracts/tools/manage-operations.js +36 -1
  183. package/vendor/core/dist/contracts/tools/manage-views.d.ts +293 -0
  184. package/vendor/core/dist/contracts/tools/manage-views.js +203 -0
  185. package/vendor/core/dist/contracts/tools/source-files-schema.d.ts +7 -0
  186. package/vendor/core/dist/contracts/tools/source-files-schema.js +19 -0
  187. package/vendor/core/dist/contracts/tools/source-files.d.ts +14 -0
  188. package/vendor/core/dist/contracts/tools/source-files.js +55 -0
  189. package/vendor/core/dist/contracts/tools/view-attach.d.ts +20 -0
  190. package/vendor/core/dist/contracts/tools/view-attach.js +45 -0
  191. package/vendor/core/dist/contracts/tools/view-content-hash.d.ts +37 -0
  192. package/vendor/core/dist/contracts/tools/view-content-hash.js +58 -0
  193. package/vendor/core/dist/contracts/tools/view-path.d.ts +18 -0
  194. package/vendor/core/dist/contracts/tools/view-path.js +24 -0
  195. package/vendor/core/dist/contracts/worker/protocol.d.ts +90 -8
  196. package/vendor/core/dist/contracts/worker/protocol.js +70 -10
  197. package/vendor/core/dist/index.d.ts +1 -1
  198. package/vendor/core/dist/provider-config-types.d.ts +0 -9
  199. package/vendor/core/dist/reserved.d.ts +3 -3
  200. package/vendor/core/dist/reserved.js +9 -1
  201. package/vendor/core/dist/sdk-compat.d.ts +1 -1
  202. package/vendor/core/dist/utils/secret-redaction.js +2 -0
  203. package/vendor/core/package.json +30 -5
  204. package/vendor/views/dist/api.d.ts +184 -0
  205. package/vendor/views/dist/api.js +410 -0
  206. package/vendor/views/dist/bridge.d.ts +141 -0
  207. package/vendor/views/dist/bridge.js +330 -0
  208. package/vendor/views/dist/index.d.ts +12 -0
  209. package/vendor/views/dist/index.js +10 -0
  210. package/vendor/views/package.json +35 -0
  211. package/dist/owletto/dist/assets/_-Ds4DyQjj.js +0 -2
  212. package/dist/owletto/dist/assets/_-VmyR6aN_.js +0 -1
  213. package/dist/owletto/dist/assets/_agentId-BAVnp0c7.js +0 -1
  214. package/dist/owletto/dist/assets/_agentId-Df-3rGi5.js +0 -1
  215. package/dist/owletto/dist/assets/_automationId-D696vOjd.js +0 -1
  216. package/dist/owletto/dist/assets/_conversationId-Ci4rgrHm.js +0 -1
  217. package/dist/owletto/dist/assets/_deploymentId-Iy-D5PDq.js +0 -1
  218. package/dist/owletto/dist/assets/_name-CeGwb0oK.js +0 -1
  219. package/dist/owletto/dist/assets/_owner-CFR1G8OX.js +0 -1
  220. package/dist/owletto/dist/assets/_skillKey-DuLcQWBu.js +0 -1
  221. package/dist/owletto/dist/assets/_slug-CDSO20ac.js +0 -1
  222. package/dist/owletto/dist/assets/accept-invitation-Db5jklHT.js +0 -1
  223. package/dist/owletto/dist/assets/activity-route-view-DVW3DoB7.js +0 -1
  224. package/dist/owletto/dist/assets/agent-thread-CzCJU3-R.js +0 -134
  225. package/dist/owletto/dist/assets/agents-DFs57C3c.js +0 -1
  226. package/dist/owletto/dist/assets/agents-workbench-C2bUlJP2.js +0 -1
  227. package/dist/owletto/dist/assets/automation-detail-content-DWkdhnv2.js +0 -1
  228. package/dist/owletto/dist/assets/automations-DFs57C3c.js +0 -1
  229. package/dist/owletto/dist/assets/clients-DhYr4lyL.js +0 -1
  230. package/dist/owletto/dist/assets/connect-Dtb-E5An.js +0 -1
  231. package/dist/owletto/dist/assets/connect._clientId-DWtceAAw.js +0 -1
  232. package/dist/owletto/dist/assets/connected._clientId-CMe-wTuV.js +0 -1
  233. package/dist/owletto/dist/assets/create-CcXUdke7.js +0 -1
  234. package/dist/owletto/dist/assets/create-Cp6hMoeU.js +0 -1
  235. package/dist/owletto/dist/assets/create-automation-form-CJ4meayB.js +0 -1
  236. package/dist/owletto/dist/assets/deployments-CjfFxyDA.js +0 -1
  237. package/dist/owletto/dist/assets/deployments-body-Cg0KiWGr.js +0 -1
  238. package/dist/owletto/dist/assets/device-DpY67Jaj.js +0 -1
  239. package/dist/owletto/dist/assets/device-rows-Cp3yMcuV.js +0 -1
  240. package/dist/owletto/dist/assets/entity-options-1EaSGMX4.js +0 -1
  241. package/dist/owletto/dist/assets/entity-page-DJmM70dv.js +0 -1
  242. package/dist/owletto/dist/assets/entity-type-page-C3mT7tXn.js +0 -1
  243. package/dist/owletto/dist/assets/events-feed-iliGfjit.js +0 -1
  244. package/dist/owletto/dist/assets/guardrails-CLlnRRy9.js +0 -1
  245. package/dist/owletto/dist/assets/identity-MSLryUi8.js +0 -1
  246. package/dist/owletto/dist/assets/index-3o4Eepb4.js +0 -1
  247. package/dist/owletto/dist/assets/index-BUr8321-.js +0 -7898
  248. package/dist/owletto/dist/assets/index-Bulu5ldM.js +0 -1
  249. package/dist/owletto/dist/assets/index-BvbfITqH.js +0 -1
  250. package/dist/owletto/dist/assets/index-ChcQMdod.css +0 -1
  251. package/dist/owletto/dist/assets/index-Clw9ZBj-.js +0 -1
  252. package/dist/owletto/dist/assets/index-D2oL4Ydo.js +0 -1
  253. package/dist/owletto/dist/assets/index-D7wulT4y.js +0 -1
  254. package/dist/owletto/dist/assets/index-DOLFe19K.js +0 -1
  255. package/dist/owletto/dist/assets/index-DTSA0Xh1.js +0 -1
  256. package/dist/owletto/dist/assets/index-DxXXVPU0.js +0 -1
  257. package/dist/owletto/dist/assets/index-nzvsA3hT.js +0 -1
  258. package/dist/owletto/dist/assets/login-CCKNM0gV.js +0 -1
  259. package/dist/owletto/dist/assets/logout-B-N2aodZ.js +0 -1
  260. package/dist/owletto/dist/assets/member-scope-gate-B560Wg-t.js +0 -1
  261. package/dist/owletto/dist/assets/memory-browse-page-DMDqKJn7.js +0 -101
  262. package/dist/owletto/dist/assets/models-M51OGDRE.js +0 -1
  263. package/dist/owletto/dist/assets/new-BVQS9H-Y.js +0 -1
  264. package/dist/owletto/dist/assets/new-DxDVE9nL.js +0 -1
  265. package/dist/owletto/dist/assets/runs-BnYdToDc.js +0 -1
  266. package/dist/owletto/dist/assets/runs-table-B7jKuILd.js +0 -1
  267. package/dist/owletto/dist/assets/settings-Bg9yCCoN.js +0 -1
  268. package/dist/owletto/dist/assets/skills-CN5Ube7A.js +0 -1
  269. package/vendor/core/dist/contracts/tools/manage-view-templates.d.ts +0 -165
  270. package/vendor/core/dist/contracts/tools/manage-view-templates.js +0 -130
@@ -0,0 +1 @@
1
+ import{j as t,a2 as o}from"./index-DtRfQcRH.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -0,0 +1 @@
1
+ import{hK as r,j as t,aY as a}from"./index-DtRfQcRH.js";import{a as s}from"./agent-connect-pages-DkDlFVY5.js";import"./agent-client-setup-list-BBbq_2B1.js";import"./clients-C7ubnFsS.js";import"./client-rows-EJSKR6z1.js";function x(){const{owner:e,clientId:o}=r.useParams();return t.jsx(a,{owner:e,children:({ownerSlug:n})=>t.jsx(s,{owner:n,clientId:o})})}export{x as component};
@@ -0,0 +1 @@
1
+ import{a4 as D,j as e,eO as _,eP as $,eQ as k,eR as c,eS as M,eT as o,L as b,hI as z,ah as K,E as H,Y as G,a3 as O,g as Q,r as m,d4 as I,S as w,ct as Y,eH as f,B as y,s as J,h0 as V,gg as W,bS as q,gh as F,gi as X,hJ as Z,aY as ee}from"./index-DtRfQcRH.js";import{u as P,a as se}from"./clients-C7ubnFsS.js";import{g as T,r as te}from"./client-rows-EJSKR6z1.js";function L(a,n){return{client_ids:a.join(","),mcp_activity_id:n}}function A(a){const n=a.title?.trim();return n||(a.activityKind==="session"?"MCP session":a.clientId)}function R({scopes:a,clientIds:n}){const l=D(),d=t=>{l({to:"/$owner/events",params:{owner:"me"},search:L(n,t.activityId)})};return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(_,{children:[e.jsx($,{children:e.jsxs(k,{children:[e.jsx(c,{className:"px-3 py-1.5 text-xs",children:"Conversation"}),e.jsx(c,{className:"px-3 py-1.5 text-xs",children:"Calls"}),e.jsx(c,{className:"px-3 py-1.5 text-xs",children:"Last action"}),e.jsx(c,{className:"px-3 py-1.5 text-xs",children:"Last active"}),e.jsx(c,{className:"w-8 px-3 py-1.5"})]})}),e.jsx(M,{children:a.map(t=>e.jsxs(k,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>d(t),children:[e.jsx(o,{className:"max-w-0 px-3 py-2 text-xs font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{to:"/$owner/events",params:{owner:"me"},search:L(n,t.activityId),onClick:r=>r.stopPropagation(),className:"truncate hover:underline",children:A(t)}),t.activityKind==="session"?e.jsx(z,{isLive:t.isLive}):null,t.unreadNotificationCount>0?e.jsxs(K,{variant:"secondary",className:"shrink-0 text-[10px]",children:[t.unreadNotificationCount," unread"]}):null]})}),e.jsx(o,{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:t.callCount}),e.jsx(o,{className:"max-w-0 truncate px-3 py-2 text-xs text-muted-foreground",children:t.lastAction||"—"}),e.jsx(o,{className:"px-3 py-2 text-xs text-muted-foreground",children:H(t.lastCallAt)}),e.jsx(o,{className:"px-3 py-2 text-right",children:e.jsx("button",{type:"button","aria-label":`View ${A(t)} activity`,className:"text-muted-foreground hover:text-foreground",tabIndex:-1,children:e.jsx(G,{className:"h-3.5 w-3.5"})})})]},`${t.clientId}:${t.activityId}`))})]})})}function ne({ownerSlug:a,clientId:n}){const{orgContext:l}=O(),{isAdmin:d}=Q(l.organizationId),{data:t=[],isLoading:r}=P(null),x=se(),[B,h]=m.useState(!1),s=m.useMemo(()=>T(t),[t]).find(i=>i.clientIds.includes(n)),N=s?.clientIds??[],g=I({enabled:!!s,limit:100,clientIds:N,activityKind:"conversation"}),p=I({enabled:!!s,limit:100,clientIds:N,activityKind:"session",refetchInterval:i=>i?5e3:!1}),u=g.data??[],v=p.data??[],E=m.useMemo(()=>t.filter(i=>s?.clientIds.includes(i.id)),[t,s]);if(r)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{className:"h-16 w-full rounded-lg"}),e.jsx(w,{className:"h-24 w-full rounded-lg"})]});if(!s)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"This app isn't connected to this workspace, so its details aren't available."});const j=E[0],C=j?.details?.redirectUris??[],S=s.linkedUserEntitySlug?Y(a,[{entity_type:"$member",slug:s.linkedUserEntitySlug}]):null,U=[{label:"Registered",value:s.title},{label:s.clientIds.length===1?"Client ID":"Client IDs",value:e.jsx("div",{className:"space-y-1",children:s.clientIds.map(i=>e.jsx("code",{className:"block break-all",children:i},i))})},...s.drivenBy&&s.drivenBy!==s.title?[{label:"Driven by",value:s.drivenBy}]:[],...j?.platform?[{label:"Software",value:j.platform}]:[],...C.length>0?[{label:"Redirects",value:C.join(", ")}]:[],{label:"Granted by",value:S&&s.linkedUser?e.jsx(b,{to:S,className:"font-medium text-primary hover:underline",children:s.linkedUser}):s.linkedUser??"—"},{label:"Last active",value:s.connected?te(s.lastSeenAt):"disconnected"},{label:"Registrations",value:String(s.clientIds.length)}];return e.jsxs("div",{className:"space-y-7",children:[e.jsx(f,{title:"Settings",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"overflow-hidden rounded-lg border text-xs",children:e.jsx("dl",{className:"divide-y",children:U.map(i=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-28 shrink-0 text-muted-foreground",children:i.label}),e.jsx("dd",{className:"min-w-0 flex-1 break-words",children:i.value})]},i.label))})}),d&&s.connected?e.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Revoking disconnects every registration this app holds",s.clientIds.length>1?` (${s.clientIds.length} of them)`:""," ","and kills its live sessions. It can reconnect by authorizing again."]}),B?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",disabled:x.isPending,onClick:()=>x.mutate({clientId:s.clientIds[0],scope:"all"},{onSettled:()=>h(!1)}),children:x.isPending?"Revoking…":"Confirm revoke"}),e.jsx(y,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:x.isPending,onClick:()=>h(!1),children:"Cancel"})]}):e.jsx(y,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>h(!0),children:"Revoke"})]}):null]})}),e.jsx(f,{title:"Conversations",count:u.length>0?String(u.length):void 0,children:g.isLoading||p.isLoading?e.jsxs("div",{className:"flex items-center py-4 text-xs text-muted-foreground",children:[e.jsx(J,{className:"mr-2"})," Loading client activity…"]}):g.isError||p.isError?e.jsx("p",{className:"py-3 text-xs text-destructive",children:"Could not load this app's activity."}):u.length===0?e.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No recent conversations."}):e.jsx(R,{scopes:u,clientIds:s.clientIds})}),v.length>0?e.jsx(f,{title:"Sessions",count:String(v.length),children:e.jsx(R,{scopes:v,clientIds:s.clientIds})}):null]})}const ae="flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6";function ie({owner:a,clientId:n}){const{data:l=[]}=P(null),t=m.useMemo(()=>T(l).find(r=>r.clientIds.includes(n)),[n,l])?.title??"Connected agent";return e.jsx("div",{className:ae,children:e.jsx(V,{header:e.jsx(W,{breadcrumb:e.jsx(F,{crumbs:[e.jsx(b,{to:"/$owner/agents",params:{owner:a},className:X,children:"Agents"},"agents")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(q,{name:t})}),title:t,caption:"An external agent connected to this workspace through Lobu. Review its Lobu conversations, activity, and access."}),children:e.jsx(ne,{ownerSlug:a,clientId:n},n)})})}function de(){const{owner:a,clientId:n}=Z.useParams();return e.jsx(ee,{owner:a,children:({ownerSlug:l})=>e.jsx(ie,{owner:l,clientId:n})})}export{de as component};
@@ -1 +1 @@
1
- import{cT as R,a7 as U,r as l,an as _,ag as z,j as e,s as y,B as x,bY as A,bZ as V,b_ as Y,b$ as F,c0 as P,ab as K,at as M,ac as W}from"./index-BUr8321-.js";import{C as q,a as B,b as D,c as G}from"./card-DeFQuU_J.js";const j="__new_org__";function H(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function C(r){return r.length>0?r[0].toUpperCase()+r.slice(1):r}function J(r,i){return r==="not_admin"?`You must be an admin or owner to connect ${i} to Lobu.`:`You don't have permission to connect ${i} to Lobu.`}function L(r,i,t){switch(r){case"not_authorized":return J(i,t);case"no_pending":return`No Lobu install was found for ${t}. Add Lobu from the marketplace to get started.`;case"no_org":return`Your account has no Lobu organization to connect ${t} to.`;default:return`Something went wrong while connecting ${t}. Please try again.`}}function ee(){const{name:r}=R({from:"/connector/$name/connection"}),{ref:i}=U({from:"/connector/$name/connection"}),[t,o]=l.useState({kind:"loading"}),[d,b]=l.useState(""),[v,E]=l.useState(""),[g,w]=l.useState(!1),[k,m]=l.useState(null),[h,f]=l.useState(null),u=C(r),a=t.kind==="confirm"&&t.subjectKind||"connection",I=t.kind==="confirm"&&t.subjectName?t.subjectName:`this ${u} ${a}`,S=l.useCallback(async()=>{if(!i){o({kind:"error",message:"This connection link is missing its reference."});return}o({kind:"loading"});try{const n=await(await _(`${z}/api/connector/${encodeURIComponent(r)}/connection/claim-context?ref=${encodeURIComponent(i)}`,{credentials:"include"})).json();if("error"in n){if(n.error==="unauthenticated"){o({kind:"signin",signinProvider:r});return}if(n.error==="signin_required"){o({kind:"signin",signinProvider:n.signinProvider??r});return}o({kind:"error",message:L(n.error,n.code,`this ${u} ${a}`)});return}if("alreadyConnected"in n){o({kind:"already_connected",orgSlug:n.orgSlug});return}b(n.orgs[0]?.slug??""),o({kind:"confirm",subjectKind:n.subjectKind,subjectName:n.subjectName,orgs:n.orgs})}catch{o({kind:"error",message:"We couldn’t load this connection link. Please try again."})}},[r,i,u]);l.useEffect(()=>{S()},[S]);const O=async c=>{await M.social({provider:c,callbackURL:window.location.href})},$=async(c=!1)=>{if(!(!i||!d)){w(!0),m(null),f(null);try{let n=d;if(d===j){const N=v.trim();if(!N){m("Enter a name for the new organization.");return}const p=await W.create({name:N,slug:H(N)});if(p.error||!p.data){m(p.error?.message??"Couldn’t create the organization.");return}n=p.data.slug}const s=await(await _(`${z}/api/connector/${encodeURIComponent(r)}/connection/claim`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({ref:i,org:n,confirmMove:c})})).json();if("error"in s){if(s.error==="signin_required"){o({kind:"signin",signinProvider:s.signinProvider??r});return}if((s.error==="already_connected_elsewhere"||s.error==="enterprise_scope_overlap")&&s.existing){f({kind:s.error,existing:s.existing});return}m(L(s.error,s.code,`this ${u} ${a}`));return}window.location.href=s.orgSlug?`/${s.orgSlug}/connectors/${encodeURIComponent(r)}?connected=1`:"/"}catch{m(`Something went wrong while connecting this ${a}. Please try again.`)}finally{w(!1)}}},T=t.kind==="signin"?"Sign in to continue":t.kind==="error"?`Can’t connect this ${a}`:t.kind==="already_connected"?"Already connected":`Connect ${u} to Lobu`;return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsx("div",{className:"w-full max-w-md p-8",children:e.jsxs(q,{children:[e.jsx(B,{children:e.jsx(D,{asChild:!0,children:e.jsx("h1",{children:T})})}),e.jsxs(G,{children:[t.kind==="loading"&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",children:[e.jsx(y,{size:"lg"}),e.jsx("span",{children:"Checking this connection link…"})]}),t.kind==="error"&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:t.message}),t.kind==="already_connected"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This ",u," ",a," is already connected to Lobu."]}),e.jsx(x,{className:"w-full",asChild:!0,children:e.jsx("a",{href:t.orgSlug?`/${t.orgSlug}/connectors/${encodeURIComponent(r)}`:"/",children:"Open Lobu"})})]}),t.kind==="signin"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Sign in with ",C(t.signinProvider)," to verify you can connect this ",a,"."]}),e.jsxs(x,{className:"w-full",onClick:()=>O(t.signinProvider),children:["Sign in with ",C(t.signinProvider)]})]}),t.kind==="confirm"&&(()=>{const c=t.subjectName||I;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Connecting"," ",e.jsx("strong",{className:"font-medium text-foreground",children:c}),". Choose the organization to connect it to:"]}),e.jsxs(A,{value:d,onValueChange:n=>{f(null),b(n)},children:[e.jsx(V,{children:e.jsx(Y,{placeholder:"Select an organization"})}),e.jsxs(F,{children:[t.orgs.map(n=>e.jsxs(P,{value:n.slug,children:[n.name,n.isPersonal&&e.jsx("span",{className:"ml-1 text-muted-foreground",children:"(personal)"})]},n.id)),e.jsx(P,{value:j,children:"+ New organization"})]})]}),d===j&&e.jsx(K,{autoFocus:!0,value:v,onChange:n=>E(n.target.value),placeholder:"New organization name","aria-label":"New organization name"}),k&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:k}),h&&(()=>{const n=h.existing.orgName??h.existing.orgSlug??"another organization";return h.kind==="already_connected_elsewhere"?e.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/40 px-3 py-3",children:[e.jsxs("p",{className:"text-sm text-foreground",children:[c," is already connected in"," ",e.jsx("strong",{className:"font-medium",children:n}),". Move it here?"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{className:"flex-1",onClick:()=>$(!0),disabled:g,children:g?e.jsxs(e.Fragment,{children:[e.jsx(y,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Moving…"})]}):"Move it here"}),e.jsx(x,{className:"flex-1",variant:"outline",onClick:()=>f(null),disabled:g,children:"Cancel"})]})]}):e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:["This ",u," Enterprise Grid is already connected in"," ",e.jsx("strong",{className:"font-medium",children:n}),"; connecting this ",a," here may change how its messages route. Contact support to move it."]})})(),e.jsx(x,{className:"w-full",onClick:()=>$(),disabled:g||h!==null||!d||d===j&&!v.trim(),children:g?e.jsxs(e.Fragment,{children:[e.jsx(y,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Connecting…"})]}):`Connect ${c}`})]})})()]})]})})})}export{ee as component};
1
+ import{bW as T,a9 as U,r as l,ap as _,ai as z,j as e,s as y,B as x,bX as A,bY as V,bZ as W,b_ as Y,b$ as P,ad as F,aw as K,ae as M}from"./index-DtRfQcRH.js";import{C as q,a as B,b as D,c as G}from"./card-4Ull9W6d.js";const j="__new_org__";function H(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function C(r){return r.length>0?r[0].toUpperCase()+r.slice(1):r}function J(r,i){return r==="not_admin"?`You must be an admin or owner to connect ${i} to Lobu.`:`You don't have permission to connect ${i} to Lobu.`}function L(r,i,t){switch(r){case"not_authorized":return J(i,t);case"no_pending":return`No Lobu install was found for ${t}. Add Lobu from the marketplace to get started.`;case"no_org":return`Your account has no Lobu organization to connect ${t} to.`;default:return`Something went wrong while connecting ${t}. Please try again.`}}function ee(){const{name:r}=T({from:"/connector/$name/connection"}),{ref:i}=U({from:"/connector/$name/connection"}),[t,o]=l.useState({kind:"loading"}),[d,b]=l.useState(""),[v,E]=l.useState(""),[g,w]=l.useState(!1),[k,m]=l.useState(null),[h,f]=l.useState(null),u=C(r),a=t.kind==="confirm"&&t.subjectKind||"connection",I=t.kind==="confirm"&&t.subjectName?t.subjectName:`this ${u} ${a}`,S=l.useCallback(async()=>{if(!i){o({kind:"error",message:"This connection link is missing its reference."});return}o({kind:"loading"});try{const n=await(await _(`${z}/api/connector/${encodeURIComponent(r)}/connection/claim-context?ref=${encodeURIComponent(i)}`,{credentials:"include"})).json();if("error"in n){if(n.error==="unauthenticated"){o({kind:"signin",signinProvider:r});return}if(n.error==="signin_required"){o({kind:"signin",signinProvider:n.signinProvider??r});return}o({kind:"error",message:L(n.error,n.code,`this ${u} ${a}`)});return}if("alreadyConnected"in n){o({kind:"already_connected",orgSlug:n.orgSlug});return}b(n.orgs[0]?.slug??""),o({kind:"confirm",subjectKind:n.subjectKind,subjectName:n.subjectName,orgs:n.orgs})}catch{o({kind:"error",message:"We couldn’t load this connection link. Please try again."})}},[r,i,u]);l.useEffect(()=>{S()},[S]);const O=async c=>{await K.social({provider:c,callbackURL:window.location.href})},$=async(c=!1)=>{if(!(!i||!d)){w(!0),m(null),f(null);try{let n=d;if(d===j){const N=v.trim();if(!N){m("Enter a name for the new organization.");return}const p=await M.create({name:N,slug:H(N)});if(p.error||!p.data){m(p.error?.message??"Couldn’t create the organization.");return}n=p.data.slug}const s=await(await _(`${z}/api/connector/${encodeURIComponent(r)}/connection/claim`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({ref:i,org:n,confirmMove:c})})).json();if("error"in s){if(s.error==="signin_required"){o({kind:"signin",signinProvider:s.signinProvider??r});return}if((s.error==="already_connected_elsewhere"||s.error==="enterprise_scope_overlap")&&s.existing){f({kind:s.error,existing:s.existing});return}m(L(s.error,s.code,`this ${u} ${a}`));return}window.location.href=s.orgSlug?`/${s.orgSlug}/connectors/${encodeURIComponent(r)}?connected=1`:"/"}catch{m(`Something went wrong while connecting this ${a}. Please try again.`)}finally{w(!1)}}},R=t.kind==="signin"?"Sign in to continue":t.kind==="error"?`Can’t connect this ${a}`:t.kind==="already_connected"?"Already connected":`Connect ${u} to Lobu`;return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsx("div",{className:"w-full max-w-md p-8",children:e.jsxs(q,{children:[e.jsx(B,{children:e.jsx(D,{asChild:!0,children:e.jsx("h1",{children:R})})}),e.jsxs(G,{children:[t.kind==="loading"&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",children:[e.jsx(y,{size:"lg"}),e.jsx("span",{children:"Checking this connection link…"})]}),t.kind==="error"&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:t.message}),t.kind==="already_connected"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This ",u," ",a," is already connected to Lobu."]}),e.jsx(x,{className:"w-full",asChild:!0,children:e.jsx("a",{href:t.orgSlug?`/${t.orgSlug}/connectors/${encodeURIComponent(r)}`:"/",children:"Open Lobu"})})]}),t.kind==="signin"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Sign in with ",C(t.signinProvider)," to verify you can connect this ",a,"."]}),e.jsxs(x,{className:"w-full",onClick:()=>O(t.signinProvider),children:["Sign in with ",C(t.signinProvider)]})]}),t.kind==="confirm"&&(()=>{const c=t.subjectName||I;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Connecting"," ",e.jsx("strong",{className:"font-medium text-foreground",children:c}),". Choose the organization to connect it to:"]}),e.jsxs(A,{value:d,onValueChange:n=>{f(null),b(n)},children:[e.jsx(V,{children:e.jsx(W,{placeholder:"Select an organization"})}),e.jsxs(Y,{children:[t.orgs.map(n=>e.jsxs(P,{value:n.slug,children:[n.name,n.isPersonal&&e.jsx("span",{className:"ml-1 text-muted-foreground",children:"(personal)"})]},n.id)),e.jsx(P,{value:j,children:"+ New organization"})]})]}),d===j&&e.jsx(F,{autoFocus:!0,value:v,onChange:n=>E(n.target.value),placeholder:"New organization name","aria-label":"New organization name"}),k&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:k}),h&&(()=>{const n=h.existing.orgName??h.existing.orgSlug??"another organization";return h.kind==="already_connected_elsewhere"?e.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/40 px-3 py-3",children:[e.jsxs("p",{className:"text-sm text-foreground",children:[c," is already connected in"," ",e.jsx("strong",{className:"font-medium",children:n}),". Move it here?"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{className:"flex-1",onClick:()=>$(!0),disabled:g,children:g?e.jsxs(e.Fragment,{children:[e.jsx(y,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Moving…"})]}):"Move it here"}),e.jsx(x,{className:"flex-1",variant:"outline",onClick:()=>f(null),disabled:g,children:"Cancel"})]})]}):e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:["This ",u," Enterprise Grid is already connected in"," ",e.jsx("strong",{className:"font-medium",children:n}),"; connecting this ",a," here may change how its messages route. Contact support to move it."]})})(),e.jsx(x,{className:"w-full",onClick:()=>$(),disabled:g||h!==null||!d||d===j&&!v.trim(),children:g?e.jsxs(e.Fragment,{children:[e.jsx(y,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Connecting…"})]}):`Connect ${c}`})]})})()]})]})})})}export{ee as component};
@@ -1 +1 @@
1
- import{ew as K,r as o,j as e,de as U,df as H,aO as W,aj as C,B as b,eq as X,f9 as Y,k as M,eR as w,ep as F,bY as Z,bZ as G,b_ as J,b$ as Q,c0 as ee,en as O,F as R,c2 as se,s as E,fa as te,eX as ne,E as ae,fb as ce,aS as ie,fc as le,fd as re,fe as oe,ff as de,fg as ue,fh as me,eS as xe,L as P,fi as T,af as he,x as V}from"./index-BUr8321-.js";import{f as fe,C as ge}from"./entity-options-1EaSGMX4.js";import{V as pe,R as je,S as $,g as L}from"./runs-table-B7jKuILd.js";function ve({organizationId:s,value:t,onChange:a,entities:n,className:m}){const{data:i=[]}=K(n?void 0:s),u=o.useMemo(()=>n??fe(i),[n,i]),p=new Set(t),l=u.filter(c=>p.has(c.id)),d=c=>{const g=new Set(p);g.has(c)?g.delete(c):g.add(c),a(Array.from(g).sort((v,y)=>v-y))},x=l.length===0?"All entities":l.length===1?l[0].name:`${l.length} entities selected`;return e.jsx(U,{contentClassName:"w-[320px]",searchPlaceholder:"Filter entities...",emptyText:"No entities found.",trigger:c=>e.jsxs(b,{variant:"outline",role:"combobox","aria-expanded":c,className:C("justify-between",m),children:[x,e.jsx(X,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:()=>u.map(c=>{const g=p.has(c.id);return e.jsxs(H,{value:`${c.name} ${c.entityType}`,onSelect:()=>d(c.id),className:"cursor-pointer",children:[e.jsx(W,{className:C("mr-2 h-4 w-4",g?"opacity-100":"opacity-0")}),e.jsxs("span",{children:[c.name," ",e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",c.entityType,")"]})]})]},c.id)})})}function ye(s){return s?.feeds_schema?Object.entries(s.feeds_schema).map(([t,a])=>({key:t,name:a.name??t,description:a.description,configSchema:a.configSchema})):[]}const ke="Feeds are optional scheduled sync targets for an existing connection.";function Ce({organizationId:s,connections:t,connectorDefinitions:a,entityId:n,onClose:m}){const i=t.length===1,[u,p]=o.useState(i?String(t[0].id):""),[l,d]=o.useState(""),[x,c]=o.useState(n?[n]:[]),[g,v]=o.useState(null),y=Y(),_=o.useMemo(()=>new Map(a.map(r=>[r.key,r])),[a]),h=o.useMemo(()=>t.find(r=>String(r.id)===u),[t,u]),N=o.useMemo(()=>h?ye(_.get(h.connector_key)):[],[h,_]),S=o.useMemo(()=>N.find(r=>r.key===l)??null,[N,l]),f=M(`${u}:${l}`,w(S?.configSchema),S?.configSchema),{values:j,setValues:I}=f,D=o.useCallback(()=>{p(i?String(t[0].id):""),d(""),c(n?[n]:[]),v(null)},[n,i,t]),k=o.useCallback(()=>{D(),m()},[m,D]),B=o.useCallback(async()=>{if(!f.canSubmit||!h||!l)return;v(null);const r=F(j);try{await y.mutateAsync({connection_id:h.id,feed_key:l,config:Object.keys(r).length>0?r:void 0,entity_ids:n?[n]:x.length>0?x:void 0}),k()}catch(A){v(A instanceof Error?A.message:"Failed to create feed")}},[j,f.canSubmit,y,n,k,h,x,l]),z=e.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto py-6 pr-1",children:[!i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Connection"}),e.jsx(ge,{connections:t,value:u,onValueChange:r=>{p(r),d(""),v(null)},placeholder:"Select a connection"})]}),h&&N.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Feed Type"}),e.jsxs(Z,{value:l,onValueChange:d,children:[e.jsx(G,{children:e.jsx(J,{placeholder:"Select feed type"})}),e.jsx(Q,{children:N.map(r=>e.jsx(ee,{value:r.key,children:e.jsxs("div",{children:[e.jsx("span",{children:r.name}),r.description&&e.jsxs("span",{className:"text-muted-foreground ml-1 text-xs",children:["— ",r.description]})]})},r.key))})]})]}),n?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entity"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This feed will be attached to the current entity."})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entities"}),e.jsx(ve,{organizationId:s,value:x,onChange:c,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Leave empty to create an unscoped feed."})]}),f.revision&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Feed Configuration"}),e.jsx(O,{schema:f.revision,values:j,onValuesChange:I})]}),h&&N.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector has no configurable feed types."}),e.jsx(R,{visible:f.hasConflict,onReload:f.reset}),g&&e.jsx("p",{className:"text-sm text-destructive",children:g})]}),q=e.jsx(se,{onCancel:k,className:"mt-2",children:e.jsxs(b,{disabled:!f.canSubmit||!l||y.isPending,onClick:()=>void B(),children:[y.isPending&&e.jsx(E,{size:"lg",className:"mr-2"}),"Create Feed"]})});return e.jsxs("div",{className:"flex flex-col",children:[z,q]})}function we({feed:s,onClose:t,hideHeader:a=!1}){const n=s.display_name?.trim()||s.feed_key,m=s.feed_key.includes(":")?s.feed_key.slice(s.feed_key.indexOf(":")+1):s.feed_key,i=s.external_tenant_id,u=s.connector_key==="slack"&&i?`https://app.slack.com/client/${i}/${m}`:void 0;return e.jsxs("div",{className:"flex max-w-xl flex-col gap-4",children:[a?null:e.jsxs(e.Fragment,{children:[t?e.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(te,{className:"h-3 w-3"}),"Back to connection"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold leading-tight",children:n}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"chat channel"})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Messages captured for this channel are available to Lobu Automations. Open Slack to read the channel history."}),u?e.jsx(b,{asChild:!0,variant:"outline",className:"w-full justify-center",children:e.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ae,{className:"mr-2 h-4 w-4"}),"Open in Slack"]})}):null,e.jsxs("div",{className:C(ie,"flex flex-col gap-3 p-4"),children:[e.jsx("div",{className:"text-xs font-medium uppercase text-muted-foreground",children:"Channel"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(ce,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"break-all",children:n})]}),i?e.jsxs("div",{className:"flex items-baseline justify-between gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),e.jsx("span",{className:"break-all font-mono text-xs",children:i})]}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:"Messages the bot sees here are captured as they arrive. Open the channel in Slack to read the full history."})]})]})}function Fe(s,t){return s.display_name?s.display_name:t?.feeds_schema?.[s.feed_key]?.name??s.feed_key}function Ne(s,t){const a=s?.feeds_schema;if(!a)return;if(a[t]?.configSchema)return a[t].configSchema;for(const m of Object.values(a))if(m?.key===t&&m.configSchema)return m.configSchema;const n=Object.values(a);if(n.length===1&&n[0]?.configSchema)return n[0].configSchema}function Ee({feed:s,ownerSlug:t}){return e.jsxs(e.Fragment,{children:[e.jsx($,{status:L(s.status),showDot:!0,children:s.status}),s.connection_status&&s.connection_status!==s.status&&e.jsxs($,{status:L(s.connection_status),showDot:!0,children:["Connection: ",s.connection_status]}),s.device_worker_id?e.jsx(P,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:s.device_worker_id},children:e.jsx(he,{variant:s.device_status==="offline"?"secondary":"outline",className:"text-xs hover:bg-accent",children:s.device_status==="offline"?`Waiting for ${s.device_label||s.device_platform||"device"}`:`On ${s.device_label||s.device_platform||"device"}`})}):null]})}function De({feed:s}){return s.operations.includes("sync")?e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Last sync: ",s.last_sync_at?V(s.last_sync_at):"—"]}),e.jsxs("span",{children:["Next: ",s.next_run_at?V(s.next_run_at):"—"]}),e.jsxs("span",{className:"font-mono",children:[(s.event_count??0).toLocaleString()," events"]})]}):e.jsx("span",{children:"Read live when queried"})}function Ae({feed:s,connectorDef:t,ownerSlug:a}){const{data:n,refetch:m}=le(s.id),i=re(),u=oe(),p=n?.recent_runs?.some(j=>["running","pending","claimed"].includes(j.status));o.useEffect(()=>{if(!p)return;const j=setInterval(()=>m(),5e3);return()=>clearInterval(j)},[p,m]);const l=o.useMemo(()=>Ne(t,s.feed_key),[t,s.feed_key]),d=M(s.id,w(l,s.config??{}),l),{values:x,setValues:c,dirty:g}=d,v=o.useCallback(async()=>{d.canSubmit&&(await i.mutateAsync({feed_id:s.id,config:F(x)}),d.accept(x,w(l,F(x))))},[i,s.id,x,l,d.canSubmit,d.accept]),y=o.useCallback(async()=>{const j=s.status==="active"?"paused":"active";await i.mutateAsync({feed_id:s.id,status:j})},[i,s.id,s.status]),_=o.useCallback(async()=>{await u.mutateAsync(s.id)},[u,s.id]),h=s.status==="active",N=s.operations.includes("sync"),S=s.auth_profile_status&&s.auth_profile_status!=="active",f=i.isPending||u.isPending;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(b,{variant:"outline",size:"sm",disabled:f,onClick:()=>void y(),children:[h?e.jsx(de,{className:"h-3.5 w-3.5 mr-1.5"}):e.jsx(ue,{className:"h-3.5 w-3.5 mr-1.5"}),h?"Pause":"Resume"]}),N?e.jsxs(b,{variant:"outline",size:"sm",disabled:f||!h,onClick:()=>void _(),children:[u.isPending?e.jsx(E,{size:"md",className:"mr-1.5"}):e.jsx(me,{className:"h-3.5 w-3.5 mr-1.5"}),"Sync now"]}):null,e.jsx(pe,{ownerSlug:a,scope:{kind:"feed",id:s.id},variant:"ghost",label:"View in memory"})]}),S&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-50 dark:bg-amber-950/20 px-3 py-2 text-sm",children:[e.jsx(xe,{className:"h-4 w-4 text-amber-500 shrink-0"}),e.jsxs("span",{className:"text-amber-700 dark:text-amber-400",children:["Authentication issue: ",s.auth_profile_status]}),e.jsx(b,{asChild:!0,variant:"outline",size:"sm",className:"ml-auto h-7 text-xs",children:e.jsx(P,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:s.connector_key,connectionId:String(s.connection_id)},search:{settings:!0},children:"Fix auth"})})]}),d.revision?e.jsx(T,{title:"Settings",children:e.jsxs("div",{className:"max-w-xl space-y-4",children:[e.jsx(O,{schema:d.revision,values:x,onValuesChange:c}),e.jsx(R,{visible:d.hasConflict,onReload:d.reset}),g&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(b,{size:"sm",disabled:f||!d.canSubmit,onClick:()=>void v(),children:[i.isPending?e.jsx(E,{size:"md",className:"mr-1.5"}):null,"Save"]})})]})}):null,N?e.jsx(T,{title:"Recent syncs",children:n?.recent_runs&&n.recent_runs.length>0?e.jsx(je,{runs:n.recent_runs,ownerSlug:a}):e.jsx("p",{className:"rounded-lg border bg-muted/20 px-3 py-6 text-center text-xs text-muted-foreground",children:"No syncs yet."})}):null]})}export{Ce as A,we as C,Ee as F,Ae as a,De as b,ke as c,Fe as f};
1
+ import{dO as K,r as o,j as e,cv as U,cw as q,aR as W,al as C,B as b,dI as X,ey as G,k as M,ed as w,dH as F,bX as J,bY as Y,bZ as Z,b_ as Q,b$ as ee,dF as O,F as R,dT as se,s as E,ez as te,ek as ne,J as ae,eA as ce,aV as ie,eB as le,eC as re,eD as oe,eE as de,eF as ue,eG as me,ef as xe,L as I,eH as T,ah as he,E as V}from"./index-DtRfQcRH.js";import{f as ge,C as pe}from"./entity-options-utGBmFX0.js";import{V as fe,R as je,S as $,g as L}from"./runs-table--dnFQatY.js";function ve({organizationId:s,value:t,onChange:a,entities:n,className:m}){const{data:i=[]}=K(n?void 0:s),u=o.useMemo(()=>n??ge(i),[n,i]),f=new Set(t),l=u.filter(c=>f.has(c.id)),d=c=>{const p=new Set(f);p.has(c)?p.delete(c):p.add(c),a(Array.from(p).sort((v,y)=>v-y))},x=l.length===0?"All entities":l.length===1?l[0].name:`${l.length} entities selected`;return e.jsx(U,{contentClassName:"w-[320px]",searchPlaceholder:"Filter entities...",emptyText:"No entities found.",trigger:c=>e.jsxs(b,{variant:"outline",role:"combobox","aria-expanded":c,className:C("justify-between",m),children:[x,e.jsx(X,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:()=>u.map(c=>{const p=f.has(c.id);return e.jsxs(q,{value:`${c.name} ${c.entityType}`,onSelect:()=>d(c.id),className:"cursor-pointer",children:[e.jsx(W,{className:C("mr-2 h-4 w-4",p?"opacity-100":"opacity-0")}),e.jsxs("span",{children:[c.name," ",e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",c.entityType,")"]})]})]},c.id)})})}function ye(s){return s?.feeds_schema?Object.entries(s.feeds_schema).map(([t,a])=>({key:t,name:a.name??t,description:a.description,configSchema:a.configSchema})):[]}const ke="Feeds are optional scheduled sync targets for an existing connection.";function Ce({organizationId:s,connections:t,connectorDefinitions:a,entityId:n,onClose:m}){const i=t.length===1,[u,f]=o.useState(i?String(t[0].id):""),[l,d]=o.useState(""),[x,c]=o.useState(n?[n]:[]),[p,v]=o.useState(null),y=G(),_=o.useMemo(()=>new Map(a.map(r=>[r.key,r])),[a]),h=o.useMemo(()=>t.find(r=>String(r.id)===u),[t,u]),N=o.useMemo(()=>h?ye(_.get(h.connector_key)):[],[h,_]),S=o.useMemo(()=>N.find(r=>r.key===l)??null,[N,l]),g=M(`${u}:${l}`,w(S?.configSchema),S?.configSchema),{values:j,setValues:P}=g,D=o.useCallback(()=>{f(i?String(t[0].id):""),d(""),c(n?[n]:[]),v(null)},[n,i,t]),k=o.useCallback(()=>{D(),m()},[m,D]),B=o.useCallback(async()=>{if(!g.canSubmit||!h||!l)return;v(null);const r=F(j);try{await y.mutateAsync({connection_id:h.id,feed_key:l,config:Object.keys(r).length>0?r:void 0,entity_ids:n?[n]:x.length>0?x:void 0}),k()}catch(A){v(A instanceof Error?A.message:"Failed to create feed")}},[j,g.canSubmit,y,n,k,h,x,l]),z=e.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto py-6 pr-1",children:[!i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Connection"}),e.jsx(pe,{connections:t,value:u,onValueChange:r=>{f(r),d(""),v(null)},placeholder:"Select a connection"})]}),h&&N.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Feed Type"}),e.jsxs(J,{value:l,onValueChange:d,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:"Select feed type"})}),e.jsx(Q,{children:N.map(r=>e.jsx(ee,{value:r.key,children:e.jsxs("div",{children:[e.jsx("span",{children:r.name}),r.description&&e.jsxs("span",{className:"text-muted-foreground ml-1 text-xs",children:["— ",r.description]})]})},r.key))})]})]}),n?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entity"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This feed will be attached to the current entity."})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entities"}),e.jsx(ve,{organizationId:s,value:x,onChange:c,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Leave empty to create an unscoped feed."})]}),g.revision&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Feed Configuration"}),e.jsx(O,{schema:g.revision,values:j,onValuesChange:P})]}),h&&N.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector has no configurable feed types."}),e.jsx(R,{visible:g.hasConflict,onReload:g.reset}),p&&e.jsx("p",{className:"text-sm text-destructive",children:p})]}),H=e.jsx(se,{onCancel:k,className:"mt-2",children:e.jsxs(b,{disabled:!g.canSubmit||!l||y.isPending,onClick:()=>void B(),children:[y.isPending&&e.jsx(E,{size:"lg",className:"mr-2"}),"Create Feed"]})});return e.jsxs("div",{className:"flex flex-col",children:[z,H]})}function we({feed:s,onClose:t,hideHeader:a=!1}){const n=s.display_name?.trim()||s.feed_key,m=s.feed_key.includes(":")?s.feed_key.slice(s.feed_key.indexOf(":")+1):s.feed_key,i=s.external_tenant_id,u=s.connector_key==="slack"&&i?`https://app.slack.com/client/${i}/${m}`:void 0;return e.jsxs("div",{className:"flex max-w-xl flex-col gap-4",children:[a?null:e.jsxs(e.Fragment,{children:[t?e.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(te,{className:"h-3 w-3"}),"Back to connection"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold leading-tight",children:n}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"chat channel"})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Messages captured for this channel are available to Lobu Automations. Open Slack to read the channel history."}),u?e.jsx(b,{asChild:!0,variant:"outline",className:"w-full justify-center",children:e.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ae,{className:"mr-2 h-4 w-4"}),"Open in Slack"]})}):null,e.jsxs("div",{className:C(ie,"flex flex-col gap-3 p-4"),children:[e.jsx("div",{className:"text-xs font-medium uppercase text-muted-foreground",children:"Channel"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(ce,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"break-all",children:n})]}),i?e.jsxs("div",{className:"flex items-baseline justify-between gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),e.jsx("span",{className:"break-all font-mono text-xs",children:i})]}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:"Messages the bot sees here are captured as they arrive. Open the channel in Slack to read the full history."})]})]})}function Fe(s,t){return s.display_name?s.display_name:t?.feeds_schema?.[s.feed_key]?.name??s.feed_key}function Ne(s,t){const a=s?.feeds_schema;if(!a)return;if(a[t]?.configSchema)return a[t].configSchema;for(const m of Object.values(a))if(m?.key===t&&m.configSchema)return m.configSchema;const n=Object.values(a);if(n.length===1&&n[0]?.configSchema)return n[0].configSchema}function Ee({feed:s,ownerSlug:t}){return e.jsxs(e.Fragment,{children:[e.jsx($,{status:L(s.status),showDot:!0,children:s.status}),s.connection_status&&s.connection_status!==s.status&&e.jsxs($,{status:L(s.connection_status),showDot:!0,children:["Connection: ",s.connection_status]}),s.device_worker_id?e.jsx(I,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:s.device_worker_id},children:e.jsx(he,{variant:s.device_status==="offline"?"secondary":"outline",className:"text-xs hover:bg-accent",children:s.device_status==="offline"?`Waiting for ${s.device_label||s.device_platform||"device"}`:`On ${s.device_label||s.device_platform||"device"}`})}):null]})}function De({feed:s}){return s.operations.includes("sync")?e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Last sync: ",s.last_sync_at?V(s.last_sync_at):"—"]}),e.jsxs("span",{children:["Next: ",s.next_run_at?V(s.next_run_at):"—"]}),e.jsxs("span",{className:"font-mono",children:[(s.event_count??0).toLocaleString()," events"]})]}):e.jsx("span",{children:"Read live when queried"})}function Ae({feed:s,connectorDef:t,ownerSlug:a}){const{data:n,refetch:m}=le(s.id),i=re(),u=oe(),f=n?.recent_runs?.some(j=>["running","pending","claimed"].includes(j.status));o.useEffect(()=>{if(!f)return;const j=setInterval(()=>m(),5e3);return()=>clearInterval(j)},[f,m]);const l=o.useMemo(()=>Ne(t,s.feed_key),[t,s.feed_key]),d=M(s.id,w(l,s.config??{}),l),{values:x,setValues:c,dirty:p}=d,v=o.useCallback(async()=>{d.canSubmit&&(await i.mutateAsync({feed_id:s.id,config:F(x)}),d.accept(x,w(l,F(x))))},[i,s.id,x,l,d.canSubmit,d.accept]),y=o.useCallback(async()=>{const j=s.status==="active"?"paused":"active";await i.mutateAsync({feed_id:s.id,status:j})},[i,s.id,s.status]),_=o.useCallback(async()=>{await u.mutateAsync(s.id)},[u,s.id]),h=s.status==="active",N=s.operations.includes("sync"),S=s.auth_profile_status&&s.auth_profile_status!=="active",g=i.isPending||u.isPending;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(b,{variant:"outline",size:"sm",disabled:g,onClick:()=>void y(),children:[h?e.jsx(de,{className:"h-3.5 w-3.5 mr-1.5"}):e.jsx(ue,{className:"h-3.5 w-3.5 mr-1.5"}),h?"Pause":"Resume"]}),N?e.jsxs(b,{variant:"outline",size:"sm",disabled:g||!h,onClick:()=>void _(),children:[u.isPending?e.jsx(E,{size:"md",className:"mr-1.5"}):e.jsx(me,{className:"h-3.5 w-3.5 mr-1.5"}),"Sync now"]}):null,e.jsx(fe,{ownerSlug:a,scope:{kind:"feed",id:s.id},variant:"ghost",label:"View in memory"})]}),S&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-50 dark:bg-amber-950/20 px-3 py-2 text-sm",children:[e.jsx(xe,{className:"h-4 w-4 text-amber-500 shrink-0"}),e.jsxs("span",{className:"text-amber-700 dark:text-amber-400",children:["Authentication issue: ",s.auth_profile_status]}),e.jsx(b,{asChild:!0,variant:"outline",size:"sm",className:"ml-auto h-7 text-xs",children:e.jsx(I,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:s.connector_key,connectionId:String(s.connection_id)},search:{settings:!0},children:"Fix auth"})})]}),d.revision?e.jsx(T,{title:"Settings",children:e.jsxs("div",{className:"max-w-xl space-y-4",children:[e.jsx(O,{schema:d.revision,values:x,onValuesChange:c}),e.jsx(R,{visible:d.hasConflict,onReload:d.reset}),p&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(b,{size:"sm",disabled:g||!d.canSubmit,onClick:()=>void v(),children:[i.isPending?e.jsx(E,{size:"md",className:"mr-1.5"}):null,"Save"]})})]})}):null,N?e.jsx(T,{title:"Recent syncs",children:n?.recent_runs&&n.recent_runs.length>0?e.jsx(je,{runs:n.recent_runs,ownerSlug:a}):e.jsx("p",{className:"rounded-lg border bg-muted/20 px-3 py-6 text-center text-xs text-muted-foreground",children:"No syncs yet."})}):null]})}export{Ce as A,we as C,Ee as F,Ae as a,De as b,ke as c,Fe as f};
@@ -1 +1 @@
1
- import{j as e,ci as m,cj as u,ck as h,E as v,af as x,L as c}from"./index-BUr8321-.js";function N({connectorDef:s,connectorKey:t,ownerSlug:n,deviceWorkerId:i,deviceLabel:o}){return s?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{children:"Runs on"}),e.jsx(c,{to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:t},className:"underline underline-offset-2 hover:text-foreground",children:s.name}),e.jsx(f,{deviceWorkerId:i,deviceLabel:o,connectorDef:s,ownerSlug:n})]}):null}function f({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){return e.jsxs(m,{children:[e.jsxs(u,{className:"rounded border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground",children:["v",s.version||"unknown"]}),e.jsx(h,{align:"start",className:"w-80 p-0",children:e.jsx(j,{connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i})})]})}function j({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){const o=s.runtime?.platforms??[],d=s.runtime?.scopes??[],r=s.source_uri?.trim()||null,p=!!r&&(r.startsWith("http://")||r.startsWith("https://")),l=[{label:"Key",value:e.jsx("span",{className:"font-mono",children:s.key})},{label:"Version",value:e.jsx("span",{className:"font-mono",children:s.version?`v${s.version}`:"unknown"})}];return s.catalog_origin&&l.push({label:"Origin",value:s.catalog_origin==="org"?e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:"Built in this workspace"}):e.jsx("span",{children:"Lobu catalog"})}),r&&l.push({label:"Source",value:p?e.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-start gap-1 break-all font-mono text-primary hover:underline",children:[r,e.jsx(v,{className:"mt-0.5 h-3 w-3 shrink-0"})]}):e.jsx("span",{className:"break-all font-mono",children:r})}),o.length>0&&l.push({label:"Platforms",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:o.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),s.required_capability&&l.push({label:"Capability",value:e.jsx("span",{className:"font-mono",children:s.required_capability})}),d.length>0&&l.push({label:"Scopes",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:d.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),e.jsxs("div",{className:"text-xs",children:[e.jsx("dl",{className:"divide-y",children:l.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-20 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1",children:a.value})]},a.label))}),o.length>0?e.jsx("div",{className:"border-t px-3 py-2 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Runs on"," ",e.jsx(c,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:n},className:"text-primary hover:underline",children:i||"this device"}),"."]}):"Runs on a linked device."}):null]})}export{f as C,N as a};
1
+ import{j as e,cj as m,ck as u,cn as h,J as v,ah as x,L as c}from"./index-DtRfQcRH.js";function N({connectorDef:s,connectorKey:t,ownerSlug:n,deviceWorkerId:i,deviceLabel:o}){return s?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{children:"Runs on"}),e.jsx(c,{to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:t},className:"underline underline-offset-2 hover:text-foreground",children:s.name}),e.jsx(f,{deviceWorkerId:i,deviceLabel:o,connectorDef:s,ownerSlug:n})]}):null}function f({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){return e.jsxs(m,{children:[e.jsxs(u,{className:"rounded border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground",children:["v",s.version||"unknown"]}),e.jsx(h,{align:"start",className:"w-80 p-0",children:e.jsx(j,{connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i})})]})}function j({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){const o=s.runtime?.platforms??[],d=s.runtime?.scopes??[],r=s.source_uri?.trim()||null,p=!!r&&(r.startsWith("http://")||r.startsWith("https://")),l=[{label:"Key",value:e.jsx("span",{className:"font-mono",children:s.key})},{label:"Version",value:e.jsx("span",{className:"font-mono",children:s.version?`v${s.version}`:"unknown"})}];return s.catalog_origin&&l.push({label:"Origin",value:s.catalog_origin==="org"?e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:"Built in this workspace"}):e.jsx("span",{children:"Lobu catalog"})}),r&&l.push({label:"Source",value:p?e.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-start gap-1 break-all font-mono text-primary hover:underline",children:[r,e.jsx(v,{className:"mt-0.5 h-3 w-3 shrink-0"})]}):e.jsx("span",{className:"break-all font-mono",children:r})}),o.length>0&&l.push({label:"Platforms",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:o.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),s.required_capability&&l.push({label:"Capability",value:e.jsx("span",{className:"font-mono",children:s.required_capability})}),d.length>0&&l.push({label:"Scopes",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:d.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),e.jsxs("div",{className:"text-xs",children:[e.jsx("dl",{className:"divide-y",children:l.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-20 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1",children:a.value})]},a.label))}),o.length>0?e.jsx("div",{className:"border-t px-3 py-2 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Runs on"," ",e.jsx(c,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:n},className:"text-primary hover:underline",children:i||"this device"}),"."]}):"Runs on a linked device."}):null]})}export{f as C,N as a};
@@ -1 +1 @@
1
- import{j as e,a0 as l}from"./index-BUr8321-.js";function n(){return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6",children:e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(l,{})})})}export{n as component};
1
+ import{j as e,a2 as l}from"./index-DtRfQcRH.js";function n(){return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6",children:e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(l,{})})})}export{n as component};
@@ -1 +1 @@
1
- import{ah as I,Y as D,r,j as e,B as M,ag as T,ai as B}from"./index-BUr8321-.js";import{u as $,b as F,a as H,s as G,g as J,A as Q,W as Y}from"./oauth-workspace-access-D9GmiMfK.js";import{C as K,a as V,b as X,d as Z,c as ee}from"./card-DeFQuU_J.js";const se=["client_id","redirect_uri","scope","code_challenge","code_challenge_method"];function ce(){const s=I.useSearch(),f=s.workspace_grants==="1",{session:y,isReady:N}=D(),j=!N,{orgList:L,workspaceAccess:P,setWorkspaceAccess:q,selectedOrgIds:w,toggleSelectedOrgId:E,orgsLoading:O,orgsError:b,retryOrgs:W,workspaceSelectionReady:_}=$({allowMultiple:f}),[n,A]=r.useState(null),[k,a]=r.useState(null);F(!!y,j);const p=r.useMemo(()=>se.filter(t=>!s[t]||s[t]?.length===0),[s]),o=p.length===0,z=s.client_name?.trim()||null,i=r.useMemo(()=>Array.from(new Set((s.scope||"").split(" ").map(t=>t.trim()).filter(Boolean))),[s.scope]),g=H(i),[l,v]=r.useState(g);r.useEffect(()=>{v(g)},[g]);const d=r.useMemo(()=>G(i,l),[l,i]),S=r.useMemo(()=>d.some(t=>t.startsWith("mcp:")),[d]),x=l,u=r.useMemo(()=>J(s.resource),[s.resource]),m=S&&!u,U=()=>{const t=new URL("/auth/login",window.location.origin);t.searchParams.set("callbackUrl",window.location.href),window.location.href=t.toString()},C=async t=>{if(!o){a(`Missing required query params: ${p.join(", ")}`);return}if(t&&m&&!_){a(b?"Workspaces could not be loaded. Retry before approving.":"Choose at least one workspace before approving.");return}A(t?"approve":"deny"),a(null);try{const c=await fetch(`${T}/oauth/authorize/consent`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({client_id:s.client_id,redirect_uri:s.redirect_uri,scope:t?d.join(" "):s.scope,state:s.state??"",code_challenge:s.code_challenge,code_challenge_method:s.code_challenge_method,client_name:s.client_name,resource:s.resource,authorization_intent:s.authorization_intent,approved:t,...t&&m?{workspace_access:P,organization_ids:w}:{}})}),h=await c.json().catch(()=>null);if(c.status===401){U();return}if(!c.ok)throw new Error(h?.error_description||h?.message||h?.error||`Failed to ${t?"approve":"deny"} OAuth consent`);const R=B(h?.redirect_url);if(!R)throw new Error("Consent response did not include a valid redirect URL");window.location.href=R}catch(c){A(null),a(c instanceof Error?c.message:"Unexpected error while submitting consent")}};return j||!y?e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking authentication..."})}):e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs(K,{className:"w-full max-w-lg",children:[e.jsxs(V,{children:[e.jsx(X,{asChild:!0,children:e.jsx("h1",{children:"Authorize application"})}),e.jsx(Z,{children:"Review the application, access level, and workspaces."})]}),e.jsxs(ee,{className:"space-y-5","aria-busy":n!==null,children:[e.jsx(Q,{idPrefix:"oauth-consent",clientName:z,requestedScopes:i,accessLevel:l,onAccessLevelChange:v,disabled:n!==null}),m&&e.jsx(Y,{idPrefix:"oauth-consent",allowMultiple:f,orgList:L,selectedOrgIds:w,onWorkspaceAccessChange:q,onSelectedOrgChange:E,orgsLoading:O,orgsError:b,onRetry:W,disabled:n!==null||!o}),(u||s.resource)&&e.jsx("section",{className:"rounded-md border bg-muted/20 p-3 text-sm text-muted-foreground space-y-1",children:s.resource&&e.jsx("p",{children:e.jsx("span",{className:"font-medium text-foreground",children:s.resource})})}),S&&u&&e.jsxs("section",{className:"rounded-md border border-primary/20 bg-primary/5 p-3 text-sm space-y-2",children:[e.jsxs("p",{className:"font-medium text-foreground",children:["Workspace access: only ",u]}),e.jsxs("ul",{className:"space-y-1 text-muted-foreground",children:[e.jsx("li",{children:"If this workspace is public, the app can read public data immediately after approval."}),x==="write"&&e.jsx("li",{children:"If you are not already a member, this connection will stay read-only. Ask an organization admin to grant write access, then reconnect the MCP client."}),x==="admin"&&e.jsx("li",{children:"If you are not already an admin or owner, elevated actions will stay blocked. Ask an organization owner to grant the required role, then reconnect the MCP client."}),x==="read"&&e.jsx("li",{children:"Public read access does not require membership."})]})]}),k&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:k}),!o&&e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Missing required query params: ",p.join(", ")]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(M,{type:"button",variant:"outline",onClick:()=>C(!1),disabled:n!==null||!o,children:n==="deny"?"Denying...":"Deny"}),e.jsx(M,{type:"button",onClick:()=>C(!0),disabled:n!==null||!o||d.length===0||m&&!_,children:n==="approve"?"Approving...":"Approve"})]})]})]})})}export{ce as component};
1
+ import{aj as I,v as D,r,j as e,B as M,ai as T,ak as B}from"./index-DtRfQcRH.js";import{u as $,b as F,a as H,s as G,g as J,A as Q,W as K}from"./oauth-workspace-access-D6epOq0R.js";import{C as V,a as X,b as Y,d as Z,c as ee}from"./card-4Ull9W6d.js";const se=["client_id","redirect_uri","scope","code_challenge","code_challenge_method"];function ce(){const s=I.useSearch(),f=s.workspace_grants==="1",{session:y,isReady:N}=D(),j=!N,{orgList:L,workspaceAccess:P,setWorkspaceAccess:q,selectedOrgIds:w,toggleSelectedOrgId:E,orgsLoading:O,orgsError:b,retryOrgs:W,workspaceSelectionReady:_}=$({allowMultiple:f}),[n,A]=r.useState(null),[k,a]=r.useState(null);F(!!y,j);const h=r.useMemo(()=>se.filter(t=>!s[t]||s[t]?.length===0),[s]),o=h.length===0,z=s.client_name?.trim()||null,i=r.useMemo(()=>Array.from(new Set((s.scope||"").split(" ").map(t=>t.trim()).filter(Boolean))),[s.scope]),g=H(i),[l,v]=r.useState(g);r.useEffect(()=>{v(g)},[g]);const d=r.useMemo(()=>G(i,l),[l,i]),S=r.useMemo(()=>d.some(t=>t.startsWith("mcp:")),[d]),x=l,u=r.useMemo(()=>J(s.resource),[s.resource]),m=S&&!u,U=()=>{const t=new URL("/auth/login",window.location.origin);t.searchParams.set("callbackUrl",window.location.href),window.location.href=t.toString()},C=async t=>{if(!o){a(`Missing required query params: ${h.join(", ")}`);return}if(t&&m&&!_){a(b?"Workspaces could not be loaded. Retry before approving.":"Choose at least one workspace before approving.");return}A(t?"approve":"deny"),a(null);try{const c=await fetch(`${T}/oauth/authorize/consent`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({client_id:s.client_id,redirect_uri:s.redirect_uri,scope:t?d.join(" "):s.scope,state:s.state??"",code_challenge:s.code_challenge,code_challenge_method:s.code_challenge_method,client_name:s.client_name,resource:s.resource,authorization_intent:s.authorization_intent,approved:t,...t&&m?{workspace_access:P,organization_ids:w}:{}})}),p=await c.json().catch(()=>null);if(c.status===401){U();return}if(!c.ok)throw new Error(p?.error_description||p?.message||p?.error||`Failed to ${t?"approve":"deny"} OAuth consent`);const R=B(p?.redirect_url);if(!R)throw new Error("Consent response did not include a valid redirect URL");window.location.href=R}catch(c){A(null),a(c instanceof Error?c.message:"Unexpected error while submitting consent")}};return j||!y?e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking authentication..."})}):e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs(V,{className:"w-full max-w-lg",children:[e.jsxs(X,{children:[e.jsx(Y,{asChild:!0,children:e.jsx("h1",{children:"Authorize application"})}),e.jsx(Z,{children:"Review the application, access level, and workspaces."})]}),e.jsxs(ee,{className:"space-y-5","aria-busy":n!==null,children:[e.jsx(Q,{idPrefix:"oauth-consent",clientName:z,requestedScopes:i,accessLevel:l,onAccessLevelChange:v,disabled:n!==null}),m&&e.jsx(K,{idPrefix:"oauth-consent",allowMultiple:f,orgList:L,selectedOrgIds:w,onWorkspaceAccessChange:q,onSelectedOrgChange:E,orgsLoading:O,orgsError:b,onRetry:W,disabled:n!==null||!o}),(u||s.resource)&&e.jsx("section",{className:"rounded-md border bg-muted/20 p-3 text-sm text-muted-foreground space-y-1",children:s.resource&&e.jsx("p",{children:e.jsx("span",{className:"font-medium text-foreground",children:s.resource})})}),S&&u&&e.jsxs("section",{className:"rounded-md border border-primary/20 bg-primary/5 p-3 text-sm space-y-2",children:[e.jsxs("p",{className:"font-medium text-foreground",children:["Workspace access: only ",u]}),e.jsxs("ul",{className:"space-y-1 text-muted-foreground",children:[e.jsx("li",{children:"If this workspace is public, the app can read public data immediately after approval."}),x==="write"&&e.jsx("li",{children:"If you are not already a member, this connection will stay read-only. Ask an organization admin to grant write access, then reconnect the MCP client."}),x==="admin"&&e.jsx("li",{children:"If you are not already an admin or owner, elevated actions will stay blocked. Ask an organization owner to grant the required role, then reconnect the MCP client."}),x==="read"&&e.jsx("li",{children:"Public read access does not require membership."})]})]}),k&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:k}),!o&&e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Missing required query params: ",h.join(", ")]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(M,{type:"button",variant:"outline",onClick:()=>C(!1),disabled:n!==null||!o,children:n==="deny"?"Denying...":"Deny"}),e.jsx(M,{type:"button",onClick:()=>C(!0),disabled:n!==null||!o||d.length===0||m&&!_,children:n==="approve"?"Approving...":"Approve"})]})]})]})})}export{ce as component};
@@ -1,4 +1,4 @@
1
- import{r as s,aL as X,aI as me}from"./index-BUr8321-.js";function Lr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ge(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function nt(e){return"nodeType"in e}function k(e){var t,n;return e?ge(e)?e:nt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function rt(e){const{Document:t}=k(e);return e instanceof t}function Ee(e){return ge(e)?!1:e instanceof k(e).HTMLElement}function $t(e){return e instanceof k(e).SVGElement}function ve(e){return e?ge(e)?e.document:nt(e)?rt(e)?e:Ee(e)||$t(e)?e.ownerDocument:document:document:document}const re=Fe?s.useLayoutEffect:s.useEffect;function ot(e){const t=s.useRef(e);return re(()=>{t.current=e}),s.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function gn(){const e=s.useRef(null),t=s.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Se(e,t){t===void 0&&(t=[e]);const n=s.useRef(e);return re(()=>{n.current!==e&&(n.current=e)},t),n}function Me(e,t){const n=s.useRef();return s.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ke(e){const t=ot(e),n=s.useRef(null),r=s.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Qe(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let Ve={};function $e(e,t){return s.useMemo(()=>{if(t)return t;const n=Ve[e]==null?0:Ve[e]+1;return Ve[e]=n,e+"-"+n},[e,t])}function Xt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,l)=>{const a=Object.entries(l);for(const[c,u]of a){const f=i[c];f!=null&&(i[c]=f+e*u)}return i},{...t})}}const he=Xt(1),ze=Xt(-1);function vn(e){return"clientX"in e&&"clientY"in e}function jt(e){if(!e)return!1;const{KeyboardEvent:t}=k(e.target);return t&&e instanceof t}function pn(e){if(!e)return!1;const{TouchEvent:t}=k(e.target);return t&&e instanceof t}function Ze(e){if(pn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return vn(e)?{x:e.clientX,y:e.clientY}:null}const Rt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Rt.Translate.toString(e),Rt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Et="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bn(e){return e.matches(Et)?e:e.querySelector(Et)}const wn={display:"none"};function yn(e){let{id:t,value:n}=e;return X.createElement("div",{id:t,style:wn},n)}function mn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return X.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function xn(){const[e,t]=s.useState("");return{announce:s.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ut=s.createContext(null);function Dn(e){const t=s.useContext(Ut);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Cn(){const[e]=s.useState(()=>new Set),t=s.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[s.useCallback(r=>{let{type:o,event:i}=r;e.forEach(l=>{var a;return(a=l[o])==null?void 0:a.call(l,i)})},[e]),t]}const Sn={draggable:`
1
+ import{r as s,aO as X,aL as me}from"./index-DtRfQcRH.js";function Lr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ge(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function nt(e){return"nodeType"in e}function k(e){var t,n;return e?ge(e)?e:nt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function rt(e){const{Document:t}=k(e);return e instanceof t}function Ee(e){return ge(e)?!1:e instanceof k(e).HTMLElement}function $t(e){return e instanceof k(e).SVGElement}function ve(e){return e?ge(e)?e.document:nt(e)?rt(e)?e:Ee(e)||$t(e)?e.ownerDocument:document:document:document}const re=Fe?s.useLayoutEffect:s.useEffect;function ot(e){const t=s.useRef(e);return re(()=>{t.current=e}),s.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function gn(){const e=s.useRef(null),t=s.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Se(e,t){t===void 0&&(t=[e]);const n=s.useRef(e);return re(()=>{n.current!==e&&(n.current=e)},t),n}function Me(e,t){const n=s.useRef();return s.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ke(e){const t=ot(e),n=s.useRef(null),r=s.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Qe(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let Ve={};function $e(e,t){return s.useMemo(()=>{if(t)return t;const n=Ve[e]==null?0:Ve[e]+1;return Ve[e]=n,e+"-"+n},[e,t])}function Xt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,l)=>{const a=Object.entries(l);for(const[c,u]of a){const f=i[c];f!=null&&(i[c]=f+e*u)}return i},{...t})}}const he=Xt(1),ze=Xt(-1);function vn(e){return"clientX"in e&&"clientY"in e}function jt(e){if(!e)return!1;const{KeyboardEvent:t}=k(e.target);return t&&e instanceof t}function pn(e){if(!e)return!1;const{TouchEvent:t}=k(e.target);return t&&e instanceof t}function Ze(e){if(pn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return vn(e)?{x:e.clientX,y:e.clientY}:null}const Rt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Rt.Translate.toString(e),Rt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Et="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bn(e){return e.matches(Et)?e:e.querySelector(Et)}const wn={display:"none"};function yn(e){let{id:t,value:n}=e;return X.createElement("div",{id:t,style:wn},n)}function mn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return X.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function xn(){const[e,t]=s.useState("");return{announce:s.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ut=s.createContext(null);function Dn(e){const t=s.useContext(Ut);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Cn(){const[e]=s.useState(()=>new Set),t=s.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[s.useCallback(r=>{let{type:o,event:i}=r;e.forEach(l=>{var a;return(a=l[o])==null?void 0:a.call(l,i)})},[e]),t]}const Sn={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -1 +1 @@
1
- import{j as n,aV as t,a0 as c,a as r,bc as i,g2 as l,aT as m,g3 as x,L as d,g4 as C,g5 as u,cr as j}from"./index-BUr8321-.js";function p({owner:o,initialConnectorKey:e}){return n.jsx(t,{owner:o,children:a=>n.jsx(h,{ownerSlug:a.ownerSlug,organizationId:a.organizationId,initialConnectorKey:e})})}function h({ownerSlug:o,organizationId:e,initialConnectorKey:a}){const{data:s=[]}=r(e??"");return n.jsxs(i,{className:"flex flex-1 flex-col gap-6",children:[n.jsx(l,{breadcrumb:n.jsx(x,{crumbs:[n.jsx(d,{to:"/$owner/connectors",params:{owner:o},search:{},className:C,children:"Connectors"},"connectors")]}),icon:n.jsx(m.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."}),e?n.jsx(u,{ownerSlug:o,organizationId:e,connections:s,initialConnectorKey:a}):n.jsx("div",{className:"max-w-3xl",children:n.jsx(j,{rows:4})})]})}const L=()=>n.jsx(c,{});export{p as ConnectionsCreateRouteContent,L as component};
1
+ import{j as n,aY as t,a2 as c,a as r,bg as i,gg as l,aW as m,gh as x,L as d,gi as C,gj as u,fK as j}from"./index-DtRfQcRH.js";function p({owner:o,initialConnectorKey:e}){return n.jsx(t,{owner:o,children:a=>n.jsx(g,{ownerSlug:a.ownerSlug,organizationId:a.organizationId,initialConnectorKey:e})})}function g({ownerSlug:o,organizationId:e,initialConnectorKey:a}){const{data:s=[]}=r(e??"");return n.jsxs(i,{className:"flex flex-1 flex-col gap-6",children:[n.jsx(l,{breadcrumb:n.jsx(x,{crumbs:[n.jsx(d,{to:"/$owner/connectors",params:{owner:o},search:{},className:C,children:"Connectors"},"connectors")]}),icon:n.jsx(m.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."}),e?n.jsx(u,{ownerSlug:o,organizationId:e,connections:s,initialConnectorKey:a}):n.jsx("div",{className:"max-w-3xl",children:n.jsx(j,{rows:4})})]})}const f=()=>n.jsx(c,{});export{p as ConnectionsCreateRouteContent,f as component};
@@ -0,0 +1 @@
1
+ import{hZ as o,j as e}from"./index-DtRfQcRH.js";import{a}from"./agent-guardrails-route-0PsTrqMC.js";import"./model-selector-XC5CI2Et.js";import"./agent-subpage-shell-DtzoRy6N.js";import"./agent-loading-shells-BQLjzMPy.js";import"./agent-card-controls-bhTMPoVi.js";import"./switch-CxDXvPGE.js";function x(){const{owner:r,agentId:t}=o.useParams();return e.jsx(a,{owner:r,agentId:t})}export{x as component};
@@ -0,0 +1 @@
1
+ import{hX as r,j as e}from"./index-DtRfQcRH.js";import{a as m}from"./agent-skills-route-Cwq1QrhW.js";import"./agent-subpage-shell-DtzoRy6N.js";import"./agent-skill-context-s42Q4Wjo.js";import"./core.esm-C-eNiUAl.js";import"./skill-editor-D_W3QlRz.js";import"./agent-loading-shells-BQLjzMPy.js";import"./agent-card-controls-bhTMPoVi.js";import"./switch-CxDXvPGE.js";function c(){const{owner:t,agentId:o}=r.useParams();return e.jsx(m,{owner:t,agentId:o})}export{c as component};
@@ -0,0 +1,2 @@
1
+ import{r as i,j as e,bX as oe,bY as ie,bZ as ce,b_ as re,b$ as T,ad as ae,B as U,Z as Yt,a as xs,d1 as ps,cy as Zt,dD as gs,dE as fs,S as Ct,ac as b,al as D,aV as Ie,dF as Et,cU as vs,cW as ys,dG as js,cm as es,cX as _s,bB as Ot,dH as Ns,cv as st,cw as Ke,aR as tt,dI as yt,bA as ts,P as Je,cr as bs,ap as ks,ai as Ss,d3 as ws,dJ as Cs,dK as Es,dL as Os,dM as As,dN as Fs,ah as Ps,L as Ts,a3 as ss,dO as Ms,bz as Ls,bf as Rs,dP as At,dQ as Ds,dR as $s,cf as Is,dS as qs,dT as gt,s as Ks,dU as Ws,dV as Bs,dW as Us,dX as Vs,dY as zs,dZ as Qs,d_ as Gs,d$ as Js,e0 as Hs,bC as Xs,c1 as Ys}from"./index-DtRfQcRH.js";import{c as Zs}from"./cronstrue-C5yTgk5z.js";import{C as en,f as tn}from"./entity-options-utGBmFX0.js";import{S as sn}from"./switch-CxDXvPGE.js";import{a as nn,A as an}from"./device-automation-BIjs7DZJ.js";import{M as on}from"./model-selector-XC5CI2Et.js";import{b as cn}from"./skill-editor-D_W3QlRz.js";import{C as ft}from"./code-editor-BHiWR94J.js";import{u as rn,M as Ft,a as Pt,s as ln,o as dn,b as un,c as mn,d as hn,e as xn,v as pn,r as gn}from"./use-mention-search-CeTEE3oE.js";const Ze=[{value:"*/15 * * * *",label:"Every 15 minutes"},{value:"0 * * * *",label:"Every hour"},{value:"0 */6 * * *",label:"Every 6 hours"},{value:"0 9 * * *",label:"Daily at 9:00 AM"},{value:"0 18 * * *",label:"Daily at 6:00 PM"},{value:"0 9 * * 1-5",label:"Weekdays at 9:00 AM"},{value:"0 9 * * 1",label:"Weekly · Monday 9:00 AM"},{value:"0 9 1 * *",label:"Monthly · 1st at 9:00 AM"},{value:"custom",label:"Custom cron…"}];function fn(n){const t=n.trim();if(!t)return null;try{return Zs.toString(t,{throwExceptionOnParseError:!0})}catch{return null}}function vn({value:n,onChange:t,placeholder:s="No schedule",className:r}){const u=n??"",m=Ze.some(g=>g.value===u),[c,o]=i.useState(!m&&u!==""),l=g=>{g==="custom"?o(!0):(o(!1),t(g))},y=u?fn(u):null,S=u?e.jsx("p",{className:y?"text-xs text-muted-foreground":"text-xs text-destructive",children:y??"Not a valid cron expression."}):null;return!u&&!c?e.jsxs(oe,{onValueChange:l,children:[e.jsx(ie,{className:r??"w-full",children:e.jsx(ce,{placeholder:s})}),e.jsx(re,{children:Ze.map(g=>e.jsxs(T,{value:g.value,children:[g.label,g.value!=="custom"&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-mono",children:g.value})]},g.value))})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx(ae,{placeholder:"0 */6 * * *",value:u,onChange:g=>t(g.target.value),className:"font-mono text-sm flex-1"}):e.jsxs(oe,{value:u,onValueChange:l,children:[e.jsx(ie,{className:r??"w-full flex-1",children:e.jsx(ce,{children:Ze.find(g=>g.value===u)?.label??u})}),e.jsx(re,{children:Ze.map(g=>e.jsxs(T,{value:g.value,children:[g.label,g.value!=="custom"&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-mono",children:g.value})]},g.value))})]}),e.jsx(U,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0",onClick:()=>{o(!1),t("")},children:e.jsx(Yt,{className:"h-4 w-4"})})]}),S]})}const dt="__all_workspace_event_types__",yn=[],jn={};function Tt(n,t,s){const r=new Map;if(!t)for(const[m,c]of Object.entries(s??{}))r.set(m,{key:m,label:Ot(m),description:c.description});const u=[...n].filter(m=>!t||m.slug===t).sort((m,c)=>m.slug.localeCompare(c.slug));for(const m of u)for(const[c,o]of Object.entries(m.event_kinds??{})){const l=r.get(c);if(l){!l.description&&o.description&&(l.description=o.description),JSON.stringify(l.metadataSchema??null)!==JSON.stringify(o.metadataSchema??null)&&(l.metadataSchema=void 0);continue}r.set(c,{key:c,label:Ot(c),description:o.description,metadataSchema:o.metadataSchema})}return[...r.values()].sort((m,c)=>m.label.localeCompare(c.label))}function Mt(n){const t=n[0];if(!t)return;const s=u=>JSON.stringify(Object.keys(u?.properties??{}).sort()),r=s(t);return n.every(u=>s(u)===r)?t:void 0}function Lt(n,t,s){const r=new Set(Object.keys(t.properties??{}));return{...Object.fromEntries(Object.entries(n).filter(([u])=>!r.has(u))),...s}}function $e(n,t,s){return s==="steer"&&(n==="window"||t!=="reply_to_source")?"coalesce":s}function Qe(n,t){return n==="window"?"silent":t}function Rt(n){return Object.fromEntries(Object.entries(n).filter(([t])=>t==="resource_ref"||t==="resource_type"))}function Dt(n,t,s){const r=new Set(Object.keys(t?.properties??{})),u=new Set(s.flatMap(m=>Object.keys(m.filterSchema?.properties??{})));return Object.fromEntries(Object.entries(Ns(n)).filter(([m])=>m==="resource_ref"||m==="resource_type"||!u.has(m)||r.has(m)))}function _n({value:n,options:t,onChange:s}){return e.jsx("div",{className:"inline-flex rounded-md border bg-muted/30 p-0.5 text-sm",children:t.map(r=>e.jsx("button",{type:"button","aria-pressed":n===r.value,onClick:()=>s(r.value),className:D("rounded px-3 py-1 transition-colors",n===r.value?"bg-background text-foreground ":"text-muted-foreground hover:text-foreground"),children:r.label},r.value))})}function $t({events:n,selectedKeys:t,onToggle:s,ariaLabel:r="Events"}){const u=i.useId(),m=n.filter(o=>t.includes(o.key)).map(o=>o.label),c=m.length===0?"Choose events":m.length===1?m[0]:`${m.length} events selected`;return e.jsx(st,{contentClassName:"w-[var(--radix-popover-trigger-width)] min-w-[280px]",searchPlaceholder:"Filter events...",emptyText:"No events found.",trigger:o=>e.jsxs(U,{type:"button",variant:"outline",role:"combobox","aria-label":r,"aria-expanded":o,className:"w-full justify-between font-normal",children:[e.jsx("span",{className:D(m.length===0&&"text-muted-foreground"),children:c}),e.jsx(yt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:()=>n.map((o,l)=>{const y=t.includes(o.key),S=`${u}-${l}-state`;return e.jsxs(Ke,{value:`${o.label} ${o.key}`,onSelect:()=>s(o.key),"aria-label":o.label,"aria-describedby":S,className:"cursor-pointer",children:[e.jsx(tt,{className:D("mr-2 h-4 w-4",y?"opacity-100":"opacity-0")}),o.label,e.jsx("span",{id:S,className:"sr-only",children:y?"Selected":"Not selected"})]},o.key)})})}function Nn({organizationId:n,initialTrigger:t,onChange:s,allowedKinds:r,showSectionHeader:u=!0,fieldIdPrefix:m="automation-trigger-"}){const c=xs(n,{status:"active",limit:500}),o=ps(n),l=Zt({organizationId:n}),y=gs({organizationId:n}),S=c.data??[],g=o.data??[],$=l.data??yn,h=y.data??jn,j=i.useMemo(()=>$.filter(d=>d.organization_id===n),[$,n]),_=t?.kind==="event"&&t?.source==="workspace",w=_||t===void 0,L=r?.length?[...r]:["event","time","manual"],N=L.join("|"),W=(()=>{const d=t===null?"manual":t?.kind==="schedule"?"time":"event";return L.includes(d)?d:L[0]??"event"})(),[f,z]=i.useState(W),[Q,Ne]=i.useState(_?"workspace":typeof t?.connection_id=="number"?String(t.connection_id):t?.kind==="event"&&t.connector_key?"":"workspace"),k=Q==="workspace",F=k?"":Q,[p,V]=i.useState(typeof t?.entity_type=="string"?t.entity_type:""),xe=i.useMemo(()=>Array.isArray(t?.event_types)?t.event_types:[],[t]),[P,H]=i.useState(()=>xe.filter(d=>typeof d=="string")),[X,te]=i.useState(t?.match&&typeof t.match=="object"&&!Array.isArray(t.match)?t.match:{}),[be,Se]=i.useState(typeof t?.cron=="string"?t.cron:"0 9 * * 1-5"),le=typeof t?.timezone=="string"?t.timezone:void 0,[I,pe]=i.useState(t?.kind==="schedule"||w&&t?.execution!=="turn"||t?.execution==="window"?"window":"turn"),[G,Y]=i.useState(Qe(I,t?.output==="reply_to_source"?"reply_to_source":"silent")),[se,ne]=i.useState(t?.kind==="schedule"||w&&t?.active_run!=="queue"?"coalesce":$e(I,G,t?.active_run==="coalesce"||t?.active_run==="steer"?t.active_run:"queue")),[we,Oe]=i.useState(t?.skip_if_unchanged!==!1),[x,ge]=i.useState(!1);i.useEffect(()=>{const d=N.split("|");if(!d.includes(f)){const v=d[0]??"event";z(v),pe(v==="time"||v==="event"&&k?"window":"turn"),ne(v==="time"||v==="event"&&k?"coalesce":"queue"),Y("silent")}},[N,f,k]);const M=S.find(d=>String(d.id)===F),de=c.isLoading||o.isLoading,Z=l.isLoading,J=typeof t?.connector_key=="string"?t.connector_key:void 0,Ae=f==="event"&&!k&&t?.kind==="event"&&t?.source!=="workspace"&&typeof t.connection_id=="number"&&String(t.connection_id)===F&&!M,ve=f==="event"&&!k&&t?.kind==="event"&&t?.source!=="workspace"&&t.connection_id==null&&J!==void 0&&F==="",Fe=g.find(d=>d.key===(M?.connector_key??(ve?J:void 0))),ue=Fe?.automation_events??[],q=ue.filter(d=>P.includes(d.key)),ye=q[0],Te=j.find(d=>d.slug===p),Pe=[...j.filter(d=>Object.keys(d.event_kinds??{}).length>0||d.slug===p),...p&&!Te?[{slug:p,name:p}]:[]],me=i.useMemo(()=>Tt(j,p||void 0,h),[j,p,h]),Me=me.filter(d=>P.includes(d.key)),We=Me[0],fe=Mt(q.map(d=>d.filterSchema)),he=Mt(Me.map(d=>d.metadataSchema)),Be=!!(k&&p&&!Te),Le=Ae||ve,Ce=(f==="event"?k?P.length>0&&!Be:!!(P.length>0&&(F&&M||Le)):f==="time"?!!be.trim():!0)&&(f!=="event"||!fs(X));i.useEffect(()=>{let d;if(Ce&&f==="event"&&!k){const v=Dt(X,fe,Fe?.automation_events??[]);M||ve?d={kind:"event",source:"connector",connector_key:M?.connector_key??J,...M?{connection_id:Number(F)}:{},event_types:P,...Object.keys(v).length>0?{match:v}:{},execution:I,active_run:$e(I,G,se),output:Qe(I,G),skip_if_unchanged:we}:Ae&&(d=t?{...t,source:"connector"}:void 0)}else if(Ce&&f==="event"&&k){const v=Dt(X,he,me.map(C=>({filterSchema:C.metadataSchema})));d={kind:"event",source:"workspace",...p?{entity_type:p}:{},event_types:P,...Object.keys(v).length>0?{match:v}:{},execution:I,active_run:se==="queue"?"queue":"coalesce"}}else Ce&&f==="time"&&(d={kind:"schedule",cron:be.trim(),...le?{timezone:le}:{},execution:"window",active_run:"coalesce",skip_if_unchanged:we});s({ready:Ce,kind:f,trigger:d})},[se,F,M,be,Fe,P,I,X,f,J,le,t,k,s,G,Ce,fe,he,we,p,me,ve,Ae]);const at=d=>{const v=S.find(E=>String(E.id)===d),C=g.find(E=>E.key===v?.connector_key),ee=P.filter(E=>C?.automation_events?.some(De=>De.key===E)),A=C?.automation_events?.find(E=>E.key===ee[0]),je=v?.connector_key!==(M?.connector_key??J);if(Ne(d),H(ee),!A)te(Rt);else if(je){const E=A.defaults?.execution??"turn",De=A.defaults?.activeRun??"queue",ze=Qe(E,A.defaults?.output??"silent");te(Rt),pe(E),ne($e(E,ze,De)),Y(ze)}},ot=d=>{if(d==="workspace"){Ne("workspace"),H(v=>v.filter(C=>me.some(ee=>ee.key===C))),te({}),pe("window"),ne("coalesce"),Y("silent");return}at(d)},Ue=d=>{const v=P.includes(d)?P.filter(E=>E!==d):ue.map(E=>E.key).filter(E=>E===d||P.includes(E));if(H(v),v[0]===P[0])return;const C=ue.find(E=>E.key===v[0]),ee=C?.defaults?.execution??"turn",A=C?.defaults?.activeRun??"queue",je=Qe(ee,C?.defaults?.output??"silent");pe(ee),ne($e(ee,je,A)),Y(je)},Xe=d=>{const v=d===dt?"":d,C=j.find(A=>A.slug===v),ee=Tt(j,C?.slug,h);V(v),H(A=>A.filter(je=>ee.some(E=>E.key===je))),te({})},Ve=d=>{H(v=>v.includes(d)?v.filter(C=>C!==d):me.map(C=>C.key).filter(C=>C===d||v.includes(C)))},Re=[{value:"event",label:"Event"},{value:"time",label:"Schedule"},{value:"manual",label:"Manual"}].filter(d=>L.includes(d.value));return e.jsxs("div",{className:"space-y-4",children:[u?e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"When"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose what starts this Automation. Its goal and context stay reusable."})]}):null,Re.length>1?e.jsx(_n,{value:f,options:Re,onChange:d=>{z(d),pe(d==="time"||d==="event"&&k?"window":"turn"),ne(d==="time"||d==="event"&&k?"coalesce":"queue"),Y("silent")}}):null,f==="event"?de||k&&Z?e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ct,{className:"h-9 w-full"}),e.jsx(Ct,{className:"h-9 w-full"})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Source"}),e.jsx(en,{connections:S,value:Q,onValueChange:ot,disabled:Le,includeWorkspaceEvents:!0,ariaLabel:"Source",placeholder:"Choose a source"}),Ae?e.jsx("p",{className:"text-xs text-muted-foreground",children:"This shared connection is managed outside this organization. Other Automation fields can still be edited."}):ve?e.jsxs("p",{className:"text-xs text-muted-foreground",children:["This Automation listens across all"," ",String(t?.connector_key)," connections. Other Automation fields can still be edited."]}):null]}),k?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:me.length>1?"Events":"Event"}),me.length>0?e.jsx($t,{events:me,selectedKeys:P,onToggle:Ve}):e.jsx("div",{className:D(Ie,"px-3 py-2 text-sm text-muted-foreground"),children:p?"This entity type has no declared Automation events.":"This workspace has no declared Automation events."}),We?.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:We.description}):null,Be?e.jsxs("p",{className:"text-xs text-destructive",children:["This trigger filters on entity type “",p,"”, which no longer exists in this workspace. Clear the Entity type filter under Trigger options to save."]}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:"Only declared Automation outputs in the current workspace can trigger this Automation. Ordinary saved events remain data."})]}),he?e.jsx(Et,{schema:he,values:X,onValuesChange:d=>te(v=>Lt(v,he,d)),fieldIdPrefix:`${m}workspace-`},`${p||"workspace"}:${P.join(",")}`):null]}):M||ve?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:ue.length>1?"Events":"Event"}),ue.length?e.jsx($t,{events:ue,selectedKeys:P,onToggle:Ue}):e.jsx("div",{className:D(Ie,"px-3 py-2 text-sm text-muted-foreground"),children:"This connector has not published subscribable events."}),ye?.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:ye.description}):null]}),typeof X.resource_ref=="string"||fe?e.jsxs("div",{className:"space-y-3",children:[typeof X.resource_ref=="string"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Resource"}),e.jsx("div",{className:D(Ie,"px-3 py-2 text-sm"),children:X.resource_ref})]}):null,fe?e.jsx(Et,{schema:fe,values:X,onValuesChange:d=>te(v=>Lt(v,fe,d)),fieldIdPrefix:m},P.join(",")):null]}):null]}):Q?null:e.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose workspace events or a connected app as the source."})]}):f==="time"?e.jsx(vn,{value:be,onChange:Se}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Run this Automation explicitly from Lobu, the API, CLI, or MCP."}),f!=="manual"&&!Le?e.jsxs(vs,{open:x,onOpenChange:ge,children:[e.jsx(ys,{asChild:!0,children:e.jsxs(U,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 py-1 text-muted-foreground hover:bg-transparent hover:text-foreground",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm",children:[e.jsx(js,{className:"h-4 w-4"}),"Trigger options",e.jsxs("span",{className:"font-normal text-muted-foreground",children:["· ",I==="turn"?"Each event":"Window"," ·"," ",f==="time"?"Combine":k?se==="queue"?"Queue":"Combine":se==="queue"?"Queue":se==="coalesce"?"Combine":"Update current run",f==="event"&&!k?` · ${I==="turn"&&G==="reply_to_source"?"Reply":"Save in Lobu"}`:""]})]}),e.jsx(es,{className:D("h-4 w-4 transition-transform",x&&"rotate-180")})]})}),e.jsxs(_s,{className:"space-y-4 pt-3",children:[f==="event"&&k?e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Entity type filter"}),e.jsxs(oe,{value:p||dt,onValueChange:Xe,children:[e.jsx(ie,{"aria-label":"Entity type filter",children:e.jsx(ce,{})}),e.jsxs(re,{children:[e.jsx(T,{value:dt,children:"All event types"}),Pe.map(d=>e.jsx(T,{value:d.slug,children:d.name},d.slug))]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Limit selected events to outputs linked to this entity type."})]}):null,f==="event"?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Run"}),e.jsxs(oe,{value:I,onValueChange:d=>{const v=d,C=Qe(v,G);pe(v),Y(C),ne($e(v,C,se))},children:[e.jsx(ie,{children:e.jsx(ce,{})}),e.jsxs(re,{children:[e.jsx(T,{value:"turn",children:"Start a run for each event"}),e.jsx(T,{value:"window",children:"Batch events into a window"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"When busy"}),e.jsxs(oe,{value:se,onValueChange:d=>ne(d),children:[e.jsx(ie,{children:e.jsx(ce,{})}),e.jsxs(re,{children:[e.jsx(T,{value:"queue",children:"Queue"}),e.jsx(T,{value:"coalesce",children:"Combine waiting events"}),!k&&I==="turn"&&G==="reply_to_source"&&ye?.capabilities?.steering?e.jsx(T,{value:"steer",children:"Update the current run"}):null]})]})]})]}):null,I==="window"&&(f==="time"||!k)?e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Skip unchanged windows"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No source changes means no agent run or LLM call."})]}),e.jsx(sn,{"aria-label":"Skip unchanged windows",checked:we,onCheckedChange:Oe})]}):null,f==="event"&&!k&&I==="turn"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Result"}),e.jsxs(oe,{value:G,onValueChange:d=>{const v=d;Y(v),ne($e(I,v,se))},children:[e.jsx(ie,{children:e.jsx(ce,{})}),e.jsxs(re,{children:[ye?.capabilities?.replyToSource?e.jsx(T,{value:"reply_to_source",children:"Reply where it happened"}):null,e.jsx(T,{value:"silent",children:"Save in Lobu"})]})]}),ye?.capabilities?.replyToSource?e.jsx("p",{className:"text-xs text-muted-foreground",children:"Messages matching this trigger run the Automation; anything else in the conversation stays with the connected agent."}):null]}):null]})]}):null]})}const bn=16;function qe(){return crypto.randomUUID()}function kn(n){return n===void 0?[{key:qe(),initial:void 0}]:n.length===0?[{key:qe(),initial:null}]:n.map(t=>({key:qe(),initial:t}))}function ns(n){return n?n.kind==="time"||n.trigger?.kind==="schedule":!1}function Sn(n,t){return n?n.ready===t.ready&&n.kind===t.kind&&JSON.stringify(n.trigger)===JSON.stringify(t.trigger):!1}function wn(n,t){const s=n.map(o=>t[o.key]??{ready:!1,kind:"event"});if(!(n.length>1)&&s[0]?.kind==="manual")return{ready:s[0].ready,triggers:[]};const u=s.filter(ns).length;return{ready:!s.some(o=>o.kind==="manual")&&u<=1&&s.length>0&&s.every(o=>o.ready&&o.trigger),triggers:s.filter(o=>o.trigger).map(o=>o.trigger)}}function na({organizationId:n,initialTriggers:t,onChange:s}){const r=i.useId(),[u,m]=i.useState(()=>kn(t)),[c,o]=i.useState({}),l=i.useRef("");i.useEffect(()=>{const h=wn(u,c),j=JSON.stringify(h);j!==l.current&&(l.current=j,s(h))},[u,c,s]);const y=u.find(h=>ns(c[h.key]))?.key??u.find(h=>h.initial&&typeof h.initial=="object"&&h.initial.kind==="schedule"&&!c[h.key])?.key??null,S=i.useCallback((h,j)=>{o(_=>Sn(_[h],j)?_:{..._,[h]:j})},[]),g=()=>{const h=u[0],j=h?c[h.key]:void 0;if(u.length===1&&(j?.kind==="manual"||h?.initial===null)){const _=qe();o({}),m([{key:_,initial:void 0}]);return}m(_=>[..._,{key:qe(),initial:void 0}])},$=h=>{if(u.length<=1){const j=qe();o({}),m([{key:j,initial:null}]);return}o(j=>{const _={...j};return delete _[h],_}),m(j=>j.filter(_=>_.key!==h))};return e.jsxs("section",{className:"space-y-4","aria-labelledby":`${r}-heading`,children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{id:`${r}-heading`,className:"text-sm font-medium",children:"When"}),u.length>1?e.jsx("p",{className:"text-xs text-muted-foreground",children:"Each trigger can start this Automation independently (OR). At most one schedule. If several match the same event, the first listed wins for run options."}):null]}),e.jsx("div",{className:"space-y-3",children:u.map((h,j)=>{const _=u.length>1,w=_?y&&y!==h.key?["event"]:["event","time"]:["event","time","manual"],L=c[h.key],N=_||(L?L.kind!=="manual":h.initial!==null);return e.jsxs("div",{className:D("space-y-3 rounded-lg border bg-card/40 p-3",_&&"relative"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:_?`Trigger ${j+1}`:"Trigger"}),N?e.jsx(U,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive","aria-label":_?`Remove trigger ${j+1}`:"Clear trigger",onClick:()=>$(h.key),children:e.jsx(ts,{className:"h-3.5 w-3.5"})}):null]}),e.jsx(Cn,{slotKey:h.key,organizationId:n,initial:h.initial,kinds:w,fieldIdPrefix:`${r}-${h.key}-`,onChange:S})]},h.key)})}),e.jsxs(U,{type:"button",variant:"outline",size:"sm",className:"w-full sm:w-auto",onClick:g,disabled:u.length>=bn,children:[e.jsx(Je,{className:"mr-1.5 h-3.5 w-3.5"}),"Add another trigger"]})]})}function Cn({slotKey:n,organizationId:t,initial:s,kinds:r,fieldIdPrefix:u,onChange:m}){const c=i.useCallback(o=>m(n,o),[m,n]);return e.jsx(Nn,{organizationId:t,initialTrigger:s,allowedKinds:r,showSectionHeader:!1,fieldIdPrefix:u,onChange:c})}const It={agents:!0,lobuEmbedded:!1};function En(){const{data:n}=bs({queryKey:["features"],queryFn:async()=>{const t=await ks(`${Ss}/api/features`);return t.ok?t.json():It},staleTime:3e4,refetchInterval:6e4});return n??It}const qt=["slack","imessage"],ut="__none__";function Ge(n){return`${n.connection_id}:${n.feed_key}`}function On(n){const t=n.indexOf(":");if(t<=0)return null;const s=Number(n.slice(0,t)),r=n.slice(t+1);return!Number.isSafeInteger(s)||s<=0||!r?null:{connection_id:s,channel_id:r}}function mt(n){return n?`${n.connection_id}:${n.channel_id}`:""}function et(n){return`${n.display_name||n.feed_key} (${n.feed_key})`}function An({organizationId:n,agentId:t,value:s,onChange:r,disabled:u=!1,automationName:m,onPendingChange:c}){const{data:o=[],isLoading:l}=ws(n),y=mt(s),[S,g]=i.useState(null),[$,h]=i.useState(!1),j=i.useRef(t),_=i.useMemo(()=>o.filter(p=>p.store==="channel_messages"&&p.target_agent_id===t&&qt.includes(p.connector_key)),[o,t]);i.useEffect(()=>{if(j.current===t||(j.current=t,g(null),h(!1),s==null))return;const p=mt(s);if(p==="")return;o.some(xe=>xe.store==="channel_messages"&&xe.target_agent_id===t&&qt.includes(xe.connector_key)&&Ge(xe)===p)||r(null)},[t,o,s,r]);const w=S??y,L=w===""?ut:w,N=_.find(p=>Ge(p)===w),W=S!==null&&S!==""&&S!==y;i.useEffect(()=>{c?.(W)},[W,c]);const f=N??(S?void 0:_.find(p=>Ge(p)===y)),z=p=>{const V=p===ut?"":p;if(V===""){g(null),h(!1),r(null);return}if(V===y){g(null),h(!1);return}g(V),h(!1)},Q=p=>{if(h(p),p&&S){const V=On(S);V&&(g(null),r(V))}else!p&&S&&g(null)},k=(s&&mt(s)!==""?s:void 0)??(N?{connection_id:N.connection_id,channel_id:N.feed_key}:void 0),F=(m??"").trim()||"This automation";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:"automation-delivery-target",children:["Digest destination"," ",e.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"(optional)"})]}),t?e.jsxs(oe,{value:L,onValueChange:z,disabled:u||l,children:[e.jsx(ie,{id:"automation-delivery-target",className:"font-mono text-sm",children:e.jsx(ce,{placeholder:l?"Loading bound channels…":_.length===0?"No bound Slack or iMessage channels":"No digest — runs stay silent"})}),e.jsxs(re,{children:[e.jsx(T,{value:ut,children:"No digest — runs stay silent"}),_.map(p=>e.jsxs(T,{value:Ge(p),children:[et(p)," · ",p.connector_key]},Ge(p)))]})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a managed agent first — only channels bound to that agent can receive digests."}),t&&!l&&_.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No Slack or iMessage channels are bound to this agent yet. Link a private channel first, then select it here."}):null,W&&N?e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:$,onChange:p=>Q(p.target.checked),className:"mt-0.5","aria-label":`Confirm digest delivery to ${et(N)}`}),e.jsxs("span",{className:"text-muted-foreground",children:["I confirm posting material-change digests to"," ",e.jsx("span",{className:"font-medium text-foreground",children:et(N)}),". Destination changes are audited."]})]}):null,f||k?e.jsxs("div",{className:D(Ie,"space-y-1.5 px-3 py-2"),children:[e.jsxs("p",{className:"text-xs font-medium",children:["Digest preview →"," ",e.jsx("span",{className:"font-mono font-normal",children:f?`${f.connector_key} ${et(f)} · connection ${f.connection_id}`:`${k?.channel_id} · connection ${k?.connection_id}`})]}),e.jsxs("p",{className:"font-mono text-xs",children:[F," applied 2 new + 1 updated"]}),e.jsx("p",{className:"whitespace-pre-line font-mono text-xs text-muted-foreground",children:`+ Example task (#12)
2
+ ~ Follow-up item (#34)`}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sends only after a successful run with material changes. Runs with zero changes send nothing. Retries reuse the same notification and delivery receipts dedupe channel posts, but provider acceptance with a lost receipt can still duplicate."})]}):null]})}const Kt=4096;function Fn({open:n,onOpenChange:t,initial:s,onSubmit:r}){const[u,m]=i.useState(""),[c,o]=i.useState(""),[l,y]=i.useState(null);i.useEffect(()=>{n&&(m(s?.name??""),o(s?.query??""),y(null))},[n,s]);const S=()=>{const $=u.trim(),h=c.trim();if(!$){y("Give the SQL source a name.");return}if(!h){y("Enter a query.");return}if(h.length>Kt){y(`Query is too long (${h.length} chars, max ${Kt}).`);return}r({name:$,query:h}),t(!1)},g=!!s;return e.jsx(Cs,{open:n,onOpenChange:t,children:e.jsxs(Es,{className:"max-w-2xl",children:[e.jsxs(Os,{children:[e.jsx(As,{children:g?"Edit SQL source":"SQL source"}),e.jsx(Fs,{children:"Write a query the automation runs each period. It becomes a reference in the prompt — the query travels with the chip."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"sql-source-name",children:"Name"}),e.jsx(ae,{id:"sql-source-name",value:u,onChange:$=>m($.target.value),placeholder:"recent_cancellations",autoFocus:!g}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The output-field name this source fills."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"sql-source-query",children:"Query"}),e.jsx(ft,{value:c,onChange:o,language:"sql",placeholder:"SELECT id, payload_text, occurred_at FROM events ORDER BY occurred_at DESC",minHeight:"160px"})]}),l?e.jsx("p",{className:"text-sm text-destructive",children:l}):null]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(U,{onClick:S,children:g?"Save":"Add source"})]})]})})}const Pn=["skill","feed","connection","connector","metric","entity_type"];function Tn({value:n,onChange:t,library:s,pinned:r,required:u,error:m,owner:c,agentId:o,sources:l,onAddSources:y}){const S=rn(Pn,Ft,{skills:s,skillAgentId:o||null}),g=i.useRef(null),[$,h]=i.useState(null),j=i.useMemo(()=>{if(!l)return[];const N=new Set(l.map(W=>W.query.trim()));return Pt(n).filter(W=>!N.has(W.query.trim()))},[n,l]),_=ln(n),w=dn(r.filter(N=>_.includes(N.name)),s),L=s.length>0;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs(b,{htmlFor:"automation-prompt",children:["Instructions"," ",u?e.jsx("span",{className:"text-destructive",children:"*"}):e.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"(optional)"})]}),_.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[_.length,"/",Ft," skills"]}):null]}),e.jsx("div",{className:"rounded-lg border bg-background focus-within:ring-1 focus-within:ring-ring",children:e.jsx(un,{value:n,onChange:t,onSubmit:()=>{},submitOnEnter:!1,searchRefs:S,handleRef:g,onSqlRequest:()=>h({}),onSqlEdit:(N,W)=>h({initial:N,pos:W}),placeholder:L?"What should this Automation do? Type @ to pull in a skill or a data source.":"What should this Automation do? Type @ to pull in a data source.",className:"[&_.ProseMirror]:min-h-[7rem] [&_.ProseMirror]:max-h-72 [&_.ProseMirror]:overflow-y-auto"})}),e.jsx(Fn,{open:$!==null,onOpenChange:N=>{N||h(null)},initial:$?.initial,onSubmit:N=>{g.current?.insertSql(N,$?.pos),h(null)}}),j.length>0&&y?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-lg border border-dashed p-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.length===1?`"${j[0]?.name}" is referenced in the instructions but is not a source on this Automation.`:`${j.length} references in the instructions are not sources on this Automation.`," ","Editing an Automation does not add them automatically."]}),e.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:()=>y(Pt(n,l)),children:j.length===1?"Add as a source":"Add as sources"})]}):null,_.length>0?e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:_.map(N=>{const W=w.includes(N),f=!s.some(z=>z.name===N);return e.jsxs(Ps,{variant:f?"destructive":"secondary",className:"font-normal",children:[N,f?" · unavailable":W?" · newer text":null]},N)})}):null,w.length>0?e.jsxs("p",{className:"rounded-lg border border-dashed p-3 text-xs text-muted-foreground",children:[w.length===1?`"${w[0]}" has been edited since this Automation pinned it.`:`${w.length} skills have been edited since this Automation pinned them.`," ","This Automation keeps running the pinned text until you save it again."]}):null,m?e.jsx("p",{className:"text-xs text-destructive",children:m}):null,!L&&o?e.jsxs("p",{className:"text-xs text-muted-foreground",children:["This agent has no skills yet."," ",e.jsx(Ts,{to:"/$owner/agents/$agentId/skills",params:{owner:c,agentId:o},className:"font-medium text-foreground underline underline-offset-2",children:"Add one"})," ","to reuse instructions across Automations."]}):m?null:e.jsx("p",{className:"text-xs text-muted-foreground",children:L?"Type @ to pull in a skill, a feed, connection, connector, metric, entity type, or a SQL query. Skill text is saved with this version, so later edits to the skill do not change this Automation until you update it.":"Type @ to pull in a feed, connection, connector, metric, entity type, or a SQL query this Automation should read."})]})}const Mn=["connection","connector","feed","metric","entity_type"];function Ln({sources:n,onChange:t,disabled:s}){const{currentOwner:r,resolvedOrganizationId:u}=ss(),[m,c]=i.useState(""),{refs:o}=mn({owner:r,organizationId:u,kinds:Mn,query:m,limitPerKind:10});return e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Sources"}),n.length>0?e.jsx("ul",{className:"space-y-2",children:n.map(l=>e.jsxs("li",{className:"flex items-start gap-2 rounded-lg border bg-background p-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-mono text-xs font-medium",children:l.name}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:l.query})]}),e.jsx(U,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0","aria-label":`Remove source ${l.name}`,disabled:s,onClick:()=>t(n.filter(y=>y.query!==l.query)),children:e.jsx(Yt,{className:"h-3.5 w-3.5"})})]},l.query))}):null,e.jsx("div",{className:"flex gap-2",children:e.jsx(st,{searchPlaceholder:"Search feeds, connections, metrics…",emptyText:"No matching reference.",onQueryChange:c,trigger:()=>e.jsxs(U,{type:"button",variant:"outline",size:"sm",disabled:s,children:[e.jsx(Je,{className:"mr-2 h-3.5 w-3.5"}),"Add source"]}),children:l=>o.map(y=>e.jsxs(Ke,{value:`${y.label} ${y.kind}`,onSelect:()=>{t(hn(y,n)),l()},children:[e.jsx("span",{className:"truncate text-sm",children:y.label}),e.jsx("span",{className:"ml-2 shrink-0 text-xs text-muted-foreground",children:y.kind})]},`${y.kind}:${y.id}`))})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Data handed to the agent alongside its instructions, and what change detection is measured against. Editing an Automation does not re-read the instructions for these — this list is what runs. To add a SQL source, write it with @ in the instructions above. Automation-owned; skills never add or remove sources."})]})}function Rn({organizationId:n,value:t,onChange:s,className:r}){const{data:u=[]}=Ms(n),m=tn(u),c=m.find(o=>o.id===t);return e.jsx(st,{contentClassName:"w-[300px]",searchPlaceholder:"Search entities...",emptyText:"No entities found.",trigger:o=>e.jsxs(U,{variant:"outline",role:"combobox","aria-expanded":o,className:D("w-full justify-between",r),children:[c?`${c.name} (${c.entityType})`:"All workspace",e.jsx(yt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:o=>e.jsxs(e.Fragment,{children:[e.jsxs(Ke,{value:"all workspace",onSelect:()=>{s(void 0),o()},className:"cursor-pointer",children:[e.jsx(tt,{className:D("mr-2 h-4 w-4",t===void 0?"opacity-100":"opacity-0")}),e.jsx("span",{children:"All workspace"})]}),m.map(l=>e.jsxs(Ke,{value:`${l.name} ${l.entityType}`,onSelect:()=>{s(l.id),o()},className:"cursor-pointer",children:[e.jsx(tt,{className:D("mr-2 h-4 w-4",t===l.id?"opacity-100":"opacity-0")}),e.jsxs("span",{children:[l.name," ",e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",l.entityType,")"]})]})]},l.id))]})})}function vt(n){if(Array.isArray(n))return n;if(typeof n=="string"&&n.startsWith("{")&&n.endsWith("}")){const t=n.slice(1,-1);return t?t.split(",").map(s=>s.trim()):[]}return[]}const Dn=nn.map(n=>({value:n,label:an[n]})),Wt=[{value:"agent",label:"Agent",hint:"An agent reads the window and follows your instructions."},{value:"code",label:"Code",hint:"A deterministic script processes each completed window."},{value:"both",label:"Agent + code",hint:"An agent extracts per your instructions, then the script runs."}];function Bt(n){const t=!!(n?.prompt?.trim()||n?.skills?.some(r=>r.content.trim())),s=!!n?.reaction_script?.trim();return t&&s?"both":s?"code":"agent"}const $n=["text","number","date","boolean","json"],In=[{value:"key",label:"Key"},{value:"plain",label:"Plain"}],ht=[{value:"plan",label:"Plan first"},{value:"auto",label:"Auto"},{value:"acceptEdits",label:"Accept edits"},{value:"dontAsk",label:"Don't ask"},{value:"bypassPermissions",label:"Bypass permissions"}];let Ut=0;function qn(){return Ut+=1,`field-${Ut}`}function as(n={}){return{id:qn(),name:n.name??"",type:n.type??"text",role:n.role??"plain"}}function He(n){return n.trim().toLowerCase().replace(/[^a-z0-9_]+/g,"_").replace(/^_+|_+$/g,"")}function Kn(n){return n?Object.keys(n).every(t=>["entity_type","entity_path","key_fields","key_output_field"].includes(t)):!0}function Vt(n){return n?Kn(n.keying_config)?"fields":"json":"fields"}function zt(n){const t=n?.keying_config?.entity_type;return typeof t=="string"?t:""}function Qt(n){const t=n?.keying_config?.entity_path;return typeof t=="string"&&t.trim()?t:"$"}function Gt(n){const t=new Map,s=Array.isArray(n?.keying_config?.key_fields)?n?.keying_config?.key_fields:[];for(const r of s){if(typeof r!="string")continue;const u=He(r);u&&t.set(u,as({name:u,role:"key"}))}return Array.from(t.values())}function _e(n,t){const s=n?.execution_config?.[t];return typeof s=="number"||typeof s=="string"?String(s):""}function Jt(n,t,s){const r=n?.execution_config?.[t];return typeof r=="string"&&s.includes(r)?r:""}function xt(n,t){const s=n.trim();if(!s)return{};const r=Number(s);return Number.isFinite(r)?{value:r}:{error:`${t} must be a number.`}}function Ht({entityType:n,entityPath:t,fields:s}){const u=s.map(o=>({...o,name:He(o.name)})).filter(o=>o.name).filter(o=>o.role==="key").map(o=>o.name),m=He(n),c=t.trim()||"$";return u.length>0&&!m?{error:"Key fields need an output entity type."}:(u.length>0,{keyingConfig:u.length>0?{entity_type:m,entity_path:c,key_fields:u,key_output_field:`${m}_key`}:void 0})}function Wn(n,t){return e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:n}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t})]})}function Xt(n){return!!(n?.keying_config||n?.reactions_guidance||n?.model_config||n?.execution_config||n?.sources?.length||vt(n?.tags).length)}function Bn({organizationId:n,entityId:t,prefill:s,onSubmit:r,isSubmitting:u,error:m,isEditing:c,onCancel:o,triggerFields:l,submitLabel:y="Create Automation",submitDisabled:S=!1,triggers:g}){const{lobuEmbedded:$}=En(),{currentOwner:h}=ss(),{data:j=[]}=Ls(),{data:_=[]}=Rs(),[w,L]=i.useState(s?.managed_agent_id??""),N=!!s?.managed_agent_id&&!c,[W,f]=i.useState(s?.delivery_target??null),[z,Q]=i.useState(!1),[Ne,k]=i.useState(s?.device_worker_id??""),[F,p]=i.useState(s?.device_worker_id?"device":"agent"),[V,xe]=i.useState(s?.agent_kind??""),{data:P=[]}=Zt({organizationId:n}),[H,X]=i.useState(s?.name??""),[te,be]=i.useState(s?.slug??""),[Se,le]=i.useState(!!s?.slug),[I,pe]=i.useState(s?.description??""),[G,Y]=i.useState(s?.prompt??""),[se,ne]=i.useState(!1),we=s?.skills??[],[Oe,x]=i.useState(s?.sources??[]),[ge,M]=i.useState(s?.entity_id??t),[de,Z]=i.useState(s?.reaction_script??""),[J,Ae]=i.useState(()=>Bt(s)),[ve,Fe]=i.useState(s?.keying_config?JSON.stringify(s.keying_config,null,2):""),[ue,q]=i.useState(null),[ye,Te]=i.useState(()=>Vt(s)),[Pe,me]=i.useState(()=>zt(s)),[Me,We]=i.useState(()=>Qt(s)),[fe,he]=i.useState(()=>Gt(s)),[Be,Le]=i.useState(s?.reactions_guidance??""),[nt,Ce]=i.useState(()=>_e(s,"timeout_seconds")),[at,ot]=i.useState(()=>_e(s,"max_budget_usd")),[Ue,Xe]=i.useState(()=>_e(s,"model")),[Ve,it]=i.useState(()=>Jt(s,"permission_mode",ht.map(a=>a.value))),[Re,d]=i.useState(()=>_e(s,"effort")),[v,C]=i.useState(()=>_e(s,"finalize_nudges")),[ee,A]=i.useState(null),[je,E]=i.useState(vt(s?.tags).join(", ")),[De,ze]=i.useState(""),[ct,jt]=i.useState(!!(c||Xt(s)));i.useEffect(()=>{s&&(X(s.name??""),be(s.slug??""),le(!!s.slug),pe(s.description??""),Y(s.prompt??""),ne(!1),x(s.sources??[]),M(s.entity_id??t),k(s.device_worker_id??""),p(s.device_worker_id?"device":"agent"),xe(s.agent_kind??""),Z(s.reaction_script??""),Ae(Bt(s)),Fe(s.keying_config?JSON.stringify(s.keying_config,null,2):""),q(null),Te(Vt(s)),me(zt(s)),We(Qt(s)),he(Gt(s)),Le(s.reactions_guidance??""),Ce(_e(s,"timeout_seconds")),ot(_e(s,"max_budget_usd")),Xe(_e(s,"model")),it(Jt(s,"permission_mode",ht.map(a=>a.value))),d(_e(s,"effort")),C(_e(s,"finalize_nudges")),A(null),E(vt(s.tags).join(", ")),ze(""),L(s.managed_agent_id??""),f(s.delivery_target??null),jt(!!(c||Xt(s))))},[s,t,c]);const os=Se?te:At(H),{data:is}=Ds(w||null),{data:cs}=$s(w||null,{enabled:!!w}),rt=cn(is??null,cs?.catalog??[]),rs=xn(g),lt=de.trim().length>0,Ye=!c&&J==="code"?"":G,ls=!c&&J==="agent"?void 0:de.trim()||void 0,_t=(c||J==="code")&&lt,Nt=pn(Ye,rt,g,_t),ds=se||Ye.trim()!==""?Nt:null,bt=gn(Ye,rt),kt=!c&&J!=="agent",St=!!H.trim()&&!Nt&&(!kt||lt)&&!z,us=rs&&!_t&&bt.length===0,ms=()=>{if(!St)return;let a;if(ye==="fields"){const ke=Ht({entityType:Pe,entityPath:Me,fields:fe});if(ke.error){q(ke.error);return}a=ke.keyingConfig,q(null)}else{if(ve.trim())try{const ke=JSON.parse(ve);if(typeof ke!="object"||Array.isArray(ke)){q("Keying config must be a JSON object.");return}a=ke}catch{q("Invalid JSON. Please check the syntax.");return}q(null)}const O=xt(nt,"Timeout");if(O.error){A(O.error);return}if(O.value!==void 0&&(!Number.isInteger(O.value)||O.value<1)){A("Timeout must be a whole number greater than 0.");return}const K=xt(at,"Budget");if(K.error){A(K.error);return}if(K.value!==void 0&&K.value<0){A("Budget cannot be negative.");return}const R=xt(v,"Finalize nudges");if(R.error){A(R.error);return}if(R.value!==void 0&&(!Number.isInteger(R.value)||R.value<0||R.value>5)){A("Finalize nudges must be a whole number from 0 to 5.");return}const Ee={...O.value!==void 0?{timeout_seconds:O.value}:{},...K.value!==void 0?{max_budget_usd:K.value}:{},...Ue.trim()?{model:Ue.trim()}:{},...Ve?{permission_mode:Ve}:{},...Re.trim()?{effort:Re.trim()}:{},...R.value!==void 0?{finalize_nudges:R.value}:{}},B=Object.keys(Ee).length>0||c?Ee:void 0;A(null);const hs=je.trim()?je.split(",").map(ke=>ke.trim()).filter(Boolean):void 0;r({slug:os,name:H.trim(),description:I.trim()||void 0,prompt:Ye,skills:bt,entity_id:ge,sources:Oe,reaction_script:ls,keying_config:a,reactions_guidance:Be.trim()||void 0,execution_config:B,tags:hs,change_notes:De.trim()||void 0,managed_agent_id:F==="agent"&&w.trim()||null,device_worker_id:F==="device"&&Ne.trim()||null,agent_kind:F==="device"&&V.trim()||null,delivery_target:W})},wt=e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:"scratch-reaction",children:["Reaction Script"," ",kt?e.jsx("span",{className:"text-destructive",children:"*"}):e.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"(optional)"})]}),e.jsx(ft,{value:de,onChange:Z,language:"typescript",placeholder:"export default async function reaction(ctx) { ... }",minHeight:"120px"}),c?null:e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Runs deterministically on every completed window, after agent extraction. Declare an ",e.jsx("code",{children:"input"})," export to set the window's extraction contract."]})]});return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs(b,{htmlFor:"scratch-name",children:["Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),!c&&e.jsx("button",{type:"button",onClick:()=>le(!Se),className:"text-xs text-muted-foreground hover:text-foreground",children:Se?"Use automatic slug":"Customize slug"})]}),e.jsx(ae,{id:"scratch-name",value:H,onChange:a=>X(a.target.value),placeholder:"e.g., Escalation signals"}),!c&&Se?e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-slug",children:"Slug"}),e.jsx(ae,{id:"scratch-slug",value:te,onChange:a=>be(a.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:At(H)||"custom-slug"})]}):null]})}),c?null:e.jsxs("fieldset",{className:"space-y-2",children:[e.jsx("legend",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"How does this run?"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Wt.map(a=>e.jsx("button",{type:"button","aria-pressed":J===a.value,onClick:()=>Ae(a.value),className:D("rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",J===a.value?"bg-secondary text-secondary-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:a.label},a.value))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:Wt.find(a=>a.value===J)?.hint})]}),c||J!=="code"?e.jsx(Tn,{value:G,onChange:a=>{ne(!0),Y(a)},library:rt,pinned:we,required:us,error:ds,owner:h??"",agentId:w,sources:c?Oe:void 0,onAddSources:c?x:void 0}):null,!c&&J!=="agent"?wt:null,c?e.jsx(Ln,{sources:Oe,onChange:x,disabled:u}):null,e.jsx("div",{className:"space-y-4",children:l}),e.jsx(An,{organizationId:n,agentId:F==="agent"?w.trim():"",value:W,onChange:f,disabled:u,automationName:H,onPendingChange:Q}),z?e.jsx("p",{className:"text-xs text-destructive",children:"Confirm the digest destination above before saving — an unconfirmed destination is not sent."}):null,e.jsxs(U,{type:"button",variant:"ghost",className:"w-full justify-between px-0 text-muted-foreground hover:bg-transparent hover:text-foreground","aria-expanded":ct,"aria-controls":"automation-advanced-settings",onClick:()=>jt(a=>!a),children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Is,{className:"h-4 w-4"}),"Advanced settings"]}),e.jsx(es,{className:D("h-4 w-4 transition-transform",ct&&"rotate-180")})]}),e.jsxs("div",{id:"automation-advanced-settings",className:D("space-y-4",!ct&&"hidden"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-description",children:"Description"}),e.jsx(ae,{id:"scratch-description",value:I,onChange:a=>pe(a.target.value),placeholder:"What this automation does"})]}),!t&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Entity scope"}),e.jsx(Rn,{organizationId:n,value:ge,onChange:M}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Limit this automation to one workspace entity."})]}),c?wt:null,e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(b,{children:"Output fields"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Key fields become stable entity keys."})]}),e.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(ye==="fields"){const a=Ht({entityType:Pe,entityPath:Me,fields:fe});if(a.error){q(a.error);return}Fe(a.keyingConfig?JSON.stringify(a.keyingConfig,null,2):""),Te("json")}else Te("fields");q(null)},children:ye==="fields"?"Edit JSON":"Use fields"})]}),ye==="fields"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-output-entity-type",children:"Output entity type"}),e.jsx(st,{contentClassName:"w-[320px]",searchPlaceholder:"Search or type a new type…",emptyText:"Type a name to create a new entity type.",trigger:a=>e.jsxs(U,{type:"button",variant:"outline",role:"combobox","aria-expanded":a,id:"scratch-output-entity-type",className:"w-full justify-between font-mono text-sm font-normal",children:[e.jsx("span",{className:D("truncate",!Pe&&"text-muted-foreground"),children:Pe||"Select entity type"}),e.jsx(yt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:(a,O)=>{const K=He(O),R=P.filter(B=>!B.backing_sql),Ee=R.some(B=>B.slug===K);return e.jsxs(e.Fragment,{children:[R.map(B=>e.jsxs(Ke,{value:`${B.name??B.slug} ${B.slug}`,onSelect:()=>{me(B.slug),q(null),a()},className:"cursor-pointer",children:[e.jsx(tt,{className:D("mr-2 h-4 w-4",Pe===B.slug?"opacity-100":"opacity-0")}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-mono text-sm",children:B.slug}),B.name&&B.name!==B.slug&&e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:B.name})]})]},B.slug)),K&&!Ee&&e.jsxs(Ke,{value:O,onSelect:()=>{me(K),q(null),a()},className:"cursor-pointer",children:[e.jsx(Je,{className:"mr-2 h-4 w-4"}),e.jsxs("span",{className:"text-sm",children:["Create"," ",e.jsx("span",{className:"font-mono",children:K})]})]})]})}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-output-path",children:"Output path"}),e.jsx(ae,{id:"scratch-output-path",value:Me,onChange:a=>{We(a.target.value),q(null)},placeholder:"$.items[*]",className:"font-mono text-sm"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(b,{children:"Fields"}),e.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>{he(a=>[...a,as()]),q(null)},children:[e.jsx(Je,{className:"mr-2 h-4 w-4"}),"Add field"]})]}),fe.length===0?e.jsx("div",{className:D(Ie,"px-3 py-2 text-sm text-muted-foreground"),children:"No output fields configured."}):e.jsx("div",{className:"space-y-2",children:fe.map(a=>e.jsxs("div",{className:D(Ie,"grid gap-2 p-3 sm:grid-cols-[minmax(0,1fr)_128px_minmax(0,240px)_auto]"),children:[e.jsx(ae,{value:a.name,onChange:O=>{const K=He(O.target.value);he(R=>R.map(Ee=>Ee.id===a.id?{...Ee,name:K}:Ee)),q(null)},placeholder:"severity","aria-label":"Output field name",className:"font-mono text-sm"}),e.jsxs(oe,{value:a.type,onValueChange:O=>{he(K=>K.map(R=>R.id===a.id?{...R,type:O}:R))},children:[e.jsx(ie,{"aria-label":"Output field type",children:e.jsx(ce,{})}),e.jsx(re,{children:$n.map(O=>e.jsx(T,{value:O,children:O},O))})]}),e.jsx("div",{className:"grid grid-cols-2 rounded-md border border-input bg-background p-1",children:In.map(O=>e.jsx("button",{type:"button",onClick:()=>{he(K=>K.map(R=>R.id===a.id?{...R,role:O.value}:R)),q(null)},className:D("rounded-sm px-2 py-1 text-xs transition-colors",a.role===O.value?"bg-muted/70 text-foreground":"text-muted-foreground hover:text-foreground"),children:O.label},O.value))}),e.jsx(U,{type:"button",variant:"ghost",size:"icon",onClick:()=>{he(O=>O.filter(K=>K.id!==a.id)),q(null)},"aria-label":"Remove output field",children:e.jsx(ts,{className:"h-4 w-4"})})]},a.id))})]}),ue&&e.jsx("p",{className:"text-xs text-destructive",children:ue})]}):e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-keying-config",children:"Keying Config (JSON)"}),e.jsx(ft,{value:ve,onChange:a=>{Fe(a),q(null)},language:"json",placeholder:'{ "entity_type": "topic", "entity_path": "$.items[*]", "key_fields": ["name"], "key_output_field": "entity_key" }',minHeight:"60px"}),ue&&e.jsx("p",{className:"text-xs text-destructive",children:ue})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-reactions-guidance",children:"Reactions Guidance"}),e.jsx(qs,{id:"scratch-reactions-guidance",value:Be,onChange:a=>Le(a.target.value),placeholder:"Guidance text for the reaction system (e.g., when to alert, severity thresholds)...",className:"font-mono text-xs min-h-[80px]"})]}),e.jsxs("div",{className:"space-y-4",children:[Wn("Run settings","Choose where the automation runs and the budget it can use."),!N&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-runs-on",children:"Runs on"}),e.jsxs(oe,{value:F,onValueChange:a=>p(a),children:[e.jsx(ie,{id:"scratch-runs-on",className:"text-sm",children:e.jsx(ce,{})}),e.jsxs(re,{children:[e.jsx(T,{value:"agent",children:"Managed agent"}),e.jsx(T,{value:"device",children:"On a device"}),e.jsx(T,{value:"manual",children:"Manual-only"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:F==="agent"?"Automated runs dispatch to a managed Lobu agent.":F==="device"?"Automated runs are claimed and executed locally by a device worker (Mac app, remote worker).":"No executor — this automation runs only when started manually by a connected client."})]}),!N&&F==="agent"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-agent-id",children:"Agent"}),$?e.jsxs(oe,{value:w||"__unselected__",onValueChange:a=>{L(a==="__unselected__"?"":a)},children:[e.jsx(ie,{id:"scratch-agent-id",className:"font-mono text-sm",children:e.jsx(ce,{placeholder:"Select a Lobu agent"})}),e.jsx(re,{children:j.map(a=>e.jsxs(T,{value:a.agentId,children:[a.name," (",a.agentId,")"]},a.agentId))})]}):e.jsx(ae,{id:"scratch-agent-id",value:w,onChange:a=>{L(a.target.value)},placeholder:"e.g., agent-123",className:"font-mono text-sm"})]}),!N&&F==="device"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-device-id",children:"Device"}),e.jsxs(oe,{value:Ne||"__unselected__",onValueChange:a=>k(a==="__unselected__"?"":a),children:[e.jsx(ie,{id:"scratch-device-id",className:"font-mono text-sm",children:e.jsx(ce,{placeholder:"Select a device worker"})}),e.jsx(re,{children:_.map(a=>e.jsx(T,{value:a.id,children:a.label||a.platform||a.id},a.id))})]})]}),!N&&F==="device"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-device-agent-kind",children:"Runs as"}),e.jsxs(oe,{value:V||"__default__",onValueChange:a=>xe(a==="__default__"?"":a),children:[e.jsx(ie,{id:"scratch-device-agent-kind",className:"text-sm",children:e.jsx(ce,{placeholder:"Device default"})}),e.jsxs(re,{children:[e.jsx(T,{value:"__default__",children:"Device default"}),Dn.map(a=>e.jsx(T,{value:a.value,children:a.label},a.value))]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Device default uses that device's preferred local agent. Availability is checked again when a run is claimed, so a run stays queued if its selected runtime is no longer available."})]}),e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Model"}),e.jsx(on,{value:Ue,onChange:a=>{Xe(a),A(null)},placeholder:"Use agent default"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-timeout",children:"Timeout seconds"}),e.jsx(ae,{id:"scratch-timeout",type:"number",min:1,max:86400,value:nt,onChange:a=>{Ce(a.target.value),A(null)},placeholder:"600"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-permission-mode",children:"Permission mode"}),e.jsxs(oe,{value:Ve||"__default__",onValueChange:a=>{it(a==="__default__"?"":a),A(null)},children:[e.jsx(ie,{id:"scratch-permission-mode",children:e.jsx(ce,{placeholder:"Default"})}),e.jsxs(re,{children:[e.jsx(T,{value:"__default__",children:"Default"}),ht.map(a=>e.jsx(T,{value:a.value,children:a.label},a.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-effort",children:"Effort"}),e.jsx(ae,{id:"scratch-effort",value:Re,onChange:a=>{d(a.target.value),A(null)},placeholder:"Default","aria-describedby":"scratch-effort-help"}),e.jsx("p",{id:"scratch-effort-help",className:"text-xs text-muted-foreground",children:"For device runs, use a value supported by the selected CLI and model. Leave empty for its default."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-finalize-nudges",children:"Finalize nudges"}),e.jsx(ae,{id:"scratch-finalize-nudges",type:"number",min:0,max:5,value:v,onChange:a=>{C(a.target.value),A(null)},placeholder:"Default"})]})]}),ee&&e.jsx("p",{className:"text-xs text-destructive",children:ee})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-tags",children:"Tags"}),e.jsx(ae,{id:"scratch-tags",value:je,onChange:a=>E(a.target.value),placeholder:"ops, support, risk"})]}),c&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"scratch-change-notes",children:"Change notes"}),e.jsx(ae,{id:"scratch-change-notes",value:De,onChange:a=>ze(a.target.value),placeholder:"What changed in this version?"})]})]})]}),m&&!ue&&!ee&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:m}),e.jsx(gt,{onCancel:o,children:e.jsx(U,{onClick:ms,disabled:!St||u||S,children:u?e.jsxs(e.Fragment,{children:[e.jsx(Ks,{size:"lg",className:"mr-2"}),c?"Saving...":"Creating..."]}):c?"Save Automation":y})})]})}function Un(n,t){const s=n??null,r=t??null;return s===null||r===null?s===r:s.connection_id===r.connection_id&&s.channel_id===r.channel_id}function Vn(n){const t=n.detail??{};return{name:n.name,slug:t.slug,description:t.description??n.description??void 0,prompt:t.prompt,triggers:t.triggers,sources:t.sources,keying_config:t.keying_config,reactions_guidance:t.reactions_guidance,reaction_script:t.reaction_script,model_config:t.model_config,execution_config:t.execution_config,tags:t.tags}}function aa({onClose:n,hideCancel:t=!1,hideHeader:s=!1,organizationId:r,entityId:u,entityName:m,prefillAgentId:c,onSuccess:o,editingAutomation:l,catalogPrefill:y,onDraft:S,triggerFields:g,submitLabel:$,submitDisabled:h,createFields:j,onPrefillTriggers:_}){const w=Ws(),L=Bs(),N=Us(),W=Vs(),f=!!l,[z,Q]=i.useState("template"),[Ne,k]=i.useState(void 0),[F,p]=i.useState(void 0),{data:V=[],isLoading:xe}=zs(),[P,H]=i.useState(""),X=i.useMemo(()=>c?{managed_agent_id:c}:void 0,[c]),te=i.useMemo(()=>V.map(x=>({key:x.id,name:x.name,description:x.description??"",badges:x.detail?.tags??[]})),[V]),be=i.useMemo(()=>te.filter(x=>x.name.toLowerCase().includes(P.toLowerCase())||x.description.toLowerCase().includes(P.toLowerCase())),[te,P]),Se=x=>{const ge=V.find(de=>de.id===x.key);if(!ge)return;const M=Vn(ge);p(c?{...M,managed_agent_id:c}:M),_?.(M.triggers??[]),Q("scratch")},le=()=>{w.reset(),L.reset(),Q("template"),k(void 0),p(void 0),n()},I=f?j?.triggers??l.triggers??[]:j?.triggers??F?.triggers??y?.triggers??[],pe=async x=>{try{if(S){await S(x);return}if(f){const ge=j?.triggers??l.triggers??[],M=l.reaction_script??"",de=x.reaction_script??"";de&&de!==M&&await N.mutateAsync({automation_id:l.automation_id,reaction_script:de}),await L.mutateAsync({automation_id:l.automation_id,name:x.name,description:x.description,prompt:x.prompt,sources:x.sources,set_as_current:!0,triggers:ge,keying_config:x.keying_config,reactions_guidance:x.reactions_guidance,change_notes:x.change_notes}),!de&&M&&await N.mutateAsync({automation_id:l.automation_id,reaction_script:""});const Z={};x.model_config!==void 0&&(Z.model_config=x.model_config),x.execution_config!==void 0&&(Z.execution_config=x.execution_config),x.tags!==void 0&&(Z.tags=x.tags),x.delivery_target!==void 0&&!Un(x.delivery_target,l.delivery_target)&&(Z.delivery_target=x.delivery_target),x.managed_agent_id!==void 0&&(Z.managed_agent_id=x.managed_agent_id||null),x.agent_kind!==void 0&&(Z.agent_kind=x.agent_kind||null),x.device_worker_id!==void 0&&(Z.device_worker_id=x.device_worker_id||null),Object.keys(Z).length>0&&await W.mutateAsync({automation_id:l.automation_id,...Z}),le(),o?.(l.automation_id)}else{const ge=j?.triggers??F?.triggers??y?.triggers??[],M=await w.mutateAsync({...x,managed_agent_id:x.managed_agent_id??void 0,device_worker_id:x.device_worker_id??void 0,agent_kind:x.agent_kind??void 0,delivery_target:x.delivery_target??void 0,triggers:ge});le(),M.automation_id&&o?.(M.automation_id)}}catch{}},G=f?L:w;let Y="Add an automation";f?Y="Edit automation configuration (saves as a new version)":m&&(Y=`Add an automation for ${m}`);const se=l?{entity_id:l.entity_id,name:l.name,slug:l.slug,description:l.description,prompt:l.prompt,sources:l.sources,reaction_script:l.reaction_script,device_worker_id:l.device_worker_id??void 0,agent_kind:l.agent_kind??void 0,keying_config:l.keying_config,reactions_guidance:l.reactions_guidance,model_config:l.model_config,execution_config:l.execution_config,tags:l.tags,managed_agent_id:l.managed_agent_id??void 0,delivery_target:l.delivery_target??void 0}:void 0,ne=f?"Edit Automation":"Create Automation",we=e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h1",{className:"text-2xl font-semibold leading-tight",children:ne}),e.jsx("p",{className:"text-sm text-muted-foreground",children:Y})]}),Oe=e.jsxs("div",{className:"py-6 space-y-6",children:[!f&&e.jsxs("div",{className:"flex flex-wrap justify-start gap-2",children:[e.jsx(pt,{active:z==="template",onClick:()=>Q("template"),icon:e.jsx(Qs,{className:"h-4 w-4"}),label:"From templates"}),e.jsx(pt,{active:z==="scratch",onClick:()=>{Q("scratch"),k(void 0),p(void 0)},icon:e.jsx(Je,{className:"h-4 w-4"}),label:"From scratch"}),e.jsx(pt,{active:z==="clone",onClick:()=>Q("clone"),icon:e.jsx(Gs,{className:"h-4 w-4"}),label:"Clone existing"})]}),!f&&z==="template"?e.jsxs(e.Fragment,{children:[xe?e.jsx(Js,{}):e.jsx(Hs,{items:be,searchQuery:P,onSearchChange:H,onSelect:Se,searchPlaceholder:"Search templates...",searchAriaLabel:"Search automation templates",emptyMessage:te.length===0?"No automation templates available.":void 0}),s&&!t?e.jsx(gt,{onCancel:le}):null]}):!f&&z==="clone"&&!Ne?e.jsxs(e.Fragment,{children:[e.jsx(zn,{organizationId:r,onSelect:x=>{k(x),_?.(x.triggers??[]),Q("scratch")}}),s&&!t?e.jsx(gt,{onCancel:le}):null]}):e.jsx(Bn,{organizationId:r,entityId:u,prefill:se??Ne??F??y??X,onSubmit:pe,isSubmitting:G.isPending,error:G.error?G.error.message:null,isEditing:f,onCancel:t?void 0:le,triggerFields:g,submitLabel:$,submitDisabled:h,triggers:I})]});return e.jsxs("div",{className:"flex flex-col",children:[s?null:we,Oe]})}function pt({active:n,onClick:t,icon:s,label:r}){return e.jsxs("button",{type:"button",onClick:t,className:D("flex items-center gap-2 rounded-md border px-3 py-2 text-sm transition-colors",n?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:border-muted-foreground/30 hover:text-foreground"),children:[s,r]})}function zn({organizationId:n,onSelect:t}){const{data:s,isLoading:r}=Xs(n),[u,m]=i.useState(""),c=(s||[]).filter(o=>o.name?.toLowerCase().includes(u.toLowerCase()));return r?e.jsx(Ys,{label:"automations",variant:"list-picker",rows:4}):!s||s.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-4",children:"No existing automations to clone."}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{type:"text",value:u,onChange:o=>m(o.target.value),placeholder:"Search automations...",className:"w-full rounded-md border px-3 py-2 text-sm bg-background"}),e.jsxs("div",{className:"space-y-2 max-h-[400px] overflow-y-auto",children:[c.map(o=>e.jsxs("button",{type:"button",onClick:()=>t({name:`${o.name} (copy)`,slug:`${o.slug||o.automation_id}-copy`,prompt:o.prompt,keying_config:o.keying_config,triggers:o.triggers,sources:o.sources}),className:"w-full text-left rounded-md border p-3 hover:border-primary/50 hover:bg-primary/5 transition-colors",children:[e.jsx("p",{className:"text-sm font-medium",children:o.name}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[o.entity_name||"Space-level"," · v",o.version??"?"]})]},o.automation_id)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No automations match your search."})]})]})}export{na as A,aa as C};
@@ -1 +1 @@
1
- import{hj as e,j as t,gq as r}from"./index-BUr8321-.js";function a(){const{owner:n,connectorKey:o}=e.useParams();return t.jsx(r,{owner:n,initialConnectorKey:o})}export{a as component};
1
+ import{hE as e,j as t,gL as r}from"./index-DtRfQcRH.js";function a(){const{owner:n,connectorKey:o}=e.useParams();return t.jsx(r,{owner:n,initialConnectorKey:o})}export{a as component};
@@ -1 +1 @@
1
- import{aC as U}from"./index-BUr8321-.js";var M={exports:{}},A;function H(){return A||(A=1,(function(L,C){(function(w,_){L.exports=_()})(globalThis,()=>(()=>{var D={949(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.CronParser=void 0;var i=v(515),y=(function(){function l(e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=r}return l.prototype.parse=function(){var e,t,r=(e=this.expression)!==null&&e!==void 0?e:"";if(r==="@reboot")return t=["@reboot","","","","","",""],t;if(r.startsWith("@")){var n=this.parseSpecial(this.expression);t=this.extractParts(n)}else t=this.extractParts(this.expression);return this.normalize(t),this.validate(t),t},l.prototype.parseSpecial=function(e){var t={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},r=t[e];if(!r)throw new Error("Unknown special expression.");return r},l.prototype.extractParts=function(e){if(!this.expression)throw new Error("cron expression is empty");for(var t=e.trim().split(/[ ]+/),r=0;r<t.length;r++)if(t[r].includes(",")){var n=t[r].split(",").map(function(a){return a.trim()}).filter(function(a){return a!==""}).map(function(a){return isNaN(Number(a))?a:Number(a)}).filter(function(a){return a!==null&&a!==""});n.length===0&&n.push("*"),n.sort(function(a,u){return a!==null&&u!==null?a-u:0}),t[r]=n.map(function(a){return a!==null?a.toString():""}).join(",")}if(t.length<5)throw new Error("Expression has only ".concat(t.length," part").concat(t.length==1?"":"s",". At least 5 parts are required."));if(t.length==5)t.unshift(""),t.push("");else if(t.length==6){var o=/\d{4}$/.test(t[5])||t[4]=="?"||t[2]=="?";o?t.unshift(""):t.push("")}else if(t.length>7)throw new Error("Expression has ".concat(t.length," parts; too many!"));return t},l.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace("?","*"),e[5]=e[5].replace("?","*"),e[2]=e[2].replace("?","*"),e[0].indexOf("0/")==0&&(e[0]=e[0].replace("0/","*/")),e[1].indexOf("0/")==0&&(e[1]=e[1].replace("0/","*/")),e[2].indexOf("0/")==0&&(e[2]=e[2].replace("0/","*/")),e[3].indexOf("1/")==0&&(e[3]=e[3].replace("1/","*/")),e[4].indexOf("1/")==0&&(e[4]=e[4].replace("1/","*/")),e[6].indexOf("1/")==0&&(e[6]=e[6].replace("1/","*/")),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(c){var d=c.replace(/\D/,""),f=d;return t.dayOfWeekStartIndexZero?d=="7"&&(f="0"):f=(parseInt(d)-1).toString(),c.replace(d,f)}),e[5]=="L"&&(e[5]="6"),e[3]=="?"&&(e[3]="*"),e[3].indexOf("W")>-1&&(e[3].indexOf(",")>-1||e[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var r={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var n in r)e[5]=e[5].replace(new RegExp(n,"gi"),r[n].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(c){var d=c.replace(/\D/,""),f=d;return t.monthStartIndexZero&&(f=(parseInt(d)+1).toString()),c.replace(d,f)});var o={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in o)e[4]=e[4].replace(new RegExp(a,"gi"),o[a].toString());e[0]=="0"&&(e[0]=""),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+="-".concat(e[2]));for(var u=0;u<e.length;u++)if(e[u].indexOf(",")!=-1&&(e[u]=e[u].split(",").filter(function(c){return c!==""}).join(",")||"*"),e[u]=="*/1"&&(e[u]="*"),e[u].indexOf("/")>-1&&!/^\*|\-|\,/.test(e[u])){var s=null;switch(u){case 4:s="12";break;case 5:s="6";break;case 6:s="9999";break;default:s=null;break}if(s!==null){var h=e[u].split("/");e[u]="".concat(h[0],"-").concat(s,"/").concat(h[1])}}},l.prototype.validate=function(e){var t="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},l.prototype.validateAnyRanges=function(e){i.default.secondRange(e[0]),i.default.minuteRange(e[1]),i.default.hourRange(e[2]),i.default.dayOfMonthRange(e[3]),i.default.monthRange(e[4],this.monthStartIndexZero),i.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},l.prototype.validateOnlyExpectedCharactersFound=function(e,t){var r=e.match(new RegExp("[^".concat(t,"]+"),"gi"));if(r&&r.length)throw new Error("Expression contains invalid values: '".concat(r.toString(),"'"))},l})();p.CronParser=y},333(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.ExpressionDescriptor=void 0;var i=v(823),y=v(949),l=(function(){function e(t,r){if(this.expression=t,this.options=r,this.expressionParts=new Array(5),!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var n=Object.keys(e.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(n,"'.")),this.options.locale=n}this.i18n=e.locales[this.options.locale],r.use24HourTimeFormat===void 0&&(r.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,r){var n=r===void 0?{}:r,o=n.throwExceptionOnParseError,a=o===void 0?!0:o,u=n.verbose,s=u===void 0?!1:u,h=n.dayOfWeekStartIndexZero,c=h===void 0?!0:h,d=n.monthStartIndexZero,f=d===void 0?!1:d,O=n.use24HourTimeFormat,T=n.trimHoursLeadingZero,m=T===void 0?!1:T,b=n.locale,E=b===void 0?null:b,X=n.logicalAndDayFields,x=X===void 0?!1:X,S={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:c,monthStartIndexZero:f,use24HourTimeFormat:O,trimHoursLeadingZero:m,locale:E,logicalAndDayFields:x};S.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var I=new e(t,S);return I.getFullDescription()},e.initialize=function(t,r){r===void 0&&(r="en"),e.specialCharacters=["/","-",",","*"],e.defaultLocale=r,t.load(e.locales)},e.prototype.getFullDescription=function(){var t,r,n="";try{var o=new y.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=o.parse(),this.expressionParts[0]==="@reboot")return((r=(t=this.i18n).atReboot)===null||r===void 0?void 0:r.call(t))||"Run once, at startup";var a=this.getTimeOfDayDescription(),u=this.getDayOfMonthDescription(),s=this.getMonthDescription(),h=this.getDayOfWeekDescription(),c=this.getYearDescription();n+=a+u+h+s+c,n=this.transformVerbosity(n,!!this.options.verbose),n=n.charAt(0).toLocaleUpperCase()+n.substr(1)}catch(d){if(!this.options.throwExceptionOnParseError)n=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(d)}return n},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],r=this.expressionParts[1],n=this.expressionParts[2],o="";if(!i.StringUtilities.containsAny(r,e.specialCharacters)&&!i.StringUtilities.containsAny(n,e.specialCharacters)&&!i.StringUtilities.containsAny(t,e.specialCharacters))o+=this.i18n.atSpace()+this.formatTime(n,r,t);else if(!t&&r.indexOf("-")>-1&&!(r.indexOf(",")>-1)&&!(r.indexOf("/")>-1)&&!i.StringUtilities.containsAny(n,e.specialCharacters)){var a=r.split("-");o+=i.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(n,a[0],""),this.formatTime(n,a[1],""))}else if(!t&&n.indexOf(",")>-1&&n.indexOf("-")==-1&&n.indexOf("/")==-1&&!i.StringUtilities.containsAny(r,e.specialCharacters)){var u=n.split(",");o+=this.i18n.at();for(var s=0;s<u.length;s++)o&&(o+=" "),o+=this.formatTime(u[s],r,""),s<u.length-2&&(o+=","),s==u.length-2&&(o+=this.i18n.spaceAnd())}else{var h=this.getSecondsDescription(),c=this.getMinutesDescription(),d=this.getHoursDescription();if(o+=h,o&&c&&(o+=", "),o+=c,c===d)return o;o&&d&&(o+=", "),o+=d}return o},e.prototype.getSecondsDescription=function(){var t=this,r=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(n){return n},function(n){return i.StringUtilities.format(t.i18n.everyX0Seconds(n),n)},function(n){return t.i18n.secondsX0ThroughX1PastTheMinute()},function(n){return n=="0"?"":parseInt(n)<20?t.i18n.atX0SecondsPastTheMinute(n):t.i18n.atX0SecondsPastTheMinuteGt20()||t.i18n.atX0SecondsPastTheMinute(n)});return r},e.prototype.getMinutesDescription=function(){var t=this,r=this.expressionParts[0],n=this.expressionParts[2],o=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(a){return a},function(a){return i.StringUtilities.format(t.i18n.everyX0Minutes(a),a)},function(a){return t.i18n.minutesX0ThroughX1PastTheHour()},function(a){var u,s;try{return a=="0"&&n.indexOf("/")==-1&&r==""?t.i18n.everyHour():a=="0"?((s=(u=t.i18n).onTheHour)===null||s===void 0?void 0:s.call(u))||t.i18n.atX0MinutesPastTheHour(a):parseInt(a)<20?t.i18n.atX0MinutesPastTheHour(a):t.i18n.atX0MinutesPastTheHourGt20()||t.i18n.atX0MinutesPastTheHour(a)}catch{return t.i18n.atX0MinutesPastTheHour(a)}});return o},e.prototype.getHoursDescription=function(){var t=this,r=this.expressionParts[2],n=0,o=[];r.split("/")[0].split(",").forEach(function(s){var h=s.split("-");h.length===2&&o.push({value:h[1],index:n+1}),n+=h.length});var a=0,u=this.getSegmentDescription(r,this.i18n.everyHour(),function(s){var h=o.find(function(d){return d.value===s&&d.index===a}),c=h&&t.expressionParts[1]!=="0";return a++,c?t.formatTime(s,"59",""):t.formatTime(s,"0","")},function(s){return i.StringUtilities.format(t.i18n.everyX0Hours(s),s)},function(s){return t.i18n.betweenX0AndX1()},function(s){return t.i18n.atX0()});return u},e.prototype.getDayOfWeekDescription=function(){var t=this,r=this.i18n.daysOfTheWeek(),n=null;return this.expressionParts[5]=="*"?n="":n=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(o,a){var u=o;o.indexOf("#")>-1?u=o.substring(0,o.indexOf("#")):o.indexOf("L")>-1&&(u=u.replace("L",""));var s=parseInt(u),h=t.i18n.daysOfTheWeekInCase?t.i18n.daysOfTheWeekInCase(a)[s]:r[s];if(o.indexOf("#")>-1){var c=null,d=o.substring(o.indexOf("#")+1),f=o.substring(0,o.indexOf("#"));switch(d){case"1":c=t.i18n.first(f);break;case"2":c=t.i18n.second(f);break;case"3":c=t.i18n.third(f);break;case"4":c=t.i18n.fourth(f);break;case"5":c=t.i18n.fifth(f);break}h=c+" "+h}return h},function(o){return parseInt(o)==1?"":i.StringUtilities.format(t.i18n.commaEveryX0DaysOfTheWeek(o),o)},function(o){var a=o.substring(0,o.indexOf("-")),u=t.expressionParts[3]!="*";return u?t.i18n.commaAndX0ThroughX1(a):t.i18n.commaX0ThroughX1(a)},function(o){var a=null;if(o.indexOf("#")>-1){var u=o.substring(o.indexOf("#")+1),s=o.substring(0,o.indexOf("#"));a=t.i18n.commaOnThe(u,s).trim()+t.i18n.spaceX0OfTheMonth()}else if(o.indexOf("L")>-1)a=t.i18n.commaOnTheLastX0OfTheMonth(o.replace("L",""));else{var h=t.expressionParts[3]!="*";h?t.options.logicalAndDayFields?a=t.i18n.commaOnlyOnX0(o):a=t.i18n.commaAndOnX0():a=t.i18n.commaOnlyOnX0(o)}return a}),n},e.prototype.getMonthDescription=function(){var t=this,r=this.i18n.monthsOfTheYear(),n=this.getSegmentDescription(this.expressionParts[4],"",function(o,a){return a&&t.i18n.monthsOfTheYearInCase?t.i18n.monthsOfTheYearInCase(a)[parseInt(o)-1]:r[parseInt(o)-1]},function(o){return parseInt(o)==1?"":i.StringUtilities.format(t.i18n.commaEveryX0Months(o),o)},function(o){return t.i18n.commaMonthX0ThroughMonthX1()||t.i18n.commaX0ThroughX1()},function(o){return t.i18n.commaOnlyInMonthX0?t.i18n.commaOnlyInMonthX0():t.i18n.commaOnlyInX0()});return n},e.prototype.getDayOfMonthDescription=function(){var t=this,r=null,n=this.expressionParts[3];switch(n){case"L":r=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":r=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var o=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(o){var a=parseInt(o[0].replace("W","")),u=a==1?this.i18n.firstWeekday():i.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());r=i.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),u);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var h=s[1];r=i.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(h),h);break}else{if(n=="*"&&this.expressionParts[5]!="*")return"";r=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(c){return c=="L"?t.i18n.lastDay():t.i18n.dayX0?i.StringUtilities.format(t.i18n.dayX0(),c):c},function(c){return c=="1"?t.i18n.commaEveryDay():t.i18n.commaEveryX0Days(c)},function(c){return t.i18n.commaBetweenDayX0AndX1OfTheMonth(c)},function(c){return t.i18n.commaOnDayX0OfTheMonth(c)})}break}}return r},e.prototype.getYearDescription=function(){var t=this,r=this.getSegmentDescription(this.expressionParts[6],"",function(n){return/^\d+$/.test(n)?new Date(parseInt(n),1).getFullYear().toString():n},function(n){return i.StringUtilities.format(t.i18n.commaEveryX0Years(n),n)},function(n){return t.i18n.commaYearX0ThroughYearX1()||t.i18n.commaX0ThroughX1()},function(n){return t.i18n.commaOnlyInYearX0?t.i18n.commaOnlyInYearX0():t.i18n.commaOnlyInX0()});return r},e.prototype.getSegmentDescription=function(t,r,n,o,a,u){var s=null,h=t.indexOf("/")>-1,c=t.indexOf("-")>-1,d=t.indexOf(",")>-1;if(!t)s="";else if(t==="*")s=r;else if(!h&&!c&&!d)s=i.StringUtilities.format(u(t),n(t));else if(d){for(var f=t.split(","),O="",T=this.i18n.spaceAnd(),m=0;m<f.length;m++)if(m>0&&f.length>2&&(O+=",",m<f.length-1&&(O+=" ")),m>0&&f.length>1&&(m==f.length-1||f.length==2)&&(O+=T==","&&f.length>2?" ":"".concat(T," ")),f[m].indexOf("/")>-1||f[m].indexOf("-")>-1){var b=f[m].indexOf("-")>-1&&f[m].indexOf("/")==-1,E=this.getSegmentDescription(f[m],r,n,o,b?this.i18n.commaX0ThroughX1:a,u);b&&(E=E.replace(", ","")),O+=E}else if(!h)O+=n(f[m]);else{var X=this.getSegmentDescription(f[m],r,n,o,a,u);X&&X.startsWith(", ")&&(X=X.substring(2)),O+=X}h?s=O:s=i.StringUtilities.format(u(t),O)}else if(h){var f=t.split("/");if(s=i.StringUtilities.format(o(f[1]),f[1]),f[0].indexOf("-")>-1){var x=this.generateRangeSegmentDescription(f[0],a,n);x.indexOf(", ")!=0&&(s+=", "),s+=x}else if(f[0].indexOf("*")==-1){var S=i.StringUtilities.format(u(f[0]),n(f[0]));S=S.replace(", ",""),s+=i.StringUtilities.format(this.i18n.commaStartingX0(),S)}}else c&&(s=this.generateRangeSegmentDescription(t,a,n));return s},e.prototype.generateRangeSegmentDescription=function(t,r,n){var o="",a=t.split("-"),u=n(a[0],1),s=n(a[1],2),h=r(t);return o+=i.StringUtilities.format(h,u,s),o},e.prototype.formatTime=function(t,r,n){var o=0,a=0,u=parseInt(t)+o,s=parseInt(r)+a;s>=60?(s-=60,u+=1):s<0&&(s+=60,u-=1),u>=24?u=u-24:u<0&&(u=24+u);var h="",c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),h=c?"".concat(this.getPeriod(u)," "):" ".concat(this.getPeriod(u)),u>12&&(u-=12),u===0&&(u=12));var d="";n&&(d=":".concat(("00"+n).substring(n.length)));var f=u.toString(),O=("00"+f).substring(f.length),T=s.toString(),m=("00"+T).substring(T.length),b=this.options.trimHoursLeadingZero?f:O;return"".concat(c?h:"").concat(b,":").concat(m).concat(d).concat(c?"":h)},e.prototype.transformVerbosity=function(t,r){if(!r&&(t=t.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),t=t.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),t=t.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),t=t.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var n=0,o=Object.entries(this.i18n.conciseVerbosityReplacements());n<o.length;n++){var a=o[n],u=a[0],s=a[1];t=t.replace(new RegExp(u,"g"),s)}return t},e.prototype.getPeriod=function(t){return t>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},e.locales={},e})();p.ExpressionDescriptor=l},747(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.enLocaleLoader=void 0;var i=v(486),y=(function(){function l(){}return l.prototype.load=function(e){e.en=new i.en},l})();p.enLocaleLoader=y},486(g,p){Object.defineProperty(p,"__esModule",{value:!0}),p.en=void 0;var v=(function(){function i(){}return i.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},i.prototype.atX0MinutesPastTheHourGt20=function(){return null},i.prototype.commaMonthX0ThroughMonthX1=function(){return null},i.prototype.commaYearX0ThroughYearX1=function(){return null},i.prototype.use24HourTimeFormatByDefault=function(){return!1},i.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},i.prototype.everyMinute=function(){return"every minute"},i.prototype.everyHour=function(){return"every hour"},i.prototype.atSpace=function(){return"At "},i.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},i.prototype.at=function(){return"At"},i.prototype.spaceAnd=function(){return" and"},i.prototype.everySecond=function(){return"every second"},i.prototype.everyX0Seconds=function(){return"every %s seconds"},i.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},i.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},i.prototype.everyX0Minutes=function(){return"every %s minutes"},i.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},i.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},i.prototype.everyX0Hours=function(){return"every %s hours"},i.prototype.betweenX0AndX1=function(){return"between %s and %s"},i.prototype.atX0=function(){return"at %s"},i.prototype.commaEveryDay=function(){return", every day"},i.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},i.prototype.commaX0ThroughX1=function(){return", %s through %s"},i.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},i.prototype.first=function(){return"first"},i.prototype.second=function(){return"second"},i.prototype.third=function(){return"third"},i.prototype.fourth=function(){return"fourth"},i.prototype.fifth=function(){return"fifth"},i.prototype.commaOnThe=function(){return", on the "},i.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},i.prototype.lastDay=function(){return"the last day"},i.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},i.prototype.commaOnlyOnX0=function(){return", only on %s"},i.prototype.commaAndOnX0=function(){return", and on %s"},i.prototype.commaEveryX0Months=function(){return", every %s months"},i.prototype.commaOnlyInX0=function(){return", only in %s"},i.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},i.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},i.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},i.prototype.firstWeekday=function(){return"first weekday"},i.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},i.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},i.prototype.commaEveryX0Days=function(){return", every %s days in a month"},i.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},i.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},i.prototype.commaEveryHour=function(){return", every hour"},i.prototype.commaEveryX0Years=function(){return", every %s years"},i.prototype.commaStartingX0=function(){return", starting %s"},i.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},i.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},i.prototype.atReboot=function(){return"Run once, at startup"},i.prototype.onTheHour=function(){return"on the hour"},i})();p.en=v},515(g,p){Object.defineProperty(p,"__esModule",{value:!0});function v(y,l){if(!y)throw new Error(l)}var i=(function(){function y(){}return y.secondRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=59,"seconds part must be >= 0 and <= 59")}},y.minuteRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=59,"minutes part must be >= 0 and <= 59")}},y.hourRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=23,"hours part must be >= 0 and <= 23")}},y.dayOfMonthRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=1&&r<=31,"DOM part must be >= 1 and <= 31")}},y.monthRange=function(l,e){for(var t=l.split(","),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var n=parseInt(t[r],10);v(n>=1&&n<=12,e?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},y.dayOfWeekRange=function(l,e){for(var t=l.split(","),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var n=parseInt(t[r],10);v(n>=0&&n<=6,e?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},y})();p.default=i},823(g,p){Object.defineProperty(p,"__esModule",{value:!0}),p.StringUtilities=void 0;var v=(function(){function i(){}return i.format=function(y){for(var l=[],e=1;e<arguments.length;e++)l[e-1]=arguments[e];return y.replace(/%s/g,function(t){return l.shift()})},i.containsAny=function(y,l){return l.some(function(e){return y.indexOf(e)>-1})},i})();p.StringUtilities=v}},w={};function _(g){var p=w[g];if(p!==void 0)return p.exports;var v=w[g]={exports:{}};return D[g](v,v.exports,_),v.exports}var k={};return(()=>{var g=k;Object.defineProperty(g,"__esModule",{value:!0}),g.toString=void 0;var p=_(333),v=_(747);p.ExpressionDescriptor.initialize(new v.enLocaleLoader),g.default=p.ExpressionDescriptor;var i=p.ExpressionDescriptor.toString;g.toString=i})(),k})())})(M)),M.exports}var R=H();const F=U(R);export{F as c};
1
+ import{aF as U}from"./index-DtRfQcRH.js";var M={exports:{}},A;function H(){return A||(A=1,(function(L,C){(function(w,_){L.exports=_()})(globalThis,()=>(()=>{var D={949(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.CronParser=void 0;var i=v(515),y=(function(){function l(e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=r}return l.prototype.parse=function(){var e,t,r=(e=this.expression)!==null&&e!==void 0?e:"";if(r==="@reboot")return t=["@reboot","","","","","",""],t;if(r.startsWith("@")){var n=this.parseSpecial(this.expression);t=this.extractParts(n)}else t=this.extractParts(this.expression);return this.normalize(t),this.validate(t),t},l.prototype.parseSpecial=function(e){var t={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},r=t[e];if(!r)throw new Error("Unknown special expression.");return r},l.prototype.extractParts=function(e){if(!this.expression)throw new Error("cron expression is empty");for(var t=e.trim().split(/[ ]+/),r=0;r<t.length;r++)if(t[r].includes(",")){var n=t[r].split(",").map(function(a){return a.trim()}).filter(function(a){return a!==""}).map(function(a){return isNaN(Number(a))?a:Number(a)}).filter(function(a){return a!==null&&a!==""});n.length===0&&n.push("*"),n.sort(function(a,u){return a!==null&&u!==null?a-u:0}),t[r]=n.map(function(a){return a!==null?a.toString():""}).join(",")}if(t.length<5)throw new Error("Expression has only ".concat(t.length," part").concat(t.length==1?"":"s",". At least 5 parts are required."));if(t.length==5)t.unshift(""),t.push("");else if(t.length==6){var o=/\d{4}$/.test(t[5])||t[4]=="?"||t[2]=="?";o?t.unshift(""):t.push("")}else if(t.length>7)throw new Error("Expression has ".concat(t.length," parts; too many!"));return t},l.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace("?","*"),e[5]=e[5].replace("?","*"),e[2]=e[2].replace("?","*"),e[0].indexOf("0/")==0&&(e[0]=e[0].replace("0/","*/")),e[1].indexOf("0/")==0&&(e[1]=e[1].replace("0/","*/")),e[2].indexOf("0/")==0&&(e[2]=e[2].replace("0/","*/")),e[3].indexOf("1/")==0&&(e[3]=e[3].replace("1/","*/")),e[4].indexOf("1/")==0&&(e[4]=e[4].replace("1/","*/")),e[6].indexOf("1/")==0&&(e[6]=e[6].replace("1/","*/")),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(c){var d=c.replace(/\D/,""),f=d;return t.dayOfWeekStartIndexZero?d=="7"&&(f="0"):f=(parseInt(d)-1).toString(),c.replace(d,f)}),e[5]=="L"&&(e[5]="6"),e[3]=="?"&&(e[3]="*"),e[3].indexOf("W")>-1&&(e[3].indexOf(",")>-1||e[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var r={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var n in r)e[5]=e[5].replace(new RegExp(n,"gi"),r[n].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(c){var d=c.replace(/\D/,""),f=d;return t.monthStartIndexZero&&(f=(parseInt(d)+1).toString()),c.replace(d,f)});var o={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in o)e[4]=e[4].replace(new RegExp(a,"gi"),o[a].toString());e[0]=="0"&&(e[0]=""),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+="-".concat(e[2]));for(var u=0;u<e.length;u++)if(e[u].indexOf(",")!=-1&&(e[u]=e[u].split(",").filter(function(c){return c!==""}).join(",")||"*"),e[u]=="*/1"&&(e[u]="*"),e[u].indexOf("/")>-1&&!/^\*|\-|\,/.test(e[u])){var s=null;switch(u){case 4:s="12";break;case 5:s="6";break;case 6:s="9999";break;default:s=null;break}if(s!==null){var h=e[u].split("/");e[u]="".concat(h[0],"-").concat(s,"/").concat(h[1])}}},l.prototype.validate=function(e){var t="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},l.prototype.validateAnyRanges=function(e){i.default.secondRange(e[0]),i.default.minuteRange(e[1]),i.default.hourRange(e[2]),i.default.dayOfMonthRange(e[3]),i.default.monthRange(e[4],this.monthStartIndexZero),i.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},l.prototype.validateOnlyExpectedCharactersFound=function(e,t){var r=e.match(new RegExp("[^".concat(t,"]+"),"gi"));if(r&&r.length)throw new Error("Expression contains invalid values: '".concat(r.toString(),"'"))},l})();p.CronParser=y},333(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.ExpressionDescriptor=void 0;var i=v(823),y=v(949),l=(function(){function e(t,r){if(this.expression=t,this.options=r,this.expressionParts=new Array(5),!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var n=Object.keys(e.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(n,"'.")),this.options.locale=n}this.i18n=e.locales[this.options.locale],r.use24HourTimeFormat===void 0&&(r.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,r){var n=r===void 0?{}:r,o=n.throwExceptionOnParseError,a=o===void 0?!0:o,u=n.verbose,s=u===void 0?!1:u,h=n.dayOfWeekStartIndexZero,c=h===void 0?!0:h,d=n.monthStartIndexZero,f=d===void 0?!1:d,O=n.use24HourTimeFormat,T=n.trimHoursLeadingZero,m=T===void 0?!1:T,b=n.locale,E=b===void 0?null:b,X=n.logicalAndDayFields,x=X===void 0?!1:X,S={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:c,monthStartIndexZero:f,use24HourTimeFormat:O,trimHoursLeadingZero:m,locale:E,logicalAndDayFields:x};S.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var I=new e(t,S);return I.getFullDescription()},e.initialize=function(t,r){r===void 0&&(r="en"),e.specialCharacters=["/","-",",","*"],e.defaultLocale=r,t.load(e.locales)},e.prototype.getFullDescription=function(){var t,r,n="";try{var o=new y.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=o.parse(),this.expressionParts[0]==="@reboot")return((r=(t=this.i18n).atReboot)===null||r===void 0?void 0:r.call(t))||"Run once, at startup";var a=this.getTimeOfDayDescription(),u=this.getDayOfMonthDescription(),s=this.getMonthDescription(),h=this.getDayOfWeekDescription(),c=this.getYearDescription();n+=a+u+h+s+c,n=this.transformVerbosity(n,!!this.options.verbose),n=n.charAt(0).toLocaleUpperCase()+n.substr(1)}catch(d){if(!this.options.throwExceptionOnParseError)n=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(d)}return n},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],r=this.expressionParts[1],n=this.expressionParts[2],o="";if(!i.StringUtilities.containsAny(r,e.specialCharacters)&&!i.StringUtilities.containsAny(n,e.specialCharacters)&&!i.StringUtilities.containsAny(t,e.specialCharacters))o+=this.i18n.atSpace()+this.formatTime(n,r,t);else if(!t&&r.indexOf("-")>-1&&!(r.indexOf(",")>-1)&&!(r.indexOf("/")>-1)&&!i.StringUtilities.containsAny(n,e.specialCharacters)){var a=r.split("-");o+=i.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(n,a[0],""),this.formatTime(n,a[1],""))}else if(!t&&n.indexOf(",")>-1&&n.indexOf("-")==-1&&n.indexOf("/")==-1&&!i.StringUtilities.containsAny(r,e.specialCharacters)){var u=n.split(",");o+=this.i18n.at();for(var s=0;s<u.length;s++)o&&(o+=" "),o+=this.formatTime(u[s],r,""),s<u.length-2&&(o+=","),s==u.length-2&&(o+=this.i18n.spaceAnd())}else{var h=this.getSecondsDescription(),c=this.getMinutesDescription(),d=this.getHoursDescription();if(o+=h,o&&c&&(o+=", "),o+=c,c===d)return o;o&&d&&(o+=", "),o+=d}return o},e.prototype.getSecondsDescription=function(){var t=this,r=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(n){return n},function(n){return i.StringUtilities.format(t.i18n.everyX0Seconds(n),n)},function(n){return t.i18n.secondsX0ThroughX1PastTheMinute()},function(n){return n=="0"?"":parseInt(n)<20?t.i18n.atX0SecondsPastTheMinute(n):t.i18n.atX0SecondsPastTheMinuteGt20()||t.i18n.atX0SecondsPastTheMinute(n)});return r},e.prototype.getMinutesDescription=function(){var t=this,r=this.expressionParts[0],n=this.expressionParts[2],o=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(a){return a},function(a){return i.StringUtilities.format(t.i18n.everyX0Minutes(a),a)},function(a){return t.i18n.minutesX0ThroughX1PastTheHour()},function(a){var u,s;try{return a=="0"&&n.indexOf("/")==-1&&r==""?t.i18n.everyHour():a=="0"?((s=(u=t.i18n).onTheHour)===null||s===void 0?void 0:s.call(u))||t.i18n.atX0MinutesPastTheHour(a):parseInt(a)<20?t.i18n.atX0MinutesPastTheHour(a):t.i18n.atX0MinutesPastTheHourGt20()||t.i18n.atX0MinutesPastTheHour(a)}catch{return t.i18n.atX0MinutesPastTheHour(a)}});return o},e.prototype.getHoursDescription=function(){var t=this,r=this.expressionParts[2],n=0,o=[];r.split("/")[0].split(",").forEach(function(s){var h=s.split("-");h.length===2&&o.push({value:h[1],index:n+1}),n+=h.length});var a=0,u=this.getSegmentDescription(r,this.i18n.everyHour(),function(s){var h=o.find(function(d){return d.value===s&&d.index===a}),c=h&&t.expressionParts[1]!=="0";return a++,c?t.formatTime(s,"59",""):t.formatTime(s,"0","")},function(s){return i.StringUtilities.format(t.i18n.everyX0Hours(s),s)},function(s){return t.i18n.betweenX0AndX1()},function(s){return t.i18n.atX0()});return u},e.prototype.getDayOfWeekDescription=function(){var t=this,r=this.i18n.daysOfTheWeek(),n=null;return this.expressionParts[5]=="*"?n="":n=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(o,a){var u=o;o.indexOf("#")>-1?u=o.substring(0,o.indexOf("#")):o.indexOf("L")>-1&&(u=u.replace("L",""));var s=parseInt(u),h=t.i18n.daysOfTheWeekInCase?t.i18n.daysOfTheWeekInCase(a)[s]:r[s];if(o.indexOf("#")>-1){var c=null,d=o.substring(o.indexOf("#")+1),f=o.substring(0,o.indexOf("#"));switch(d){case"1":c=t.i18n.first(f);break;case"2":c=t.i18n.second(f);break;case"3":c=t.i18n.third(f);break;case"4":c=t.i18n.fourth(f);break;case"5":c=t.i18n.fifth(f);break}h=c+" "+h}return h},function(o){return parseInt(o)==1?"":i.StringUtilities.format(t.i18n.commaEveryX0DaysOfTheWeek(o),o)},function(o){var a=o.substring(0,o.indexOf("-")),u=t.expressionParts[3]!="*";return u?t.i18n.commaAndX0ThroughX1(a):t.i18n.commaX0ThroughX1(a)},function(o){var a=null;if(o.indexOf("#")>-1){var u=o.substring(o.indexOf("#")+1),s=o.substring(0,o.indexOf("#"));a=t.i18n.commaOnThe(u,s).trim()+t.i18n.spaceX0OfTheMonth()}else if(o.indexOf("L")>-1)a=t.i18n.commaOnTheLastX0OfTheMonth(o.replace("L",""));else{var h=t.expressionParts[3]!="*";h?t.options.logicalAndDayFields?a=t.i18n.commaOnlyOnX0(o):a=t.i18n.commaAndOnX0():a=t.i18n.commaOnlyOnX0(o)}return a}),n},e.prototype.getMonthDescription=function(){var t=this,r=this.i18n.monthsOfTheYear(),n=this.getSegmentDescription(this.expressionParts[4],"",function(o,a){return a&&t.i18n.monthsOfTheYearInCase?t.i18n.monthsOfTheYearInCase(a)[parseInt(o)-1]:r[parseInt(o)-1]},function(o){return parseInt(o)==1?"":i.StringUtilities.format(t.i18n.commaEveryX0Months(o),o)},function(o){return t.i18n.commaMonthX0ThroughMonthX1()||t.i18n.commaX0ThroughX1()},function(o){return t.i18n.commaOnlyInMonthX0?t.i18n.commaOnlyInMonthX0():t.i18n.commaOnlyInX0()});return n},e.prototype.getDayOfMonthDescription=function(){var t=this,r=null,n=this.expressionParts[3];switch(n){case"L":r=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":r=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var o=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(o){var a=parseInt(o[0].replace("W","")),u=a==1?this.i18n.firstWeekday():i.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());r=i.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),u);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var h=s[1];r=i.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(h),h);break}else{if(n=="*"&&this.expressionParts[5]!="*")return"";r=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(c){return c=="L"?t.i18n.lastDay():t.i18n.dayX0?i.StringUtilities.format(t.i18n.dayX0(),c):c},function(c){return c=="1"?t.i18n.commaEveryDay():t.i18n.commaEveryX0Days(c)},function(c){return t.i18n.commaBetweenDayX0AndX1OfTheMonth(c)},function(c){return t.i18n.commaOnDayX0OfTheMonth(c)})}break}}return r},e.prototype.getYearDescription=function(){var t=this,r=this.getSegmentDescription(this.expressionParts[6],"",function(n){return/^\d+$/.test(n)?new Date(parseInt(n),1).getFullYear().toString():n},function(n){return i.StringUtilities.format(t.i18n.commaEveryX0Years(n),n)},function(n){return t.i18n.commaYearX0ThroughYearX1()||t.i18n.commaX0ThroughX1()},function(n){return t.i18n.commaOnlyInYearX0?t.i18n.commaOnlyInYearX0():t.i18n.commaOnlyInX0()});return r},e.prototype.getSegmentDescription=function(t,r,n,o,a,u){var s=null,h=t.indexOf("/")>-1,c=t.indexOf("-")>-1,d=t.indexOf(",")>-1;if(!t)s="";else if(t==="*")s=r;else if(!h&&!c&&!d)s=i.StringUtilities.format(u(t),n(t));else if(d){for(var f=t.split(","),O="",T=this.i18n.spaceAnd(),m=0;m<f.length;m++)if(m>0&&f.length>2&&(O+=",",m<f.length-1&&(O+=" ")),m>0&&f.length>1&&(m==f.length-1||f.length==2)&&(O+=T==","&&f.length>2?" ":"".concat(T," ")),f[m].indexOf("/")>-1||f[m].indexOf("-")>-1){var b=f[m].indexOf("-")>-1&&f[m].indexOf("/")==-1,E=this.getSegmentDescription(f[m],r,n,o,b?this.i18n.commaX0ThroughX1:a,u);b&&(E=E.replace(", ","")),O+=E}else if(!h)O+=n(f[m]);else{var X=this.getSegmentDescription(f[m],r,n,o,a,u);X&&X.startsWith(", ")&&(X=X.substring(2)),O+=X}h?s=O:s=i.StringUtilities.format(u(t),O)}else if(h){var f=t.split("/");if(s=i.StringUtilities.format(o(f[1]),f[1]),f[0].indexOf("-")>-1){var x=this.generateRangeSegmentDescription(f[0],a,n);x.indexOf(", ")!=0&&(s+=", "),s+=x}else if(f[0].indexOf("*")==-1){var S=i.StringUtilities.format(u(f[0]),n(f[0]));S=S.replace(", ",""),s+=i.StringUtilities.format(this.i18n.commaStartingX0(),S)}}else c&&(s=this.generateRangeSegmentDescription(t,a,n));return s},e.prototype.generateRangeSegmentDescription=function(t,r,n){var o="",a=t.split("-"),u=n(a[0],1),s=n(a[1],2),h=r(t);return o+=i.StringUtilities.format(h,u,s),o},e.prototype.formatTime=function(t,r,n){var o=0,a=0,u=parseInt(t)+o,s=parseInt(r)+a;s>=60?(s-=60,u+=1):s<0&&(s+=60,u-=1),u>=24?u=u-24:u<0&&(u=24+u);var h="",c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),h=c?"".concat(this.getPeriod(u)," "):" ".concat(this.getPeriod(u)),u>12&&(u-=12),u===0&&(u=12));var d="";n&&(d=":".concat(("00"+n).substring(n.length)));var f=u.toString(),O=("00"+f).substring(f.length),T=s.toString(),m=("00"+T).substring(T.length),b=this.options.trimHoursLeadingZero?f:O;return"".concat(c?h:"").concat(b,":").concat(m).concat(d).concat(c?"":h)},e.prototype.transformVerbosity=function(t,r){if(!r&&(t=t.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),t=t.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),t=t.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),t=t.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var n=0,o=Object.entries(this.i18n.conciseVerbosityReplacements());n<o.length;n++){var a=o[n],u=a[0],s=a[1];t=t.replace(new RegExp(u,"g"),s)}return t},e.prototype.getPeriod=function(t){return t>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},e.locales={},e})();p.ExpressionDescriptor=l},747(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.enLocaleLoader=void 0;var i=v(486),y=(function(){function l(){}return l.prototype.load=function(e){e.en=new i.en},l})();p.enLocaleLoader=y},486(g,p){Object.defineProperty(p,"__esModule",{value:!0}),p.en=void 0;var v=(function(){function i(){}return i.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},i.prototype.atX0MinutesPastTheHourGt20=function(){return null},i.prototype.commaMonthX0ThroughMonthX1=function(){return null},i.prototype.commaYearX0ThroughYearX1=function(){return null},i.prototype.use24HourTimeFormatByDefault=function(){return!1},i.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},i.prototype.everyMinute=function(){return"every minute"},i.prototype.everyHour=function(){return"every hour"},i.prototype.atSpace=function(){return"At "},i.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},i.prototype.at=function(){return"At"},i.prototype.spaceAnd=function(){return" and"},i.prototype.everySecond=function(){return"every second"},i.prototype.everyX0Seconds=function(){return"every %s seconds"},i.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},i.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},i.prototype.everyX0Minutes=function(){return"every %s minutes"},i.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},i.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},i.prototype.everyX0Hours=function(){return"every %s hours"},i.prototype.betweenX0AndX1=function(){return"between %s and %s"},i.prototype.atX0=function(){return"at %s"},i.prototype.commaEveryDay=function(){return", every day"},i.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},i.prototype.commaX0ThroughX1=function(){return", %s through %s"},i.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},i.prototype.first=function(){return"first"},i.prototype.second=function(){return"second"},i.prototype.third=function(){return"third"},i.prototype.fourth=function(){return"fourth"},i.prototype.fifth=function(){return"fifth"},i.prototype.commaOnThe=function(){return", on the "},i.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},i.prototype.lastDay=function(){return"the last day"},i.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},i.prototype.commaOnlyOnX0=function(){return", only on %s"},i.prototype.commaAndOnX0=function(){return", and on %s"},i.prototype.commaEveryX0Months=function(){return", every %s months"},i.prototype.commaOnlyInX0=function(){return", only in %s"},i.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},i.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},i.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},i.prototype.firstWeekday=function(){return"first weekday"},i.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},i.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},i.prototype.commaEveryX0Days=function(){return", every %s days in a month"},i.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},i.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},i.prototype.commaEveryHour=function(){return", every hour"},i.prototype.commaEveryX0Years=function(){return", every %s years"},i.prototype.commaStartingX0=function(){return", starting %s"},i.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},i.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},i.prototype.atReboot=function(){return"Run once, at startup"},i.prototype.onTheHour=function(){return"on the hour"},i})();p.en=v},515(g,p){Object.defineProperty(p,"__esModule",{value:!0});function v(y,l){if(!y)throw new Error(l)}var i=(function(){function y(){}return y.secondRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=59,"seconds part must be >= 0 and <= 59")}},y.minuteRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=59,"minutes part must be >= 0 and <= 59")}},y.hourRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=23,"hours part must be >= 0 and <= 23")}},y.dayOfMonthRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=1&&r<=31,"DOM part must be >= 1 and <= 31")}},y.monthRange=function(l,e){for(var t=l.split(","),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var n=parseInt(t[r],10);v(n>=1&&n<=12,e?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},y.dayOfWeekRange=function(l,e){for(var t=l.split(","),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var n=parseInt(t[r],10);v(n>=0&&n<=6,e?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},y})();p.default=i},823(g,p){Object.defineProperty(p,"__esModule",{value:!0}),p.StringUtilities=void 0;var v=(function(){function i(){}return i.format=function(y){for(var l=[],e=1;e<arguments.length;e++)l[e-1]=arguments[e];return y.replace(/%s/g,function(t){return l.shift()})},i.containsAny=function(y,l){return l.some(function(e){return y.indexOf(e)>-1})},i})();p.StringUtilities=v}},w={};function _(g){var p=w[g];if(p!==void 0)return p.exports;var v=w[g]={exports:{}};return D[g](v,v.exports,_),v.exports}var k={};return(()=>{var g=k;Object.defineProperty(g,"__esModule",{value:!0}),g.toString=void 0;var p=_(333),v=_(747);p.ExpressionDescriptor.initialize(new v.enLocaleLoader),g.default=p.ExpressionDescriptor;var i=p.ExpressionDescriptor.toString;g.toString=i})(),k})())})(M)),M.exports}var R=H();const F=U(R);export{F as c};
@@ -0,0 +1 @@
1
+ import{j as t,a2 as o}from"./index-DtRfQcRH.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -0,0 +1 @@
1
+ import{cq as r,e$ as l,ap as i,e5 as u,cr as c,ai as d}from"./index-DtRfQcRH.js";function o(e,a=""){return`${d}/api/${e}/deployments${a}`}const y=50;function f(e){const{slug:a}=r();return l({queryKey:["deployments-feed",a,e?.resourceKind,e?.resourceId],queryFn:async({pageParam:t})=>{const n=new URLSearchParams({limit:String(y)});t!==null&&n.set("before_id",String(t)),e&&(n.set("resource_kind",e.resourceKind),n.set("resource_id",e.resourceId));const s=await i(o(a,`?${n.toString()}`),{credentials:"include"});return s.status===404?{items:[],has_more:!1}:(await u(s,"Failed to fetch deployments"),await s.json())},initialPageParam:null,getNextPageParam:t=>t.has_more?t.items[t.items.length-1]?.id:void 0,enabled:!!a,staleTime:15e3,retry:!1})}function h(e){const{slug:a}=r();return c({queryKey:["deployment-detail",a,e],queryFn:async()=>{const t=await i(o(a,`/${e}`),{credentials:"include"});return t.status===404?null:(await u(t,"Failed to fetch deployment"),await t.json())},enabled:!!a&&!!e,staleTime:15e3,retry:!1})}function g(e){const{slug:a}=r();return c({queryKey:["deployment-change-detail",a,e],queryFn:async()=>{const t=await i(o(a,`/changes/${e}`),{credentials:"include"});return t.status===404?null:(await u(t,"Failed to fetch change"),(await t.json()).change)},enabled:!!a&&!!e,staleTime:15e3,retry:!1})}export{g as a,h as b,f as u};
@@ -0,0 +1 @@
1
+ import{j as a,c1 as x,c2 as p,bq as m,gI as c,B as f,E as o,L as i,gJ as h,ah as r}from"./index-DtRfQcRH.js";import{u as g}from"./deployments-D1gbQwsy.js";function y(e){return e==="partial_failure"?a.jsx(r,{variant:"destructive",children:"Partial failure"}):e==="succeeded"?a.jsx(r,{variant:"secondary",children:"Succeeded"}):null}function j(e){switch(e){case"created":return a.jsx(r,{variant:"default",children:"Created"});case"updated":return a.jsx(r,{variant:"secondary",children:"Updated"});case"deleted":return a.jsx(r,{variant:"destructive",children:"Deleted"});default:return null}}function N(e){if(!e)return null;const t=[e.create?`${e.create} created`:null,e.update?`${e.update} updated`:null,e.delete?`${e.delete} deleted`:null].filter(n=>n!==null);return t.length>0?t.join(" · "):"no changes"}const u="flex items-start gap-3 px-3 py-2.5 transition-colors hover:bg-accent/50";function B({owner:e}){const t=g(),n=t.data?.pages.flatMap(s=>s.items)??[];return t.isLoading?a.jsx("div",{className:"max-w-3xl",children:a.jsx(x,{label:"deployments"})}):t.isError?a.jsx(p,{label:"deployments"}):n.length===0?a.jsx(m,{icon:c,title:"No deployments yet",description:"lobu apply runs and settings edits will appear here as an audit trail."}):a.jsxs("div",{className:"max-w-3xl space-y-3",children:[a.jsx("div",{className:"overflow-hidden rounded-lg border",children:n.map((s,l)=>{const d=l===n.length-1;return s.type==="deployment"?a.jsx(v,{item:s,owner:e,isLast:d},s.id):a.jsx(b,{item:s,owner:e,isLast:d},s.id)})}),t.hasNextPage?a.jsx(f,{variant:"outline",size:"sm",className:"h-8 text-xs",disabled:t.isFetchingNextPage,onClick:()=>t.fetchNextPage(),children:t.isFetchingNextPage?"Loading...":"Load more"}):null]})}function v({item:e,owner:t,isLast:n}){const l=[N(e.counts),e.createdBy?`by ${e.createdBy}`:null,o(e.createdAt)].filter(Boolean).join(" · ");return a.jsxs(i,{to:"/$owner/connectors/deployments/$deploymentId",params:{owner:t,deploymentId:e.applyId??String(e.id)},className:`${u} ${n?"":"border-b"}`,children:[a.jsx(c,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"truncate text-sm font-medium",children:"Deployment"}),y(e.status),e.gitSha?a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.gitSha.slice(0,7)}):null]}),a.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:l})]})]})}function b({item:e,owner:t,isLast:n}){const s=[e.actorSource?`via ${e.actorSource}`:null,e.createdBy?`by ${e.createdBy}`:null,o(e.createdAt)].filter(Boolean).join(" · ");return a.jsxs(i,{to:"/$owner/connectors/deployments/$deploymentId",params:{owner:t,deploymentId:`change-${e.id}`},className:`${u} ${n?"":"border-b"}`,children:[a.jsx(h,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("span",{className:"truncate text-sm font-medium",children:[e.resourceKind??"config",e.resourceId?a.jsxs("span",{className:"text-muted-foreground",children:[" ",e.resourceId]}):null]}),j(e.op)]}),a.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:s})]})]})}export{B as D,j as c,y as d};