@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{ag as ge,v as xe,r as o,j as e,ad as ve,B as R,ah as X,ai as oe}from"./index-DtRfQcRH.js";import{s as ye,g as we,u as je,a as be,b as ke,A as Ce,W as Ne}from"./oauth-workspace-access-D6epOq0R.js";import{C as Z,a as ee,b as se,d as re,c as te}from"./card-4Ull9W6d.js";function W(r){return r.trim().toUpperCase()}const Se=15e3;async function Ae(r){const c=new AbortController,_=window.setTimeout(()=>c.abort(),Se);try{const i=await fetch(`${oe}/oauth/device/info?user_code=${encodeURIComponent(r)}`,{credentials:"include",signal:c.signal}),b=await i.json().catch(()=>null);return{response:i,data:b}}catch(i){throw c.signal.aborted?new Error("Verification timed out. Check your connection and try again."):i}finally{window.clearTimeout(_)}}function P(r,c){return typeof r?.error_description=="string"&&r.error_description||typeof r?.error=="string"&&r.error||c}function Te(){const r=ge.useSearch(),{session:c,isReady:_}=xe(),i=!_,[b,ne]=o.useState(r.user_code||""),[n,f]=o.useState(null),[O,a]=o.useState(null),[l,ce]=o.useState(null),[I,E]=o.useState(null),[T,L]=o.useState(null),[D,U]=o.useState(!1),g=o.useRef(0),v=r.return_to,M=v?"app":"terminal",ie=!!r.user_code,k=W(b),d=I?.code===k?I:null,h=d!==null,y=d?.scopes??[],ae=o.useMemo(()=>ye(y,T),[T,y]),F=y.some(s=>s.startsWith("mcp:")),C=y.includes("device_worker:run"),le=y.includes("connections:token"),V=C||le,N=we(d?.resource),w=h&&F&&!N,B=d?.multiWorkspaceGrantsEnabled===!0,{orgList:$,workspaceAccess:de,setWorkspaceAccess:ue,selectedOrgIds:G,toggleSelectedOrgId:pe,resetWorkspaceSelection:he,personalOrgId:me,orgsLoading:q,orgsError:S,retryOrgs:Y,workspaceSelectionReady:fe}=je({requirePersonal:w&&C,allowMultiple:B}),x=$.find(s=>s.id===me)??null,A=h&&C&&!N,H=w?fe:!A||!q&&!S&&x!==null,z=o.useCallback(async s=>{const u=++g.current;f("verify"),a(null),U(!1);try{const{response:m,data:t}=await Ae(s);if(u!==g.current)return;if(m.status===401){const j=new URL("/auth/login",window.location.origin);j.searchParams.set("callbackUrl",window.location.href),window.location.href=j.toString();return}if(!m.ok||!t)throw new Error(P(t,"Failed to verify device authorization code"));const p=Array.isArray(t.scopes)?t.scopes:[];E({code:s,clientName:t.client_name??null,scopes:p,resource:typeof t.resource=="string"?t.resource:null,multiWorkspaceGrantsEnabled:t.multi_workspace_grants_enabled===!0}),L(be(p))}catch(m){if(u!==g.current)return;E(null),a(m instanceof Error?m.message:"Unexpected error")}finally{u===g.current&&f(null)}},[]);ke(!!c,i),o.useEffect(()=>{if(!(i||!c||!r.user_code))return z(W(r.user_code)),()=>{g.current+=1}},[c,i,r.user_code,z]);const J=async s=>{const u=k;if(!u){a(`Please enter the code shown in your ${M}.`);return}if(!h){a("Verify the device code before approving or denying access.");return}if(s&&V&&!D){a("Confirm that you initiated this request and that the device code matches.");return}if(s&&!H){a(S?"Workspaces could not be loaded. Retry before approving.":A&&!x?"Your personal workspace is required before this device can be approved.":"Choose at least one workspace before approving.");return}const m=d?.clientName??null;f(s?"approve":"deny"),a(null);try{const t=await fetch(`${oe}/oauth/device/approve`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({user_code:u,approved:s,...s?{scope:ae.join(" ")}:{},...s&&w?{workspace_access:de,organization_ids:G}:{},...s&&A&&x?{organization_id:x.id}:{}})}),p=await t.json().catch(()=>null);if(t.status===401){const Q=new URL("/auth/login",window.location.origin);Q.searchParams.set("callbackUrl",window.location.href),window.location.href=Q.toString();return}if(!t.ok)throw new Error(P(p,"Failed to process device authorization"));const j=s?"approved":"denied";if(p?.status!==j)throw new Error(P(p,s?"The server did not confirm this approval. The device is still waiting — try again.":"The server did not confirm this denial. Try again."));const K=typeof p.user_code=="string"?W(p.user_code):null;if(K!==null&&K!==u)throw new Error("The server confirmed a different device code. Re-check the code shown on your device.");f(null),ce({outcome:j,code:u,clientName:m})}catch(t){f(null),a(t instanceof Error?t.message:"Unexpected error")}};return o.useEffect(()=>{if(l?.outcome!=="approved"||!v)return;const s=window.setTimeout(()=>{window.location.href=v},600);return()=>window.clearTimeout(s)},[l,v]),i||!c?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..."})}):l?e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs(Z,{className:"w-full max-w-lg",role:"status","aria-live":"polite",children:[e.jsxs(ee,{children:[e.jsx(se,{children:l.outcome==="approved"?ie?"Access Authorized":"Device Authorized":"Authorization Denied"}),e.jsx(re,{children:l.outcome==="approved"?v?"Returning you to the app...":"You can close this tab and return to your terminal.":"The device was not authorized. You can close this tab."})]}),e.jsx(te,{className:"text-sm",children:e.jsxs("dl",{className:"space-y-1",children:[e.jsx("dt",{className:"text-muted-foreground",children:l.outcome==="approved"?"Approved code":"Denied code"}),e.jsx("dd",{className:"font-mono text-base tracking-widest text-foreground",children:l.code}),l.clientName?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Requested by"}),e.jsx("dd",{className:"text-foreground",children:l.clientName})]}):null]})})]})}):e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs(Z,{className:"w-full max-w-lg",children:[e.jsxs(ee,{children:[e.jsx(se,{asChild:!0,children:e.jsx("h1",{children:h?"Authorize application":"Connect a device"})}),e.jsx(re,{children:h?"Review the application, access level, and workspaces.":`Enter the code shown in your ${M}.`})]}),e.jsxs(te,{className:"space-y-5","aria-busy":n!==null,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"user-code",className:"text-sm font-medium",children:"Device code"}),e.jsx(ve,{id:"user-code",value:b,disabled:n==="approve"||n==="deny",onChange:s=>{g.current+=1,ne(s.target.value.toUpperCase()),E(null),L(null),he(),U(!1),f(null),a(null)},placeholder:"ABCD-1234",className:"font-mono text-center text-lg tracking-widest",maxLength:9,autoFocus:!r.user_code})]}),d&&e.jsx(Ce,{idPrefix:"oauth-device",clientName:d.clientName,requestedScopes:d.scopes,accessLevel:T,onAccessLevelChange:L,sensitiveScopesAcknowledged:D,onSensitiveScopesAcknowledgedChange:U,disabled:n!==null}),w&&e.jsx(Ne,{idPrefix:"oauth-device",allowMultiple:B,orgList:$,selectedOrgIds:G,onWorkspaceAccessChange:ue,onSelectedOrgChange:pe,orgsLoading:q,orgsError:S,onRetry:Y,disabled:n!==null,personalRequired:C}),h&&F&&N&&e.jsxs("section",{className:"rounded-md border border-primary/20 bg-primary/5 p-3 text-sm space-y-1",children:[e.jsxs("p",{className:"font-medium text-foreground",children:["Workspace access: only ",N]}),e.jsx("p",{className:"text-muted-foreground",children:"This request is fixed to the workspace in the MCP resource URL."})]}),A&&!w&&e.jsxs("section",{className:"rounded-md border border-primary/20 bg-primary/5 p-3 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Device home"}),q?e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground",children:"Loading your personal workspace..."}):S?e.jsxs("div",{role:"alert",className:"space-y-2 text-destructive",children:[e.jsx("p",{children:"Workspaces could not be loaded. Approval is unavailable until they load."}),e.jsx(R,{type:"button",variant:"outline",size:"sm",onClick:Y,children:"Retry"})]}):x?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{children:x.name}),e.jsx(X,{variant:"outline",children:"Personal"}),e.jsx(X,{variant:"secondary",children:"Required"})]}),e.jsx("p",{className:"text-muted-foreground",children:"Device data stays in your personal workspace."})]}):e.jsx("p",{role:"alert",className:"text-destructive",children:"A personal workspace is required to authorize this device."})]}),O&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:O}),e.jsx("div",{className:"flex items-center justify-end gap-3",children:h?e.jsxs(e.Fragment,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>J(!1),disabled:n!==null,children:n==="deny"?"Denying...":"Deny"}),e.jsx(R,{type:"button",onClick:()=>J(!0),disabled:n!==null||!H||V&&!D,children:n==="approve"?"Approving...":"Approve"})]}):e.jsx(R,{type:"button",onClick:()=>z(k),disabled:n!==null||!k,children:n==="verify"?"Verifying...":"Continue"})})]})]})})}export{Te as component};
@@ -1 +1 @@
1
- import{j as e,cr as C,n as w,h9 as b,r as x,s as k,bm as F,ha as v,B as u,hb as L,x as A,bw as S,aj as I,aS as P,hc as y,aD as R,hd as E,he as $,fi as _,L as O,P as z,b as B,hf as T,hg as D,J as K,hh as V,fk as q}from"./index-BUr8321-.js";import{a as M,R as H}from"./runs-panel-DsdESupx.js";import{S as J,g as U,c as N,b as X,d as G}from"./runs-table-B7jKuILd.js";function ae({formRows:s=5}){return e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]",children:[e.jsx(M,{}),e.jsx(C,{rows:s})]})}function Q(s,a){const n=s?.display_name;return typeof n=="string"&&n.trim()?n:a?.trim()||"Folder"}function W({connectionId:s}){const{data:a=[],isLoading:n}=w(s),o=b(),[c,r]=x.useState(null),i=a.filter(t=>t.config?.folder_id!=null),d=()=>{window.location.href=y("feeds/add"),R("Opening Lobu…",{description:"Choose a folder in the Lobu app. It appears here after the next sync."})},l=t=>{const m=t.config?.folder_id;typeof m=="string"&&(window.location.href=y(`feeds/remove?folder_id=${encodeURIComponent(m)}`)),o.mutate(t.id),r(null)};return n?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(k,{size:"lg"})}):i.length===0?e.jsx(F,{icon:v,title:"No folders yet",description:"Add a local folder for Lobu to read text files from.",actionLabel:"Add folder",onAction:d}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Folders"}),e.jsxs(u,{variant:"outline",size:"sm",onClick:d,children:[e.jsx(L,{className:"mr-2 h-4 w-4"}),"Add folder"]})]}),e.jsx("div",{className:"space-y-2",children:i.map(t=>e.jsxs("div",{className:I(P,"flex items-center justify-between gap-3 px-3 py-2"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(v,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:Q(t.config,t.display_name)}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[t.event_count>0?`${t.event_count} document${t.event_count===1?"":"s"}`:"No documents yet",t.last_sync_at?` · synced ${A(t.last_sync_at)}`:""]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(J,{status:U(t.status),children:t.status}),c===t.id?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(u,{variant:"destructive",size:"sm",onClick:()=>l(t),children:"Remove"}),e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>r(null),children:"Cancel"})]}):e.jsx(u,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive","aria-label":"Remove folder",onClick:()=>r(t.id),children:e.jsx(S,{className:"h-4 w-4"})})]})]},t.id))})]})}function ne({connection:s,connectorDef:a,ownerSlug:n,openSettings:o=!1,authResult:c,showActivity:r=!0,embedded:i=!1}){const[d,l]=x.useState(o);x.useEffect(()=>{o&&l(!0)},[o]);const t=s.id,m=s.connector_key,h=s.facets?.chat??!1,p=h?"Channels":"Feeds",f=s.has_operations===!0,j=s.feed_count>0||N(a),g=e.jsx(D,{connection:s,connectorDef:a,ownerSlug:n});return e.jsxs("div",{className:"space-y-6",children:[c&&e.jsx(E,{result:c}),s.auth_profile_kind==="oauth_account"&&e.jsx($,{connection:s,connectorDef:a,onReview:()=>{l(!0),requestAnimationFrame(()=>document.getElementById("connection-auth")?.scrollIntoView({block:"nearest"}))}}),m==="local.directory"&&e.jsx(W,{connectionId:t}),(j||f)&&e.jsxs("div",{className:i?"space-y-6":"grid grid-cols-1 items-start gap-3 sm:grid-cols-2",children:[j&&(i?e.jsx(_,{title:p,count:s.feed_count===1?"1 source":`${s.feed_count} sources`,action:N(a)?e.jsx(u,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(O,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:n,connectorKey:m,connectionId:String(t)},search:{addFeed:!0},children:[e.jsx(z,{className:"h-3.5 w-3.5"}),h?"Add channel":"Add source"]})}):null,children:e.jsx(X,{connection:s,ownerSlug:n,connectorKey:m,connectorDef:a})}):e.jsx(G,{connection:s,ownerSlug:n,title:p})),f&&(i?e.jsx(B,{connection:s}):e.jsx(Y,{connection:s,ownerSlug:n}))]}),i?e.jsx(T,{title:"Connection settings",summary:"name, visibility, credentials, remove",open:d,onOpenChange:l,children:g}):g,r&&!h&&e.jsx(_,{title:"Recent activity",children:e.jsx(H,{scope:{connectionId:t},ownerSlug:n})})]})}function Y({connection:s,ownerSlug:a}){const n=K(),{data:o=[],isLoading:c,isError:r}=V(s.id),i=o.filter(l=>l.readiness==="scope_upgrade_required").length,d=c?"Loading actions…":r?"Could not load actions — open to retry":`${o.length} actions${i?` · ${i} need additional provider access`:" · permissions and approval policy"}`;return e.jsx(q,{title:"Actions",summary:d,onOpen:()=>n?.open({href:"",title:"Actions",connectorPanel:{section:"actions",connectionId:s.id,connectorKey:s.connector_key,organizationId:s.organization_id,ownerSlug:a}})})}const Z=new Set(["Device was removed","Device was moved to another workspace"]);function ie(s){const a=s.error_message??null;return!a||!Z.has(a)?a:!!s.device_worker_id&&(s.device_last_seen_at!=null||s.device_worker_handle!=null||s.device_label!=null)?null:a}export{ne as C,ae as R,ie as c};
1
+ import{j as e,fK as C,n as w,hu as b,r as x,s as k,bq as A,hv as v,B as m,hw as F,E as L,bA as I,al as S,aV as E,hx as y,aG as P,hy as R,hz as $,eH as _,L as O,P as z,b as B,hA as T,hB as D,t as K,hC as V,eJ as q}from"./index-DtRfQcRH.js";import{a as H,R as M}from"./runs-panel-B2852xus.js";import{S as G,g as J,c as N,b as U,d as X}from"./runs-table--dnFQatY.js";function ae({formRows:s=5}){return e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]",children:[e.jsx(H,{}),e.jsx(C,{rows:s})]})}function Q(s,a){const n=s?.display_name;return typeof n=="string"&&n.trim()?n:a?.trim()||"Folder"}function W({connectionId:s}){const{data:a=[],isLoading:n}=w(s),o=b(),[c,r]=x.useState(null),i=a.filter(t=>t.config?.folder_id!=null),d=()=>{window.location.href=y("feeds/add"),P("Opening Lobu…",{description:"Choose a folder in the Lobu app. It appears here after the next sync."})},l=t=>{const u=t.config?.folder_id;typeof u=="string"&&(window.location.href=y(`feeds/remove?folder_id=${encodeURIComponent(u)}`)),o.mutate(t.id),r(null)};return n?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(k,{size:"lg"})}):i.length===0?e.jsx(A,{icon:v,title:"No folders yet",description:"Add a local folder for Lobu to read text files from.",actionLabel:"Add folder",onAction:d}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Folders"}),e.jsxs(m,{variant:"outline",size:"sm",onClick:d,children:[e.jsx(F,{className:"mr-2 h-4 w-4"}),"Add folder"]})]}),e.jsx("div",{className:"space-y-2",children:i.map(t=>e.jsxs("div",{className:S(E,"flex items-center justify-between gap-3 px-3 py-2"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(v,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:Q(t.config,t.display_name)}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[t.event_count>0?`${t.event_count} document${t.event_count===1?"":"s"}`:"No documents yet",t.last_sync_at?` · synced ${L(t.last_sync_at)}`:""]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(G,{status:J(t.status),children:t.status}),c===t.id?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(m,{variant:"destructive",size:"sm",onClick:()=>l(t),children:"Remove"}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>r(null),children:"Cancel"})]}):e.jsx(m,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive","aria-label":"Remove folder",onClick:()=>r(t.id),children:e.jsx(I,{className:"h-4 w-4"})})]})]},t.id))})]})}function ne({connection:s,connectorDef:a,ownerSlug:n,openSettings:o=!1,authResult:c,showActivity:r=!0,embedded:i=!1}){const[d,l]=x.useState(o);x.useEffect(()=>{o&&l(!0)},[o]);const t=s.id,u=s.connector_key,h=s.facets?.chat??!1,p=h?"Channels":"Feeds",f=s.has_operations===!0,j=s.feed_count>0||N(a),g=e.jsx(D,{connection:s,connectorDef:a,ownerSlug:n});return e.jsxs("div",{className:"space-y-6",children:[c&&e.jsx(R,{result:c}),s.auth_profile_kind==="oauth_account"&&e.jsx($,{connection:s,connectorDef:a,onReview:()=>{l(!0),requestAnimationFrame(()=>document.getElementById("connection-auth")?.scrollIntoView({block:"nearest"}))}}),u==="local.directory"&&e.jsx(W,{connectionId:t}),(j||f)&&e.jsxs("div",{className:i?"space-y-6":"grid grid-cols-1 items-start gap-3 sm:grid-cols-2",children:[j&&(i?e.jsx(_,{title:p,count:s.feed_count===1?"1 source":`${s.feed_count} sources`,action:N(a)?e.jsx(m,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(O,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:n,connectorKey:u,connectionId:String(t)},search:{addFeed:!0},children:[e.jsx(z,{className:"h-3.5 w-3.5"}),h?"Add channel":"Add source"]})}):null,children:e.jsx(U,{connection:s,ownerSlug:n,connectorKey:u,connectorDef:a})}):e.jsx(X,{connection:s,ownerSlug:n,title:p})),f&&(i?e.jsx(B,{connection:s}):e.jsx(Y,{connection:s,ownerSlug:n}))]}),i?e.jsx(T,{title:"Connection settings",summary:"name, visibility, credentials, remove",open:d,onOpenChange:l,children:g}):g,r&&!h&&e.jsx(_,{title:"Recent activity",children:e.jsx(M,{scope:{connectionId:t},ownerSlug:n})})]})}function Y({connection:s,ownerSlug:a}){const n=K(),{data:o=[],isLoading:c,isError:r}=V(s.id),i=o.filter(l=>l.readiness==="scope_upgrade_required").length,d=c?"Loading actions…":r?"Could not load actions — open to retry":`${o.length} actions${i?` · ${i} need additional provider access`:" · permissions and approval policy"}`;return e.jsx(q,{title:"Actions",summary:d,onOpen:()=>n?.open({href:"",title:"Actions",connectorPanel:{section:"actions",connectionId:s.id,connectorKey:s.connector_key,organizationId:s.organization_id,ownerSlug:a}})})}const Z=new Set(["Device was removed","Device was moved to another workspace"]);function ie(s){const a=s.error_message??null;return!a||!Z.has(a)?a:!!s.device_worker_id&&(s.device_last_seen_at!=null||s.device_worker_handle!=null||s.device_label!=null)?null:a}export{ne as C,ae as R,ie as c};
@@ -0,0 +1 @@
1
+ import{ci as u,eI as l,bu as f}from"./index-DtRfQcRH.js";function p(n){return l(n)&&n.required_capability!=="os.files"}const m={data:!1,chat:!1,actions:!1,audience:!1,inference:!1,runtime:!0};function _(n){return n==="macos"?"macOS":n==="ios"?"iOS":n==="chrome-extension"?"Chrome":n??"Unknown platform"}function y(n,c,o){const i=new Map(c.map(e=>[e.connector_key,e]));return n.map(e=>{const s={...m};for(const r of e.connectors){if(r.organization_slug!==o)continue;const a=i.get(r.connector_key);if(a?.connections.some(t=>t.id===r.connection_id))for(const t of Object.keys(s))s[t]||=a.facets[t]}return{device:e,facets:s,connector:{key:`device-row:${e.id}`,name:u(e),description:null,version:"",auth_schema:null,feeds_schema:null,actions_schema:null,options_schema:null,status:e.online?"active":"inactive",login_enabled:!1,installed:!0}}})}function b(n){const c=_(f(n)),o=n.connector_count,i=`${o} ${o===1?"connector":"connectors"}`;return[c,i,n.online?"online":"offline"].join(" · ")}export{y as b,p as c,b as d};
@@ -1 +1 @@
1
- import{dI as K,h1 as O,j as e,fi as N,S as _,B as j,bq as E,L as w,dU as A,r as b,dz as F,dB as H,dC as V,a as q,a2 as U,bb as W,h2 as Y,h3 as G,h4 as J,b7 as Q,bc as P,h5 as X,h6 as Z,gH as ee,bF as se,g2 as ne,h7 as L,ab as te,d8 as R,s as $,bw as ae,H as ie,bp as ce,g3 as oe,g4 as re,x as le,h8 as B,aV as de}from"./index-BUr8321-.js";import{c as me,C as xe,R as ue}from"./device-pin-tombstone-1ikyqSdb.js";import{R as he}from"./runs-panel-DsdESupx.js";import{S as pe,g as fe}from"./runs-table-B7jKuILd.js";import{c as ge}from"./connection-label-BobuYiAG.js";import{c as je}from"./device-rows-Cp3yMcuV.js";import"./runs-BnYdToDc.js";function ve({device:t,organizationId:s,ownerSlug:r,selectedConnection:p,openSettings:u}){const{data:d=[],isLoading:g,isError:h,refetch:l}=K(s),c=new Map(d.map(i=>[i.key,i])),a=new Map,m=[];for(const i of t.connectors){if(i.organization_slug!==r)continue;const o=c.get(i.connector_key);if(!o||!je(o)){m.push(i);continue}const v=o.required_capability??`connector:${o.key}`,f=a.get(v)??{key:v,name:o.name,connections:[]};f.name=O[v]??o.name,f.connections.push(i),a.set(v,f)}return e.jsxs(e.Fragment,{children:[e.jsxs(N,{title:"Capabilities",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Manage the native connections available to this workspace."}),t.online?null:e.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:"This device is offline. You can edit its settings; actions and sync need it to reconnect."}),!s||g?e.jsx(_,{className:"h-24 w-full"}):h?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load capability settings."}),e.jsx(j,{variant:"outline",size:"sm",onClick:()=>void l(),children:"Retry"})]}):a.size===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No native connections on this device in this workspace."}):e.jsx("div",{className:"divide-y border-y",children:[...a.values()].map(i=>e.jsx(be,{group:i,deviceId:t.id,organizationId:s,ownerSlug:r,definitionsByKey:c,selectedConnection:p,openSettings:u},i.key))}),E(t)==="macos"?e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Manage macOS permissions in the Lobu app on this device."}):null]}),s&&m.length>0&&!g&&!h?e.jsxs(N,{title:"Connections",count:String(m.length),children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Apps and sources that use this device."}),e.jsx("div",{className:"divide-y border-y",children:m.map(i=>e.jsxs(w,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:r,connectorKey:i.connector_key,connectionId:String(i.connection_id)},search:{},className:"flex items-center gap-3 py-3 text-sm hover:text-primary",children:[e.jsx("span",{className:"min-w-0 flex-1",children:i.display_name||c.get(i.connector_key)?.name||i.connector_key}),e.jsx("span",{className:"text-xs text-muted-foreground",children:i.status}),e.jsx(A,{className:"size-3.5 text-muted-foreground"})]},i.connection_id))})]}):null]})}function be({group:t,deviceId:s,organizationId:r,ownerSlug:p,definitionsByKey:u,selectedConnection:d,openSettings:g}){const h=t.connections.some(a=>a.connection_id===d),[l,c]=b.useState(h);return b.useEffect(()=>{h&&d!==void 0&&c(!0)},[h,d]),e.jsxs(F,{open:l,onOpenChange:c,children:[e.jsxs(H,{className:"group flex w-full items-center gap-3 py-3 text-left",children:[e.jsx(A,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90"}),e.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:t.name}),e.jsx("span",{className:"text-right text-xs text-muted-foreground",children:t.connections.some(a=>a.status==="error"||a.status==="revoked")?"Needs attention":t.connections.length>1?`${t.connections.length} connections`:"Configured"})]}),e.jsx(V,{forceMount:!0,hidden:!l,className:"pb-4 pl-6",children:e.jsx("div",{className:"space-y-5",children:t.connections.map(a=>e.jsx(Ne,{summary:a,deviceId:s,organizationId:r,ownerSlug:p,connectorDef:u.get(a.connector_key),openSettings:a.connection_id===d&&g},a.connection_id))})})]})}function Ne({summary:t,deviceId:s,organizationId:r,ownerSlug:p,connectorDef:u,openSettings:d}){const{data:g=[],isLoading:h,isError:l,refetch:c}=q(r,{connectionIds:[t.connection_id]}),a=g.find(o=>o.id===t.connection_id&&o.device_worker_id===s),m=u?.name??t.connector_key,i=a?me(a):null;return e.jsxs("section",{id:`connection-${t.connection_id}`,"aria-label":m,className:"scroll-mt-24",children:[a?e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-3 text-xs text-muted-foreground",children:[e.jsx("span",{children:ge(a)}),e.jsx("span",{children:a.status})]}):null,h||!r?e.jsx(_,{className:"h-24 w-full"}):l?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load this connection."}),e.jsx(j,{variant:"outline",size:"sm",onClick:()=>void c(),children:"Retry"})]}):a?e.jsxs(e.Fragment,{children:[i?e.jsx("p",{role:"alert",className:"mb-4 text-sm text-destructive",children:i}):null,e.jsx(xe,{connection:a,connectorDef:u,ownerSlug:p,openSettings:d,showActivity:!1,embedded:!0})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection is no longer available on this device."})]})}function _e({ownerSlug:t,deviceId:s,organizationId:r,selectedConnection:p,openSettings:u}){const d=U(),{data:g=[],isLoading:h}=W(),l=Y(),c=G(),[a,m]=b.useState(!1),[i,o]=b.useState(!1),[v,f]=b.useState(""),n=J(g,s),y=n?.id??s,{data:k=[]}=Q(r,{profileKind:"browser_session"}),C=b.useMemo(()=>k.filter(x=>x.device_worker_id===y&&x.status!=="revoked"),[k,y]),D=n?.label?.trim()??"";if(b.useEffect(()=>{i||f(D)},[D,i]),h)return e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{className:"h-6 w-6 rounded"}),e.jsx(_,{className:"h-5 w-40"})]}),e.jsx(ue,{})]});if(!n)return e.jsxs(P,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"This device isn't in this workspace, so its details aren't available."}),e.jsx(w,{to:"/$owner/connectors",params:{owner:t},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const I=E(n),z=X(n.app_version),T=Z(n,z),S=()=>{const x=v.trim(),M=n.label?.trim()??"";if(x===M){o(!1);return}c.mutate({deviceWorkerId:n.id,label:x.length===0?null:x},{onSuccess:()=>o(!1)})};return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(ee,{header:e.jsx(ne,{breadcrumb:e.jsx(oe,{crumbs:[e.jsx(w,{to:"/$owner/connectors",params:{owner:t},search:{},className:re,children:"Connectors"},"connectors")]}),icon:e.jsx(ce,{platform:I,className:"h-5 w-5"}),title:i?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(te,{"aria-label":"Device name",value:v,onChange:x=>f(x.target.value),placeholder:R({...n,label:null}),maxLength:80,className:"h-9 max-w-sm text-base font-semibold",autoFocus:!0,onKeyDown:x=>{x.key==="Enter"?(x.preventDefault(),a||S()):x.key==="Escape"&&(m(!1),f(n.label?.trim()??""),o(!1))}}),a?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Forgets this device"," ",n.connector_count>0?`and un-pins ${n.connector_count} connector${n.connector_count===1?"":"s"} across every workspace, not just this one.`:"with no pinned connections."]}),e.jsxs(j,{variant:"destructive",size:"sm",disabled:l.isPending,onClick:()=>l.mutate(n.id,{onSuccess:()=>{m(!1),d({to:"/$owner/connectors",params:{owner:t},search:{}})}}),children:[l.isPending?e.jsx($,{className:"mr-1.5"}):null,l.isPending?"Removing...":"Confirm remove"]}),e.jsx(j,{size:"sm",variant:"ghost",disabled:l.isPending,onClick:()=>m(!1),children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{size:"sm",onClick:S,disabled:c.isPending,children:[c.isPending?e.jsx($,{className:"mr-1.5"}):null,c.isPending?"Saving...":"Save"]}),e.jsx(j,{size:"sm",variant:"ghost",disabled:c.isPending,onClick:()=>{f(n.label?.trim()??""),o(!1)},children:"Cancel"}),e.jsxs(j,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",disabled:c.isPending||l.isPending,onClick:()=>m(!0),children:[e.jsx(ae,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove device"]})]})]}):e.jsxs("span",{className:"flex items-center gap-1.5",children:[R(n),e.jsx(j,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground","aria-label":"Edit device",onClick:()=>{m(!1),f(n.label?.trim()??""),o(!0)},children:e.jsx(ie,{className:"h-3.5 w-3.5"})})]}),badge:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:`size-1.5 rounded-full ${n.online?"bg-emerald-500":"bg-muted-foreground/50"}`}),n.online?n.connector_error_count>0?"Needs attention":"Online":"Offline"]}),meta:T||void 0,caption:`Last seen ${L(new Date(n.last_seen_at),{addSuffix:!0})}${n.last_sync_at?` · Last sync ${L(new Date(n.last_sync_at),{addSuffix:!0})}`:""}`}),children:[n.connector_error_count>0?e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-600",children:[e.jsx(se,{className:"h-3.5 w-3.5 shrink-0"}),n.connector_error_count," connector",n.connector_error_count===1?"":"s"," pinned to this device ",n.connector_error_count===1?"is":"are"," erroring."]}):null,e.jsx(ve,{device:n,organizationId:r,ownerSlug:t,selectedConnection:p,openSettings:u}),C.length>0?e.jsx(N,{title:"Browser auth profiles",children:e.jsx(ye,{profiles:C})}):null,e.jsx(N,{title:"Runs",children:e.jsx(he,{scope:{deviceId:y},ownerSlug:t})})]})})}function ye({profiles:t}){return t.length===0?null:e.jsx("div",{className:"rounded-lg border",children:e.jsx("ul",{className:"divide-y",children:t.map(s=>e.jsxs("li",{className:"space-y-2 px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:s.display_name}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:s.connector_key??"Any connector"}),s.browser_kind?e.jsxs("span",{children:["· ",s.browser_kind]}):null,s.captured_at?e.jsxs("span",{title:s.captured_at,children:["· captured ",le(s.captured_at)]}):null,typeof s.cookie_count=="number"?e.jsxs("span",{children:["· ",s.cookie_count," cookie",s.cookie_count===1?"":"s"]}):null]})]}),e.jsx(pe,{status:s.is_expired?"error":fe(s.status),showDot:!0,children:s.is_expired?"expired":s.status})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Refresh the session using the connector’s authorization instructions."})]},s.id))})})}function Re(){const{owner:t,deviceId:s}=B.useParams(),{connection:r,settings:p}=B.useSearch();return e.jsx(de,{owner:t,children:({ownerSlug:u,organizationId:d})=>e.jsx(_e,{ownerSlug:u,deviceId:s,organizationId:d,selectedConnection:r,openSettings:p})})}export{Re as component};
1
+ import{d1 as K,hm as O,j as e,eH as b,S as _,B as j,bu as A,L as w,dd as B,r as N,cU as F,cW as W,cX as Y,a as q,a4 as H,bf as U,hn as V,ho as G,hp as J,bb as X,bg as P,hq as Q,hr as Z,h0 as ee,bJ as se,gg as ne,hs as L,ad as te,ci as R,s as $,bA as ae,N as ie,bt as ce,gh as oe,gi as re,E as le,ht as E,aY as de}from"./index-DtRfQcRH.js";import{c as me,C as xe,R as ue}from"./device-pin-tombstone-CwJitllC.js";import{R as he}from"./runs-panel-B2852xus.js";import{S as pe,g as fe}from"./runs-table--dnFQatY.js";import{c as ge}from"./connection-label-BobuYiAG.js";import{c as je}from"./device-rows-BBhW1C7Y.js";import"./runs-_yVh6PPB.js";function ve({device:t,organizationId:s,ownerSlug:r,selectedConnection:p,openSettings:u}){const{data:d=[],isLoading:g,isError:h,refetch:l}=K(s),c=new Map(d.map(i=>[i.key,i])),a=new Map,m=[];for(const i of t.connectors){if(i.organization_slug!==r)continue;const o=c.get(i.connector_key);if(!o||!je(o)){m.push(i);continue}const v=o.required_capability??`connector:${o.key}`,f=a.get(v)??{key:v,name:o.name,connections:[]};f.name=O[v]??o.name,f.connections.push(i),a.set(v,f)}return e.jsxs(e.Fragment,{children:[e.jsxs(b,{title:"Capabilities",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Manage the native connections available to this workspace."}),t.online?null:e.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:"This device is offline. You can edit its settings; actions and sync need it to reconnect."}),!s||g?e.jsx(_,{className:"h-24 w-full"}):h?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load capability settings."}),e.jsx(j,{variant:"outline",size:"sm",onClick:()=>void l(),children:"Retry"})]}):a.size===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No native connections on this device in this workspace."}):e.jsx("div",{className:"divide-y border-y",children:[...a.values()].map(i=>e.jsx(Ne,{group:i,deviceId:t.id,organizationId:s,ownerSlug:r,definitionsByKey:c,selectedConnection:p,openSettings:u},i.key))}),A(t)==="macos"?e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Manage macOS permissions in the Lobu app on this device."}):null]}),s&&m.length>0&&!g&&!h?e.jsxs(b,{title:"Connections",count:String(m.length),children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Apps and sources that use this device."}),e.jsx("div",{className:"divide-y border-y",children:m.map(i=>e.jsxs(w,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:r,connectorKey:i.connector_key,connectionId:String(i.connection_id)},search:{},className:"flex items-center gap-3 py-3 text-sm hover:text-primary",children:[e.jsx("span",{className:"min-w-0 flex-1",children:i.display_name||c.get(i.connector_key)?.name||i.connector_key}),e.jsx("span",{className:"text-xs text-muted-foreground",children:i.status}),e.jsx(B,{className:"size-3.5 text-muted-foreground"})]},i.connection_id))})]}):null]})}function Ne({group:t,deviceId:s,organizationId:r,ownerSlug:p,definitionsByKey:u,selectedConnection:d,openSettings:g}){const h=t.connections.some(a=>a.connection_id===d),[l,c]=N.useState(h);return N.useEffect(()=>{h&&d!==void 0&&c(!0)},[h,d]),e.jsxs(F,{open:l,onOpenChange:c,children:[e.jsxs(W,{className:"group flex w-full items-center gap-3 py-3 text-left",children:[e.jsx(B,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90"}),e.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:t.name}),e.jsx("span",{className:"text-right text-xs text-muted-foreground",children:t.connections.some(a=>a.status==="error"||a.status==="revoked")?"Needs attention":t.connections.length>1?`${t.connections.length} connections`:"Configured"})]}),e.jsx(Y,{forceMount:!0,hidden:!l,className:"pb-4 pl-6",children:e.jsx("div",{className:"space-y-5",children:t.connections.map(a=>e.jsx(be,{summary:a,deviceId:s,organizationId:r,ownerSlug:p,connectorDef:u.get(a.connector_key),openSettings:a.connection_id===d&&g},a.connection_id))})})]})}function be({summary:t,deviceId:s,organizationId:r,ownerSlug:p,connectorDef:u,openSettings:d}){const{data:g=[],isLoading:h,isError:l,refetch:c}=q(r,{connectionIds:[t.connection_id]}),a=g.find(o=>o.id===t.connection_id&&o.device_worker_id===s),m=u?.name??t.connector_key,i=a?me(a):null;return e.jsxs("section",{id:`connection-${t.connection_id}`,"aria-label":m,className:"scroll-mt-24",children:[a?e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-3 text-xs text-muted-foreground",children:[e.jsx("span",{children:ge(a)}),e.jsx("span",{children:a.status})]}):null,h||!r?e.jsx(_,{className:"h-24 w-full"}):l?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load this connection."}),e.jsx(j,{variant:"outline",size:"sm",onClick:()=>void c(),children:"Retry"})]}):a?e.jsxs(e.Fragment,{children:[i?e.jsx("p",{role:"alert",className:"mb-4 text-sm text-destructive",children:i}):null,e.jsx(xe,{connection:a,connectorDef:u,ownerSlug:p,openSettings:d,showActivity:!1,embedded:!0})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection is no longer available on this device."})]})}function _e({ownerSlug:t,deviceId:s,organizationId:r,selectedConnection:p,openSettings:u}){const d=H(),{data:g=[],isLoading:h}=U(),l=V(),c=G(),[a,m]=N.useState(!1),[i,o]=N.useState(!1),[v,f]=N.useState(""),n=J(g,s),y=n?.id??s,{data:k=[]}=X(r,{profileKind:"browser_session"}),C=N.useMemo(()=>k.filter(x=>x.device_worker_id===y&&x.status!=="revoked"),[k,y]),D=n?.label?.trim()??"";if(N.useEffect(()=>{i||f(D)},[D,i]),h)return e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{className:"h-6 w-6 rounded"}),e.jsx(_,{className:"h-5 w-40"})]}),e.jsx(ue,{})]});if(!n)return e.jsxs(P,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"This device isn't in this workspace, so its details aren't available."}),e.jsx(w,{to:"/$owner/connectors",params:{owner:t},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const I=A(n),T=Q(n.app_version),z=Z(n,T),S=()=>{const x=v.trim(),M=n.label?.trim()??"";if(x===M){o(!1);return}c.mutate({deviceWorkerId:n.id,label:x.length===0?null:x},{onSuccess:()=>o(!1)})};return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(ee,{header:e.jsx(ne,{breadcrumb:e.jsx(oe,{crumbs:[e.jsx(w,{to:"/$owner/connectors",params:{owner:t},search:{},className:re,children:"Connectors"},"connectors")]}),icon:e.jsx(ce,{platform:I,className:"h-5 w-5"}),title:i?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(te,{"aria-label":"Device name",value:v,onChange:x=>f(x.target.value),placeholder:R({...n,label:null}),maxLength:80,className:"h-9 max-w-sm text-base font-semibold",autoFocus:!0,onKeyDown:x=>{x.key==="Enter"?(x.preventDefault(),a||S()):x.key==="Escape"&&(m(!1),f(n.label?.trim()??""),o(!1))}}),a?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Forgets this device"," ",n.connector_count>0?`and un-pins ${n.connector_count} connector${n.connector_count===1?"":"s"} across every workspace, not just this one.`:"with no pinned connections."]}),e.jsxs(j,{variant:"destructive",size:"sm",disabled:l.isPending,onClick:()=>l.mutate(n.id,{onSuccess:()=>{m(!1),d({to:"/$owner/connectors",params:{owner:t},search:{}})}}),children:[l.isPending?e.jsx($,{className:"mr-1.5"}):null,l.isPending?"Removing...":"Confirm remove"]}),e.jsx(j,{size:"sm",variant:"ghost",disabled:l.isPending,onClick:()=>m(!1),children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{size:"sm",onClick:S,disabled:c.isPending,children:[c.isPending?e.jsx($,{className:"mr-1.5"}):null,c.isPending?"Saving...":"Save"]}),e.jsx(j,{size:"sm",variant:"ghost",disabled:c.isPending,onClick:()=>{f(n.label?.trim()??""),o(!1)},children:"Cancel"}),e.jsxs(j,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",disabled:c.isPending||l.isPending,onClick:()=>m(!0),children:[e.jsx(ae,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove device"]})]})]}):e.jsxs("span",{className:"flex items-center gap-1.5",children:[R(n),e.jsx(j,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground","aria-label":"Edit device",onClick:()=>{m(!1),f(n.label?.trim()??""),o(!0)},children:e.jsx(ie,{className:"h-3.5 w-3.5"})})]}),badge:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:`size-1.5 rounded-full ${n.online?"bg-emerald-500":"bg-muted-foreground/50"}`}),n.online?n.connector_error_count>0?"Needs attention":"Online":"Offline"]}),meta:z||void 0,caption:`Last seen ${L(new Date(n.last_seen_at),{addSuffix:!0})}${n.last_sync_at?` · Last sync ${L(new Date(n.last_sync_at),{addSuffix:!0})}`:""}`}),children:[n.connector_error_count>0?e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-600",children:[e.jsx(se,{className:"h-3.5 w-3.5 shrink-0"}),n.connector_error_count," connector",n.connector_error_count===1?"":"s"," pinned to this device ",n.connector_error_count===1?"is":"are"," erroring."]}):null,e.jsx(ve,{device:n,organizationId:r,ownerSlug:t,selectedConnection:p,openSettings:u}),C.length>0?e.jsx(b,{title:"Browser auth profiles",children:e.jsx(ye,{profiles:C})}):null,e.jsx(b,{title:"Runs",children:e.jsx(he,{scope:{deviceId:y},ownerSlug:t})})]})})}function ye({profiles:t}){return t.length===0?null:e.jsx("div",{className:"rounded-lg border",children:e.jsx("ul",{className:"divide-y",children:t.map(s=>e.jsxs("li",{className:"space-y-2 px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:s.display_name}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:s.connector_key??"Any connector"}),s.browser_kind?e.jsxs("span",{children:["· ",s.browser_kind]}):null,s.captured_at?e.jsxs("span",{title:s.captured_at,children:["· captured ",le(s.captured_at)]}):null,typeof s.cookie_count=="number"?e.jsxs("span",{children:["· ",s.cookie_count," cookie",s.cookie_count===1?"":"s"]}):null]})]}),e.jsx(pe,{status:s.is_expired?"error":fe(s.status),showDot:!0,children:s.is_expired?"expired":s.status})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Refresh the session using the connector’s authorization instructions."})]},s.id))})})}function Re(){const{owner:t,deviceId:s}=E.useParams(),{connection:r,settings:p}=E.useSearch();return e.jsx(de,{owner:t,children:({ownerSlug:u,organizationId:d})=>e.jsx(_e,{ownerSlug:u,deviceId:s,organizationId:d,selectedConnection:r,openSettings:p})})}export{Re as component};
@@ -0,0 +1 @@
1
+ import{a4 as x,w as _,j as e,bX as C,bY as m,bZ as S,b_ as b,b$ as c,fd as u}from"./index-DtRfQcRH.js";import{c as w}from"./connection-label-BobuYiAG.js";const h="__connection_picker_create_new__";function y({connections:s,value:r,onValueChange:n,connectorKey:a,disabled:d,placeholder:g="Choose a connection",includeWorkspaceEvents:i=!1,ariaLabel:p="Connection"}){const f=x(),l=_().org?.slug,o=a?s.filter(t=>t.connector_key===a):s,j=t=>{if(t===h){if(!l)return;f({to:"/$owner/connectors/create",params:{owner:l},search:a?{connector:a}:{}});return}n(t)};return e.jsxs(C,{value:r,onValueChange:j,disabled:d,children:[e.jsx(m,{"aria-label":p,children:e.jsx(S,{placeholder:g})}),e.jsxs(b,{children:[i?e.jsxs(e.Fragment,{children:[e.jsx(c,{value:"workspace",children:"Current workspace"}),o.length>0?e.jsx(u,{}):null]}):null,o.map(t=>e.jsx(c,{value:String(t.id),children:w(t)},t.id)),l?e.jsxs(e.Fragment,{children:[o.length>0||i?e.jsx(u,{}):null,e.jsx(c,{value:h,children:"Connect an app…"})]}):null]})]})}function v(s){const r=[];for(const n of s)r.push({id:n.id,name:n.name,entityType:n.entity_type}),n.children&&n.children.length>0&&r.push(...v(n.children));return r}export{y as C,v as f};
@@ -0,0 +1 @@
1
+ import{a3 as Y,i3 as ie,r as _,j as e,S as O,a4 as I,i4 as re,ah as Z,al as E,cs as le,i5 as oe,dy as C,eO as ce,eS as de,eQ as me,eT as U,fM as ue,fN as xe,a9 as ge,i6 as H,i7 as he,aV as G,fU as pe,g as fe,dk as ee,fO as ye,i8 as ve,k as je,c6 as k,fK as be,F as Ne,ac as $,ad as J,dS as we,bJ as _e,B as N,fZ as ke,eg as Se,fP as Ce,L as Ee,ez as Te,i9 as De,t as Pe,ia as Fe,dw as Le,c4 as Oe}from"./index-DtRfQcRH.js";import{a as K,c as W,S as $e,D as Ie,E as ze}from"./schema-value-normalization-BspxVEGy.js";import{V as Q,T as Ae,a as Me,b as q,c as X}from"./view-frame-HoBawpT2.js";import{V as Re,M as Ve}from"./missing-view-CD4DOaG8.js";import{u as Be}from"./use-applied-views-DvMT3wap.js";import"./calendar-CHXehtu0.js";import"./app-bridge-BH3g2mKG.js";function Ue({entityId:s,ownerSlug:t}){const{orgContext:n}=Y(),{data:i,isLoading:a}=ie(s,n),r=_.useMemo(()=>{if(!i)return[];const l=new Map;for(const c of i.rows){const d=l.get(c.relationship_type_slug);d?d.rows.push(c):l.set(c.relationship_type_slug,{slug:c.relationship_type_slug,label:c.relationship_type_name,rows:[c]})}return[...l.values()]},[i]);return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{className:"h-4 w-32"}),e.jsx(O,{className:"h-12 w-full rounded-lg"}),e.jsx(O,{className:"h-12 w-full rounded-lg"})]}):!i||i.rows.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No relationships for this entity yet."}):e.jsx("div",{className:"space-y-3",children:r.map(({slug:l,label:c,rows:d})=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[c,e.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground/70",children:d.length})]}),e.jsx("ul",{className:"space-y-1",children:d.map(x=>e.jsx(He,{entityId:s,row:x,ownerSlug:t},x.id))})]},l))})}function He({entityId:s,row:t,ownerSlug:n}){const i=I(),{orgContext:a}=Y(),[r,l]=_.useState(!1),[c,d]=_.useState(!1),x=t.from_entity_id===t.to_entity_id,h=t.from_entity_id===s,p=x?"this entity":h?t.to_entity_name??`Entity #${t.to_entity_id}`:t.from_entity_name??`Entity #${t.from_entity_id}`,u=h?t.to_entity_type:t.from_entity_type,g=h?t.to_entity_id:t.from_entity_id,o=u?`${u} · ${p}`:p;async function f(){l(!0),d(!1);try{const w=[],j=new Set;let b=g;for(;b!==null;){if(j.has(b))throw new Error("Cyclic entity ancestry");j.add(b);const{entity:y}=await le("manage_entity",{action:"get",entity_id:b},oe(a));w.unshift({entity_type:y.entity_type,slug:y.slug}),b=y.parent_id}await i({to:C(n,w)})}catch{d(!0)}finally{l(!1)}}return e.jsxs("li",{className:E("flex items-center gap-2 rounded-md border border-border/70 px-2.5 py-1.5"),children:[e.jsx(re,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),x||!u?e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:o}):e.jsxs("button",{type:"button",onClick:f,disabled:r,"aria-busy":r,className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm hover:underline",children:o}),u?e.jsx(Z,{variant:"outline",className:"shrink-0 text-[9px] px-1.5 py-0 h-4 text-muted-foreground",children:u}):null]}),c?e.jsx("span",{role:"alert",className:"text-xs text-destructive",children:"Could not open this record. Try again."}):null]})}function Je(s,t){const n=new Set([...Object.keys(s),...Object.keys(t)]);let i=!1;const a={};for(const r of n){const l=r in s,c=r in t;if(!l&&c){a[r]=t[r];continue}l&&(a[r]=s[r],(!c||JSON.stringify(s[r])!==JSON.stringify(t[r]))&&(i=!0))}return i?a:void 0}function Ke({entity:s,entityTypeSlug:t,orgContext:n,onDeleted:i}){const{isAdmin:a,isLoading:r}=fe(n.organizationId),l=a&&!r,{data:c,isLoading:d}=ee(t,n),x=ye(),h=ve(),p=c?.metadata_schema,u=s.field_controls,g=_.useMemo(()=>K(s.metadata??{},p),[s.metadata,p]),o=je(s.id,{name:s.name,slug:s.slug,metadata:g},p),[f,w]=o.field("name"),[j,b]=o.field("slug"),[y,m]=o.field("metadata"),[z,A]=k(s.id,""),[M,T]=k(s.id,null),[se,D]=k(s.id,!1),[R,P]=k(s.id,null),F=_.useMemo(()=>o.hasInvalidInput?void 0:Je(W(y),W(o.baseline.metadata)),[o.baseline.metadata,y,o.hasInvalidInput]),L=F!==void 0,te=f!==o.baseline.name||j!==o.baseline.slug||L,ae=async v=>{if(v.preventDefault(),!(!l||!o.canSubmit)){if(T(null),!f.trim()){T("Name is required");return}try{await x.mutateAsync({entityId:s.id,name:f.trim()!==o.baseline.name.trim()?f.trim():void 0,slug:j,metadata:F,field_note:L&&z.trim()||void 0}),o.accept(o.values,{name:f.trim(),slug:j,metadata:K({...Se(o.baseline.metadata),...F},p)}),A("")}catch(B){T(B instanceof Error?B.message:"Failed to update entity")}}},ne=async()=>{if(l){P(null);try{await h.mutateAsync({entityId:s.id}),D(!1),i?.()}catch(v){P(v instanceof Error?v.message:"Failed to delete entity")}}},V=[s.total_content>0&&`${s.total_content} content item${s.total_content===1?"":"s"}`,s.automations_count>0&&`${s.automations_count} Automation${s.automations_count===1?"":"s"}`,s.active_connections>0&&`${s.active_connections} connector${s.active_connections===1?"":"s"}`].filter(Boolean).join(", ");return d?e.jsx(be,{rows:6}):e.jsxs("form",{onSubmit:ae,className:"space-y-4",children:[e.jsx(Ne,{visible:o.hasConflict,onReload:o.reset}),!l&&e.jsx("p",{className:"text-sm text-muted-foreground",role:"status",children:r?"Checking edit permissions…":"You can view this record. Ask a workspace owner or admin to make changes."}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs($,{htmlFor:"sidebar-name",children:["Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(J,{id:"sidebar-name",readOnly:!l,value:f,onChange:v=>w(v.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:"sidebar-slug",children:"URL Slug"}),e.jsx(J,{id:"sidebar-slug",readOnly:!l,value:j,onChange:v=>b(v.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))})]}),o.revision&&Object.keys(o.revision).length>0&&e.jsxs(e.Fragment,{children:[e.jsx($e,{}),e.jsx(Ie,{schema:o.revision,values:y,onValuesChange:m,readonly:!l,fieldControls:u,orgContext:n})]}),l&&L&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:"sidebar-correction-note",children:"Correction note (optional)"}),e.jsx(we,{id:"sidebar-correction-note",value:z,onChange:v=>A(v.target.value),placeholder:"Why are you changing these fields? Helps Automations respect the correction.",rows:2})]}),M&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:M}),l&&(se?e.jsxs("div",{className:"space-y-3 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5 text-sm",children:[e.jsx(_e,{className:"h-4 w-4 shrink-0 text-destructive mt-0.5"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"font-medium text-foreground",children:['Delete "',s.name,'"?']}),V&&e.jsxs("p",{className:"text-muted-foreground",children:["Removes ",V,". This cannot be easily undone."]})]})]}),R&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-2.5 py-1.5 text-sm text-destructive",children:R}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>{D(!1),P(null)},children:"Cancel"}),e.jsx(N,{type:"button",variant:"destructive",size:"sm",onClick:ne,disabled:h.isPending,children:h.isPending?"Deleting...":`Delete ${c?.name||"entity"}`})]})]}):e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(N,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>D(!0),children:"Delete"}),e.jsx(N,{type:"submit",size:"sm",disabled:!o.canSubmit||!te||x.isPending||!f.trim(),children:x.isPending?"Saving...":"Save"})]}))]})}function We({entity:s}){const t=new Set(s.measure_columns??[]),n=s.metadata??{},i=Object.keys(n).filter(a=>a!=="id"&&a!=="slug"&&a!=="name");return e.jsx("div",{className:"mt-4 max-w-2xl",children:e.jsx("div",{className:"rounded-lg border",children:e.jsx(ce,{children:e.jsx(de,{children:i.map(a=>{const r=t.has(a);return e.jsxs(me,{children:[e.jsx(U,{className:"w-44 align-top font-medium text-muted-foreground",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[r?a:ue(a.replace(/_/g," ")),r&&e.jsx(Z,{variant:"secondary",className:"font-normal lowercase",children:"measure"})]})}),e.jsx(U,{className:E("break-words align-top",r?"text-right tabular-nums":""),children:xe(n[a])})]},a)})})})})})}function Qe({namespace:s,entity:t,recordUrl:n,viewKey:i,onDeleted:a}){return t.is_derived?e.jsx(We,{entity:t}):e.jsx(Ye,{namespace:s,entity:t,recordUrl:n,viewKey:i,onDeleted:a})}const S=":overview",qe={},Xe=()=>{};function Ye({namespace:s,entity:t,recordUrl:n,viewKey:i,onDeleted:a}){const r=ge({strict:!1}),l=I(),c={slug:s.slug,organizationId:s.id},d=Be(c),x=d.data??[],h={type:t.entity_type,id:t.id,slug:t.slug,parentId:t.parent_id},p=H(x,h,"overview"),u=H(x,h,"tab"),g=he(u,i),o=m=>`${n}${ke(m)}`,f=m=>void l({to:".",search:m,replace:!0}),w={type:t.entity_type,entity:t.id},j=e.jsx(Ke,{entity:t,entityTypeSlug:t.entity_type,orgContext:c,onDeleted:a}),b=e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Relationships"}),e.jsx(Ue,{entityId:t.id,ownerSlug:s.slug})]}),y=e.jsxs(e.Fragment,{children:[p.map(m=>e.jsx("section",{className:E(G,"mb-4 p-2"),"data-testid":"view-card","data-view":m.key,children:e.jsx(Q,{orgSlug:s.slug,viewKey:m.key,scope:w,params:qe,onParamsChange:Xe,contentHash:m.content_hash,title:m.name,minHeight:160})},m.key)),b,e.jsx("div",{className:"mt-4",children:j})]});return i&&d.data===void 0?d.isError?e.jsx(Re,{onRetry:()=>void d.refetch()}):null:g.kind==="missing"?e.jsx(Ve,{viewKey:g.key,backTo:n,backLabel:`Back to ${t.name}`}):u.length===0?e.jsx("div",{className:"mt-4 max-w-xl",children:y}):e.jsx("div",{className:"mt-4",children:e.jsxs(Ae,{value:g.kind==="tab"?g.view.key:S,onValueChange:m=>void l({to:m===S?n:o(m)}),children:[e.jsxs(Me,{children:[e.jsx(q,{value:S,children:"Overview"}),u.map(m=>e.jsx(q,{value:m.key,"data-testid":`tab-${m.key}`,children:m.name},m.key))]}),e.jsx(X,{value:S,className:"max-w-xl",children:y}),g.kind==="tab"&&e.jsx(X,{value:g.view.key,children:e.jsx(Q,{orgSlug:s.slug,viewKey:g.view.key,scope:w,params:pe(r),onParamsChange:f,contentHash:g.view.content_hash,title:g.view.name,minHeight:320})})]})})}function Ze(s){return typeof s=="string"?s:s===null?"None":JSON.stringify(s)??String(s)}function Ge({records:s}){const t=Le(),[n,i]=_.useState(null);return s.length===0?null:e.jsxs("details",{className:E(G,"px-4 py-3"),children:[e.jsxs("summary",{className:"cursor-pointer text-sm font-medium",children:["Merged records (",s.length,")"]}),e.jsx("div",{className:"mt-3 space-y-3",children:s.map(a=>e.jsxs("div",{className:"rounded-lg bg-background p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:a.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Merged ",new Date(a.merged_at).toLocaleString()]})]}),a.can_unmerge?n===a.id?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{type:"button",variant:"destructive",size:"sm",disabled:t.isPending,onClick:()=>t.mutate({entityId:a.id},{onSettled:()=>i(null)}),children:"Confirm undo"}),e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:t.isPending,onClick:()=>i(null),children:"Cancel"})]}):e.jsxs(N,{type:"button",variant:"outline",size:"sm",disabled:t.isPending,onClick:()=>i(a.id),children:[e.jsx(Oe,{className:"mr-1.5 size-3.5"}),"Undo merge"]}):null]}),Object.keys(a.metadata).length>0?e.jsx("dl",{className:"mt-3 grid gap-x-4 gap-y-1 text-xs sm:grid-cols-2",children:Object.entries(a.metadata).map(([r,l])=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("dt",{className:"text-muted-foreground",children:r}),e.jsx("dd",{className:"break-words",children:Ze(l)})]},r))}):null]},a.id))})]})}function es(s){return s?.trim()?s:void 0}function ss({ownerSlug:s,entityName:t,activityHref:n}){const i=Pe();return e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>i?.open({href:n,title:`${t} · Activity`,owner:s}),disabled:!i,children:[e.jsx(Fe,{className:"mr-2 h-4 w-4"}),"See activity"]})}function cs({namespace:s,path:t,entity:n,mergedFrom:i,viewKey:a}){const r=I(),{data:l}=ee(n.entity_type,{slug:s.slug}),c=es(l?.icon),d=t.map(u=>({entity_type:u.entity_type,slug:u.slug})),x=`/${s.slug}/${Ce(n.entity_type)}`,h=C(s.slug,d),p=t.length>1?C(s.slug,d.slice(0,-1)):x;return e.jsxs("div",{className:"mx-auto flex min-h-0 w-full max-w-3xl flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:[i?e.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 px-4 py-3 text-sm",children:[e.jsx("strong",{children:i})," was merged into this canonical record."]}):null,e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[e.jsx(N,{asChild:!0,variant:"ghost",size:"sm",className:"-ml-2 h-7 w-fit px-2 text-muted-foreground hover:text-foreground",children:e.jsxs(Ee,{to:p,children:[e.jsx(Te,{className:"mr-1 h-4 w-4"}),"Back"]})}),!n.is_derived&&e.jsx("div",{className:"ml-auto",children:e.jsx(ss,{ownerSlug:s.slug,entityName:n.name,activityHref:`/${s.slug}/events/${De(d)}`})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ze,{metadata:n.metadata,metadataSchema:l?.metadata_schema,name:n.name,typeIcon:c,className:"h-6 w-6"}),e.jsx("h2",{className:"text-lg font-semibold leading-tight",children:n.name})]})]}),e.jsx(Ge,{records:n.merged_records??[]}),e.jsx(Qe,{namespace:s,entity:n,recordUrl:h,viewKey:a,onDeleted:()=>{const u=t.slice(0,-1);u.length>0?r({to:C(s.slug,u)}):r({to:x})}})]})}export{cs as EntityPage};
@@ -0,0 +1 @@
1
+ import{j as e,ah as $,a3 as W,fy as me,dr as xe,fB as Z,c1 as ae,r as x,fz as he,fA as pe,cj as ge,ck as fe,B as f,P as B,cn as je,ac as C,bX as q,bY as P,bZ as M,b_ as L,b$ as R,ad as T,s as ve,fG as Ne,g0 as ye,dB as be,Z as H,cm as ne,dd as re,am as we,bA as le,g1 as ie,g2 as Se,bJ as oe,g3 as Ce,g4 as ke,k as Ee,c6 as G,F as _e,dS as Re,dT as Te,g5 as Oe,g6 as De,al as K}from"./index-DtRfQcRH.js";import{J}from"./json-diff-DYeX-xLk.js";import{C as ce}from"./code-editor-BHiWR94J.js";function Ae(s){switch(s){case"create":return"default";case"update":return"secondary";case"delete":return"destructive";default:return"outline"}}function Fe(s){switch(s){case"create":return"Created";case"update":return"Updated";case"delete":return"Deleted";default:return s}}function ze(s){try{return new Date(s).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}catch{return s}}function qe({entry:s}){return e.jsxs("div",{className:"relative pl-6 pb-6 last:pb-0",children:[e.jsx("div",{className:"absolute left-0 top-1.5 h-3 w-3 rounded-full border-2 border-border bg-background"}),e.jsx("div",{className:"absolute left-[5px] top-5 bottom-0 w-px bg-border last:hidden"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{variant:Ae(s.action),children:Fe(s.action)}),s.actor&&e.jsx("span",{className:"text-xs text-muted-foreground",children:s.actor})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:ze(s.created_at)}),s.action==="update"&&e.jsx(J,{before:s.before_payload,after:s.after_payload}),s.action==="create"&&s.after_payload&&e.jsx(J,{before:null,after:s.after_payload}),s.action==="delete"&&s.before_payload&&e.jsx(J,{before:s.before_payload,after:null})]})]})}function Pe({entityType:s}){const{orgContext:a}=W(),{data:c,isLoading:n}=me(a),{data:r}=xe(a),t=(c||[]).filter(m=>m.status==="active"),i=t.filter(m=>!m.organization_slug||m.organization_slug===a?.slug),o=i.filter(m=>m.purpose!==Z),d=i.filter(m=>m.purpose===Z),h=t.filter(m=>m.organization_slug&&m.organization_slug!==a?.slug);return e.jsx("div",{className:"space-y-4 py-4",children:n?e.jsx(ae,{label:"relationships",variant:"rows",rows:4}):e.jsxs(e.Fragment,{children:[e.jsx(U,{entityTypeSlug:s.slug,relationshipTypes:o,allEntityTypes:r||[]}),d.length>0&&e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Managed by access control"}),e.jsx(U,{entityTypeSlug:s.slug,relationshipTypes:d,allEntityTypes:r||[],readOnly:!0})]}),h.length>0&&e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"From public catalogs"}),e.jsx(U,{entityTypeSlug:s.slug,relationshipTypes:h,allEntityTypes:r||[],readOnly:!0})]}),e.jsx(Ie,{entityTypeSlug:s.slug,relationshipTypes:o,allEntityTypes:r||[]})]})})}function U({entityTypeSlug:s,relationshipTypes:a,allEntityTypes:c,readOnly:n=!1}){return e.jsx("div",{className:"space-y-2",children:a.map(r=>e.jsx(Me,{relationshipType:r,entityTypeSlug:s,allEntityTypes:c,readOnly:n},r.id))})}function Me({relationshipType:s,entityTypeSlug:a,allEntityTypes:c,readOnly:n=!1}){const{orgContext:r}=W(),{data:t}=Ne(s.slug,r),i=ye(),o=(t||[]).filter(h=>h.source_entity_type_slug===a||h.target_entity_type_slug===a);if(o.length===0)return null;const d=new Map(c.map(h=>[h.slug,h.name]));return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.name}),e.jsx("code",{className:"text-[11px] bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:s.slug}),s.is_symmetric&&e.jsx($,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"symmetric"}),n&&e.jsx($,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"read-only"})]}),o.map(h=>e.jsx(Le,{rule:h,entityTypeSlug:a,entityTypeNameMap:d,onRemove:()=>i.mutate(h.id),isRemoving:i.isPending,readOnly:n},h.id))]})}function Le({rule:s,entityTypeSlug:a,entityTypeNameMap:c,onRemove:n,isRemoving:r,readOnly:t=!1}){const[i,o]=x.useState(!1),d=s.source_entity_type_slug===a,h=d?s.target_entity_type_slug:s.source_entity_type_slug,m=c.get(h)||h;return e.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-3 rounded-md border border-border bg-muted/30 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:d?"this":m}),e.jsx(be,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:d?m:"this"}),t?null:i?e.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[e.jsx(f,{variant:"destructive",size:"sm",className:"h-6 px-2 text-xs",onClick:n,disabled:r,children:r?"Removing...":"Remove"}),e.jsx(f,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>o(!1),disabled:r,children:"Cancel"})]}):e.jsx("div",{className:"ml-auto",children:e.jsx(f,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-muted-foreground hover:text-destructive",onClick:()=>o(!0),disabled:r,children:e.jsx(H,{className:"h-3 w-3"})})})]})}function Ie({entityTypeSlug:s,relationshipTypes:a,allEntityTypes:c}){const{orgContext:n}=W(),r=c.filter(l=>!l.organization_slug||l.organization_slug===n?.slug),[t,i]=x.useState(!1),[o,d]=x.useState("existing"),[h,m]=x.useState(""),[S,N]=x.useState(""),[y,b]=x.useState("source"),[g,j]=x.useState(""),[k,E]=x.useState(""),[D,w]=x.useState(!1),[A,_]=x.useState(null),u=he(),p=pe(),v=()=>{d("existing"),m(""),N(""),b("source"),j(""),E(""),w(!1),_(null)},O=l=>{i(l),l||v()},F=l=>l.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),V=async()=>{_(null);try{let l=h;if(o==="new"){if(!g.trim()){_("Name is required");return}const Y=k.trim()||F(g);if(!Y){_("Slug is required");return}l=(await u.mutateAsync({slug:Y,name:g.trim(),is_symmetric:D})).relationship_type.slug}if(!l){_("Select a relationship type");return}if(!S){_("Select a target entity type");return}const I=y==="source"?s:S,ue=y==="source"?S:s;await p.mutateAsync({slug:l,source_entity_type_slug:I,target_entity_type_slug:ue}),O(!1)}catch(l){_(l instanceof Error?l.message:"An error occurred")}},z=u.isPending||p.isPending;return e.jsxs(ge,{open:t,onOpenChange:O,children:[e.jsx(fe,{asChild:!0,children:e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",children:[e.jsx(B,{className:"h-3.5 w-3.5 mr-1.5"}),"Add Relationship Rule"]})}),e.jsx(je,{className:"w-80 p-4",align:"start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{className:"text-xs",children:"Relationship Type"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(f,{variant:o==="existing"?"default":"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>d("existing"),children:"Existing"}),e.jsx(f,{variant:o==="new"?"default":"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>d("new"),children:"Create New"})]})]}),o==="existing"?e.jsxs(q,{value:h,onValueChange:m,children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{placeholder:"Select relationship type..."})}),e.jsxs(L,{children:[a.map(l=>e.jsx(R,{value:l.slug,children:l.name},l.slug)),a.length===0&&e.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No relationship types yet. Create one."})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{placeholder:"Name (e.g. Integrates With)",className:"h-8 text-sm",value:g,onChange:l=>{j(l.target.value),k||E("")}}),e.jsx(T,{placeholder:g?F(g)||"slug":"Slug (auto-generated)",className:"h-8 text-sm",value:k,onChange:l=>E(l.target.value)}),e.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:D,onChange:l=>w(l.target.checked),className:"rounded"}),"Symmetric (A↔B = B↔A)"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{className:"text-xs",children:"Direction"}),e.jsxs(q,{value:y,onValueChange:l=>b(l),children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{})}),e.jsxs(L,{children:[e.jsx(R,{value:"source",children:"This type → other"}),e.jsx(R,{value:"target",children:"Other → this type"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{className:"text-xs",children:[y==="source"?"Target":"Source"," Entity Type"]}),e.jsxs(q,{value:S,onValueChange:N,children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{placeholder:"Select entity type..."})}),e.jsx(L,{children:r.map(l=>e.jsxs(R,{value:l.slug,children:[l.icon?`${l.icon} `:"",l.name]},l.slug))})]})]}),A&&e.jsx("p",{className:"text-xs text-destructive",children:A}),e.jsx(f,{size:"sm",className:"w-full",onClick:V,disabled:z,children:z?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"mr-1.5"}),"Saving..."]}):"Add Rule"})]})})]})}function Be({options:s,onChange:a}){const[c,n]=x.useState(""),r=()=>{const i=c.trim();i&&!s.includes(i)&&(a([...s,i]),n(""))},t=i=>{a(s.filter((o,d)=>d!==i))};return e.jsxs("div",{className:"space-y-2 pl-4 border-l-2 border-muted",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map((i,o)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-muted text-sm px-2 py-0.5 rounded",children:[i,e.jsx("button",{type:"button",onClick:()=>t(o),className:"text-muted-foreground hover:text-foreground",children:e.jsx(H,{className:"h-3 w-3"})})]},i))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(T,{value:c,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),r())},placeholder:"Add option...",className:"h-7 text-sm"}),e.jsx(f,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2",onClick:r,children:e.jsx(B,{className:"h-3 w-3"})})]})]})}const Ve=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"integer",label:"Integer"},{value:"boolean",label:"Boolean"},{value:"enum",label:"Enum"}];function Je({examples:s,onChange:a}){const[c,n]=x.useState(""),r=()=>{const t=c.trim();t&&!s.includes(t)&&(a([...s,t]),n(""))};return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map((t,i)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-muted text-xs px-2 py-0.5 rounded",children:[t,e.jsx("button",{type:"button",onClick:()=>a(s.filter((o,d)=>d!==i)),className:"text-muted-foreground hover:text-foreground",children:e.jsx(H,{className:"h-3 w-3"})})]},t))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(T,{value:c,onChange:t=>n(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),r())},placeholder:"Add example...",className:"h-7 text-xs"}),e.jsx(f,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2",onClick:r,children:e.jsx(B,{className:"h-3 w-3"})})]})]})}function Ue({field:s,onChange:a,onDelete:c}){const[n,r]=x.useState(!!(s.description||s.default||s.role||s.examples&&s.examples.length>0));return e.jsxs("div",{className:"rounded-md border border-border p-2.5 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!n),className:"text-muted-foreground hover:text-foreground shrink-0",children:n?e.jsx(ne,{className:"h-3.5 w-3.5"}):e.jsx(re,{className:"h-3.5 w-3.5"})}),e.jsx(T,{value:s.name,onChange:t=>a({...s,name:t.target.value}),placeholder:"Field name",className:"h-8 flex-1"}),e.jsxs(q,{value:s.type,onValueChange:t=>a({...s,type:t,enumOptions:t==="enum"?s.enumOptions||[]:void 0,role:t==="enum"||s.role!=="workflowState"?s.role:void 0}),children:[e.jsx(P,{className:"h-8 w-32",children:e.jsx(M,{})}),e.jsx(L,{children:Ve.map(t=>e.jsx(R,{value:t.value,children:t.label},t.value))})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground whitespace-nowrap",children:[e.jsx(we,{checked:s.required,onCheckedChange:t=>a({...s,required:t===!0})}),e.jsx("span",{children:"Required"})]}),e.jsx(f,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",onClick:c,children:e.jsx(le,{className:"h-3.5 w-3.5"})})]}),s.type==="enum"&&e.jsx("div",{className:"pl-6",children:e.jsx(Be,{options:s.enumOptions||[],onChange:t=>a({...s,enumOptions:t})})}),n&&e.jsxs("div",{className:"pl-6 space-y-2 pt-1",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Description"}),e.jsx(T,{value:s.description||"",onChange:t=>a({...s,description:t.target.value||void 0}),placeholder:"Field description",className:"h-7 text-xs mt-0.5"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Default"}),e.jsx(T,{value:s.default||"",onChange:t=>a({...s,default:t.target.value||void 0}),placeholder:s.type==="boolean"?"true / false":"Default value",className:"h-7 text-xs mt-0.5"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"View role"}),e.jsxs(q,{value:s.role||"none",onValueChange:t=>a({...s,role:t==="workflowState"||t==="sortRank"?t:void 0}),children:[e.jsx(P,{className:"h-7 text-xs mt-0.5",children:e.jsx(M,{})}),e.jsxs(L,{children:[e.jsx(R,{value:"none",children:"None"}),e.jsx(R,{value:"workflowState",disabled:s.type!=="enum",children:"Workflow state (board)"}),e.jsx(R,{value:"sortRank",children:"Sort rank"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Examples"}),e.jsx("div",{className:"mt-0.5",children:e.jsx(Je,{examples:s.examples||[],onChange:t=>a({...s,examples:t.length>0?t:void 0})})})]})]})]})}function X({value:s,onChange:a,readonly:c,error:n}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{value:s,onChange:a,readonly:c,placeholder:'{ "type": "object", "properties": {} }',minHeight:"200px"}),n&&e.jsx("p",{className:"text-sm text-destructive",children:n})]})}function Q(s){if(s.type!=="object")return!1;const a=s.properties;if(!a||typeof a!="object")return Object.keys(s).length<=1;for(const c of Object.values(a)){if(!c||typeof c!="object")return!1;const n=c,r=n.type;if(!n.enum&&(!r||!["string","number","integer","boolean"].includes(r)||n.properties||n.items||n.allOf||n.oneOf||n.anyOf))return!1}return!0}function de(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`field-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ee(s){const a=s.properties||{},c=s.required||[];return Object.entries(a).map(([n,r])=>{const t=r["x-lobu"]?.role||r["x-lobu-role"],i=t==="workflowState"?"workflowState":t==="sortRank"?"sortRank":void 0,o={id:de(),name:n,required:c.includes(n),description:r.description||void 0,default:r.default!==void 0?String(r.default):void 0,examples:Array.isArray(r.examples)?r.examples.map(String):void 0,role:i};return r.enum?{...o,type:"enum",enumOptions:r.enum||[]}:{...o,type:r.type||"string"}})}function se(s,a){if(a==="number"||a==="integer"){const c=Number(s);return Number.isNaN(c)?s:c}return a==="boolean"?s==="true"?!0:s==="false"?!1:s:s}function $e(s,a="auto"){const c={},n=[];for(const t of s){if(!t.name.trim())continue;const i={};t.type==="enum"?i.enum=t.enumOptions||[]:i.type=t.type,t.description?.trim()&&(i.description=t.description.trim()),t.default!==void 0&&t.default!==""&&(i.default=se(t.default,t.type)),t.examples&&t.examples.length>0&&(i.examples=t.examples.map(o=>se(o,t.type))),t.role&&(i["x-lobu"]={role:t.role,...t.role==="workflowState"&&t.type==="enum"?{states:(t.enumOptions||[]).map(o=>({value:o,label:o.replace(/[_-]+/g," ").replace(/\b\w/g,d=>d.toUpperCase()),terminal:["done","complete","completed","closed","archived"].includes(o.toLowerCase())}))}:{}}),c[t.name]=i,t.required&&n.push(t.name)}const r={type:"object",properties:c};return n.length>0&&(r.required=n),a&&a!=="auto"&&(r["x-lobu"]={defaultView:a}),r}function te(s){const a=s["x-lobu"]?.defaultView;return a==="table"||a==="board"?a:"auto"}function We({value:s,onChange:a,readonly:c=!1}){const[n,r]=x.useState("visual"),[t,i]=x.useState([]),[o,d]=x.useState("auto"),[h,m]=x.useState(""),[S,N]=x.useState(null),[y,b]=x.useState(!1),g=x.useRef(!1);x.useEffect(()=>{if(g.current){g.current=!1;return}if(!s||Object.keys(s).length===0){i([]),d("auto"),m(""),b(!1);return}const u=JSON.stringify(s,null,2);m(u),d(te(s)),Q(s)?(i(ee(s)),b(!1)):(b(!0),r("json"))},[s]);const j=x.useCallback((u,p)=>{g.current=!0;const v=$e(u,p),O=u.some(F=>F.name.trim());m(O?JSON.stringify(v,null,2):""),a(O?v:void 0)},[a]),k=x.useCallback(u=>{i(u),j(u,o)},[j,o]),E=x.useCallback(u=>{d(u),j(t,u)},[j,t]),D=x.useCallback(u=>{if(g.current=!0,m(u),!u.trim()){N(null),i([]),d("auto"),a(void 0);return}try{const p=JSON.parse(u);N(null),d(te(p)),Q(p)?(i(ee(p)),b(!1)):b(!0),a(p)}catch(p){N(p instanceof Error?p.message:"Invalid JSON")}},[a]),w=()=>{k([...t,{id:de(),name:"",type:"string",required:!1}])},A=(u,p)=>{const v=[...t];v[u]=p,k(v)},_=u=>{k(t.filter((p,v)=>v!==u))};return c?e.jsx(X,{value:h,onChange:()=>{},readonly:!0}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(f,{type:"button",variant:n==="visual"?"default":"outline",size:"sm",onClick:()=>!y&&r("visual"),disabled:y,className:"h-7 text-xs",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),"Visual"]}),e.jsxs(f,{type:"button",variant:n==="json"?"default":"outline",size:"sm",onClick:()=>r("json"),className:"h-7 text-xs",children:[e.jsx(Se,{className:"h-3 w-3 mr-1"}),"JSON"]})]}),y&&e.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-md bg-amber-500/10 text-amber-600 text-xs",children:[e.jsx(oe,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),e.jsx("span",{children:"This schema uses advanced features (nested objects, allOf, etc.) that can only be edited in JSON mode."})]}),n==="visual"?e.jsxs("div",{className:"space-y-3",children:[t.map((u,p)=>e.jsx(Ue,{field:u,onChange:v=>A(p,v),onDelete:()=>_(p)},u.id)),e.jsxs(f,{type:"button",variant:"outline",size:"sm",onClick:w,className:"w-full",children:[e.jsx(B,{className:"h-3.5 w-3.5 mr-1"}),"Add Field"]}),t.some(u=>u.name.trim())&&e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border p-2.5",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Default view"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Which view this type opens in. Auto picks from your fields (a workflow field → board, otherwise table)."})]}),e.jsxs(q,{value:o,onValueChange:u=>E(u),children:[e.jsx(P,{className:"h-8 w-32 text-xs",children:e.jsx(M,{})}),e.jsxs(L,{children:[e.jsx(R,{value:"auto",children:"Auto"}),e.jsx(R,{value:"table",children:"Table"}),e.jsx(R,{value:"board",children:"Board"})]})]})]})]}):e.jsx(X,{value:h,onChange:D,error:S})]})}function He(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Ye({entityType:s,onCancel:a,onSaved:c}){const n=!!s,r=Ce(),t=ke(),i=s?.slug??"new",o=Ee(i,{name:s?.name??"",slug:s?.slug??"",description:s?.description??"",icon:s?.icon??"",color:s?.color??"",metadataSchema:s?.metadata_schema??void 0,backingSql:s?.backing_sql??""}),[d,h]=o.field("name"),[m,S]=o.field("slug"),[N,y]=o.field("description"),[b,g]=o.field("icon"),[j,k]=o.field("color"),[E,D]=o.field("metadataSchema"),[w,A]=o.field("backingSql"),[_,u]=G(i,n),[p,v]=G(i,null),O=w.trim().length>0,F=l=>{h(l),!n&&!_&&S(He(l))},V=async()=>{if(!o.canSubmit)return;if(v(null),!d.trim()){v("Name is required");return}if(!n&&!m.trim()){v("Slug is required");return}const l=O?{sql:w.trim()}:null;try{n?await t.mutateAsync({slug:s.slug,name:d.trim(),description:N.trim()||void 0,icon:b.trim()||void 0,color:j.trim()||void 0,metadata_schema:O?void 0:E,backing:l}):await r.mutateAsync({slug:m.trim(),name:d.trim(),description:N.trim()||void 0,icon:b.trim()||void 0,color:j.trim()||void 0,metadata_schema:O?void 0:E,backing:l}),c()}catch(I){v(I instanceof Error?I.message:"An error occurred")}},z=r.isPending||t.isPending;return e.jsxs("div",{className:"space-y-5",children:[e.jsx(_e,{visible:o.hasConflict,onReload:o.reset}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-name",children:"Name"}),e.jsx(T,{id:"et-name",value:d,onChange:l=>F(l.target.value),placeholder:"e.g. Product"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-slug",children:"Slug"}),e.jsx(T,{id:"et-slug",value:m,onChange:l=>{u(!0),S(l.target.value)},placeholder:"e.g. topic",disabled:n}),n&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Slug cannot be changed after creation."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-desc",children:"Description"}),e.jsx(Re,{id:"et-desc",value:N,onChange:l=>y(l.target.value),placeholder:"Optional description...",rows:2})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-icon",children:"Icon (emoji)"}),e.jsx(T,{id:"et-icon",value:b,onChange:l=>g(l.target.value),placeholder:"e.g. 📦"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-color",children:"Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{id:"et-color",value:j,onChange:l=>k(l.target.value),placeholder:"e.g. #6366f1",className:"flex-1"}),j&&e.jsx("div",{className:"h-9 w-9 rounded-md border border-border shrink-0",style:{backgroundColor:j}})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Backing query (SQL)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. A read-only SELECT turns this into a derived (view) type — rows are computed from the query, not stored. Leave empty for a normal stored type. Table references are auto-scoped to your organization."}),e.jsx(ce,{value:w,onChange:A,minHeight:"120px",placeholder:"SELECT (metadata->>'vendor') AS vendor, SUM((metadata->>'amount')::numeric) AS total FROM events GROUP BY 1"})]}),O?e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground",children:[e.jsx(ie,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("span",{children:"Derived view — columns are computed from the query, so there's no stored-row schema to define."})]}),s?.measure_columns&&s.measure_columns.length>0&&e.jsxs("div",{className:"space-y-1 pt-1",children:[e.jsx(C,{children:"Measure columns"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.measure_columns.map(l=>e.jsx("span",{className:"rounded-md border border-border bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:l},l))})]})]}):e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Metadata Schema"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define the structure of metadata fields for entities of this type."}),e.jsx(We,{value:E,onChange:D})]}),n&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Relationships"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define how this entity type relates to others."}),e.jsx(Pe,{entityType:s})]}),p&&e.jsx("div",{className:"p-3 rounded-md bg-destructive/10 text-destructive text-sm",children:p}),e.jsx(Te,{onCancel:a,cancelDisabled:z,className:"pt-2",children:e.jsx(f,{onClick:V,disabled:z,children:z?"Saving...":n?"Update":"Create"})})]})}function Qe({entityType:s,onClose:a,orgContext:c,hideDelete:n=!1,compact:r=!1}){const t=!!s,[i,o]=x.useState(!1),[d,h]=x.useState(!1),[m,S]=x.useState(null),N=Oe(),{data:y,isLoading:b}=De(i&&s?s.slug:null,c),g=s?.entity_count??0,j=g>0,k=async()=>{if(s){S(null);try{await N.mutateAsync(s.slug),a()}catch(w){S(w instanceof Error?w.message:"Failed to delete")}}},E=t?`${s?.icon||"📄"} ${s?.name}`:"Create Entity Type",D=t?"Edit entity type configuration.":"Define a new entity type for your workspace.";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:K("space-y-1.5",!t&&!r&&"text-center"),children:[e.jsx("h1",{className:K("font-semibold leading-tight",r?"text-lg":"text-2xl"),children:E}),e.jsx("p",{className:"text-sm text-muted-foreground",children:D})]}),e.jsx("div",{className:"py-4",children:e.jsx(Ye,{entityType:s,onCancel:a,onSaved:a})}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-border pt-4",children:[e.jsxs("button",{type:"button",onClick:()=>o(!i),className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors w-full",children:[i?e.jsx(ne,{className:"h-4 w-4"}):e.jsx(re,{className:"h-4 w-4"}),"History"]}),i&&e.jsx("div",{className:"mt-3",children:b?e.jsx(ae,{label:"history",variant:"rows",rows:4}):y&&y.length>0?e.jsx("div",{className:"relative ml-1.5",children:y.map(w=>e.jsx(qe,{entry:w},w.id))}):e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No audit history found."})})]}),!n&&e.jsx("div",{className:"border-t border-border pt-4 mt-4",children:d?e.jsxs("div",{className:"space-y-3",children:[j?e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-md bg-amber-500/10 text-amber-600",children:[e.jsx(oe,{className:"h-5 w-5 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium",children:"Cannot delete this entity type"}),e.jsxs("p",{className:"mt-1 text-amber-600/80",children:["There ",g===1?"is":"are"," ",g," entit",g===1?"y":"ies",' of type "',s.name,'". Migrate or delete them first.']})]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground",children:['Are you sure you want to delete "',s.name,'"? This action will soft-delete the entity type. It can be restored by a database administrator.']}),m&&e.jsx("div",{className:"p-3 rounded-md bg-destructive/10 text-destructive text-sm",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{variant:"outline",size:"sm",onClick:()=>{h(!1),S(null)},children:"Cancel"}),e.jsx(f,{variant:"destructive",size:"sm",onClick:k,disabled:j||N.isPending,children:N.isPending?"Deleting...":"Delete"})]})]}):e.jsxs(f,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>h(!0),children:[e.jsx(le,{className:"h-3.5 w-3.5 mr-1.5"}),"Delete entity type"]})})]})]})}export{Qe as E};
@@ -0,0 +1 @@
1
+ import{j as e,aY as V,v as T,w as y,a9 as L,a4 as N,gG as U,fU as $,fZ as S}from"./index-DtRfQcRH.js";import{E as h,u as B}from"./events-feed-C4L8mQV7.js";import{T as C,a as O,b as f,c as g,V as P}from"./view-frame-HoBawpT2.js";import{M as w,V as z}from"./missing-view-CD4DOaG8.js";const o=":event";function H({owner:l,eventId:t,viewKey:n}){return l==="me"?e.jsx("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-6 px-4 py-6 lg:px-6",children:n?e.jsx(w,{viewKey:n,backTo:`/me/events/${t}`,backLabel:"Back to the event"}):e.jsx(h,{organizationId:null,ownerSlug:"me",filters:{contentIds:[t],sortBy:"date",sortOrder:"desc"}})}):e.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:e.jsx(V,{owner:l,children:i=>i.organizationId?e.jsx(A,{organizationId:i.organizationId,ownerSlug:i.ownerSlug,eventId:t,viewKey:n}):e.jsx("div",{className:"mx-auto h-40 w-full max-w-3xl animate-pulse rounded-md bg-muted/40"})})})}function A({organizationId:l,ownerSlug:t,eventId:n,viewKey:i}){const{isAuthenticated:x,isReady:d}=T(),{isMember:j,isLoading:b}=y(),m=d&&x&&j,r=B(m?{slug:t,organizationId:l}:null,n),k=L({strict:!1}),v=N(),c=`/${t}/events/${n}`,p=s=>`${c}${S(s)}`,E=s=>void v({to:".",search:s,replace:!0}),u=e.jsx("div",{className:"mx-auto w-full max-w-3xl","data-testid":"event-native",children:e.jsx(h,{organizationId:l,ownerSlug:t,filters:{contentIds:[n]}})});if(i&&(!d||x&&b))return null;if(!m)return u;if(i&&r.isLoading)return null;if(i&&r.isError)return e.jsx(z,{onRetry:r.refetch});const a=U(r.views,i);return a.kind==="missing"?e.jsx(w,{viewKey:a.key,backTo:c,backLabel:"Back to the event"}):r.views.length===0?u:e.jsxs(C,{value:a.kind==="view"?a.view.key:o,onValueChange:s=>void v({to:s===o?c:p(s)}),children:[e.jsxs(O,{children:[e.jsx(f,{value:o,"data-testid":"tab-event",children:"Event"}),r.views.map(s=>e.jsx(f,{value:s.key,"data-testid":`tab-${s.key}`,children:s.name},s.key))]}),e.jsx(g,{value:o,children:u}),a.kind==="view"&&e.jsx(g,{value:a.view.key,children:e.jsx(P,{orgSlug:t,viewKey:a.view.key,scope:{event:n},params:$(k),onParamsChange:E,contentHash:a.view.content_hash,title:a.view.name,minHeight:320})})]})}export{H as E};
@@ -0,0 +1 @@
1
+ import{r as j,j as e,L as Q,dd as Oe,dy as be,cs as De,e2 as Fe,e3 as _e,e4 as Me,ap as Le,ai as ze,e5 as qe,t as Be,a3 as He,aG as me,as as Ue,y as Ve,ah as G,H as Je,cj as We,ck as Qe,B as k,cn as Ke,cG as Ge,cH as Ze,J as we,cI as Xe,e6 as ke,e7 as oe,cm as le,e8 as Ye,al as et,w as ee,M as Ce,e9 as tt,ea as nt,s as Y,eb as st,ec as rt,k as it,ed as at,bI as ot,F as lt,dF as dt,ee as ct,ef as ut,aR as mt,eg as pt,Z as xt,bS as ht,x as gt,v as ft,d1 as yt,d2 as jt,d9 as vt,da as Nt,eh as bt,ei as _t,S as wt,c2 as kt,bq as Ct,I as St,cU as ge,cW as fe,aZ as Rt,cX as ye,E as Se,ej as Re,ek as At}from"./index-DtRfQcRH.js";import{u as Ae}from"./use-applied-views-DvMT3wap.js";import{u as Et}from"./clients-C7ubnFsS.js";import{J as Tt}from"./renderer-1nRJFMGx.js";function $t({onIntersect:n,enabled:t,rootMargin:s="400px"}){const r=j.useRef(null),i=j.useRef(n);return i.current=n,j.useEffect(()=>{const d=r.current;if(!d||!t)return;const c=new IntersectionObserver(o=>{o[0]?.isIntersecting&&i.current()},{rootMargin:s});return c.observe(d),()=>c.disconnect()},[t,s]),r}function Pt(n,t){const s=t.parentEntityType&&t.parentEntitySlug?[{entity_type:t.parentEntityType,slug:t.parentEntitySlug},{entity_type:t.entityType,slug:t.entitySlug}]:[{entity_type:t.entityType,slug:t.entitySlug}];return be(n,s)}function It({ownerSlug:n,entity:t,className:s}){const r=Pt(n,t);return e.jsxs(Q,{to:r,className:`flex items-center gap-1 text-primary hover:underline group ${s??""}`,children:[e.jsx("span",{className:"font-medium",children:t.entityName}),e.jsx(Oe,{className:"h-3 w-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Ee(n,t,s){return{queryKey:["event-view-match",n,t.key,t.content_hash,s],queryFn:async()=>{try{return await De("open_view",{key:t.key,scope:{event:s}},{slug:n}),!0}catch(r){if(r instanceof Fe&&(r.status===400||r.status===404))return!1;throw r}},staleTime:6e4}}function hn(n,t){const s=Ae(n??{slug:null,organizationId:null}),r=n?.slug??null,i=j.useMemo(()=>r?_e(s.data??[]):[],[r,s.data]),d=Me({queries:i.map(c=>Ee(r,c,t))});return r?{views:i.filter((c,o)=>d[o]?.data===!0),isLoading:s.data===void 0?!s.isError:d.some(c=>c.isPending),isError:s.isError||d.some(c=>c.isError),refetch:()=>{s.refetch();for(const c of d)c.isError&&c.refetch()}}:{views:[],isLoading:!1,isError:!1,refetch:()=>{}}}async function Ot(n,t,s,r){const i=await Promise.all(s.map(d=>n.fetchQuery(Ee(t,d,r))));return s.find((d,c)=>i[c])??null}async function Dt(n,t,s,r){const i=await Le(`${ze}/api/${encodeURIComponent(n)}/events/${t}/actions/${encodeURIComponent(s.action)}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s.value,interaction_id:r})});return await qe(i,"Could not record interaction"),i.json()}function C(n){if(typeof n!="string")return;const t=n.trim();return t.length>0?t:void 0}function pe(n){return typeof n=="boolean"?n:void 0}function Ft(n,t,s){const r=(s??"").toLowerCase();return!!(r==="prepare_comment"||r==="verify_staged_comment"||r.includes("prepare_")||r.includes("verify_staged")||t?.prepared===!0||typeof t?.verified=="boolean"||C(t?.reason_preview)&&C(t?.message)||C(n?.body)&&(C(n?.post_url)||C(n?.activity_id)))}function Mt(n,t,s){if(!Ft(n,t,s))return null;const r=(s??"").toLowerCase(),i=C(t?.body)??C(n?.body),d=C(t?.reason_preview)??C(n?.reason),c=C(t?.post_url)??C(n?.post_url)??(C(n?.activity_id)?`https://www.linkedin.com/feed/update/urn:li:activity:${C(n?.activity_id)}`:void 0),o=pe(t?.prepared),x=pe(t?.verified),m=pe(t?.banner_shown),g=C(t?.message),h=t?.match&&typeof t.match=="object"?t.match:null,T=C(h?.text_preview),l=C(h?.author);let p="generic";r==="verify_staged_comment"||r.includes("verify")||typeof x=="boolean"?p="verify":(r==="prepare_comment"||r.includes("prepare")||o===!0||i&&c)&&(p="prepare");const f=[];return o===!0&&f.push("Staged — not posted"),o===!1&&f.push("Not staged"),x===!0&&f.push("Verified posted"),x===!1&&f.push("Not verified as posted"),m===!0&&f.push("In-page banner"),m===!1&&f.push("No banner"),{kind:p,message:g,reason:d,body:i,postUrl:c,prepared:o,bannerShown:m,verified:x,matchPreview:T,matchAuthor:l,chips:f}}const Lt={};function se(n){return n.replace(/_/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}const zt={notification:"Notification",tool_invocation:"Action",deployment:"Deployment",config_change:"Config change",message:"Message",msg:"Note",summary:"Summary"};function qt(n){return n.author_name?n.author_name:n.platform?se(n.platform):n.origin_type?zt[n.origin_type]??se(n.origin_type):null}function je(n){return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?String(n):Array.isArray(n)?n.length===0?"":n.every(t=>typeof t!="object")?n.map(t=>String(t)).join(", "):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(n,null,2)}):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(n,null,2)})}const xe=1e5;function Bt({value:n}){const t=JSON.stringify(n,null,2)??"null",s=t.length>xe;return e.jsxs(e.Fragment,{children:[e.jsx("pre",{className:"max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-muted/40 p-3 font-mono text-xs",children:s?t.slice(0,xe):t}),s&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",xe.toLocaleString()," of"," ",t.length.toLocaleString()," characters."]})]})}function Ht(n){return Object.entries(n).filter(([,t])=>t==null?!1:typeof t=="string"?t.trim().length>0:Array.isArray(t)?t.length>0:typeof t=="object"?Object.keys(t).length>0:!0).sort(([t],[s])=>t.localeCompare(s))}function Ut({breakdown:n}){if(!n)return null;const t=[{label:"Engagement",value:n.engagement,max:100},{label:"Criticality",value:n.criticality,max:100},{label:"Depth",value:n.depth,max:100},{label:"Authority",value:n.authority,max:100},{label:"Recency",value:n.recency,max:100},{label:"Quality",value:n.quality,max:100}];return e.jsx("div",{className:"space-y-2 text-sm",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-muted-foreground",children:s.label}),e.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary",style:{width:`${s.value/s.max*100}%`}})}),e.jsx("span",{className:"w-8 text-right",children:s.value})]},s.label))})}function Vt({slug:n,value:t,isManual:s}){return e.jsxs(G,{variant:"secondary",className:"text-xs",children:[n,": ",t,s&&e.jsx(ke,{className:"ml-1 h-2.5 w-2.5 fill-current"})]})}function Jt(n){if(n&&typeof n=="object"){const t=n;if(Array.isArray(t.values))return{values:t.values.map(s=>String(s)).filter(s=>s.length>0),isManual:t.is_manual===!0};if(t.value!==void 0&&t.value!==null)return{values:[String(t.value)],isManual:t.is_manual===!0};if(typeof t.values=="string"&&t.values.length>0)return{values:[t.values],isManual:t.is_manual===!0}}return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?{values:[String(n)],isManual:!1}:{values:[],isManual:!1}}function Wt(n,t){if(n)switch(n){case"pending":return"pending_approval";case"approved":return"confirmed";case"rejected":return"rejected";case"completed":return"completed";case"failed":return"failed";default:return n}return t||"pending_approval"}function z(n){return!n||typeof n!="object"||Array.isArray(n)?null:n}function ve(n){return n==null||n===""?"Not set":typeof n=="string"?n:JSON.stringify(n,null,2)}function Qt(n){return n.replace(/\s+[—-]\s+pending approval$/i,"")}function Z(n){return n.replace(/^\$/,"").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}function Te(n,t,s){return n?.kind==="agent_session"&&n.agent_id?n.client_id?`${n.agent_id} via ${n.client_id}`:n.agent_id:n?.kind==="user"?"a person":t==="agent"?"an agent":s?`Automation ${s}`:"an Automation"}function Kt({initiator:n,clientName:t,fallback:s}){const{org:r}=ee(),i=r?.slug,d=n?.client_id??t,o=Et(void 0,{enabled:!!(i&&d)}).data?.find(h=>h.id===d)?.title,x=n&&n.kind!=="user"?Te(n,void 0,n.automation_id===void 0?void 0:String(n.automation_id)):s,m="font-medium text-foreground",g=`${m} underline-offset-4 hover:underline`;return i&&n?.kind==="automation"&&n.automation_id?e.jsx(Q,{to:"/$owner/automations/$automationId",params:{owner:i,automationId:String(n.automation_id)},search:{view:"definition",run_id:void 0},className:g,children:x}):i&&n?.kind==="agent_session"&&n.agent_id?e.jsx(Q,{to:"/$owner/agents/$agentId",params:{owner:i,agentId:String(n.agent_id)},className:g,children:x}):i&&d?e.jsxs(Q,{to:"/$owner/agents/connected/$clientId",params:{owner:i,clientId:d},className:`${g} inline-flex items-center gap-1 align-middle`,children:[e.jsx(ht,{name:o??t??d}),o??x]}):e.jsx("span",{className:m,children:x})}function Gt(n){const t=Object.keys(n.fields),s=t.map(Z).join(", ")||"field",r=t.length===1?"field":"fields";return`Update ${n.entityType?Z(n.entityType).toLowerCase():"entity"} ${r}: ${s}`}function Zt(n,t){const s=z(t.fields);if(!s||Object.keys(s).length===0||t.action_key!=="entity_field_change"&&t.tool!=="entity_field_change")return null;const r=z(t.current)??{},i=n;return{fields:s,current:r,reason:typeof t.reason=="string"?t.reason:void 0,automationId:t.automation_id!=null?String(t.automation_id):void 0,automationName:typeof t.automation_name=="string"?t.automation_name:void 0,automationAgentId:typeof t.automation_agent_id=="string"?t.automation_agent_id:void 0,entityType:typeof t.entity_type=="string"?t.entity_type:void 0,entityName:(typeof t.entity_name=="string"?t.entity_name:void 0)??i.entity_name??void 0,entitySlug:typeof t.entity_slug=="string"?t.entity_slug:void 0,parentSlug:typeof t.parent_slug=="string"?t.parent_slug:void 0,parentEntityType:typeof t.parent_entity_type=="string"?t.parent_entity_type:void 0,attribution:typeof t.attribution=="string"?t.attribution:void 0,initiator:t.initiator&&typeof t.initiator=="object"?t.initiator:void 0}}function Xt(n){return!n||!Array.isArray(n.evidence)?[]:n.evidence.flatMap(t=>{const s=z(t),r=s?.kind,i=s?.identifier;return typeof r=="string"&&typeof i=="string"?[{kind:r,identifier:i}]:[]})}function Ne(n){return Array.isArray(n)?n.flatMap(t=>{const s=z(t),r=s?.kind,i=s?.identifier;return typeof r=="string"&&typeof i=="string"?[{kind:r,identifier:i}]:[]}):[]}function Yt(n){const t=z(n?.evidence_change);if(t&&!(!Array.isArray(t.dropped)||!Array.isArray(t.gained)))return{dropped:Ne(t.dropped),gained:Ne(t.gained)}}function L(n){return typeof n=="string"?n:void 0}function en(n){const t=z(n.current),s=z(n.proposal),r=z(t?.winner),i=z(t?.loser),d=Array.isArray(t?.duplicates)?t.duplicates.map(z):[],o=(d.length>0?d:i?[i]:[]).flatMap(l=>{const p=L(l?.name),f=l?.id;return p&&(typeof f=="string"||typeof f=="number")?[{key:String(f),name:p,slug:L(l?.slug),entityType:L(l?.entity_type),parentSlug:L(l?.parent_slug),parentEntityType:L(l?.parent_entity_type)}]:[]}),x=Array.isArray(s?.entity_ids)?s.entity_ids:[],m=Array.isArray(s?.names)?s.names.flatMap((l,p)=>{const f=x[p];return typeof l=="string"&&(typeof f=="string"||typeof f=="number")?[{key:String(f),name:l}]:[]}):[],g=L(s?.name),h=s?.entity_id,T=o.length>0?o:m.length>0?m:g&&(typeof h=="string"||typeof h=="number")?[{key:String(h),name:g}]:[];return{winnerName:L(r?.name)??L(s?.winner_name),winnerSlug:L(r?.slug),winnerEntityType:L(r?.entity_type),winnerParentSlug:L(r?.parent_slug),winnerParentEntityType:L(r?.parent_entity_type),losers:T,matchEvidence:Xt(s),evidenceChange:Yt(s)}}function tn(n){const t=n.entityType?Z(n.entityType).toLowerCase():"entity";if(n.operation==="merge"){const s=n.merge?.losers??[];return s.length>1?`Merge ${s.length} duplicate ${t}s`:`Merge duplicate ${t}`}return`${Z(n.operation)} ${t}`}function nn(n,t){if(t.action_key!=="entity_change"&&t.tool!=="entity_change")return null;const s=t.action;if(s!=="create"&&s!=="delete"&&s!=="merge")return null;const r=n;return{operation:s,merge:s==="merge"?en(t):void 0,proposal:z(t.proposal),current:z(t.current),reason:typeof t.reason=="string"?t.reason:void 0,automationId:t.automation_id!=null?String(t.automation_id):void 0,automationName:typeof t.automation_name=="string"?t.automation_name:void 0,automationAgentId:typeof t.automation_agent_id=="string"?t.automation_agent_id:void 0,entityType:typeof t.entity_type=="string"?t.entity_type:void 0,entityName:(typeof t.entity_name=="string"?t.entity_name:void 0)??r.entity_name??void 0,entitySlug:typeof t.entity_slug=="string"?t.entity_slug:void 0,parentSlug:typeof t.parent_slug=="string"?t.parent_slug:void 0,parentEntityType:typeof t.parent_entity_type=="string"?t.parent_entity_type:void 0,attribution:typeof t.attribution=="string"?t.attribution:void 0,proposerRationale:typeof t.proposer_rationale=="string"?t.proposer_rationale:void 0,initiator:t.initiator&&typeof t.initiator=="object"?t.initiator:void 0}}function he(n,t){return!n||!t.entityType||!t.entitySlug?null:be(n,t.parentEntityType&&t.parentSlug?[{entity_type:t.parentEntityType,slug:t.parentSlug},{entity_type:t.entityType,slug:t.entitySlug}]:[{entity_type:t.entityType,slug:t.entitySlug}])}function $e({runId:n,details:t}){const{org:s}=ee(),i=Ce(t.automationId,void 0,s?.id,{includeVersions:!1}).data?.automation,d=Te(t.initiator,t.attribution,t.automationId),c=i?.automation_name??t.automationName??d,o=s?.slug;return e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Requested by"," ",o&&t.automationId?e.jsx(Q,{to:"/$owner/automations/$automationId",params:{owner:o,automationId:t.automationId},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:c}):e.jsx("span",{className:"font-medium text-foreground",children:c}),o&&n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" · "}),e.jsxs(Q,{to:"/$owner/events",params:{owner:o},search:{run_ids:String(n)},className:"font-medium text-foreground underline-offset-4 hover:underline",children:["Run #",n]})]})]})}function Pe({details:n}){const{org:t}=ee(),s=he(t?.slug,n);return n.entityName?e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Entity"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:s?e.jsx(Q,{to:s,className:"underline-offset-4 hover:underline",children:n.entityName}):n.entityName})]}):null}function Ie({label:n,before:t,after:s}){return e.jsxs("div",{className:"rounded-md border border-border/70 overflow-hidden",children:[e.jsx("div",{className:"border-b border-border/70 px-3 py-2 text-xs font-medium",children:n}),e.jsxs("div",{className:"grid gap-px bg-border/70 sm:grid-cols-2",children:[e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Current"}),e.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:ve(t)})]}),e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Proposed"}),e.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:ve(s)})]})]})]})}function sn({runId:n,details:t}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx($e,{runId:n,details:t}),e.jsx(Pe,{details:t}),Object.entries(t.fields).map(([s,r])=>e.jsx(Ie,{label:Z(s),before:t.current[s],after:r},s)),t.reason&&e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.reason})]})]})}function rn({merge:n,status:t}){const{org:s}=ee(),r=he(s?.slug,{entityType:n.winnerEntityType,entitySlug:n.winnerSlug,parentEntityType:n.winnerParentEntityType,parentSlug:n.winnerParentSlug}),i=n.losers.length,d=t==="rejected"||t==="failed",c=t==="completed";return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg border border-border/70 overflow-hidden",children:e.jsxs("div",{className:"grid gap-px bg-border/70 sm:grid-cols-2",children:[e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:d?"Would have kept":"Kept"}),e.jsx("div",{className:"text-sm font-medium leading-relaxed",children:n.winnerName?r?e.jsx(Q,{to:r,className:"underline-offset-4 hover:underline",children:n.winnerName}):n.winnerName:e.jsx("span",{className:"text-muted-foreground",children:"Unknown"})})]}),e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:d?i>1?`Kept separate (${i})`:"Kept separate":c?i>1?`Merged away (${i})`:"Merged away":i>1?`To merge away (${i})`:"To merge away"}),e.jsx("div",{className:"space-y-0.5 text-sm leading-relaxed",children:i>0?n.losers.map(o=>{const x=he(s?.slug,{entityType:o.entityType,entitySlug:o.slug,parentEntityType:o.parentEntityType,parentSlug:o.parentSlug}),m=c?"line-through decoration-muted-foreground/60":"";return e.jsx("div",{className:"break-words",children:x?e.jsx(Q,{to:x,className:`${m} underline-offset-4 hover:underline`,children:o.name}):e.jsx("span",{className:m,children:o.name})},o.key)}):e.jsx("span",{className:"text-muted-foreground",children:"Unknown"})})]})]})}),n.evidenceChange&&e.jsxs("div",{className:n.evidenceChange.dropped.length>0?"rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2":"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:n.evidenceChange.dropped.length>0?"What changed since you reviewed this":"Evidence re-checked"}),e.jsxs("div",{className:"mt-1.5 flex flex-col gap-1",children:[n.evidenceChange.dropped.map(o=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"mr-1.5 font-medium text-amber-700 dark:text-amber-400",children:"No longer proven"}),Z(o.kind),": ",o.identifier]},`dropped-${o.kind}:${o.identifier}`)),n.evidenceChange.gained.map(o=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"mr-1.5 font-medium text-emerald-700 dark:text-emerald-400",children:"Newly proven"}),Z(o.kind),": ",o.identifier]},`gained-${o.kind}:${o.identifier}`)),n.evidenceChange.dropped.length===0&&n.evidenceChange.gained.length===0&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"The recorded match evidence did not change."})]})]}),n.matchEvidence.length>0&&e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Match evidence"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:n.matchEvidence.map(o=>e.jsxs(G,{variant:"outline",className:"text-[10px] font-normal",children:[Z(o.kind),": ",o.identifier]},`${o.kind}:${o.identifier}`))})]})]})}function an({runId:n,details:t,status:s}){const r=t.operation==="merge";return e.jsxs("div",{className:"space-y-3",children:[e.jsx($e,{runId:n,details:t}),r&&t.merge?e.jsx(rn,{merge:t.merge,status:s}):e.jsxs(e.Fragment,{children:[e.jsx(Pe,{details:t}),e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Change"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.operation==="create"?"Create a new entity after approval.":"Delete this entity after approval."})]})]}),!r&&t.proposal&&e.jsxs("div",{className:"rounded-md border border-border/70 p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Proposal"}),e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed",children:JSON.stringify(t.proposal,null,2)})]}),t.proposerRationale&&e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:t.attribution==="agent"?"The agent's reasoning":"The Automation's reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.proposerRationale})]}),t.reason&&e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:r?"Why this needs approval":"Reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.reason})]})]})}function on({summary:n}){return e.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 bg-muted/30 p-3 text-sm",children:[n.chips.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.chips.map(t=>e.jsx(G,{variant:"outline",className:"text-[10px] font-normal",children:t},t))}),n.message&&e.jsx("p",{className:"leading-relaxed text-foreground",children:n.message}),n.reason&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Why"}),e.jsx("div",{className:"mt-0.5 leading-relaxed",children:n.reason})]}),n.body&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:n.kind==="verify"?"Expected comment":"Draft"}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed",children:n.body})]}),n.matchPreview&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsxs("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:["Matched comment",n.matchAuthor?` · ${n.matchAuthor}`:""]}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed text-muted-foreground",children:n.matchPreview})]}),n.postUrl&&e.jsxs("a",{href:n.postUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Open post",e.jsx(we,{className:"h-3 w-3"})]})]})}function ln({content:n}){const t=n.metadata||{},s=n.run_id??void 0,r=Zt(n,t),i=nn(n,t),d=(r?Gt(r):i?tn(i):void 0)||t.operation_name||t.action_name||(n.title?Qt(n.title):void 0)||"Action",c=t.connection_name,o=t.operation_key||t.action_key||null,x=n.interaction_input_schema||t.input_schema||null,m=j.useMemo(()=>n.interaction_input||t.action_input||t.operation_input||Lt,[n.interaction_input,t.action_input,t.operation_input]),g=n.interaction_output||t.action_output||void 0,h=Mt(m,g??null,o),T=n.interaction_error||t.error_message||void 0,l=Wt(n.interaction_status,t.status),p=t.reviewed_by_name||t.reviewed_by_id||void 0,f=t.reject_reason||void 0,v=t.initiator,$=st(),S=rt(),q=it(n.id,at(x,m),x),{values:D,setValues:U}=q,[R,V]=j.useState(null),[F,M]=j.useState(!1),[B,u]=j.useState(""),P=l==="pending_approval",J=typeof t.source_run_id=="number";return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ot,{className:"h-4 w-4 text-yellow-500"}),e.jsx("span",{className:"font-medium",children:d}),c&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["on ",c]}),l==="confirmed"&&e.jsxs(G,{variant:"outline",className:"text-blue-700 border-blue-300 bg-blue-50 dark:bg-blue-950/30 text-[10px]",children:[e.jsx(Y,{size:"xs",className:"mr-1"}),"Executing"]}),l==="completed"&&e.jsx(G,{variant:"outline",className:"text-green-700 border-green-300 bg-green-50 dark:bg-green-950/30 text-[10px]",children:"Completed"}),l==="failed"&&e.jsx(G,{variant:"outline",className:"text-red-700 border-red-300 bg-red-50 dark:bg-red-950/30 text-[10px]",children:"Failed"}),l==="rejected"&&e.jsx(G,{variant:"outline",className:"text-muted-foreground text-[10px]",children:"Rejected"})]}),!r&&!i&&(n.author_name||p)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs text-muted-foreground",children:[n.author_name&&e.jsxs("span",{children:["Requested by"," ",e.jsx(Kt,{initiator:v,clientName:n.author_name,fallback:n.author_name})]}),n.author_name&&p&&e.jsx("span",{children:"·"}),p&&e.jsxs("span",{children:[l==="rejected"?"Rejected":"Approved"," by"," ",e.jsx("span",{className:"font-medium text-foreground",children:p})]})]}),r&&e.jsx(sn,{runId:s,details:r}),!r&&i&&e.jsx(an,{runId:s,details:i,status:l}),l==="rejected"&&f&&e.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Reason:"})," ",f]}),h&&e.jsx(on,{summary:h}),(P?q.revision:x)&&(P||Object.keys(m).length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:h?"Full input":"Input"}),P?e.jsxs(e.Fragment,{children:[e.jsx(lt,{visible:q.hasConflict,onReload:q.reset}),e.jsx(dt,{schema:q.revision,values:D,onValuesChange:U,fieldIdPrefix:`action-${n.id}-`},`action-${n.id}`)]}):h?e.jsxs("details",{className:"text-xs",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw input"}),e.jsx("pre",{className:"mt-1 bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}):e.jsx("pre",{className:"text-xs bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}),l==="completed"&&g&&Object.keys(g).length>0&&!h&&e.jsxs("div",{className:"rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium",children:[e.jsx(ct,{className:"h-3.5 w-3.5"}),"Output"]}),e.jsx("pre",{className:"text-xs text-green-800 dark:text-green-300 font-mono whitespace-pre-wrap",children:JSON.stringify(g,null,2)})]}),l==="completed"&&g&&Object.keys(g).length>0&&h&&e.jsxs("details",{className:"text-xs",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw output"}),e.jsx("pre",{className:"mt-1 rounded bg-green-50 p-2 font-mono dark:bg-green-950/30 overflow-auto max-h-32",children:JSON.stringify(g,null,2)})]}),l==="failed"&&T&&e.jsxs("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-red-700 dark:text-red-400 font-medium",children:[e.jsx(ut,{className:"h-3.5 w-3.5"}),"Error"]}),e.jsx("p",{className:"text-xs text-red-800 dark:text-red-300 font-mono mt-1",children:T})]}),R==="confirmed"&&e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-blue-700 dark:text-blue-400 font-medium",children:[e.jsx(Y,{size:"md"}),"Confirmed — executing..."]}),e.jsx("p",{className:"text-xs text-blue-800 dark:text-blue-300 mt-1",children:"The worker will execute this action shortly. Redirecting..."})]}),R==="rejected"&&e.jsx(G,{variant:"outline",className:"text-muted-foreground text-xs",children:"Rejected — redirecting..."}),P&&!R&&J&&e.jsx("div",{className:"pt-1 text-xs text-muted-foreground",children:"Part of an Automation run — approve or reject it from the run's change-set above."}),P&&s&&!R&&!J&&e.jsx("div",{className:"flex items-center gap-2 pt-1",children:F?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"Reason (optional)",value:B,onChange:te=>u(te.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs(k,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>S.mutate({run_id:s,reason:B||void 0},{onSuccess:()=>{V("rejected")}}),disabled:S.isPending,children:[S.isPending&&e.jsx(Y,{size:"sm",className:"mr-1"}),"Confirm Reject"]}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{M(!1),u("")},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(k,{size:"sm",className:"h-7 text-xs",onClick:()=>$.mutate({run_id:s,input:pt(D)},{onSuccess:()=>{V("confirmed")}}),disabled:!q.canSubmit||$.isPending||S.isPending,children:[$.isPending?e.jsx(Y,{size:"sm",className:"mr-1"}):e.jsx(mt,{className:"h-3 w-3 mr-1"}),"Confirm"]}),e.jsxs(k,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>M(!0),disabled:$.isPending||S.isPending,children:[e.jsx(xt,{className:"h-3 w-3 mr-1"}),"Reject"]})]})})]})}function dn({content:n}){const t=n.metadata||{},s=t.kind,r=n.run_id??null,i=typeof t.automation_id=="number"?t.automation_id:null,{org:d}=ee(),c=d?.slug,m=Ce(i!=null?String(i):void 0,void 0,d?.id,{includeVersions:!1}).data?.automation?.automation_name??(i!=null?`Automation ${i}`:"An Automation"),g=tt(),h=nt(),[T,l]=j.useState(!1),[p,f]=j.useState(""),[v,$]=j.useState(null);if(s==="automation_batch_reject"){const u=t.reason||void 0;return e.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Proposals rejected"}),u&&e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:u}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Ask the agent to revise its proposals with this feedback."})]})}const S=Array.isArray(t.changes)?t.changes:[],q=typeof t.created_count=="number"?t.created_count:S.filter(u=>u.kind==="created").length,D=typeof t.updated_count=="number"?t.updated_count:S.filter(u=>u.kind==="updated").length,U=typeof t.denied_count=="number"?t.denied_count:S.filter(u=>u.kind==="denied").length,R=S.filter(u=>u.kind==="denied"),V=S.filter(u=>u.kind==="updated"&&Object.keys(u.applied||{}).length>0),F=typeof t.pending_proposal_count=="number"?t.pending_proposal_count:null,M=F==null||F>0,B=M?"proposed":"applied";return e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[e.jsxs("div",{className:"text-sm font-medium",children:[B==="proposed"?"Proposed":"Applied"," ",q," ","new + ",D," updated",U>0&&e.jsxs(e.Fragment,{children:[" + ",U," denied"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[c&&i!=null?e.jsx(Q,{to:"/$owner/automations/$automationId",params:{owner:c,automationId:String(i)},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:m}):e.jsx("span",{className:"font-medium text-foreground",children:m}),r!=null&&e.jsxs("span",{children:[" · run #",r]}),F!=null&&F>0&&e.jsxs("span",{children:[" · ",F," pending"]})]})]}),V.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:V.map(u=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:u.name}),Object.entries(u.applied).map(([P,J])=>e.jsx(Ie,{label:P,before:J.old,after:J.new},P))]},u.entityId))}),R.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:R.map(u=>e.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-2.5 py-2",children:[e.jsxs("div",{className:"text-xs font-medium",children:[u.name," — not written"]}),u.denied&&e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[u.denied.reason,e.jsxs("span",{className:"ml-1 opacity-70",children:["(refused by"," ",u.denied.source==="rule"?"a write rule":"org policy",")"]})]})]},`denied-${u.entityId}-${u.name}`))}),r!=null&&v==null&&M&&e.jsx("div",{className:"mt-3 border-t border-border/70 pt-3",children:T?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"What should the agent change?",value:p,onChange:u=>f(u.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs(k,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>h.mutate({run_id:r,reason:p||void 0},{onSuccess:()=>$("rejected")}),disabled:h.isPending,children:[h.isPending&&e.jsx(Y,{size:"sm",className:"mr-1"}),"Reject all"]}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{l(!1),f("")},children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{size:"sm",className:"h-7 text-xs",onClick:()=>g.mutate({run_id:r},{onSuccess:()=>$("approved")}),disabled:g.isPending||h.isPending,children:[g.isPending&&e.jsx(Y,{size:"sm",className:"mr-1"}),"Approve all proposals"]}),e.jsx(k,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>l(!0),disabled:g.isPending||h.isPending,children:"Reject with feedback"})]})}),v==="approved"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals approved."}),v==="rejected"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Proposals rejected — ask the agent to revise them."}),r!=null&&v==null&&!M&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals reviewed."})]})}function ae({ownerSlug:n,content:t,isReply:s,showParentContext:r,connectorDefinitions:i}){const[d,c]=j.useState(!1),[o,x]=j.useState(!1),m=Be(),{currentOwner:g,allOrgs:h,isAuthenticated:T}=He(),l=n??g,p=l==="me"?null:l,f=j.useCallback(async a=>{if(!p){me.error("Open this event inside a workspace to interact with it.");return}try{await Dt(p,Number(t.id),a,crypto.randomUUID()),me.success("Recorded")}catch(N){me.error(N instanceof Error?N.message:"Could not record that interaction.")}},[t.id,p]),v=t.payload_data??{},$=t.semantic_type==="audit"&&t.origin_type==="tool_invocation",S=$&&(v.request!==void 0||v.request_status==="too_large"),D=$&&v.request_status==="complete"&&l?`/${l}/events?content_ids=${t.id}`:!l||l==="me"?null:t.run_id!=null?`/${l}/events?run_ids=${t.run_id}`:null,U=T?(h??[]).find(a=>a.slug===p):void 0,R=U?{slug:U.slug,organizationId:U.id}:null,V=Ae(R??{slug:null,organizationId:null}),F=R?.slug??null,M=j.useMemo(()=>F&&!$?_e(V.data??[],t.semantic_type):[],[F,$,V.data,t.semantic_type]),B=Ue(),u=!!(m&&R&&M.length>0),P=p&&t.run_id!=null?`/${p}/events?run_ids=${t.run_id}`:null,J=u||!!(m&&D&&Ve(D)),te=()=>{!m||!P||m.open({href:P,title:t.title??`Run #${t.run_id}`,runId:t.run_id??void 0})},re=()=>{if(u&&m&&R&&p){const a=Number(t.id);Ot(B,R.slug,M,a).catch(()=>null).then(N=>m.open({href:gt(p,a,N?.key),title:t.title??"Event"}));return}!m||!D||m.open({href:D,title:t.title??(t.run_id!=null?`Run #${t.run_id}`:"Event"),runId:t.run_id??void 0})},ie=a=>{const N=a.target;if(!(N instanceof Element))return!1;const y=N.closest('a,button,input,select,textarea,[role="button"],[role="radio"]');return y!==null&&y!==a.currentTarget},de=a=>{ie(a)||re()},ce=a=>{a.key!=="Enter"&&a.key!==" "||ie(a)||(a.preventDefault(),re())},W=t.metadata||{};if(t.semantic_type==="change_set")return e.jsx(dn,{content:t});if(t.interaction_type==="approval"||t.semantic_type==="operation"||W.status!=null||W.action_key!=null)return e.jsx(ln,{content:t});const b=Number.isFinite(t.score)?Math.round(t.score):"-",A=t.payload_type||"text",E=t.text_content||"",H=(A==="text"||A==="markdown")&&E.length>500,I=H&&!d?`${E.slice(0,500)}...`:E,K=W.thumbnail_url||W.thumbnail,O=W.media_url,X=Ht(W),ne=Object.entries(t.classifications||{}).flatMap(([a,N])=>{const y=Jt(N);return y.values.map(w=>({slug:a,value:w,isManual:y.isManual}))}),ue=(()=>{const a=t.metadata??{},N=t.platform||(typeof a.platform=="string"?a.platform:null),y=t.connection_id!=null?t.connection_id:a.source_connection_id!=null?Number(a.source_connection_id):null;return{...t,platform:N,connection_id:y!=null&&Number.isFinite(y)?y:null}})();return e.jsxs("div",{className:et(s?"border-l-2 border-l-muted pl-4":"",J&&"-mx-2 cursor-pointer rounded-lg px-2 py-1 transition-colors hover:bg-accent/40"),...J?{role:"button",tabIndex:0,onClick:de,onKeyDown:ce}:{},children:[r&&t.parent_context&&e.jsxs("div",{className:"mb-3 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Replying to:"}),e.jsx("div",{className:"font-medium",children:t.parent_context.author_name}),e.jsx("div",{className:"text-muted-foreground line-clamp-2",children:t.parent_context.text_content})]}),e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[t.title&&e.jsx("h4",{className:"font-medium line-clamp-2 mb-1",children:t.title}),e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:(()=>{const a=qt(t),N=!!t.platform&&a!==se(t.platform);return e.jsxs(e.Fragment,{children:[a&&e.jsx("span",{className:"font-medium",children:a}),N&&e.jsxs(e.Fragment,{children:[a&&e.jsx("span",{children:"·"}),e.jsx(G,{variant:"outline",className:"text-xs",children:t.platform})]})]})})()}),l?e.jsx(Je,{owner:l,source:ue,connectorDefinitions:i,className:"mt-0.5 text-xs"}):null]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.score_breakdown?e.jsxs(We,{children:[e.jsx(Qe,{asChild:!0,children:e.jsx(k,{variant:"ghost",size:"sm",className:"h-7 px-2",children:e.jsx("span",{className:"font-medium",children:b})})}),e.jsx(Ke,{className:"w-64",align:"end",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Score Breakdown"}),e.jsx(Ut,{breakdown:t.score_breakdown})]})})]}):e.jsx(k,{variant:"ghost",size:"sm",className:"h-7 px-2",disabled:!0,children:e.jsx("span",{className:"font-medium",children:b})}),u&&P&&e.jsx(k,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs","data-testid":"event-card-open-run",onClick:te,children:"Open run"}),t.source_url&&e.jsxs(Ge,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(k,{variant:"ghost",size:"icon",className:"h-7 w-7",asChild:!0,children:e.jsx("a",{href:t.source_url,target:"_blank",rel:"noopener noreferrer",children:e.jsx(we,{className:"h-3.5 w-3.5"})})})}),e.jsx(Xe,{children:"View original"})]})]})]}),t.rating&&e.jsx("div",{className:"flex items-center gap-1 mb-2",children:[1,2,3,4,5].map(a=>e.jsx(ke,{className:`h-4 w-4 ${a<=Number(t.rating)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},a))}),K&&e.jsx("a",{href:O||t.source_url||"#",target:"_blank",rel:"noopener noreferrer",className:"block mb-2",children:e.jsx("img",{src:K,alt:"",className:`rounded-md object-cover ${A==="media"?"max-h-96 w-full":"max-h-48"}`,loading:"lazy"})}),(()=>{switch(A){case"markdown":if(I)return e.jsx("div",{className:"max-w-none text-sm space-y-2",children:e.jsx(Ye,{text:I})});break;case"json_template":{const a=t.payload_template;if(a?.root)return e.jsx(Tt,{template:{root:a.root},data:t.payload_data||{},onAction:f,interactions:a.interactions});if(I)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:I});break}case"media":return e.jsxs("div",{className:"space-y-3",children:[!K&&O&&e.jsx("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline truncate block",children:O}),I&&e.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:I})]});case"empty":return e.jsxs("div",{className:"space-y-3",children:[S&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{variant:"outline",size:"sm","aria-expanded":o,onClick:()=>x(a=>!a),children:[o?e.jsx(oe,{className:"h-3.5 w-3.5"}):e.jsx(le,{className:"h-3.5 w-3.5"}),"Request"]}),o&&(v.request_status==="too_large"?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["The request was too large to retain",typeof v.request_bytes=="number"?` (${v.request_bytes.toLocaleString()} bytes).`:"."]}):e.jsx(Bt,{value:v.request}))]}),X.length>0?e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:X.map(([a,N])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:se(a)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:je(N)})]},a))}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No content"})]});default:if(I)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:I});break}return e.jsxs("div",{className:"space-y-3",children:[O&&!K&&e.jsx("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground truncate block",children:O}),X.length>0&&e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:X.map(([a,N])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:se(a)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:je(N)})]},a))})]})})(),H&&e.jsx(k,{variant:"link",size:"sm",className:"px-0 h-6 mt-1",onClick:()=>c(!d),children:d?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3 w-3 mr-1"})," Show less"]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"h-3 w-3 mr-1"})," Show more"]})}),ne.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:ne.map(a=>e.jsx(Vt,{slug:a.slug,value:a.value||"",isManual:a.isManual},a.slug))})]})}function cn({occurredAt:n,isLast:t,children:s}){return e.jsxs("div",{className:"relative flex gap-4 pb-6",children:[e.jsxs("div",{className:"relative flex w-2.5 shrink-0 justify-center",children:[!t&&e.jsx("div",{className:"absolute top-1 bottom-[-1.5rem] left-1/2 w-px -translate-x-1/2 bg-border","aria-hidden":!0}),e.jsx("div",{className:"relative z-10 mt-1 h-2.5 w-2.5 rounded-full border-2 border-background bg-muted-foreground/60"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[n&&e.jsx("time",{dateTime:new Date(n).toISOString(),title:Re(n),className:"mb-1 block text-xs leading-none text-muted-foreground",children:Se(n)}),s]})]})}function gn({organizationId:n,ownerSlug:t,entityId:s,filters:r,showEntityLinks:i=!1,emptyState:d,dense:c=!1}){const{isAuthenticated:o,isReady:x}=ft(),{isMember:m,isLoading:g}=ee(),h=t==="me",T=!h&&x&&o&&m,l=!h&&x&&(!o||!g&&!m),{data:p=[]}=yt(x&&T?n:null),{data:f=[]}=jt(l?t:null),v=T?p:f,$=vt(x&&T?n:null,s,r,t),S=Nt(l?t:null,s,r),q=l?S:$,{data:D,isLoading:U,error:R,fetchNextPage:V,hasNextPage:F,isFetchingNextPage:M}=q,B=j.useMemo(()=>D?.pages.flatMap(_=>_.content)??[],[D]),u=$t({onIntersect:()=>V(),enabled:!!F&&!M}),P=j.useMemo(()=>{const _=bt(B),b=_.map(H=>H.head),A=new Map(_.map(H=>[H.head.id,H])),E=_t(b);return Array.from(E.entries()).map(([H,I])=>{const K=I.root||I.replies[0],O=K?A.get(K.id):void 0;return{rootId:H,group:I,history:O?.history??[],runId:O?.runId??null}})},[B]),[J,te]=j.useState(new Set),[re,ie]=j.useState(new Set),[de,ce]=j.useState(new Set),W=(_,b)=>_(A=>{const E=new Set(A);return E.has(b)?E.delete(b):E.add(b),E});return U&&B.length===0?e.jsx("div",{className:"space-y-4",children:["s1","s2","s3"].map(_=>e.jsx(wt,{className:"h-32 rounded-lg"},_))}):R?e.jsx(kt,{label:"events"}):B.length===0?d??e.jsx(Ct,{icon:St,title:"Nothing here yet",description:"No events match this view."}):e.jsxs("div",{className:c?"":"pt-1",children:[P.map(({rootId:_,group:b,history:A,runId:E},H,I)=>{const K=b.replies.length>0,O=J.has(_),X=de.has(_),ne=re.has(_),ue=b.replies.filter(w=>w.depth<=3),a=b.replies.filter(w=>w.depth>3),N=!b.root&&b.replies.length>0,y=b.root||b.replies[0];return y?e.jsxs(cn,{occurredAt:y.occurred_at,isLast:H===I.length-1,children:[i&&t&&y.entity_name&&y.entity_type&&y.entity_slug&&e.jsx("div",{className:"mb-2",children:e.jsx(It,{ownerSlug:t,entity:{entityName:y.entity_name,entityType:y.entity_type,entitySlug:y.entity_slug}})}),e.jsx(ae,{ownerSlug:t,content:y,showParentContext:N&&!!y.parent_context,connectorDefinitions:v}),A.length>0&&e.jsxs(ge,{open:ne,children:[e.jsx(fe,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:"sm",className:"mt-1 h-7 gap-1 text-xs text-muted-foreground",onClick:()=>W(ie,_),children:[e.jsx(Rt,{className:"h-3.5 w-3.5"}),ne?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),"Hide ",E!=null?`run #${E} `:"","history"]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"h-3.5 w-3.5"}),E!=null?`Run #${E} · ${A.length===1?"1 earlier step":`${A.length} earlier steps`}`:A.length===1?"1 earlier state":`${A.length} earlier states`]})]})}),e.jsx(ye,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:A.map(w=>e.jsxs("div",{children:[e.jsx("time",{dateTime:new Date(w.occurred_at).toISOString(),title:Re(w.occurred_at),className:"mb-1 block text-xs text-muted-foreground",children:Se(w.occurred_at)}),e.jsx(ae,{ownerSlug:t,content:w,connectorDefinitions:v})]},w.id))})]}),K&&e.jsxs(ge,{open:O,children:[e.jsx(fe,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:"sm",className:"mt-2 ml-6 gap-1",onClick:()=>W(te,_),children:[e.jsx(At,{className:"h-3.5 w-3.5"}),O?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),"Hide ",b.replies.length," replies"]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Show ",b.replies.length," replies"]})]})}),e.jsxs(ye,{className:"space-y-2 mt-2",children:[ue.map(w=>e.jsx(ae,{ownerSlug:t,content:w,isReply:!0,connectorDefinitions:v},w.id)),a.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",size:"sm",className:"ml-12",onClick:()=>W(ce,_),children:X?e.jsxs(e.Fragment,{children:["Hide ",a.length," nested replies"]}):e.jsxs(e.Fragment,{children:["Show ",a.length," nested replies"]})}),X&&a.map(w=>e.jsx(ae,{ownerSlug:t,content:w,isReply:!0,connectorDefinitions:v},w.id))]})]})]})]},_):null}),e.jsx("div",{ref:u,className:"h-1"}),M&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(Y,{size:"xl",className:"text-muted-foreground"})})]})}export{gn as E,hn as u};
@@ -1 +1 @@
1
- import{r,j as t,aj as u}from"./index-BUr8321-.js";function l({className:i,delayMs:e=500}){const[s,n]=r.useState(e<=0);return r.useEffect(()=>{if(e<=0)return;const a=setTimeout(()=>n(!0),e);return()=>clearTimeout(a)},[e]),s?t.jsx("div",{className:u("flex min-h-[50vh] items-center justify-center",i),role:"status","aria-label":"Loading",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):null}export{l as F};
1
+ import{r,j as t,al as u}from"./index-DtRfQcRH.js";function l({className:i,delayMs:e=500}){const[s,n]=r.useState(e<=0);return r.useEffect(()=>{if(e<=0)return;const a=setTimeout(()=>n(!0),e);return()=>clearTimeout(a)},[e]),s?t.jsx("div",{className:u("flex min-h-[50vh] items-center justify-center",i),role:"status","aria-label":"Loading",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):null}export{l as F};
@@ -0,0 +1 @@
1
+ import{j as t,a2 as o}from"./index-DtRfQcRH.js";function a(){return t.jsx(o,{})}export{a as component};
@@ -0,0 +1 @@
1
+ import{hP as t,j as n}from"./index-DtRfQcRH.js";import{a as i}from"./agents-workbench-Cl7FO7b3.js";import"./agent-editor-form-DwHD9j1Y.js";import"./model-selector-XC5CI2Et.js";import"./proposal-review-shell-C3K-JXjb.js";import"./runs-_yVh6PPB.js";function d(){const{owner:o,agentId:r}=t.useParams(),e=t.useSearch();return n.jsx(i,{owner:o,agentId:r,tab:"identity",runId:e.run_id})}export{d as component};
@@ -1,4 +1,4 @@
1
- import{aA as vr,aB as pr,r as u,aC as St,j as v,aD as Mt,aE as yt,aF as Er,aG as On,aH as mr,aI as gr,aJ as _r,aK as Or,aL as F,aM as Tn,aN as Ut,X as Tr,aO as Ar,aP as Ir,aQ as Rr,aR as Sr}from"./index-BUr8321-.js";function x(...e){return vr(pr(e))}function Be({error:e,localization:t,localizeErrors:n=!0}){var r;const a="Request failed";if(!n)return e?.message?e.message:(r=e?.error)!=null&&r.message?e.error.message:a;if(typeof e=="string"&&t?.[e])return t[e];if(e?.error){if(e.error.code){const o=e.error.code;if(t?.[o])return t[o]}return e.error.message||e.error.code||e.error.statusText||t?.REQUEST_FAILED}return e?.message||t?.REQUEST_FAILED||a}function An(e){return typeof window<"u"?new URLSearchParams(window.location.search).get(e):null}var yr={FAILED_TO_CREATE_USER:"Failed to create user",USER_ALREADY_EXISTS:"User already exists",YOU_CANNOT_BAN_YOURSELF:"You cannot ban yourself",YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:"You are not allowed to change users role",YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:"You are not allowed to create users",YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:"You are not allowed to list users",YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:"You are not allowed to list users sessions",YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:"You are not allowed to ban users",YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:"You are not allowed to impersonate users",YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:"You are not allowed to revoke users sessions",YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:"You are not allowed to delete users",YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:"You are not allowed to set users password",BANNED_USER:"You have been banned from this application"},Nr={FAILED_TO_CREATE_USER:"Failed to create user",COULD_NOT_CREATE_SESSION:"Could not create session",ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:"Anonymous users cannot sign in again anonymously"},Cr={INVALID_METADATA_TYPE:"metadata must be an object or undefined",REFILL_AMOUNT_AND_INTERVAL_REQUIRED:"refillAmount is required when refillInterval is provided",REFILL_INTERVAL_AND_AMOUNT_REQUIRED:"refillInterval is required when refillAmount is provided",USER_BANNED:"User is banned",UNAUTHORIZED_SESSION:"Unauthorized or invalid session",KEY_NOT_FOUND:"API Key not found",KEY_DISABLED:"API Key is disabled",KEY_EXPIRED:"API Key has expired",USAGE_EXCEEDED:"API Key has reached its usage limit",KEY_NOT_RECOVERABLE:"API Key is not recoverable",EXPIRES_IN_IS_TOO_SMALL:"The expiresIn is smaller than the predefined minimum value.",EXPIRES_IN_IS_TOO_LARGE:"The expiresIn is larger than the predefined maximum value.",INVALID_REMAINING:"The remaining count is either too large or too small.",INVALID_PREFIX_LENGTH:"The prefix length is either too large or too small.",INVALID_NAME_LENGTH:"The name length is either too large or too small.",METADATA_DISABLED:"Metadata is disabled.",RATE_LIMIT_EXCEEDED:"Rate limit exceeded.",NO_VALUES_TO_UPDATE:"No values to update.",KEY_DISABLED_EXPIRATION:"Custom key expiration values are disabled.",INVALID_API_KEY:"Invalid API key.",INVALID_USER_ID_FROM_API_KEY:"The user id from the API key is invalid.",INVALID_API_KEY_GETTER_RETURN_TYPE:"API Key getter returned an invalid key type. Expected string.",SERVER_ONLY_PROPERTY:"The property you're trying to set can only be set from the server auth instance only."},wr={USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account."},br={VERIFICATION_FAILED:"Captcha verification failed",MISSING_RESPONSE:"Missing CAPTCHA response",UNKNOWN_ERROR:"Something went wrong"},Dr={MISSING_SECRET_KEY:"Missing secret key",SERVICE_UNAVAILABLE:"CAPTCHA service unavailable"},xr={...br,...Dr},Pr={OTP_EXPIRED:"otp expired",INVALID_OTP:"Invalid OTP",INVALID_EMAIL:"Invalid email",USER_NOT_FOUND:"User not found",TOO_MANY_ATTEMPTS:"Too many attempts"},Lr={INVALID_OAUTH_CONFIGURATION:"Invalid OAuth configuration"},Mr={PASSWORD_COMPROMISED:"The password you entered has been compromised. Please choose a different password."},Ur={INVALID_SESSION_TOKEN:"Invalid session token"},kr={YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:"You are not allowed to create a new organization",YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:"You have reached the maximum number of organizations",ORGANIZATION_ALREADY_EXISTS:"Organization already exists",ORGANIZATION_NOT_FOUND:"Organization not found",USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:"User is not a member of the organization",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:"You are not allowed to update this organization",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:"You are not allowed to delete this organization",NO_ACTIVE_ORGANIZATION:"No active organization",USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:"User is already a member of this organization",MEMBER_NOT_FOUND:"Member not found",ROLE_NOT_FOUND:"Role not found",YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:"You are not allowed to create a new team",TEAM_ALREADY_EXISTS:"Team already exists",TEAM_NOT_FOUND:"Team not found",YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:"You cannot leave the organization as the only owner",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:"You are not allowed to delete this member",YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:"You are not allowed to invite users to this organization",USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:"User is already invited to this organization",INVITATION_NOT_FOUND:"Invitation not found",YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:"You are not the recipient of the invitation",YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:"You are not allowed to cancel this invitation",INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:"Inviter is no longer a member of the organization",YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:"you are not allowed to invite user with this role",FAILED_TO_RETRIEVE_INVITATION:"Failed to retrieve invitation",YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:"You have reached the maximum number of teams",UNABLE_TO_REMOVE_LAST_TEAM:"Unable to remove last team",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:"You are not allowed to update this member",ORGANIZATION_MEMBERSHIP_LIMIT_REACHED:"Organization membership limit reached",YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:"You are not allowed to create teams in this organization",YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:"You are not allowed to delete teams in this organization",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:"You are not allowed to update this team",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:"You are not allowed to delete this team",INVITATION_LIMIT_REACHED:"Invitation limit reached"},Fr={CHALLENGE_NOT_FOUND:"Challenge not found",YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:"You are not allowed to register this passkey",FAILED_TO_VERIFY_REGISTRATION:"Failed to verify registration",PASSKEY_NOT_FOUND:"Passkey not found",AUTHENTICATION_FAILED:"Authentication failed",UNABLE_TO_CREATE_SESSION:"Unable to create session",FAILED_TO_UPDATE_PASSKEY:"Failed to update passkey"},Br={INVALID_PHONE_NUMBER:"Invalid phone number",PHONE_NUMBER_EXIST:"Phone number already exists",INVALID_PHONE_NUMBER_OR_PASSWORD:"Invalid phone number or password",UNEXPECTED_ERROR:"Unexpected error",OTP_NOT_FOUND:"OTP not found",OTP_EXPIRED:"OTP expired",INVALID_OTP:"Invalid OTP",PHONE_NUMBER_NOT_VERIFIED:"Phone number not verified"},jr={SUBSCRIPTION_NOT_FOUND:"Subscription not found",SUBSCRIPTION_PLAN_NOT_FOUND:"Subscription plan not found",ALREADY_SUBSCRIBED_PLAN:"You're already subscribed to this plan",UNABLE_TO_CREATE_CUSTOMER:"Unable to create customer",FAILED_TO_FETCH_PLANS:"Failed to fetch plans",EMAIL_VERIFICATION_REQUIRED:"Email verification is required before you can subscribe to a plan",SUBSCRIPTION_NOT_ACTIVE:"Subscription is not active",SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION:"Subscription is not scheduled for cancellation"},Hr={TEAM_LIMIT_REACHED:"Team limit reached for this organization",TEAM_MEMBER_LIMIT_REACHED:"Team member limit reached for this team",TEAM_NOT_FOUND:"Team not found",TEAM_MEMBER_NOT_FOUND:"Team member not found",TEAM_NAME_TOO_LONG:"Team name is too long",CANNOT_REMOVE_LAST_TEAM:"Cannot remove the last team",NOT_ORGANIZATION_MEMBER:"User is not a member of the organization",ALREADY_TEAM_MEMBER:"User is already a member of this team",INSUFFICIENT_TEAM_PERMISSIONS:"Insufficient permissions to perform this action on team"},Vr={OTP_NOT_ENABLED:"OTP not enabled",OTP_HAS_EXPIRED:"OTP has expired",TOTP_NOT_ENABLED:"TOTP not enabled",TWO_FACTOR_NOT_ENABLED:"Two factor isn't enabled",BACKUP_CODES_NOT_ENABLED:"Backup codes aren't enabled",INVALID_BACKUP_CODE:"Invalid backup code",INVALID_CODE:"Invalid code",TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:"Too many attempts. Please request a new code.",INVALID_TWO_FACTOR_COOKIE:"Invalid two factor cookie"},zr={INVALID_USERNAME_OR_PASSWORD:"invalid username or password",EMAIL_NOT_VERIFIED:"email not verified",UNEXPECTED_ERROR:"unexpected error",USERNAME_IS_ALREADY_TAKEN:"username is already taken. please try another.",USERNAME_TOO_SHORT:"username is too short",USERNAME_TOO_LONG:"username is too long",INVALID_USERNAME:"username is invalid"},Wr={APP:"App",ACCOUNT:"Account",ACCOUNTS:"Accounts",ACCOUNTS_DESCRIPTION:"Switch between your currently signed in accounts.",ACCOUNTS_INSTRUCTIONS:"Sign in to an additional account.",ADD_ACCOUNT:"Add Account",ADD_PASSKEY:"Add Passkey",ALREADY_HAVE_AN_ACCOUNT:"Already have an account?",AVATAR:"Avatar",AVATAR_DESCRIPTION:"Click on the avatar to upload a custom one from your files.",AVATAR_INSTRUCTIONS:"An avatar is optional but strongly recommended.",BACKUP_CODE_REQUIRED:"Backup code is required",BACKUP_CODES:"Backup Codes",BACKUP_CODES_DESCRIPTION:"Save these backup codes in a secure place. You can use them to access your account if you lose your two-factor authentication method.",BACKUP_CODE_PLACEHOLDER:"Backup Code",BACKUP_CODE:"Backup Code",CANCEL:"Cancel",CHANGE_PASSWORD:"Change Password",CHANGE_PASSWORD_DESCRIPTION:"Enter your current password and a new password.",CHANGE_PASSWORD_INSTRUCTIONS:"Please use 8 characters at minimum.",CHANGE_PASSWORD_SUCCESS:"Your password has been changed.",CONFIRM_PASSWORD:"Confirm Password",CONFIRM_PASSWORD_PLACEHOLDER:"Confirm Password",CONFIRM_PASSWORD_REQUIRED:"Confirm password is required",CONTINUE_WITH_AUTHENTICATOR:"Continue with Authenticator",COPIED_TO_CLIPBOARD:"Copied to clipboard",COPY_TO_CLIPBOARD:"Copy to clipboard",COPY_ALL_CODES:"Copy all codes",CONTINUE:"Continue",CURRENT_PASSWORD:"Current Password",CURRENT_PASSWORD_PLACEHOLDER:"Current Password",CURRENT_SESSION:"Current Session",UPDATE:"Update",DELETE:"Delete",DELETE_AVATAR:"Delete Avatar",DELETE_ACCOUNT:"Delete Account",DELETE_ACCOUNT_DESCRIPTION:"Permanently remove your account and all of its contents. This action is not reversible, so please continue with caution.",DELETE_ACCOUNT_INSTRUCTIONS:"Please confirm the deletion of your account. This action is not reversible, so please continue with caution.",DELETE_ACCOUNT_VERIFY:"Please check your email to verify the deletion of your account.",DELETE_ACCOUNT_SUCCESS:"Your account has been deleted.",DISABLE_TWO_FACTOR:"Disable Two-Factor",DISABLED_CREDENTIALS_DESCRIPTION:"Choose a provider to login to your account",DONT_HAVE_AN_ACCOUNT:"Don't have an account?",DONE:"Done",EMAIL:"Email",EMAIL_DESCRIPTION:"Enter the email address you want to use to log in.",EMAIL_INSTRUCTIONS:"Please enter a valid email address.",EMAIL_IS_THE_SAME:"Email is the same",EMAIL_PLACEHOLDER:"m@example.com",EMAIL_REQUIRED:"Email address is required",EMAIL_VERIFY_CHANGE:"Please check your email to verify the change.",EMAIL_VERIFICATION:"Email Verification",EMAIL_VERIFICATION_DESCRIPTION:"Please check your email for the verification code to complete your registration.",EMAIL_VERIFICATION_SUCCESS:"Email verification successful.",ENABLE_TWO_FACTOR:"Enable Two-Factor",IS_INVALID:"is invalid",IS_REQUIRED:"is required",IS_THE_SAME:"is the same",FORGOT_AUTHENTICATOR:"Forgot authenticator?",FORGOT_PASSWORD:"Forgot Password",FORGOT_PASSWORD_ACTION:"Send reset link",FORGOT_PASSWORD_DESCRIPTION:"Enter your email to reset your password",FORGOT_PASSWORD_EMAIL:"Check your email for the password reset link.",FORGOT_PASSWORD_LINK:"Forgot your password?",LINK:"Link",MAGIC_LINK:"Magic Link",MAGIC_LINK_ACTION:"Send magic link",MAGIC_LINK_DESCRIPTION:"Enter your email to receive a magic link",MAGIC_LINK_EMAIL:"Check your email for the magic link",EMAIL_OTP:"Email Code",EMAIL_OTP_SEND_ACTION:"Send code",EMAIL_OTP_VERIFY_ACTION:"Verify code",EMAIL_OTP_DESCRIPTION:"Enter your email to receive a code",EMAIL_OTP_VERIFICATION_SENT:"Please check your email for the verification code.",NAME:"Name",NAME_DESCRIPTION:"Please enter your full name, or a display name.",NAME_INSTRUCTIONS:"Please use 32 characters at maximum.",NAME_PLACEHOLDER:"Name",NEW_PASSWORD:"New Password",NEW_PASSWORD_PLACEHOLDER:"New Password",NEW_PASSWORD_REQUIRED:"New password is required",ONE_TIME_PASSWORD:"One-Time Password",OR_CONTINUE_WITH:"Or continue with",PASSKEY:"Passkey",PASSKEYS:"Passkeys",PASSKEYS_DESCRIPTION:"Manage your passkeys for secure access.",PASSKEYS_INSTRUCTIONS:"Securely access your account without a password.",PERSONAL_ACCOUNT:"Personal Account",API_KEYS:"API Keys",API_KEYS_DESCRIPTION:"Manage your API keys for secure access.",API_KEYS_INSTRUCTIONS:"Generate API keys to access your account programmatically.",CREATE_API_KEY:"Create API Key",CREATE_API_KEY_DESCRIPTION:"Enter a unique name for your API key to differentiate it from other keys.",API_KEY_NAME_PLACEHOLDER:"New API Key",API_KEY_CREATED:"API Key Created",CREATE_API_KEY_SUCCESS:"Please copy your API key and store it in a safe place. For security reasons we cannot show it again.",NEVER_EXPIRES:"Never Expires",EXPIRES:"Expires",NO_EXPIRATION:"No Expiration",CREATE_ORGANIZATION:"Create Organization",ORGANIZATION:"Organization",ORGANIZATION_NAME:"Name",ORGANIZATION_NAME_PLACEHOLDER:"Acme Inc.",ORGANIZATION_NAME_DESCRIPTION:"This is your organization's visible name.",ORGANIZATION_NAME_INSTRUCTIONS:"Please use 32 characters at maximum.",ORGANIZATION_SLUG:"Slug URL",ORGANIZATION_SLUG_DESCRIPTION:"This is your organization's URL namespace.",ORGANIZATION_SLUG_INSTRUCTIONS:"Please use 48 characters at maximum.",ORGANIZATION_SLUG_PLACEHOLDER:"acme-inc",CREATE_ORGANIZATION_SUCCESS:"Organization created successfully",PASSWORD:"Password",PASSWORD_PLACEHOLDER:"Password",PASSWORD_REQUIRED:"Password is required",PASSWORDS_DO_NOT_MATCH:"Passwords do not match",PROVIDERS:"Providers",PROVIDERS_DESCRIPTION:"Connect your account with a third-party service.",RECOVER_ACCOUNT:"Recover Account",RECOVER_ACCOUNT_ACTION:"Recover account",RECOVER_ACCOUNT_DESCRIPTION:"Please enter a backup code to access your account",REMEMBER_ME:"Remember me",RESEND_CODE:"Resend code",RESEND_VERIFICATION_EMAIL:"Resend Verification Email",RESET_PASSWORD:"Reset Password",RESET_PASSWORD_ACTION:"Save new password",RESET_PASSWORD_DESCRIPTION:"Enter your new password below",RESET_PASSWORD_SUCCESS:"Password reset successfully",REQUEST_FAILED:"Request failed",REVOKE:"Revoke",DELETE_API_KEY:"Delete API Key",DELETE_API_KEY_CONFIRM:"Are you sure you want to delete this API key?",API_KEY:"API Key",SIGN_IN:"Sign In",SIGN_IN_ACTION:"Login",SIGN_IN_DESCRIPTION:"Enter your email below to login to your account",SIGN_IN_USERNAME_DESCRIPTION:"Enter your username or email to login to your account",SIGN_IN_WITH:"Sign in with",SIGN_OUT:"Sign Out",SIGN_UP:"Sign Up",SIGN_UP_ACTION:"Create an account",SIGN_UP_DESCRIPTION:"Enter your information to create an account",SIGN_UP_EMAIL:"Check your email for the verification link.",SESSIONS:"Sessions",SESSIONS_DESCRIPTION:"Manage your active sessions and revoke access.",SET_PASSWORD:"Set Password",SET_PASSWORD_DESCRIPTION:"Click the button below to receive an email to set up a password for your account.",SETTINGS:"Settings",SAVE:"Save",SECURITY:"Security",SWITCH_ACCOUNT:"Switch Account",TRUST_DEVICE:"Trust this device",TWO_FACTOR:"Two-Factor",TWO_FACTOR_ACTION:"Verify code",TWO_FACTOR_DESCRIPTION:"Please enter your one-time password to continue",TWO_FACTOR_CARD_DESCRIPTION:"Add an extra layer of security to your account.",TWO_FACTOR_DISABLE_INSTRUCTIONS:"Please enter your password to disable 2FA.",TWO_FACTOR_ENABLE_INSTRUCTIONS:"Please enter your password to enable 2FA.",TWO_FACTOR_ENABLED:"Two-factor authentication has been enabled",TWO_FACTOR_DISABLED:"Two-Factor Authentication has been disabled",TWO_FACTOR_PROMPT:"Two-Factor Authentication",TWO_FACTOR_TOTP_LABEL:"Scan the QR Code with your Authenticator",SEND_VERIFICATION_CODE:"Send verification code",UNLINK:"Unlink",UPDATED_SUCCESSFULLY:"updated successfully",USERNAME:"Username",USERNAME_DESCRIPTION:"Enter the username you want to use to log in.",USERNAME_INSTRUCTIONS:"Please use 32 characters at maximum.",USERNAME_PLACEHOLDER:"Username",OPTIONAL_BRACKETS:"(Optional)",SIGN_IN_USERNAME_PLACEHOLDER:"Username or email",VERIFY_YOUR_EMAIL:"Verify Your Email",VERIFY_YOUR_EMAIL_DESCRIPTION:"Please verify your email address. Check your inbox for the verification email. If you haven't received the email, click the button below to resend.",GO_BACK:"Go back",SESSION_NOT_FRESH:"Your session is not fresh. Please sign in again.",UPLOAD_AVATAR:"Upload Avatar",LOGO:"Logo",LOGO_DESCRIPTION:"Click on the logo to upload a custom one from your files.",LOGO_INSTRUCTIONS:"A logo is optional but strongly recommended.",UPLOAD:"Upload",UPLOAD_LOGO:"Upload Logo",DELETE_LOGO:"Delete Logo",PRIVACY_POLICY:"Privacy Policy",TERMS_OF_SERVICE:"Terms of Service",PROTECTED_BY_RECAPTCHA:"This site is protected by reCAPTCHA.",BY_CONTINUING_YOU_AGREE:"By continuing, you agree to the",USER:"User",ORGANIZATIONS:"Organizations",ORGANIZATIONS_DESCRIPTION:"Manage your organizations and memberships.",ORGANIZATIONS_INSTRUCTIONS:"Create an organization to collaborate with other users.",LEAVE_ORGANIZATION:"Leave Organization",LEAVE_ORGANIZATION_CONFIRM:"Are you sure you want to leave this organization?",LEAVE_ORGANIZATION_SUCCESS:"You have successfully left the organization.",MANAGE_ORGANIZATION:"Manage Organization",REMOVE_MEMBER:"Remove Member",REMOVE_MEMBER_CONFIRM:"Are you sure you want to remove this member from the organization?",REMOVE_MEMBER_SUCCESS:"Member removed successfully",INVITE_MEMBER:"Invite Member",MEMBERS:"Members",MEMBERS_DESCRIPTION:"Add or remove members and manage their roles.",MEMBERS_INSTRUCTIONS:"Invite new members to your organization.",INVITE_MEMBER_DESCRIPTION:"Send an invitation to add a new member to your organization.",ROLE:"Role",SELECT_ROLE:"Select a role",ADMIN:"Admin",MEMBER:"Member",GUEST:"Guest",OWNER:"Owner",UPDATE_ROLE_DESCRIPTION:"Update the role for this member",UPDATE_ROLE:"Update Role",MEMBER_ROLE_UPDATED:"Member role updated successfully",SEND_INVITATION:"Send Invitation",SEND_INVITATION_SUCCESS:"Invitation sent successfully",PENDING_INVITATIONS:"Pending Invitations",PENDING_INVITATIONS_DESCRIPTION:"Manage pending invitations to your organization.",PENDING_USER_INVITATIONS_DESCRIPTION:"Invitations you've received from organizations.",CANCEL_INVITATION:"Cancel Invitation",INVITATION_CANCELLED:"Invitation cancelled successfully",ACCEPT_INVITATION:"Accept Invitation",ACCEPT_INVITATION_DESCRIPTION:"You have been invited to join an organization.",INVITATION_ACCEPTED:"Invitation accepted successfully",INVITATION_REJECTED:"Invitation rejected successfully",ACCEPT:"Accept",REJECT:"Reject",INVITATION_EXPIRED:"This invitation has expired",DELETE_ORGANIZATION:"Delete Organization",DELETE_ORGANIZATION_DESCRIPTION:"Permanently remove your organization and all of its contents. This action is not reversible — please continue with caution.",DELETE_ORGANIZATION_SUCCESS:"Organization deleted successfully",DELETE_ORGANIZATION_INSTRUCTIONS:"Enter the organization slug to continue:",SLUG_REQUIRED:"Organization slug is required",SLUG_DOES_NOT_MATCH:"The slug does not match",TEAM:"Team",TEAMS:"Teams",TEAM_ACTIVE:"Active",TEAM_SET_ACTIVE:"Set Active",CREATE_TEAM:"Create Team",CREATE_TEAM_SUCCESS:"Team created successfully",UPDATE_TEAM:"Update Team",UPDATE_TEAMS:"Update Teams",SELECT_TEAMS:"Select teams",ADD:"Add",REMOVE:"Remove",UPDATE_TEAM_DESCRIPTION:"Update the name for this team",UPDATE_TEAMS_DESCRIPTION:"Add or remove teams for this member",REMOVE_TEAM_CONFIRM:"Are you sure you want to remove this team from the organization?",CREATE_TEAM_INSTRUCTIONS:"Add new team to your organization.",TEAM_NAME:"Team Name",TEAM_NAME_PLACEHOLDER:"Engineering Team",TEAM_NAME_DESCRIPTION:"This is your team's visible name.",TEAM_NAME_INSTRUCTIONS:"Please use 64 characters at maximum.",TEAMS_DESCRIPTION:"Manage your teams within your organization.",USER_TEAMS_DESCRIPTION:"You are a member of the following teams.",DELETE_TEAM:"Delete Team",DELETE_TEAM_DESCRIPTION:"Permanently remove this team and all of its contents.",DELETE_TEAM_SUCCESS:"Team deleted successfully",DELETE_TEAM_INSTRUCTIONS:"Enter the team name to continue:",TEAM_NAME_REQUIRED:"Team name is required",TEAM_NAME_DOES_NOT_MATCH:"The team name does not match",TEAM_MEMBERS:"Team Members",TEAM_MEMBERS_DESCRIPTION:"Manage your team members and their roles.",ADD_TEAM_MEMBER:"Add Team Member",REMOVE_TEAM_MEMBER:"Remove Team Member",REMOVE_TEAM_MEMBER_CONFIRM:"Are you sure you want to remove this member from the team?",REMOVE_TEAM_MEMBER_SUCCESS:"Team member removed successfully",ADD_TEAM_MEMBER_SUCCESS:"Team member added successfully",UPDATE_TEAM_SUCCESS:"Team updated successfully",MANAGE_TEAM_MEMBERS:"Manage Team Members",MANAGE_TEAM_MEMBERS_DESCRIPTION:"Search and add organization members to this team.",NO_TEAMS_FOUND:"No teams found",MEMBER_SINGULAR:"member",MEMBER_PLURAL:"members",UNKNOWN:"Unknown",...wr,...yr,...Nr,...Cr,...xr,...Pr,...Lr,...Mr,...Ur,...kr,...Fr,...Br,...jr,...Hr,...Vr,...zr},Gr={CALLBACK:"callback",EMAIL_OTP:"email-otp",EMAIL_VERIFICATION:"email-verification",FORGOT_PASSWORD:"forgot-password",MAGIC_LINK:"magic-link",RECOVER_ACCOUNT:"recover-account",RESET_PASSWORD:"reset-password",SIGN_IN:"sign-in",SIGN_OUT:"sign-out",SIGN_UP:"sign-up",TWO_FACTOR:"two-factor",ACCEPT_INVITATION:"accept-invitation"},kt={SETTINGS:"settings",SECURITY:"security",TEAMS:"teams",API_KEYS:"api-keys",ORGANIZATIONS:"organizations"},Ft={SETTINGS:"settings",MEMBERS:"members",TEAMS:"teams",API_KEYS:"api-keys"};const In=u.createContext({});function Yr(){return u.useContext(In)}var Xe,Bt;function Kr(){if(Bt)return Xe;Bt=1;var e=function(){};return Xe=e,Xe}var qr=Kr();const $r=St(qr);function Zr({async:e,appendTo:t,defer:n,id:r,nonce:a,src:o}){const c=document.createElement("script");e!==void 0&&(c.async=e),n!==void 0&&(c.defer=n),r&&(c.id=r),a&&c.setAttribute("nonce",a),c.src=o,(t==="head"?document.head:document.body).appendChild(c)}var Xr=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};let we=null,be=!1;const je=new Set,He=new Set,Qr=typeof window<"u",ye="___grecaptcha_cfg",Rn=`onLoadCallback_${Math.random().toString(36).slice(2)}`;function Jr(){if(!Qr)return;function e(n){if(be)n();else{window[ye]||(window[ye]={});const r=window[ye];r.fns||(r.fns=[]),r.fns.push(n)}}window.grecaptcha||(window.grecaptcha={}),window.grecaptcha.enterprise||(window.grecaptcha.enterprise={}),window.grecaptcha.ready=e,window.grecaptcha.enterprise.ready=e;function t(){be=!0;for(const n of He)n();He.clear()}window[Rn]=t}function ea({language:e,onLoadCallbackName:t,render:n,useEnterprise:r=!1,useRecaptchaNet:a=!1}){const o=a?"recaptcha.net":"google.com",c=r?"enterprise.js":"api.js",s=new URLSearchParams({render:n});return t&&s.set("onload",t),e&&s.set("hl",e),`https://www.${o}/recaptcha/${c}?${s.toString()}`}function ta({language:e,render:t,scriptProps:n,useEnterprise:r,useRecaptchaNet:a}){const o={id:"google-recaptcha-v3"},c=ea({language:e,onLoadCallbackName:Rn,render:t,useEnterprise:r,useRecaptchaNet:a});if(we){if(we!==c)throw new Error("reCAPTCHA has already been loaded with different parameters. Remove the existing script and load it again.");return}we=c,Zr(Object.assign(Object.assign(Object.assign({},o),n),{src:c}))}function na(e){if(!window[ye])return;const t=window[ye];t.clients&&delete t.clients[e]}function ra(e,t){var{onLoadCallback:n,onLoadCallbackName:r}=t,a=Xr(t,["onLoadCallback","onLoadCallbackName"]);if(je.size===0&&Jr(),ta(a),je.add(e),n&&(be?n():He.add(n)),r){let o=function(){if(!r)return;const c=window[r];typeof c=="function"&&c()};be?o():He.add(o)}}function aa(e){var t,n,r;je.delete(e),je.size===0&&(window.grecaptcha=void 0,window[ye]=void 0,(t=document.querySelector(".grecaptcha-badge"))===null||t===void 0||t.remove(),(n=document.querySelector(`script[src="${we}"]`))===null||n===void 0||n.remove(),(r=document.querySelector('script[src^="https://www.gstatic.com/recaptcha/releases"]'))===null||r===void 0||r.remove(),we=null,be=!1)}let jt=!1;function oa({container:e,children:t,language:n,reCaptchaKey:r,scriptProps:a,useEnterprise:o,useRecaptchaNet:c}){var s,l,i,h,d,f,p;const E=u.useId(),[_,R]=u.useState(null),[g,S]=u.useState(null),O=u.useRef(!1);u.useEffect(()=>{function I(){var D;const C=o?(D=window.grecaptcha)===null||D===void 0?void 0:D.enterprise:window.grecaptcha;if(!C)throw new Error("reCAPTCHA not found");if(!C.ready)throw new Error("reCAPTCHA ready callback not found");C.ready(()=>{R(C)})}return ra(E,{language:n,onLoadCallback:I,onLoadCallbackName:a?.onLoadCallbackName,render:e?.element?"explicit":r,scriptProps:{appendTo:a?.appendTo,async:a?.async,defer:a?.defer,id:a?.id,nonce:a?.nonce},useEnterprise:o,useRecaptchaNet:c}),()=>{aa(E),R(null)}},[e?.element,E,n,r,a?.appendTo,a?.async,a?.defer,a?.id,a?.nonce,a?.onLoadCallbackName,o,c]),u.useEffect(()=>{var I,D,C;if(!e?.element||!_?.render)return;const M={"error-callback":e.parameters.errorCallback,"expired-callback":e.parameters.expiredCallback,badge:((I=e.parameters)===null||I===void 0?void 0:I.badge)||"inline",callback:e.parameters.callback,sitekey:r,size:"invisible",tabindex:e.parameters.tabindex,theme:e.parameters.theme},L=typeof e?.element=="string"?document.getElementById(e.element):e?.element;if(!L)throw new Error("reCAPTCHA container element not found");const k=_.render(L,M);return!((D=e?.parameters)===null||D===void 0)&&D.hidden&&(jt||($r(!1,"reCAPTCHA badge hidden. See https://cloud.google.com/recaptcha/docs/faq#id_like_to_hide_the_badge_what_is_allowed for more information."),jt=!0),(C=L.querySelector(".grecaptcha-badge"))===null||C===void 0||C.style.setProperty("display","none")),S(k),O.current=!0,()=>{S(null),O.current=!1,na(k),L.innerHTML=""}},[e?.element,(s=e?.parameters)===null||s===void 0?void 0:s.badge,(l=e?.parameters)===null||l===void 0?void 0:l.hidden,(i=e?.parameters)===null||i===void 0?void 0:i.callback,(h=e?.parameters)===null||h===void 0?void 0:h.errorCallback,(d=e?.parameters)===null||d===void 0?void 0:d.expiredCallback,(f=e?.parameters)===null||f===void 0?void 0:f.tabindex,(p=e?.parameters)===null||p===void 0?void 0:p.theme,_,r]);const A=!!e?.element,m=A?g:r,N=u.useMemo(()=>m!==null&&_?.execute?I=>{if(m===null||!_?.execute)throw new Error("reCAPTCHA has not been loaded");return A&&!O.current?(console.warn("Client ID not mounted"),null):_.execute(m,{action:I})}:void 0,[m,_,A]);return v.jsx(In.Provider,{value:{container:e?.element,executeRecaptcha:N,reCaptchaInstance:_},children:t})}var ia=class{cache=new Map;listeners=new Map;inFlightRequests=new Map;get(e){return this.cache.get(e)}set(e,t){const n={data:t,timestamp:Date.now(),isRefetching:!1};this.cache.set(e,n),this.notify(e)}setRefetching(e,t){const n=this.cache.get(e);n&&(n.isRefetching=t,this.notify(e))}clear(e){if(e)this.cache.delete(e),this.inFlightRequests.delete(e),this.notify(e);else{this.cache.clear(),this.inFlightRequests.clear();const t=Array.from(this.listeners.keys());for(const n of t)this.notify(n)}}getInFlightRequest(e){return this.inFlightRequests.get(e)}setInFlightRequest(e,t){this.inFlightRequests.set(e,t)}removeInFlightRequest(e){this.inFlightRequests.delete(e)}subscribe(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>{const n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}}notify(e){const t=this.listeners.get(e);if(t){const n=Array.from(t);for(const r of n)r()}}},te=new ia;function sa(){return()=>{}}function la(){return u.useSyncExternalStore(sa,()=>!0,()=>!1)}function ca(){const[e,t]=u.useState();return u.useEffect(()=>{const n=()=>{const a=document.documentElement.getAttribute("lang");t(a??void 0)};n();const r=new MutationObserver(a=>{for(const o of a)o.attributeName==="lang"&&n()});return r.observe(document.documentElement,{attributes:!0}),()=>{r.disconnect()}},[]),{lang:e}}function ua(){const[e,t]=u.useState("light");return u.useEffect(()=>{const n=()=>{var a;const o=document.documentElement.classList.contains("dark")||((a=document.documentElement.getAttribute("style"))==null?void 0:a.includes("color-scheme: dark"));t(o?"dark":"light")};n();const r=new MutationObserver(a=>{for(const o of a)(o.attributeName==="style"||o.attributeName==="class")&&n()});return r.observe(document.documentElement,{attributes:!0}),()=>{r.disconnect()}},[]),{theme:e}}function da({children:e}){const t=la(),{captcha:n}=u.useContext(oe);return n?.provider!=="google-recaptcha-v3"?e:v.jsxs(oa,{reCaptchaKey:n.siteKey,useEnterprise:n.enterprise,useRecaptchaNet:n.recaptchaNet,children:[t&&v.jsx("style",{children:`
1
+ import{aD as vr,aE as pr,r as u,aF as St,j as v,aG as Mt,aH as yt,aI as Er,aJ as On,aK as mr,aL as gr,aM as _r,aN as Or,aO as F,aP as Tn,aQ as Ut,Z as Tr,aR as Ar,aS as Ir,aT as Rr,aU as Sr}from"./index-DtRfQcRH.js";function x(...e){return vr(pr(e))}function Be({error:e,localization:t,localizeErrors:n=!0}){var r;const a="Request failed";if(!n)return e?.message?e.message:(r=e?.error)!=null&&r.message?e.error.message:a;if(typeof e=="string"&&t?.[e])return t[e];if(e?.error){if(e.error.code){const o=e.error.code;if(t?.[o])return t[o]}return e.error.message||e.error.code||e.error.statusText||t?.REQUEST_FAILED}return e?.message||t?.REQUEST_FAILED||a}function An(e){return typeof window<"u"?new URLSearchParams(window.location.search).get(e):null}var yr={FAILED_TO_CREATE_USER:"Failed to create user",USER_ALREADY_EXISTS:"User already exists",YOU_CANNOT_BAN_YOURSELF:"You cannot ban yourself",YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:"You are not allowed to change users role",YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:"You are not allowed to create users",YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:"You are not allowed to list users",YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:"You are not allowed to list users sessions",YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:"You are not allowed to ban users",YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:"You are not allowed to impersonate users",YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:"You are not allowed to revoke users sessions",YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:"You are not allowed to delete users",YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:"You are not allowed to set users password",BANNED_USER:"You have been banned from this application"},Nr={FAILED_TO_CREATE_USER:"Failed to create user",COULD_NOT_CREATE_SESSION:"Could not create session",ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:"Anonymous users cannot sign in again anonymously"},Cr={INVALID_METADATA_TYPE:"metadata must be an object or undefined",REFILL_AMOUNT_AND_INTERVAL_REQUIRED:"refillAmount is required when refillInterval is provided",REFILL_INTERVAL_AND_AMOUNT_REQUIRED:"refillInterval is required when refillAmount is provided",USER_BANNED:"User is banned",UNAUTHORIZED_SESSION:"Unauthorized or invalid session",KEY_NOT_FOUND:"API Key not found",KEY_DISABLED:"API Key is disabled",KEY_EXPIRED:"API Key has expired",USAGE_EXCEEDED:"API Key has reached its usage limit",KEY_NOT_RECOVERABLE:"API Key is not recoverable",EXPIRES_IN_IS_TOO_SMALL:"The expiresIn is smaller than the predefined minimum value.",EXPIRES_IN_IS_TOO_LARGE:"The expiresIn is larger than the predefined maximum value.",INVALID_REMAINING:"The remaining count is either too large or too small.",INVALID_PREFIX_LENGTH:"The prefix length is either too large or too small.",INVALID_NAME_LENGTH:"The name length is either too large or too small.",METADATA_DISABLED:"Metadata is disabled.",RATE_LIMIT_EXCEEDED:"Rate limit exceeded.",NO_VALUES_TO_UPDATE:"No values to update.",KEY_DISABLED_EXPIRATION:"Custom key expiration values are disabled.",INVALID_API_KEY:"Invalid API key.",INVALID_USER_ID_FROM_API_KEY:"The user id from the API key is invalid.",INVALID_API_KEY_GETTER_RETURN_TYPE:"API Key getter returned an invalid key type. Expected string.",SERVER_ONLY_PROPERTY:"The property you're trying to set can only be set from the server auth instance only."},wr={USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account."},br={VERIFICATION_FAILED:"Captcha verification failed",MISSING_RESPONSE:"Missing CAPTCHA response",UNKNOWN_ERROR:"Something went wrong"},Dr={MISSING_SECRET_KEY:"Missing secret key",SERVICE_UNAVAILABLE:"CAPTCHA service unavailable"},xr={...br,...Dr},Pr={OTP_EXPIRED:"otp expired",INVALID_OTP:"Invalid OTP",INVALID_EMAIL:"Invalid email",USER_NOT_FOUND:"User not found",TOO_MANY_ATTEMPTS:"Too many attempts"},Lr={INVALID_OAUTH_CONFIGURATION:"Invalid OAuth configuration"},Mr={PASSWORD_COMPROMISED:"The password you entered has been compromised. Please choose a different password."},Ur={INVALID_SESSION_TOKEN:"Invalid session token"},kr={YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:"You are not allowed to create a new organization",YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:"You have reached the maximum number of organizations",ORGANIZATION_ALREADY_EXISTS:"Organization already exists",ORGANIZATION_NOT_FOUND:"Organization not found",USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:"User is not a member of the organization",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:"You are not allowed to update this organization",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:"You are not allowed to delete this organization",NO_ACTIVE_ORGANIZATION:"No active organization",USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:"User is already a member of this organization",MEMBER_NOT_FOUND:"Member not found",ROLE_NOT_FOUND:"Role not found",YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:"You are not allowed to create a new team",TEAM_ALREADY_EXISTS:"Team already exists",TEAM_NOT_FOUND:"Team not found",YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:"You cannot leave the organization as the only owner",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:"You are not allowed to delete this member",YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:"You are not allowed to invite users to this organization",USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:"User is already invited to this organization",INVITATION_NOT_FOUND:"Invitation not found",YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:"You are not the recipient of the invitation",YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:"You are not allowed to cancel this invitation",INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:"Inviter is no longer a member of the organization",YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:"you are not allowed to invite user with this role",FAILED_TO_RETRIEVE_INVITATION:"Failed to retrieve invitation",YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:"You have reached the maximum number of teams",UNABLE_TO_REMOVE_LAST_TEAM:"Unable to remove last team",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:"You are not allowed to update this member",ORGANIZATION_MEMBERSHIP_LIMIT_REACHED:"Organization membership limit reached",YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:"You are not allowed to create teams in this organization",YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:"You are not allowed to delete teams in this organization",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:"You are not allowed to update this team",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:"You are not allowed to delete this team",INVITATION_LIMIT_REACHED:"Invitation limit reached"},Fr={CHALLENGE_NOT_FOUND:"Challenge not found",YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:"You are not allowed to register this passkey",FAILED_TO_VERIFY_REGISTRATION:"Failed to verify registration",PASSKEY_NOT_FOUND:"Passkey not found",AUTHENTICATION_FAILED:"Authentication failed",UNABLE_TO_CREATE_SESSION:"Unable to create session",FAILED_TO_UPDATE_PASSKEY:"Failed to update passkey"},Br={INVALID_PHONE_NUMBER:"Invalid phone number",PHONE_NUMBER_EXIST:"Phone number already exists",INVALID_PHONE_NUMBER_OR_PASSWORD:"Invalid phone number or password",UNEXPECTED_ERROR:"Unexpected error",OTP_NOT_FOUND:"OTP not found",OTP_EXPIRED:"OTP expired",INVALID_OTP:"Invalid OTP",PHONE_NUMBER_NOT_VERIFIED:"Phone number not verified"},jr={SUBSCRIPTION_NOT_FOUND:"Subscription not found",SUBSCRIPTION_PLAN_NOT_FOUND:"Subscription plan not found",ALREADY_SUBSCRIBED_PLAN:"You're already subscribed to this plan",UNABLE_TO_CREATE_CUSTOMER:"Unable to create customer",FAILED_TO_FETCH_PLANS:"Failed to fetch plans",EMAIL_VERIFICATION_REQUIRED:"Email verification is required before you can subscribe to a plan",SUBSCRIPTION_NOT_ACTIVE:"Subscription is not active",SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION:"Subscription is not scheduled for cancellation"},Hr={TEAM_LIMIT_REACHED:"Team limit reached for this organization",TEAM_MEMBER_LIMIT_REACHED:"Team member limit reached for this team",TEAM_NOT_FOUND:"Team not found",TEAM_MEMBER_NOT_FOUND:"Team member not found",TEAM_NAME_TOO_LONG:"Team name is too long",CANNOT_REMOVE_LAST_TEAM:"Cannot remove the last team",NOT_ORGANIZATION_MEMBER:"User is not a member of the organization",ALREADY_TEAM_MEMBER:"User is already a member of this team",INSUFFICIENT_TEAM_PERMISSIONS:"Insufficient permissions to perform this action on team"},Vr={OTP_NOT_ENABLED:"OTP not enabled",OTP_HAS_EXPIRED:"OTP has expired",TOTP_NOT_ENABLED:"TOTP not enabled",TWO_FACTOR_NOT_ENABLED:"Two factor isn't enabled",BACKUP_CODES_NOT_ENABLED:"Backup codes aren't enabled",INVALID_BACKUP_CODE:"Invalid backup code",INVALID_CODE:"Invalid code",TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:"Too many attempts. Please request a new code.",INVALID_TWO_FACTOR_COOKIE:"Invalid two factor cookie"},zr={INVALID_USERNAME_OR_PASSWORD:"invalid username or password",EMAIL_NOT_VERIFIED:"email not verified",UNEXPECTED_ERROR:"unexpected error",USERNAME_IS_ALREADY_TAKEN:"username is already taken. please try another.",USERNAME_TOO_SHORT:"username is too short",USERNAME_TOO_LONG:"username is too long",INVALID_USERNAME:"username is invalid"},Wr={APP:"App",ACCOUNT:"Account",ACCOUNTS:"Accounts",ACCOUNTS_DESCRIPTION:"Switch between your currently signed in accounts.",ACCOUNTS_INSTRUCTIONS:"Sign in to an additional account.",ADD_ACCOUNT:"Add Account",ADD_PASSKEY:"Add Passkey",ALREADY_HAVE_AN_ACCOUNT:"Already have an account?",AVATAR:"Avatar",AVATAR_DESCRIPTION:"Click on the avatar to upload a custom one from your files.",AVATAR_INSTRUCTIONS:"An avatar is optional but strongly recommended.",BACKUP_CODE_REQUIRED:"Backup code is required",BACKUP_CODES:"Backup Codes",BACKUP_CODES_DESCRIPTION:"Save these backup codes in a secure place. You can use them to access your account if you lose your two-factor authentication method.",BACKUP_CODE_PLACEHOLDER:"Backup Code",BACKUP_CODE:"Backup Code",CANCEL:"Cancel",CHANGE_PASSWORD:"Change Password",CHANGE_PASSWORD_DESCRIPTION:"Enter your current password and a new password.",CHANGE_PASSWORD_INSTRUCTIONS:"Please use 8 characters at minimum.",CHANGE_PASSWORD_SUCCESS:"Your password has been changed.",CONFIRM_PASSWORD:"Confirm Password",CONFIRM_PASSWORD_PLACEHOLDER:"Confirm Password",CONFIRM_PASSWORD_REQUIRED:"Confirm password is required",CONTINUE_WITH_AUTHENTICATOR:"Continue with Authenticator",COPIED_TO_CLIPBOARD:"Copied to clipboard",COPY_TO_CLIPBOARD:"Copy to clipboard",COPY_ALL_CODES:"Copy all codes",CONTINUE:"Continue",CURRENT_PASSWORD:"Current Password",CURRENT_PASSWORD_PLACEHOLDER:"Current Password",CURRENT_SESSION:"Current Session",UPDATE:"Update",DELETE:"Delete",DELETE_AVATAR:"Delete Avatar",DELETE_ACCOUNT:"Delete Account",DELETE_ACCOUNT_DESCRIPTION:"Permanently remove your account and all of its contents. This action is not reversible, so please continue with caution.",DELETE_ACCOUNT_INSTRUCTIONS:"Please confirm the deletion of your account. This action is not reversible, so please continue with caution.",DELETE_ACCOUNT_VERIFY:"Please check your email to verify the deletion of your account.",DELETE_ACCOUNT_SUCCESS:"Your account has been deleted.",DISABLE_TWO_FACTOR:"Disable Two-Factor",DISABLED_CREDENTIALS_DESCRIPTION:"Choose a provider to login to your account",DONT_HAVE_AN_ACCOUNT:"Don't have an account?",DONE:"Done",EMAIL:"Email",EMAIL_DESCRIPTION:"Enter the email address you want to use to log in.",EMAIL_INSTRUCTIONS:"Please enter a valid email address.",EMAIL_IS_THE_SAME:"Email is the same",EMAIL_PLACEHOLDER:"m@example.com",EMAIL_REQUIRED:"Email address is required",EMAIL_VERIFY_CHANGE:"Please check your email to verify the change.",EMAIL_VERIFICATION:"Email Verification",EMAIL_VERIFICATION_DESCRIPTION:"Please check your email for the verification code to complete your registration.",EMAIL_VERIFICATION_SUCCESS:"Email verification successful.",ENABLE_TWO_FACTOR:"Enable Two-Factor",IS_INVALID:"is invalid",IS_REQUIRED:"is required",IS_THE_SAME:"is the same",FORGOT_AUTHENTICATOR:"Forgot authenticator?",FORGOT_PASSWORD:"Forgot Password",FORGOT_PASSWORD_ACTION:"Send reset link",FORGOT_PASSWORD_DESCRIPTION:"Enter your email to reset your password",FORGOT_PASSWORD_EMAIL:"Check your email for the password reset link.",FORGOT_PASSWORD_LINK:"Forgot your password?",LINK:"Link",MAGIC_LINK:"Magic Link",MAGIC_LINK_ACTION:"Send magic link",MAGIC_LINK_DESCRIPTION:"Enter your email to receive a magic link",MAGIC_LINK_EMAIL:"Check your email for the magic link",EMAIL_OTP:"Email Code",EMAIL_OTP_SEND_ACTION:"Send code",EMAIL_OTP_VERIFY_ACTION:"Verify code",EMAIL_OTP_DESCRIPTION:"Enter your email to receive a code",EMAIL_OTP_VERIFICATION_SENT:"Please check your email for the verification code.",NAME:"Name",NAME_DESCRIPTION:"Please enter your full name, or a display name.",NAME_INSTRUCTIONS:"Please use 32 characters at maximum.",NAME_PLACEHOLDER:"Name",NEW_PASSWORD:"New Password",NEW_PASSWORD_PLACEHOLDER:"New Password",NEW_PASSWORD_REQUIRED:"New password is required",ONE_TIME_PASSWORD:"One-Time Password",OR_CONTINUE_WITH:"Or continue with",PASSKEY:"Passkey",PASSKEYS:"Passkeys",PASSKEYS_DESCRIPTION:"Manage your passkeys for secure access.",PASSKEYS_INSTRUCTIONS:"Securely access your account without a password.",PERSONAL_ACCOUNT:"Personal Account",API_KEYS:"API Keys",API_KEYS_DESCRIPTION:"Manage your API keys for secure access.",API_KEYS_INSTRUCTIONS:"Generate API keys to access your account programmatically.",CREATE_API_KEY:"Create API Key",CREATE_API_KEY_DESCRIPTION:"Enter a unique name for your API key to differentiate it from other keys.",API_KEY_NAME_PLACEHOLDER:"New API Key",API_KEY_CREATED:"API Key Created",CREATE_API_KEY_SUCCESS:"Please copy your API key and store it in a safe place. For security reasons we cannot show it again.",NEVER_EXPIRES:"Never Expires",EXPIRES:"Expires",NO_EXPIRATION:"No Expiration",CREATE_ORGANIZATION:"Create Organization",ORGANIZATION:"Organization",ORGANIZATION_NAME:"Name",ORGANIZATION_NAME_PLACEHOLDER:"Acme Inc.",ORGANIZATION_NAME_DESCRIPTION:"This is your organization's visible name.",ORGANIZATION_NAME_INSTRUCTIONS:"Please use 32 characters at maximum.",ORGANIZATION_SLUG:"Slug URL",ORGANIZATION_SLUG_DESCRIPTION:"This is your organization's URL namespace.",ORGANIZATION_SLUG_INSTRUCTIONS:"Please use 48 characters at maximum.",ORGANIZATION_SLUG_PLACEHOLDER:"acme-inc",CREATE_ORGANIZATION_SUCCESS:"Organization created successfully",PASSWORD:"Password",PASSWORD_PLACEHOLDER:"Password",PASSWORD_REQUIRED:"Password is required",PASSWORDS_DO_NOT_MATCH:"Passwords do not match",PROVIDERS:"Providers",PROVIDERS_DESCRIPTION:"Connect your account with a third-party service.",RECOVER_ACCOUNT:"Recover Account",RECOVER_ACCOUNT_ACTION:"Recover account",RECOVER_ACCOUNT_DESCRIPTION:"Please enter a backup code to access your account",REMEMBER_ME:"Remember me",RESEND_CODE:"Resend code",RESEND_VERIFICATION_EMAIL:"Resend Verification Email",RESET_PASSWORD:"Reset Password",RESET_PASSWORD_ACTION:"Save new password",RESET_PASSWORD_DESCRIPTION:"Enter your new password below",RESET_PASSWORD_SUCCESS:"Password reset successfully",REQUEST_FAILED:"Request failed",REVOKE:"Revoke",DELETE_API_KEY:"Delete API Key",DELETE_API_KEY_CONFIRM:"Are you sure you want to delete this API key?",API_KEY:"API Key",SIGN_IN:"Sign In",SIGN_IN_ACTION:"Login",SIGN_IN_DESCRIPTION:"Enter your email below to login to your account",SIGN_IN_USERNAME_DESCRIPTION:"Enter your username or email to login to your account",SIGN_IN_WITH:"Sign in with",SIGN_OUT:"Sign Out",SIGN_UP:"Sign Up",SIGN_UP_ACTION:"Create an account",SIGN_UP_DESCRIPTION:"Enter your information to create an account",SIGN_UP_EMAIL:"Check your email for the verification link.",SESSIONS:"Sessions",SESSIONS_DESCRIPTION:"Manage your active sessions and revoke access.",SET_PASSWORD:"Set Password",SET_PASSWORD_DESCRIPTION:"Click the button below to receive an email to set up a password for your account.",SETTINGS:"Settings",SAVE:"Save",SECURITY:"Security",SWITCH_ACCOUNT:"Switch Account",TRUST_DEVICE:"Trust this device",TWO_FACTOR:"Two-Factor",TWO_FACTOR_ACTION:"Verify code",TWO_FACTOR_DESCRIPTION:"Please enter your one-time password to continue",TWO_FACTOR_CARD_DESCRIPTION:"Add an extra layer of security to your account.",TWO_FACTOR_DISABLE_INSTRUCTIONS:"Please enter your password to disable 2FA.",TWO_FACTOR_ENABLE_INSTRUCTIONS:"Please enter your password to enable 2FA.",TWO_FACTOR_ENABLED:"Two-factor authentication has been enabled",TWO_FACTOR_DISABLED:"Two-Factor Authentication has been disabled",TWO_FACTOR_PROMPT:"Two-Factor Authentication",TWO_FACTOR_TOTP_LABEL:"Scan the QR Code with your Authenticator",SEND_VERIFICATION_CODE:"Send verification code",UNLINK:"Unlink",UPDATED_SUCCESSFULLY:"updated successfully",USERNAME:"Username",USERNAME_DESCRIPTION:"Enter the username you want to use to log in.",USERNAME_INSTRUCTIONS:"Please use 32 characters at maximum.",USERNAME_PLACEHOLDER:"Username",OPTIONAL_BRACKETS:"(Optional)",SIGN_IN_USERNAME_PLACEHOLDER:"Username or email",VERIFY_YOUR_EMAIL:"Verify Your Email",VERIFY_YOUR_EMAIL_DESCRIPTION:"Please verify your email address. Check your inbox for the verification email. If you haven't received the email, click the button below to resend.",GO_BACK:"Go back",SESSION_NOT_FRESH:"Your session is not fresh. Please sign in again.",UPLOAD_AVATAR:"Upload Avatar",LOGO:"Logo",LOGO_DESCRIPTION:"Click on the logo to upload a custom one from your files.",LOGO_INSTRUCTIONS:"A logo is optional but strongly recommended.",UPLOAD:"Upload",UPLOAD_LOGO:"Upload Logo",DELETE_LOGO:"Delete Logo",PRIVACY_POLICY:"Privacy Policy",TERMS_OF_SERVICE:"Terms of Service",PROTECTED_BY_RECAPTCHA:"This site is protected by reCAPTCHA.",BY_CONTINUING_YOU_AGREE:"By continuing, you agree to the",USER:"User",ORGANIZATIONS:"Organizations",ORGANIZATIONS_DESCRIPTION:"Manage your organizations and memberships.",ORGANIZATIONS_INSTRUCTIONS:"Create an organization to collaborate with other users.",LEAVE_ORGANIZATION:"Leave Organization",LEAVE_ORGANIZATION_CONFIRM:"Are you sure you want to leave this organization?",LEAVE_ORGANIZATION_SUCCESS:"You have successfully left the organization.",MANAGE_ORGANIZATION:"Manage Organization",REMOVE_MEMBER:"Remove Member",REMOVE_MEMBER_CONFIRM:"Are you sure you want to remove this member from the organization?",REMOVE_MEMBER_SUCCESS:"Member removed successfully",INVITE_MEMBER:"Invite Member",MEMBERS:"Members",MEMBERS_DESCRIPTION:"Add or remove members and manage their roles.",MEMBERS_INSTRUCTIONS:"Invite new members to your organization.",INVITE_MEMBER_DESCRIPTION:"Send an invitation to add a new member to your organization.",ROLE:"Role",SELECT_ROLE:"Select a role",ADMIN:"Admin",MEMBER:"Member",GUEST:"Guest",OWNER:"Owner",UPDATE_ROLE_DESCRIPTION:"Update the role for this member",UPDATE_ROLE:"Update Role",MEMBER_ROLE_UPDATED:"Member role updated successfully",SEND_INVITATION:"Send Invitation",SEND_INVITATION_SUCCESS:"Invitation sent successfully",PENDING_INVITATIONS:"Pending Invitations",PENDING_INVITATIONS_DESCRIPTION:"Manage pending invitations to your organization.",PENDING_USER_INVITATIONS_DESCRIPTION:"Invitations you've received from organizations.",CANCEL_INVITATION:"Cancel Invitation",INVITATION_CANCELLED:"Invitation cancelled successfully",ACCEPT_INVITATION:"Accept Invitation",ACCEPT_INVITATION_DESCRIPTION:"You have been invited to join an organization.",INVITATION_ACCEPTED:"Invitation accepted successfully",INVITATION_REJECTED:"Invitation rejected successfully",ACCEPT:"Accept",REJECT:"Reject",INVITATION_EXPIRED:"This invitation has expired",DELETE_ORGANIZATION:"Delete Organization",DELETE_ORGANIZATION_DESCRIPTION:"Permanently remove your organization and all of its contents. This action is not reversible — please continue with caution.",DELETE_ORGANIZATION_SUCCESS:"Organization deleted successfully",DELETE_ORGANIZATION_INSTRUCTIONS:"Enter the organization slug to continue:",SLUG_REQUIRED:"Organization slug is required",SLUG_DOES_NOT_MATCH:"The slug does not match",TEAM:"Team",TEAMS:"Teams",TEAM_ACTIVE:"Active",TEAM_SET_ACTIVE:"Set Active",CREATE_TEAM:"Create Team",CREATE_TEAM_SUCCESS:"Team created successfully",UPDATE_TEAM:"Update Team",UPDATE_TEAMS:"Update Teams",SELECT_TEAMS:"Select teams",ADD:"Add",REMOVE:"Remove",UPDATE_TEAM_DESCRIPTION:"Update the name for this team",UPDATE_TEAMS_DESCRIPTION:"Add or remove teams for this member",REMOVE_TEAM_CONFIRM:"Are you sure you want to remove this team from the organization?",CREATE_TEAM_INSTRUCTIONS:"Add new team to your organization.",TEAM_NAME:"Team Name",TEAM_NAME_PLACEHOLDER:"Engineering Team",TEAM_NAME_DESCRIPTION:"This is your team's visible name.",TEAM_NAME_INSTRUCTIONS:"Please use 64 characters at maximum.",TEAMS_DESCRIPTION:"Manage your teams within your organization.",USER_TEAMS_DESCRIPTION:"You are a member of the following teams.",DELETE_TEAM:"Delete Team",DELETE_TEAM_DESCRIPTION:"Permanently remove this team and all of its contents.",DELETE_TEAM_SUCCESS:"Team deleted successfully",DELETE_TEAM_INSTRUCTIONS:"Enter the team name to continue:",TEAM_NAME_REQUIRED:"Team name is required",TEAM_NAME_DOES_NOT_MATCH:"The team name does not match",TEAM_MEMBERS:"Team Members",TEAM_MEMBERS_DESCRIPTION:"Manage your team members and their roles.",ADD_TEAM_MEMBER:"Add Team Member",REMOVE_TEAM_MEMBER:"Remove Team Member",REMOVE_TEAM_MEMBER_CONFIRM:"Are you sure you want to remove this member from the team?",REMOVE_TEAM_MEMBER_SUCCESS:"Team member removed successfully",ADD_TEAM_MEMBER_SUCCESS:"Team member added successfully",UPDATE_TEAM_SUCCESS:"Team updated successfully",MANAGE_TEAM_MEMBERS:"Manage Team Members",MANAGE_TEAM_MEMBERS_DESCRIPTION:"Search and add organization members to this team.",NO_TEAMS_FOUND:"No teams found",MEMBER_SINGULAR:"member",MEMBER_PLURAL:"members",UNKNOWN:"Unknown",...wr,...yr,...Nr,...Cr,...xr,...Pr,...Lr,...Mr,...Ur,...kr,...Fr,...Br,...jr,...Hr,...Vr,...zr},Gr={CALLBACK:"callback",EMAIL_OTP:"email-otp",EMAIL_VERIFICATION:"email-verification",FORGOT_PASSWORD:"forgot-password",MAGIC_LINK:"magic-link",RECOVER_ACCOUNT:"recover-account",RESET_PASSWORD:"reset-password",SIGN_IN:"sign-in",SIGN_OUT:"sign-out",SIGN_UP:"sign-up",TWO_FACTOR:"two-factor",ACCEPT_INVITATION:"accept-invitation"},kt={SETTINGS:"settings",SECURITY:"security",TEAMS:"teams",API_KEYS:"api-keys",ORGANIZATIONS:"organizations"},Ft={SETTINGS:"settings",MEMBERS:"members",TEAMS:"teams",API_KEYS:"api-keys"};const In=u.createContext({});function Yr(){return u.useContext(In)}var Xe,Bt;function Kr(){if(Bt)return Xe;Bt=1;var e=function(){};return Xe=e,Xe}var qr=Kr();const $r=St(qr);function Zr({async:e,appendTo:t,defer:n,id:r,nonce:a,src:o}){const c=document.createElement("script");e!==void 0&&(c.async=e),n!==void 0&&(c.defer=n),r&&(c.id=r),a&&c.setAttribute("nonce",a),c.src=o,(t==="head"?document.head:document.body).appendChild(c)}var Xr=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};let we=null,be=!1;const je=new Set,He=new Set,Qr=typeof window<"u",ye="___grecaptcha_cfg",Rn=`onLoadCallback_${Math.random().toString(36).slice(2)}`;function Jr(){if(!Qr)return;function e(n){if(be)n();else{window[ye]||(window[ye]={});const r=window[ye];r.fns||(r.fns=[]),r.fns.push(n)}}window.grecaptcha||(window.grecaptcha={}),window.grecaptcha.enterprise||(window.grecaptcha.enterprise={}),window.grecaptcha.ready=e,window.grecaptcha.enterprise.ready=e;function t(){be=!0;for(const n of He)n();He.clear()}window[Rn]=t}function ea({language:e,onLoadCallbackName:t,render:n,useEnterprise:r=!1,useRecaptchaNet:a=!1}){const o=a?"recaptcha.net":"google.com",c=r?"enterprise.js":"api.js",s=new URLSearchParams({render:n});return t&&s.set("onload",t),e&&s.set("hl",e),`https://www.${o}/recaptcha/${c}?${s.toString()}`}function ta({language:e,render:t,scriptProps:n,useEnterprise:r,useRecaptchaNet:a}){const o={id:"google-recaptcha-v3"},c=ea({language:e,onLoadCallbackName:Rn,render:t,useEnterprise:r,useRecaptchaNet:a});if(we){if(we!==c)throw new Error("reCAPTCHA has already been loaded with different parameters. Remove the existing script and load it again.");return}we=c,Zr(Object.assign(Object.assign(Object.assign({},o),n),{src:c}))}function na(e){if(!window[ye])return;const t=window[ye];t.clients&&delete t.clients[e]}function ra(e,t){var{onLoadCallback:n,onLoadCallbackName:r}=t,a=Xr(t,["onLoadCallback","onLoadCallbackName"]);if(je.size===0&&Jr(),ta(a),je.add(e),n&&(be?n():He.add(n)),r){let o=function(){if(!r)return;const c=window[r];typeof c=="function"&&c()};be?o():He.add(o)}}function aa(e){var t,n,r;je.delete(e),je.size===0&&(window.grecaptcha=void 0,window[ye]=void 0,(t=document.querySelector(".grecaptcha-badge"))===null||t===void 0||t.remove(),(n=document.querySelector(`script[src="${we}"]`))===null||n===void 0||n.remove(),(r=document.querySelector('script[src^="https://www.gstatic.com/recaptcha/releases"]'))===null||r===void 0||r.remove(),we=null,be=!1)}let jt=!1;function oa({container:e,children:t,language:n,reCaptchaKey:r,scriptProps:a,useEnterprise:o,useRecaptchaNet:c}){var s,l,i,h,d,f,p;const E=u.useId(),[_,R]=u.useState(null),[g,S]=u.useState(null),O=u.useRef(!1);u.useEffect(()=>{function I(){var D;const C=o?(D=window.grecaptcha)===null||D===void 0?void 0:D.enterprise:window.grecaptcha;if(!C)throw new Error("reCAPTCHA not found");if(!C.ready)throw new Error("reCAPTCHA ready callback not found");C.ready(()=>{R(C)})}return ra(E,{language:n,onLoadCallback:I,onLoadCallbackName:a?.onLoadCallbackName,render:e?.element?"explicit":r,scriptProps:{appendTo:a?.appendTo,async:a?.async,defer:a?.defer,id:a?.id,nonce:a?.nonce},useEnterprise:o,useRecaptchaNet:c}),()=>{aa(E),R(null)}},[e?.element,E,n,r,a?.appendTo,a?.async,a?.defer,a?.id,a?.nonce,a?.onLoadCallbackName,o,c]),u.useEffect(()=>{var I,D,C;if(!e?.element||!_?.render)return;const M={"error-callback":e.parameters.errorCallback,"expired-callback":e.parameters.expiredCallback,badge:((I=e.parameters)===null||I===void 0?void 0:I.badge)||"inline",callback:e.parameters.callback,sitekey:r,size:"invisible",tabindex:e.parameters.tabindex,theme:e.parameters.theme},L=typeof e?.element=="string"?document.getElementById(e.element):e?.element;if(!L)throw new Error("reCAPTCHA container element not found");const k=_.render(L,M);return!((D=e?.parameters)===null||D===void 0)&&D.hidden&&(jt||($r(!1,"reCAPTCHA badge hidden. See https://cloud.google.com/recaptcha/docs/faq#id_like_to_hide_the_badge_what_is_allowed for more information."),jt=!0),(C=L.querySelector(".grecaptcha-badge"))===null||C===void 0||C.style.setProperty("display","none")),S(k),O.current=!0,()=>{S(null),O.current=!1,na(k),L.innerHTML=""}},[e?.element,(s=e?.parameters)===null||s===void 0?void 0:s.badge,(l=e?.parameters)===null||l===void 0?void 0:l.hidden,(i=e?.parameters)===null||i===void 0?void 0:i.callback,(h=e?.parameters)===null||h===void 0?void 0:h.errorCallback,(d=e?.parameters)===null||d===void 0?void 0:d.expiredCallback,(f=e?.parameters)===null||f===void 0?void 0:f.tabindex,(p=e?.parameters)===null||p===void 0?void 0:p.theme,_,r]);const A=!!e?.element,m=A?g:r,N=u.useMemo(()=>m!==null&&_?.execute?I=>{if(m===null||!_?.execute)throw new Error("reCAPTCHA has not been loaded");return A&&!O.current?(console.warn("Client ID not mounted"),null):_.execute(m,{action:I})}:void 0,[m,_,A]);return v.jsx(In.Provider,{value:{container:e?.element,executeRecaptcha:N,reCaptchaInstance:_},children:t})}var ia=class{cache=new Map;listeners=new Map;inFlightRequests=new Map;get(e){return this.cache.get(e)}set(e,t){const n={data:t,timestamp:Date.now(),isRefetching:!1};this.cache.set(e,n),this.notify(e)}setRefetching(e,t){const n=this.cache.get(e);n&&(n.isRefetching=t,this.notify(e))}clear(e){if(e)this.cache.delete(e),this.inFlightRequests.delete(e),this.notify(e);else{this.cache.clear(),this.inFlightRequests.clear();const t=Array.from(this.listeners.keys());for(const n of t)this.notify(n)}}getInFlightRequest(e){return this.inFlightRequests.get(e)}setInFlightRequest(e,t){this.inFlightRequests.set(e,t)}removeInFlightRequest(e){this.inFlightRequests.delete(e)}subscribe(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>{const n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}}notify(e){const t=this.listeners.get(e);if(t){const n=Array.from(t);for(const r of n)r()}}},te=new ia;function sa(){return()=>{}}function la(){return u.useSyncExternalStore(sa,()=>!0,()=>!1)}function ca(){const[e,t]=u.useState();return u.useEffect(()=>{const n=()=>{const a=document.documentElement.getAttribute("lang");t(a??void 0)};n();const r=new MutationObserver(a=>{for(const o of a)o.attributeName==="lang"&&n()});return r.observe(document.documentElement,{attributes:!0}),()=>{r.disconnect()}},[]),{lang:e}}function ua(){const[e,t]=u.useState("light");return u.useEffect(()=>{const n=()=>{var a;const o=document.documentElement.classList.contains("dark")||((a=document.documentElement.getAttribute("style"))==null?void 0:a.includes("color-scheme: dark"));t(o?"dark":"light")};n();const r=new MutationObserver(a=>{for(const o of a)(o.attributeName==="style"||o.attributeName==="class")&&n()});return r.observe(document.documentElement,{attributes:!0}),()=>{r.disconnect()}},[]),{theme:e}}function da({children:e}){const t=la(),{captcha:n}=u.useContext(oe);return n?.provider!=="google-recaptcha-v3"?e:v.jsxs(oa,{reCaptchaKey:n.siteKey,useEnterprise:n.enterprise,useRecaptchaNet:n.recaptchaNet,children:[t&&v.jsx("style",{children:`
2
2
  .grecaptcha-badge {
3
3
  visibility: hidden;
4
4
  border-radius: var(--radius) !important;