@lobu/runtime-server 24.11.0 → 24.12.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 (275) hide show
  1. package/dist/catalogs/connectors.json +1113 -107
  2. package/dist/catalogs/skills.json +2 -2
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/README.md +2 -2
  5. package/dist/connectors/chat-transport-actions.ts +50 -0
  6. package/dist/connectors/discord.ts +2 -0
  7. package/dist/connectors/gchat.ts +2 -0
  8. package/dist/connectors/github.ts +4 -4
  9. package/dist/connectors/google_drive.ts +20 -0
  10. package/dist/connectors/google_gmail.ts +49 -8
  11. package/dist/connectors/herdr.ts +1 -1
  12. package/dist/connectors/imessage.ts +1 -0
  13. package/dist/connectors/linkedin-browser-script.ts +11 -0
  14. package/dist/connectors/linkedin-draft-page.js +24 -8
  15. package/dist/connectors/linkedin-inbox-adapter.js +209 -19
  16. package/dist/connectors/linkedin-inbox.ts +152 -4
  17. package/dist/connectors/linkedin-network.ts +788 -0
  18. package/dist/connectors/linkedin-search.ts +1284 -0
  19. package/dist/connectors/linkedin.ts +892 -27
  20. package/dist/connectors/microsoft_outlook.ts +57 -19
  21. package/dist/connectors/rss.ts +179 -33
  22. package/dist/connectors/slack.ts +2 -0
  23. package/dist/connectors/source-file-attachment.ts +46 -0
  24. package/dist/connectors/teams.ts +2 -0
  25. package/dist/connectors/telegram.ts +2 -0
  26. package/dist/connectors/tiktok_web.ts +1 -1
  27. package/dist/connectors/whatsapp.ts +2 -0
  28. package/dist/connectors/whatsapp_web.ts +3 -3
  29. package/dist/connectors/x-dm-adapter.js +8 -10
  30. package/dist/connectors/x.ts +8 -9
  31. package/dist/db/migrations/20261115040000_account_two_factor.sql +20 -0
  32. package/dist/db/migrations/20261115120000_events_unbound_tool_audit_without_bridge.sql +40 -0
  33. package/dist/db/migrations/20261115120001_events_unbound_tool_audit_validate.sql +19 -0
  34. package/dist/db/migrations/20261115120002_drop_events_linked_org_ids.sql +119 -0
  35. package/dist/db/migrations/20261115130000_entities_retired_type_idx.sql +34 -0
  36. package/dist/db/migrations/20261115140000_entity_identities_personal_owner_idx.sql +34 -0
  37. package/dist/db/migrations/20261117090000_write_policy_kind_note.sql +65 -0
  38. package/dist/db/migrations/20261117120000_app_policy_principal.sql +48 -0
  39. package/dist/db/migrations/20261117170000_personal_org_connector_auto_policy_backfill.sql +57 -0
  40. package/dist/db/migrations/20261117190000_org_slug_reserved_paths.sql +29 -0
  41. package/dist/db/migrations/20261118120000_workspace_view_top_level_paths.sql +69 -0
  42. package/dist/db/migrations/preconditions/20261117190000_org_slug_reserved_paths.sql +14 -0
  43. package/dist/db/migrations/preconditions/20261118120000_workspace_view_top_level_paths.sql +21 -0
  44. package/dist/dependencies.bun.lock +51 -46
  45. package/dist/guest.bundle.js +11 -2
  46. package/dist/owletto/dist/assets/_-BC9j6MkU.js +2 -0
  47. package/dist/owletto/dist/assets/_-Z1u1cIe6.js +3 -0
  48. package/dist/owletto/dist/assets/_agentId-B-TFq9TP.js +2 -0
  49. package/dist/owletto/dist/assets/{_agentId-CGScf8z_.js → _agentId-BGatZWsd.js} +2 -2
  50. package/dist/owletto/dist/assets/_automationId-CMUrWPvr.js +2 -0
  51. package/dist/owletto/dist/assets/_connectorKey._connectionId-CUoAoP0_.js +2 -0
  52. package/dist/owletto/dist/assets/_connectorKey.index-Bs49QGGH.js +2 -0
  53. package/dist/owletto/dist/assets/_conversationId-CszP1den.js +2 -0
  54. package/dist/owletto/dist/assets/_eventId-C0AZUBnD.js +2 -0
  55. package/dist/owletto/dist/assets/_owner-B4ydA75k.js +3 -0
  56. package/dist/owletto/dist/assets/_shape-C4-ikE70.js +2 -0
  57. package/dist/owletto/dist/assets/_slug-DE5J3KVu.js +2 -0
  58. package/dist/owletto/dist/assets/_viewKey-Dkcd8JQC.js +2 -0
  59. package/dist/owletto/dist/assets/{accept-invitation-BKeIzZXE.js → accept-invitation-DmrQQu_W.js} +2 -2
  60. package/dist/owletto/dist/assets/{activity-route-location-sLvKaSCa.js → activity-route-location-Bec6fW-t.js} +2 -2
  61. package/dist/owletto/dist/assets/activity-route-view-DCSNBKZU.js +2 -0
  62. package/dist/owletto/dist/assets/agent-client-connections-xvabPpi6.js +4 -0
  63. package/dist/owletto/dist/assets/agent-connect-pages-DDPtkcmq.js +6 -0
  64. package/dist/owletto/dist/assets/{agent-editor-form-DVFyyMyd.js → agent-editor-form-BrhQbHZg.js} +2 -2
  65. package/dist/owletto/dist/assets/{agent-loading-shells-BLNHIy-r.js → agent-loading-shells-D3y98xuO.js} +2 -2
  66. package/dist/owletto/dist/assets/{agent-permissions-matrix-UBKRR5vs.js → agent-permissions-matrix-jQJjSa9i.js} +2 -2
  67. package/dist/owletto/dist/assets/{agent-skill-context-fqedKd0D.js → agent-skill-context-CCcknBYE.js} +2 -2
  68. package/dist/owletto/dist/assets/{agent-subpage-shell-BUCoY2Nf.js → agent-subpage-shell-6f_53cSf.js} +2 -2
  69. package/dist/owletto/dist/assets/agent-thread-v_lSSnJi.js +6 -0
  70. package/dist/owletto/dist/assets/{app._appId-ByIypCL9.js → app._appId-CKWzZ2ic.js} +2 -2
  71. package/dist/owletto/dist/assets/assist-composer-Q9ZJjAta.js +2 -0
  72. package/dist/owletto/dist/assets/automation-run-now-Dl0MKx3N.js +2 -0
  73. package/dist/owletto/dist/assets/{callback-Pz5uS-k7.js → callback-Bentv78L.js} +2 -2
  74. package/dist/owletto/dist/assets/{card-CAPpY9P5.js → card-C4oPCVh6.js} +2 -2
  75. package/dist/owletto/dist/assets/{claim-DgWWK0KI.js → claim-B3C4qIi2.js} +2 -2
  76. package/dist/owletto/dist/assets/client-activity-scopes-DqaFEyir.js +2 -0
  77. package/dist/owletto/dist/assets/{client-rows-Dd5YV8vn.js → client-rows-rse9thnk.js} +2 -2
  78. package/dist/owletto/dist/assets/{clients-Bf7ZgGro.js → clients-BhPMbxHi.js} +2 -2
  79. package/dist/owletto/dist/assets/{code-editor-z1Sy_hiX.js → code-editor-CTdKUDPY.js} +2 -2
  80. package/dist/owletto/dist/assets/connect-D8o7HBlo.js +2 -0
  81. package/dist/owletto/dist/assets/connect-menu-D5EZvSHb.js +2 -0
  82. package/dist/owletto/dist/assets/connect._clientId-Dbagcg9L.js +2 -0
  83. package/dist/owletto/dist/assets/connected._clientId-DALW9S2K.js +2 -0
  84. package/dist/owletto/dist/assets/connection-DyxzSqVE.js +2 -0
  85. package/dist/owletto/dist/assets/connection-feed-detail-LqpxUCdy.js +2 -0
  86. package/dist/owletto/dist/assets/{connector-page-shell-an3SYLim.js → connector-page-shell-DZjKv9zQ.js} +2 -2
  87. package/dist/owletto/dist/assets/{connector-provenance-mSZCOud-.js → connector-provenance-DtTJn1Nk.js} +2 -2
  88. package/dist/owletto/dist/assets/connectors-BVl-AR33.js +2 -0
  89. package/dist/owletto/dist/assets/{consent-1ulwyJ3k.js → consent-XCqsHLxS.js} +2 -2
  90. package/dist/owletto/dist/assets/{core.esm-Ctg_pXLe.js → core.esm-B1du4Zwy.js} +3 -3
  91. package/dist/owletto/dist/assets/create-BYKCtGL4.js +2 -0
  92. package/dist/owletto/dist/assets/create-D6Mmuxcq.js +2 -0
  93. package/dist/owletto/dist/assets/{create-CGuoqPh8.js → create-GHTb6wKX.js} +2 -2
  94. package/dist/owletto/dist/assets/{create-automation-form-CD6jSlWL.js → create-automation-form-CTiy_S9G.js} +3 -3
  95. package/dist/owletto/dist/assets/create._connectorKey-DMH97KkK.js +2 -0
  96. package/dist/owletto/dist/assets/custom-guardrail-edits-DZy66ucV.js +2 -0
  97. package/dist/owletto/dist/assets/definition-comparison-C2mPfIMD.js +2 -0
  98. package/dist/owletto/dist/assets/detail-page-skeleton-DNBL7nyk.js +2 -0
  99. package/dist/owletto/dist/assets/device-CwP1PY8q.js +2 -0
  100. package/dist/owletto/dist/assets/{device-pin-tombstone-Dkj7hrBE.js → device-pin-tombstone-DYTt7kU5.js} +2 -2
  101. package/dist/owletto/dist/assets/device._deviceId-DZ2kqI4Y.js +2 -0
  102. package/dist/owletto/dist/assets/{entity-options-D4t-NAcg.js → entity-options-D9K_5Lcs.js} +2 -2
  103. package/dist/owletto/dist/assets/entity-page-DggKXrcE.js +2 -0
  104. package/dist/owletto/dist/assets/entity-pages-C6M6yKFf.js +2 -0
  105. package/dist/owletto/dist/assets/{entity-schema-graph-Cq96SJ3c.js → entity-schema-graph-B255NKjF.js} +2 -2
  106. package/dist/owletto/dist/assets/entity-type-page-CGBAP2wt.js +2 -0
  107. package/dist/owletto/dist/assets/event-attachments-D8Z8uwv9.js +2 -0
  108. package/dist/owletto/dist/assets/event-detail-CgG3pDLA.js +2 -0
  109. package/dist/owletto/dist/assets/events-feed-ClhEywwV.js +2 -0
  110. package/dist/owletto/dist/assets/{filter-editors-DGVl9U4D.js → filter-editors-D_Sfn0dv.js} +3 -3
  111. package/dist/owletto/dist/assets/{full-page-spinner-CtVlF8GQ.js → full-page-spinner-C1clibUY.js} +2 -2
  112. package/dist/owletto/dist/assets/{index-CK5GDX4B.js → index-04B26s6E.js} +2 -2
  113. package/dist/owletto/dist/assets/index-2HrEO-nl.js +2 -0
  114. package/dist/owletto/dist/assets/index-BU3k9wpw.js +2 -0
  115. package/dist/owletto/dist/assets/{index-DvuJ_S_o.js → index-BXHqp23o.js} +2 -2
  116. package/dist/owletto/dist/assets/index-BdLRUDIR.js +2 -0
  117. package/dist/owletto/dist/assets/index-C2FrGwYN.js +2 -0
  118. package/dist/owletto/dist/assets/index-CB9wGfUm.js +2 -0
  119. package/dist/owletto/dist/assets/index-Caihaftb.js +2 -0
  120. package/dist/owletto/dist/assets/index-CwH59DJV.js +2 -0
  121. package/dist/owletto/dist/assets/index-DB2lVKuV.js +7908 -0
  122. package/dist/owletto/dist/assets/{index-DbjbHlDe.js → index-DTvJRjrM.js} +2 -2
  123. package/dist/owletto/dist/assets/index-SF2ni1Rs.css +1 -0
  124. package/dist/owletto/dist/assets/{index-BifR-LE9.js → index-mSrdbx3C.js} +9 -9
  125. package/dist/owletto/dist/assets/index-uFn-Ilrx.js +2 -0
  126. package/dist/owletto/dist/assets/{json-diff-OjtREegr.js → json-diff-Ce6YAXzY.js} +2 -2
  127. package/dist/owletto/dist/assets/{list-skeleton-CH0qQBYk.js → list-skeleton-DLPBTnbR.js} +2 -2
  128. package/dist/owletto/dist/assets/login-DeWlvogD.js +2 -0
  129. package/dist/owletto/dist/assets/{logout-DfdgOLoM.js → logout-CJY0ceN9.js} +2 -2
  130. package/dist/owletto/dist/assets/{member-scope-gate-Cxg2zGQT.js → member-scope-gate-CBPMprXu.js} +2 -2
  131. package/dist/owletto/dist/assets/memory-browse-page-D5kj1RaR.js +74 -0
  132. package/dist/owletto/dist/assets/{model-selector-D2OpDkwH.js → model-selector-CjkBPpjN.js} +2 -2
  133. package/dist/owletto/dist/assets/new-BKrNkOQD.js +2 -0
  134. package/dist/owletto/dist/assets/new-BetiMuDq.js +2 -0
  135. package/dist/owletto/dist/assets/new-dk_-eXqU.js +2 -0
  136. package/dist/owletto/dist/assets/new-efN--4Wx.js +2 -0
  137. package/dist/owletto/dist/assets/organization-C3rpwx_d.js +2 -0
  138. package/dist/owletto/dist/assets/pdf-document--AN-oCKj.css +1 -0
  139. package/dist/owletto/dist/assets/pdf-document-2W1q0sRA.js +56 -0
  140. package/dist/owletto/dist/assets/pdf.worker.min-CIqJB0yW.mjs +28 -0
  141. package/dist/owletto/dist/assets/peek-pane-content-ChsBWO0P.js +3 -0
  142. package/dist/owletto/dist/assets/{pending-seed-BBACroge.js → pending-seed-CTKYdA4X.js} +2 -2
  143. package/dist/owletto/dist/assets/proposal-review-shell-EyGWEYwQ.js +2 -0
  144. package/dist/owletto/dist/assets/public-shell-ready-_KWdfzEM.js +2 -0
  145. package/dist/owletto/dist/assets/record-session-D27VNxP_.js +2 -0
  146. package/dist/owletto/dist/assets/{renderer-CTKNMcXP.js → renderer-B8yZ5lql.js} +34 -33
  147. package/dist/owletto/dist/assets/{reset-password-DKBEneyR.js → reset-password-BGVJIh2I.js} +2 -2
  148. package/dist/owletto/dist/assets/run-initiator-C0sur8lU.js +2 -0
  149. package/dist/owletto/dist/assets/runs-list-CJOFMgpk.js +2 -0
  150. package/dist/owletto/dist/assets/schema-value-DDNHANGs.js +3 -0
  151. package/dist/owletto/dist/assets/{scoped-feed-bar-DNFL0sYX.js → scoped-feed-bar-BTv9mPcR.js} +2 -2
  152. package/dist/owletto/dist/assets/settings-Ponr5XbS.js +3 -0
  153. package/dist/owletto/dist/assets/{status-variants-SzXYYedJ.js → status-variants-mLqVhg5O.js} +2 -2
  154. package/dist/owletto/dist/assets/subDays-BGA_fkig.js +2 -0
  155. package/dist/owletto/dist/assets/two-factor-pqoxGSgL.js +2 -0
  156. package/dist/owletto/dist/assets/{use-automations-DfBtVzGa.js → use-automations-DcdlmVuX.js} +2 -2
  157. package/dist/owletto/dist/assets/{use-login-redirect-BDiS3eyl.js → use-login-redirect-D7HW5Ed6.js} +2 -2
  158. package/dist/owletto/dist/assets/{use-mention-search-khySpz_V.js → use-mention-search-BniE-K2d.js} +3 -3
  159. package/dist/owletto/dist/assets/view-card-Cg6PeEiV.js +2 -0
  160. package/dist/owletto/dist/assets/view-param-filters-CvrKw0mZ.js +2 -0
  161. package/dist/owletto/dist/index.html +2 -2
  162. package/dist/server-main.bundle.mjs +5766 -2999
  163. package/npm-shrinkwrap.json +195 -172
  164. package/package.json +2 -1
  165. package/vendor/connector-sdk/dist/connector-types.d.ts +20 -0
  166. package/vendor/connector-sdk/dist/define-connector.js +2 -0
  167. package/vendor/connector-sdk/dist/extension-dom-scrape.d.ts +2 -0
  168. package/vendor/connector-sdk/dist/extension-dom-scrape.js +5 -0
  169. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +20 -0
  170. package/vendor/connector-sdk/package.json +1 -1
  171. package/vendor/core/dist/contracts/entity-reference.d.ts +2 -0
  172. package/vendor/core/dist/contracts/entity-reference.js +4 -3
  173. package/vendor/core/dist/contracts/tools/entity-list-sort.d.ts +18 -0
  174. package/vendor/core/dist/contracts/tools/entity-list-sort.js +64 -0
  175. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +1 -1
  176. package/vendor/core/dist/contracts/tools/manage-agents.js +3 -3
  177. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +4 -0
  178. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +4 -0
  179. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +4 -0
  180. package/vendor/core/dist/contracts/tools/manage-entity.js +11 -1
  181. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +29 -3
  182. package/vendor/core/dist/contracts/tools/manage-operations.js +24 -2
  183. package/vendor/core/dist/contracts/tools/manage-views.d.ts +36 -0
  184. package/vendor/core/dist/contracts/tools/manage-views.js +15 -2
  185. package/vendor/core/dist/contracts/tools/view-definition.js +7 -2
  186. package/vendor/core/dist/contracts/tools/view-host.js +5 -0
  187. package/vendor/core/dist/contracts/tools/view-path.d.ts +8 -1
  188. package/vendor/core/dist/contracts/tools/view-path.js +11 -1
  189. package/vendor/core/dist/reserved.d.ts +7 -1
  190. package/vendor/core/dist/reserved.js +17 -0
  191. package/vendor/core/package.json +6 -1
  192. package/vendor/views/dist/api.d.ts +19 -3
  193. package/vendor/views/dist/api.js +53 -5
  194. package/vendor/views/dist/components.d.ts +7 -0
  195. package/vendor/views/dist/components.js +223 -2
  196. package/vendor/views/dist/embed.js +13 -2
  197. package/vendor/views/dist/live-gate.d.ts +34 -0
  198. package/vendor/views/dist/live-gate.js +100 -0
  199. package/vendor/views/dist/native.d.ts +43 -1
  200. package/vendor/views/dist/native.js +1 -0
  201. package/vendor/views/package.json +1 -1
  202. package/dist/owletto/dist/assets/_-BDMUN9XZ.js +0 -2
  203. package/dist/owletto/dist/assets/_-CF5X4ANe.js +0 -3
  204. package/dist/owletto/dist/assets/_agentId-EQU2aUP0.js +0 -2
  205. package/dist/owletto/dist/assets/_automationId-PXZ33jsF.js +0 -2
  206. package/dist/owletto/dist/assets/_connectorKey._connectionId-DcI29kGy.js +0 -2
  207. package/dist/owletto/dist/assets/_connectorKey.index-Cr2NDJWX.js +0 -2
  208. package/dist/owletto/dist/assets/_conversationId-CnmLYlVS.js +0 -2
  209. package/dist/owletto/dist/assets/_eventId-w5sDz5oa.js +0 -2
  210. package/dist/owletto/dist/assets/_owner-CkOZR4n0.js +0 -3
  211. package/dist/owletto/dist/assets/_shape-C_FmSf9G.js +0 -2
  212. package/dist/owletto/dist/assets/_slug-COPpRXLt.js +0 -2
  213. package/dist/owletto/dist/assets/_viewKey-BVdJiilV.js +0 -2
  214. package/dist/owletto/dist/assets/_viewKey-mxxpqjtC.js +0 -2
  215. package/dist/owletto/dist/assets/activity-route-view-msesKUwn.js +0 -2
  216. package/dist/owletto/dist/assets/agent-connect-pages-DVq9nAR7.js +0 -4
  217. package/dist/owletto/dist/assets/agent-thread-Cqf9ITrT.js +0 -6
  218. package/dist/owletto/dist/assets/assist-composer-kG_heHXo.js +0 -2
  219. package/dist/owletto/dist/assets/automation-run-now-C5XTS00o.js +0 -2
  220. package/dist/owletto/dist/assets/client-activity-scopes-Aqdo6Pdr.js +0 -2
  221. package/dist/owletto/dist/assets/connect-BFNp1y_s.js +0 -2
  222. package/dist/owletto/dist/assets/connect-menu-BWrAhMqO.js +0 -2
  223. package/dist/owletto/dist/assets/connect._clientId-CSPfwYIN.js +0 -2
  224. package/dist/owletto/dist/assets/connected._clientId-CuOeHafK.js +0 -2
  225. package/dist/owletto/dist/assets/connection-CVeHmDLs.js +0 -2
  226. package/dist/owletto/dist/assets/connection-feed-detail-BYo7zdVD.js +0 -2
  227. package/dist/owletto/dist/assets/connectors-DBEM9QQz.js +0 -2
  228. package/dist/owletto/dist/assets/copy-button-Xhh7ZnjO.js +0 -2
  229. package/dist/owletto/dist/assets/create-Ccb5R-S4.js +0 -2
  230. package/dist/owletto/dist/assets/create-DmhbacIa.js +0 -2
  231. package/dist/owletto/dist/assets/create._connectorKey-CZsAqj1p.js +0 -2
  232. package/dist/owletto/dist/assets/custom-guardrail-edits-Ce_BwiwD.js +0 -2
  233. package/dist/owletto/dist/assets/definition-comparison-D_qP25jR.js +0 -2
  234. package/dist/owletto/dist/assets/detail-page-skeleton-CPAfZLG0.js +0 -2
  235. package/dist/owletto/dist/assets/device-DDl5XKvt.js +0 -2
  236. package/dist/owletto/dist/assets/device._deviceId-bNhTcops.js +0 -2
  237. package/dist/owletto/dist/assets/dynamic-schema-form-CRyUchXo.js +0 -2
  238. package/dist/owletto/dist/assets/entity-page-BOOL_vy3.js +0 -2
  239. package/dist/owletto/dist/assets/entity-pages-_nuesgnp.js +0 -2
  240. package/dist/owletto/dist/assets/entity-type-page-CkCSbkBx.js +0 -2
  241. package/dist/owletto/dist/assets/event-detail-DUvlqn9b.js +0 -2
  242. package/dist/owletto/dist/assets/events-feed-DcKTkJVe.js +0 -2
  243. package/dist/owletto/dist/assets/index-BUlkNJzX.js +0 -2
  244. package/dist/owletto/dist/assets/index-BoqrvLHQ.js +0 -7906
  245. package/dist/owletto/dist/assets/index-CA9mW_ZM.js +0 -2
  246. package/dist/owletto/dist/assets/index-CH0GzG4i.js +0 -2
  247. package/dist/owletto/dist/assets/index-CtI5Eomq.js +0 -2
  248. package/dist/owletto/dist/assets/index-DmtQ0bds.js +0 -2
  249. package/dist/owletto/dist/assets/index-Du_J8hnx.js +0 -2
  250. package/dist/owletto/dist/assets/index-Pae_f9LM.css +0 -1
  251. package/dist/owletto/dist/assets/index-XETZnN7L.js +0 -2
  252. package/dist/owletto/dist/assets/login-DG0b9uSC.js +0 -2
  253. package/dist/owletto/dist/assets/memory-browse-page-qEDQ9Z18.js +0 -74
  254. package/dist/owletto/dist/assets/missing-view-xT0B-f5z.js +0 -2
  255. package/dist/owletto/dist/assets/needs-you-list-3uMsWcDv.js +0 -2
  256. package/dist/owletto/dist/assets/new-AdGV6a8R.js +0 -2
  257. package/dist/owletto/dist/assets/new-BdtIhBpo.js +0 -2
  258. package/dist/owletto/dist/assets/new-BjGwX6s6.js +0 -2
  259. package/dist/owletto/dist/assets/new-D-iMjV74.js +0 -2
  260. package/dist/owletto/dist/assets/organization-qaIpEiQg.js +0 -2
  261. package/dist/owletto/dist/assets/peek-pane-content-CEsDVScl.js +0 -2
  262. package/dist/owletto/dist/assets/proposal-review-shell-C8ZfIAYn.js +0 -2
  263. package/dist/owletto/dist/assets/public-shell-ready-K2R8iXSI.js +0 -2
  264. package/dist/owletto/dist/assets/record-session-BrM9cdXu.js +0 -2
  265. package/dist/owletto/dist/assets/run-initiator-BKSgI1o0.js +0 -2
  266. package/dist/owletto/dist/assets/runs-k2NpbZm8.js +0 -2
  267. package/dist/owletto/dist/assets/runs-list-DUXRMkWN.js +0 -2
  268. package/dist/owletto/dist/assets/schema-value-wjqGxXhv.js +0 -3
  269. package/dist/owletto/dist/assets/settings-V0m5Om5j.js +0 -2
  270. package/dist/owletto/dist/assets/source-record-panels-BMut9YIA.js +0 -2
  271. package/dist/owletto/dist/assets/subDays-9s9OEl5t.js +0 -2
  272. package/dist/owletto/dist/assets/table-ZuYMOjVR.js +0 -2
  273. package/dist/owletto/dist/assets/view-card-DiHWlypr.js +0 -2
  274. package/dist/owletto/dist/assets/view-param-filters-DGKxSr7r.js +0 -2
  275. package/dist/owletto/dist/assets/views-access-required-HA-PiOwA.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{a$ as ys,j as e,r as N,c as K,Q as Oe,dU as vs,y as De,dT as Nt,L as ee,ad as gs,dY as xs,S as Ct,dZ as bs,dl as js,aU as kt,aW as A,dg as Ns,bx as lt,d_ as Cs,d$ as ks,e0 as Ss,e1 as _s,e2 as Es,df as Rs,e3 as J,cB as As,e4 as St,e5 as Is,aF as Fs,e6 as Ts,t as Ps,dw as Ms,aJ as ge,e7 as $s,e8 as ws,o as _t,cV as Et,e9 as Ls,cH as dt,ea as Os,cZ as Ds,ds as Rt,eb as Bs,ec as Ks,cE as Vs,aX as Gs,dA as Us,a0 as Qs,i as xe,X as Ws,ed as Hs,ee as zs,b$ as qs,ef as Xs,eg as Zs,eh as At,bz as Ys,bA as Js,bB as en,bC as tn,bD as sn,ei as nn,ej as It,ek as ut,H as on,el as an,em as Fe,en as mt,cW as rn,eo as cn,x as ln,cU as dn,ep as un,eq as mn,dW as pn,dX as fn,er as hn,es as yn,c9 as vn,et as gn,eu as xn,ev as bn,bk as pt,ew as ft,ex as Ft,ey as Te,dD as Tt,B as te,ez as jn,eA as Pe,P as Pt,eB as Nn,eC as Cn,n as kn,K as Sn,eD as _n,T as En,l as Rn}from"./index-DB2lVKuV.js";import{E as Mt,a as An,R as In,b as Fn}from"./events-feed-ClhEywwV.js";import{E as Tn,a as Pn}from"./run-initiator-C0sur8lU.js";import{S as O,F as ht,o as Z,d as Mn,r as $n,f as wn,a as Ln}from"./filter-editors-D_Sfn0dv.js";import{u as $t}from"./activity-route-location-Bec6fW-t.js";import{e as On,f as Ae,C as wt,c as Dn}from"./event-kind-options-fHAIXu24.js";import{b as Bn}from"./event-attachments-D8Z8uwv9.js";import{u as Kn}from"./clients-BhPMbxHi.js";import{u as Vn}from"./client-activity-scopes-DqaFEyir.js";import{g as Gn}from"./client-rows-rse9thnk.js";import{L as Un,u as Qn}from"./renderer-B8yZ5lql.js";import{E as Wn}from"./agent-loading-shells-D3y98xuO.js";import{M as Hn}from"./member-scope-gate-CBPMprXu.js";import{a as zn}from"./view-param-filters-CvrKw0mZ.js";const Be=N.createContext(null);function qn({organizationId:t,isWorkspaceLoading:s,children:a}){const{data:o=[],isLoading:n}=ys(t);return e.jsx(Be.Provider,{value:{groups:o,isLoading:!!s||n},children:a})}function Xn(){const t=N.useContext(Be);if(!t)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return t}function Zn(){return N.useContext(Be)}function Lt(t){const{parse:s,serialize:a,filterKeys:o,clearClassifications:n=!0,replace:i=!0,merge:r}=t,y=K(),d=Oe(),u=N.useMemo(()=>{const g=new URLSearchParams;for(const[f,p]of Object.entries(d.search||{}))p!=null&&g.set(f,typeof p=="object"&&!Array.isArray(p)?JSON.stringify(p):String(p));return s(g)},[d.search,s]),l=N.useCallback((g,f)=>{const p=r?r(u,g):{...u,...g},c=a(p),j={};for(const[b,S]of Object.entries(d.search||{}))S!=null&&(j[b]=S);for(const b of o)delete j[b];if(n)for(const b of Object.keys(j))b.startsWith("clf_")&&delete j[b];for(const[b,S]of Object.entries(c))S!==void 0&&(j[b]=S);y({to:d.pathname,search:j,replace:f?.replace??i})},[u,a,o,n,r,y,d,i]),m=N.useCallback(()=>{const g={};for(const[f,p]of Object.entries(d.search||{}))p!=null&&(o.includes(f)||n&&f.startsWith("clf_")||(g[f]=p));y({to:d.pathname,search:g,replace:i})},[y,d.pathname,d.search,o,n,i]);return{filters:u,updateFilters:l,clearFilters:m}}function Yn(t){const{slug:s}=vs();return De({queryKey:["schedules",s,t],queryFn:async()=>((await Nt("manage_schedules",{action:"list",action_type:"wake_agent",include_paused:!0})).schedules??[]).filter(o=>o.action_args?.agent_id===t),enabled:!!s&&!!t,staleTime:3e4})}function Jn(t,s){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:s.connector_key,connectionId:String(s.connection_id)},search:{feedId:s.id}}}function eo(t,s){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:s.connector_key,connectionId:String(s.id)}}}function to(t,s){return{to:"/$owner/agents/connected/$clientId",params:{owner:t,clientId:s}}}function so(t,s){return{to:"/$owner/automations/$automationId",params:{owner:t,automationId:s}}}function no(t,s,a){return{to:"/$owner/events",params:{owner:t},search:{agent:s,schedule:a}}}function pe({id:t,label:s,value:a,sourceLink:o,details:n,onRemove:i}){return{id:t,label:s,op:"is",value:a,onRemove:i,editor:o||n?{kind:"custom",className:"w-80",render:()=>e.jsxs("div",{className:"flex flex-col gap-2 p-3 text-sm",children:[o?e.jsxs(ee,{to:o.to,params:o.params,search:o.search,className:"inline-flex min-w-0 items-center gap-1.5 font-medium text-foreground hover:underline",children:[e.jsx("span",{className:"truncate",children:a}),e.jsx(gs,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}):e.jsx("span",{className:"font-medium",children:a}),n]})}:void 0}}function oo({ownerSlug:t,clientIds:s,linkedUser:a,linkedUserEntitySlug:o}){const n=t&&o?xs(t,[{entity_type:"$member",slug:o}]):null;return e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:s.length===1?"Client ID":"Client IDs"}),s.map(i=>e.jsx("code",{className:"break-all text-foreground",children:i},i))]}),a?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:["Granted by",n?e.jsx(ee,{to:n,className:"font-medium text-foreground hover:underline",children:a}):e.jsx("span",{className:"font-medium text-foreground",children:a})]}):null]})}function ao(t,s=!0){return De({queryKey:["automations-list","activity",t],queryFn:async()=>{const a=await Promise.all(["active","archived"].map(o=>Nt("manage_automations",{action:"list",status:o,include_details:!1},{slug:t})));return[...new Map(a.flatMap(o=>o.automations).map(o=>[Number(o.automation_id),o])).values()].sort((o,n)=>o.name.localeCompare(n.name))},enabled:s&&!!t,staleTime:3e4})}function Y({to:t,params:s,search:a,label:o}){return e.jsx(ee,{to:t,params:s,search:a,onClick:n=>n.stopPropagation(),onPointerDown:n=>n.stopPropagation(),className:"shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100","aria-label":`Manage ${o}`,children:e.jsx(Ct,{className:"h-3.5 w-3.5"})})}const Me=["produced","analyzed"],be=t=>t==="produced"?"Produced by":"Analyzed by";function io({enabled:t,...s}){const a=ro(s,t);if(!t)return{fields:[],chips:[]};const o=co(s);return{fields:[a.field,o.field],chips:[...a.chips,...o.chips]}}function ro({ownerSlug:t,filters:s,onFiltersChange:a},o){const n=ao(t,o),i=n.data??[],r=l=>l==="produced"?s.producedByAutomationId:s.automationId,y=l=>i.find(m=>Number(m.automation_id)===l)?.name??`#${l}`,d=Me.flatMap(l=>{const m=r(l);return m==null?[]:[{id:`automation-${l}`,field:"automation",label:be(l),value:y(m),onRemove:()=>a(l==="produced"?{producedByAutomationId:null}:{automationId:null})}]}),u={kind:"list",className:"w-80",searchPlaceholder:"Search Automations...",emptyText:n.isLoading?"Loading Automations...":"No Automations found",items:l=>e.jsxs(e.Fragment,{children:[Me.map(m=>{const g=r(m),f=i.map(c=>({id:Number(c.automation_id),label:`${c.name}${c.status==="archived"?" (archived)":""}`}));g!=null&&!f.some(c=>c.id===g)&&f.unshift({id:g,label:`Automation #${g} (selected)`});const p=c=>{a(m==="produced"?{producedByAutomationId:c}:{automationId:c}),l()};return e.jsx(kt,{heading:be(m),children:f.map(c=>e.jsxs(A,{"aria-label":c.label,value:`${m} ${c.label} ${c.id}`,onSelect:()=>p(c.id),className:"group",children:[e.jsx(O,{selected:g===c.id}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.label}),e.jsx(Y,{...so(t,String(c.id)),label:c.label})]},c.id))},m)}),n.isError?e.jsx(A,{forceMount:!0,onSelect:()=>void n.refetch(),children:"Could not load Automations. Retry"}):null]})};return{chips:d,field:{key:"automation",label:"Automation",group:"Scope",icon:e.jsx(bs,{className:"h-4 w-4"}),editor:u}}}function co(t){const{filters:s,onFiltersChange:a}=t,o=[];s.runIds?.length&&o.push({id:"run-produced",field:"run",label:"Produced by run",value:s.runIds.map(i=>`#${i}`).join(", "),onRemove:()=>a({runIds:null})}),s.runId!=null&&o.push({id:"run-analyzed",field:"run",label:"Analyzed by run",value:`#${s.runId}`,onRemove:()=>a({runId:null})});const n={kind:"list",className:"w-96",searchPlaceholder:"Search runs or enter a run ID...",emptyText:"No matching runs. Enter an exact run ID or load more.",items:(i,r)=>Me.map(y=>e.jsx(lo,{...t,mode:y,query:r,close:i},y))};return{chips:o,field:{key:"run",label:"Run",group:"Scope",icon:e.jsx(js,{className:"h-4 w-4"}),editor:n}}}function lo({ownerSlug:t,filters:s,onFiltersChange:a,mode:o,query:n,close:i}){const r=o==="produced"?s.producedByAutomationId:s.automationId,y=Ns({workspace:!0},{automationIds:r==null?void 0:[r],runTypes:o==="analyzed"?["automation"]:void 0,connectionIds:o==="produced"?s.connectionIds??void 0:void 0,feedIds:o==="produced"?s.feedIds??void 0:void 0},t),d=o==="produced"?s.runIds??[]:s.runId==null?[]:[s.runId],u=y.data?.pages.flatMap(f=>f.runs)??[],l=[...new Map(u.map(f=>[f.id,{id:f.id,label:`Run #${f.id} · ${f.feed_display_name??f.operation_key??f.run_type} · ${f.status}`}])).values()];for(const f of d)l.some(p=>p.id===f)||l.unshift({id:f,label:`Run #${f} (selected)`});const m=f=>{if(o==="produced"){const p=d.includes(f)?d.filter(c=>c!==f):[...d,f];a({runIds:p.length?p:null})}else a({runId:f}),i()},g=/^\d+$/.test(n.trim())?Number(n.trim()):0;return e.jsxs(kt,{heading:be(o),children:[l.map(f=>e.jsxs(A,{value:`${o} ${f.label}`,onSelect:()=>m(f.id),children:[e.jsx(O,{selected:d.includes(f.id)}),e.jsx("span",{className:"truncate",children:f.label})]},f.id)),Number.isSafeInteger(g)&&g>0&&!l.some(f=>f.id===g)?e.jsxs(A,{value:`${o} ${g}`,onSelect:()=>m(g),children:[be(o)," run #",g]}):null,y.isLoading?e.jsx(A,{disabled:!0,forceMount:!0,children:"Loading runs..."}):null,y.isError?e.jsx(A,{forceMount:!0,onSelect:()=>void(y.isFetchNextPageError?y.fetchNextPage():y.refetch()),children:"Could not load runs. Retry"}):null,!y.isLoading&&!y.isError&&!l.length?e.jsx(A,{disabled:!0,forceMount:!0,children:"No runs found"}):null,y.hasNextPage?e.jsx(A,{forceMount:!0,disabled:y.isFetching,onSelect:()=>void y.fetchNextPage(),children:y.isFetchingNextPage?"Loading more runs...":"Load more runs"}):null]})}const Ke="Scope",Ie="Source",U="h-4 w-4";function se(){return $t().search??{}}function Ot(t){const{pathname:s}=$t(),a=s.startsWith(`/${t}/events/`),o=Ss(s,a?1:0),n=!!(o&&!a&&!_s(o.split("/")[0]));return{pathname:s,embedded:n,recordPath:n?Es(o)?.entityPath:a?o:void 0}}function Dt(t){const s=se(),{recordPath:a,pathname:o,embedded:n}=Ot(t);return i=>{const r=J(t,s,i,a);return n?{to:o,search:r.search}:r}}const yt=t=>new Set((t??"").split(",").map(s=>s.trim()).filter(Boolean));function uo({ownerSlug:t,sourceRead:s=!1,filters:a,onFiltersChange:o}){const n=se(),{recordPath:i,embedded:r}=Ot(t),y=i?i.split("/").at(-2):void 0,d=typeof n.type=="string"&&n.type.trim()?n.type.trim():void 0,u=(y?lt(y):void 0)??(d?lt(d):void 0),l=Cs(n),m=ks(n),g=typeof n.feed_ids=="string"?n.feed_ids:typeof n.feed_ids=="number"?String(n.feed_ids):void 0,f=mo(t,u,!r),p=po(t,u,i,r),c=fo(t,l,!s),j=io({ownerSlug:t,filters:a,onFiltersChange:o,enabled:!s}),b=ho(t,m,g);return[f,p,c,j,b].reduce((S,T)=>({fields:[...S.fields,...T.fields],chips:[...S.chips,...T.chips]}),{fields:[],chips:[]})}function mo(t,s,a){const o=K(),n=se(),{visible:i}=Rs(t);if(!a)return{fields:[],chips:[]};const r=i.find(d=>d.slug===s),y={kind:"list",searchPlaceholder:"Search types...",emptyText:"No entity types",items:d=>e.jsxs(e.Fragment,{children:[i.map(u=>e.jsxs(A,{onSelect:()=>{o(J(t,n,{entity:void 0,create:void 0,type:u.slug})),d()},className:"group gap-2",children:[e.jsx(O,{selected:u.slug===s}),e.jsx(Ds,{icon:u.icon,className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:u.name}),typeof u.entity_count=="number"?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:u.entity_count}):null,e.jsx(Y,{to:"/$owner/entity-types/$slug",params:{owner:t,slug:u.slug},label:u.name})]},u.id)),e.jsxs(A,{onSelect:()=>{o(Bs(t)),d()},className:"text-muted-foreground",children:[e.jsx(Rt,{className:"h-4 w-4 shrink-0"}),"Add entity type"]})]})};return{fields:[{key:"type",label:"Entity type",group:Ke,icon:e.jsx(As,{className:U}),editor:y}],chips:s?[{id:"type",label:"Entity type",op:"is",value:r?.name??s,onRemove:()=>void o(J(t,n,{type:void 0}))}]:[]}}function po(t,s,a,o){const n=K(),i=se(),[r,y]=N.useState(""),[d,u]=N.useState(0),l=St(r,250),m={slug:t},{data:g,isLoading:f,isError:p,refetch:c}=Is(s??"",m,{search:l,offset:d,limit:30,enabled:!o&&!!s}),{data:j}=Fs(a?`/${t}/${a}`:"",m),b=a?j?.entity:void 0,S=b?.name??(a?a.split("/").at(-1):void 0);if(o)return{fields:[],chips:S?[{id:"entity",label:"Entity",op:"is",value:S}]:[]};if(!s)return{fields:[],chips:[]};const T={kind:"list",searchPlaceholder:"Search entities...",emptyText:f?"Loading entities...":"No matching entities",className:"w-80",onQueryChange:F=>{y(F),u(0)},items:F=>e.jsxs(e.Fragment,{children:[p?e.jsx(A,{onSelect:()=>void c(),children:"Could not load entities. Retry"}):g?.entities.map(E=>e.jsxs(A,{value:E.slug,onSelect:()=>{const P=Ks([...E.parent_slug&&E.parent_entity_type?[{entity_type:E.parent_entity_type,slug:E.parent_slug}]:[],{entity_type:E.entity_type,slug:E.slug}]);n(J(t,i,{type:s},P)),F()},children:[e.jsx(O,{selected:b?.slug===E.slug}),E.name]},E.slug)),d>0&&e.jsx(A,{onSelect:()=>u(Math.max(0,d-30)),children:"Previous entities"}),g?.metadata.has_more&&e.jsx(A,{disabled:f,onSelect:()=>u(d+30),children:"More entities"})]})};return{fields:[{key:"entity",label:"Entity",group:Ke,icon:e.jsx(Ts,{className:U}),editor:T}],chips:S?[{id:"entity",label:"Entity",op:"is",value:S,onRemove:()=>void n(J(t,i,{type:s}))}]:[]}}function fo(t,s,a){const o=K(),n=Dt(t),{data:i=[]}=Ps(),r=N.useMemo(()=>[...i].sort((u,l)=>u.name.localeCompare(l.name)),[i]);if(!a)return{fields:[],chips:[]};const y=r.find(u=>u.agentId===s),d={kind:"list",searchPlaceholder:"Search agents...",emptyText:"No agents",items:u=>r.map(l=>e.jsxs(A,{onSelect:()=>{o(n({agent:l.agentId,schedule:void 0})),u()},className:"gap-2",children:[e.jsx(O,{selected:l.agentId===s}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-medium",children:l.name.trim().charAt(0).toUpperCase()||"?"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.name})]},l.agentId))};return{fields:[{key:"agent",label:"Agent",group:Ke,icon:e.jsx(Ms,{className:U}),editor:d}],chips:s?[{id:"agent",label:"Agent",op:"is",value:y?.name??s,onRemove:()=>void o(n({agent:void 0,schedule:void 0}))}]:[]}}function ho(t,s,a){const o=K(),n=Dt(t),{groups:i}=Xn(),r=se(),y=ge({platforms:String(r.platforms??r.platform??"")}).platforms??[],d=N.useMemo(()=>yt(s),[s]),u=N.useMemo(()=>yt(a),[a]),l=y.length===1?y[0]:$s(i,d),m=i.find(R=>R.connector_key===l),g=d.size===1?Number([...d][0]):void 0,f=ws(g),{org:p}=_t(),c=Et(p?.id,{feedIds:[...u].map(Number),enabled:g==null&&u.size>0}),j=g==null?c:f,b=j.data??[],S={platforms:void 0,platform:void 0,connection_ids:void 0,feed_ids:void 0},T={kind:"list",searchPlaceholder:"Search connectors...",emptyText:"No connectors",items:R=>e.jsxs(e.Fragment,{children:[i.map(C=>{const x=C.connector_name??C.connector_key;return e.jsxs(A,{disabled:C.connections.length===0,onSelect:()=>{o(n({...S,platforms:C.connector_key})),R()},className:"group gap-2",children:[e.jsx(O,{selected:C.connector_key===m?.connector_key}),e.jsx(Gs,{plain:!0,name:x,faviconDomain:C.favicon_domain,className:"h-5 w-5 shrink-0 rounded-md text-[10px]"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:x}),C.connection_count>0?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:C.connection_count}):null,e.jsx(Y,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:C.connector_key},label:x})]},C.connector_key)}),e.jsx(A,{asChild:!0,onSelect:R,className:"text-muted-foreground",children:e.jsxs(ee,{to:"/$owner/connectors/create",params:{owner:t},className:"flex items-center gap-2",children:[e.jsx(Rt,{className:"h-4 w-4 shrink-0"}),"Add connector"]})})]})},F=[{key:"connector",label:"Connector",group:Ie,icon:e.jsx(Vs,{className:U}),editor:T}],E=[],P=m?.connector_name??m?.connector_key??(y.join(", ")||(d.size?`Connections ${[...d].join(", ")}`:void 0));if(P&&E.push({id:"connector",label:"Connector",op:"is",value:P,onRemove:()=>void o(n(S))}),m){F.push({key:"connection",label:"Connection",group:Ie,icon:e.jsx(Ls,{className:U}),editor:V(m)});const R=d.size===1?m.connections.find(C=>d.has(String(C.id))):void 0;R&&E.push({id:"connection",label:"Connection",op:"is",value:dt({display_name:R.display_name,connector_name:m.connector_name,connector_key:m.connector_key}),onRemove:()=>void o(n({...S,platforms:m.connector_key}))})}if((g||a)&&F.push({key:"feed",label:"Feed",group:Ie,icon:e.jsx(Os,{className:U}),editor:D()}),u.size>0){const R=u.size===1?b.find(C=>u.has(String(C.id))):void 0;E.push({id:"feed",label:"Feed",op:"is",value:R?fe(R):`#${a}`,onRemove:()=>void o(n({...g!=null?{connection_ids:String(g)}:{},feed_ids:void 0}))})}return{fields:F,chips:E};function V(R){return{kind:"list",searchPlaceholder:"Search connections...",emptyText:"No connections",items:C=>R.connections.map(x=>{const I=dt({display_name:x.display_name,connector_name:R.connector_name,connector_key:R.connector_key});return e.jsxs(A,{onSelect:()=>{o(n({connection_ids:String(x.id),feed_ids:void 0})),C()},className:"group gap-2",children:[e.jsx(O,{selected:d.has(String(x.id))}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:I}),x.feed_count>0?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:x.feed_count}):null,e.jsx(Y,{...eo(t,{id:x.id,connector_key:R.connector_key}),label:I})]},x.id)})}}function D(){return{kind:"list",searchPlaceholder:"Search feeds...",emptyText:j.isLoading?"Loading feeds...":"No feeds",items:R=>b.map(C=>e.jsxs(A,{"aria-label":fe(C),onSelect:()=>{o(n({...g!=null?{connection_ids:String(g)}:{},feed_ids:String(C.id)})),R()},className:"group gap-2",children:[e.jsx(O,{selected:u.has(String(C.id))}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:fe(C)}),e.jsx(Y,{...Jn(t,C),label:fe(C)})]},C.id))}}}function fe(t){return t.display_name?.trim()||t.feed_key}const je=[{value:"date-desc",label:"Newest first"},{value:"date-asc",label:"Oldest first"},{value:"score-desc",label:"Highest score"},{value:"score-asc",label:"Lowest score"}];function yo({value:t,onChange:s}){const a=je.find(o=>o.value===t)?.label??"Newest first";return e.jsxs(Ys,{value:t,onValueChange:s,children:[e.jsxs(Js,{"aria-label":"Sort",className:"h-8 w-auto shrink-0 gap-2 bg-muted px-2.5",children:[e.jsx(At,{"aria-hidden":"true",className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx(en,{children:a})]}),e.jsx(tn,{align:"end",className:"min-w-40",children:je.map(o=>e.jsx(sn,{value:o.value,children:o.label},o.value))})]})}const vt=[{value:"user",label:"Manual review"},{value:"system",label:"Auto-classified"},{value:"llm",label:"LLM-classified"}],gt=[{value:"pending",label:"Pending approval"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],he=0,ye=100,X="Event",G="h-4 w-4";function vo(t,s,a){const o=t.engagementRange??[he,ye],n=t.reviewStatus,i=t.interactionStatus,r=t.semanticTypes??[],y=[{key:"kind",label:"Event kind",group:X,icon:e.jsx(Hs,{className:G}),editor:Z({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:On(a,r).map(l=>({value:l,label:Ae(l)})),selected:r,multiple:!0,onSelect:l=>{const m=r.includes(l)?r.filter(g=>g!==l):[...r,l];s({semanticTypes:m.length>0?m:void 0})}})},{key:"date",label:"Date",group:X,icon:e.jsx(zs,{className:G}),editor:Mn({value:t.dateRange??void 0,onApply:l=>s({dateRange:l})})},{key:"approval",label:"Approval",group:X,icon:e.jsx(qs,{className:G}),editor:Z({searchPlaceholder:"Search statuses...",options:[...gt],selected:i?[i]:[],onSelect:l=>s({interactionStatus:l})})},{key:"review",label:"Reviewed by",group:X,icon:e.jsx(Xs,{className:G}),editor:Z({searchPlaceholder:"Search reviewers...",options:[...vt],selected:n&&n!=="all"?[n]:[],onSelect:l=>s({reviewStatus:l})})},{key:"score",label:"Engagement score",group:X,icon:e.jsx(Zs,{className:G}),editor:$n({value:o,min:he,max:ye,onApply:l=>s({engagementRange:l})})}],d=[],u=t.eventCategory!=null&&r.length===1&&r[0]===wt;return r.length&&!u&&d.push({id:"kind",label:"Kind",value:r.length<=2?r.map(Ae).join(", "):`${r.length} kinds`,title:r.map(Ae).join(", "),onRemove:()=>s({semanticTypes:void 0})}),t.dateRange&&d.push({id:"date",label:"Date",op:"is",value:wn(t.dateRange),onRemove:()=>s({dateRange:null})}),i&&d.push({id:"approval",label:"Approval",op:"is",value:gt.find(l=>l.value===i)?.label??i,onRemove:()=>s({interactionStatus:null})}),n&&n!=="all"&&d.push({id:"review",label:"Reviewed by",op:"is",value:vt.find(l=>l.value===n)?.label??n,onRemove:()=>s({reviewStatus:void 0})}),(o[0]!==he||o[1]!==ye)&&d.push({id:"score",label:"Engagement score",value:Ln(o,he,ye),onRemove:()=>s({engagementRange:void 0})}),{fields:y,chips:d}}function Bt({filters:t,onFiltersChange:s,eventKinds:a=[],searchQuery:o,onSearchChange:n,scope:i,extraFields:r=[],drillChips:y=[],sourceRead:d=!1,filterTrailing:u,filterActions:l,quickFilters:m,toolbar:g=!1,onClearFilters:f}){const p=o.trim().length>0,c=d?{fields:[],chips:[]}:vo(t,s,a),j=`${t.sortBy??"date"}-${t.sortOrder??"desc"}`,b=P=>{const[V,D]=P.split("-");s({sortBy:V,sortOrder:D})},S=g&&!d?{fields:[{key:"sort",label:"Order",group:"Order",icon:e.jsx(At,{className:G}),editor:Z({searchPlaceholder:"Search orders...",options:[...je],selected:[j],onSelect:b})}],chips:j==="date-desc"?[]:[{id:"sort",label:"Order",value:je.find(P=>P.value===j)?.label??j,onRemove:()=>s({sortBy:"date",sortOrder:"desc"})}]}:{fields:[],chips:[]},T=[...m?.fields??[],...c.fields,...i?.fields??[],...r,...S.fields],F=[...m?.chips??[],...i?.chips??[],...y,...c.chips,...S.chips],E=d?null:e.jsxs("div",{className:xe("relative min-w-0",g?"w-64 max-w-full":"flex-1"),children:[e.jsx(Us,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Qs,{type:"search","aria-label":"Search events",placeholder:"Search events...",value:o,onChange:P=>n(P.target.value),className:xe("h-8 pl-9",p&&"pr-9")}),p&&e.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>n(""),className:"absolute right-0.5 top-1/2 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:e.jsx(Ws,{className:"h-3.5 w-3.5"})})]});return g?e.jsx(ht,{label:"Event filters",clearAllMin:2,fields:T,chips:F,actions:l,trailing:e.jsxs(e.Fragment,{children:[u,E]}),onClearAll:f,hasClearableState:p,className:"w-full"}):e.jsxs("div",{className:"w-full space-y-2.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[E,!d&&e.jsx(yo,{value:j,onChange:b})]}),e.jsx(ht,{label:"Event filters",fields:T,chips:F,actions:l,trailing:u,onClearAll:f,hasClearableState:p})]})}function Kt({ownerSlug:t,...s}){const a=uo({ownerSlug:t,sourceRead:s.sourceRead,filters:s.filters,onFiltersChange:s.onFiltersChange});return e.jsx(Bt,{...s,scope:a})}const $e=3600*1e3,xt=24*$e;function bt(t){const s=t instanceof Date?t:new Date(String(t));return Number.isNaN(s.getTime())?null:s}function jt(t){return t.toISOString().split("T")[0]}function we(t){return t.toLocaleDateString(void 0,{timeZone:"UTC",month:"short",day:"numeric"})}function go(t){const a=t[t.length-1].date.getTime()-t[0].date.getTime()>180*xt,o=new Map;for(const n of t){const i=new Date(n.date);a&&i.setUTCDate(i.getUTCDate()-i.getUTCDay()),o.set(i.getTime(),(o.get(i.getTime())??0)+n.count)}return[...o.entries()].sort(([n],[i])=>n-i).map(([n,i])=>{const r=new Date(n);return{start:r,end:new Date(n+(a?7:1)*xt),count:i,label:`${r.getUTCMonth()+1}/${r.getUTCDate()}`,tooltip:a?`Week of ${we(r)}`:we(r)}})}function xo(t){const s=r=>{const y=new Date(r);return y.setMinutes(0,0,0),y.getTime()},a=new Map;for(const r of t)a.set(s(r),(a.get(s(r))??0)+1);const o=Math.min(...a.keys()),n=Math.max(...a.keys()),i=[];for(let r=o;r<=n;r+=$e){const y=new Date(r);i.push({start:y,end:new Date(r+$e),count:a.get(r)??0,label:ut(y,"HH:mm"),tooltip:ut(y,"MMM d, HH:mm")})}return i}function bo({entityId:t,organizationId:s,ownerSlug:a,eventTimes:o,selectedRange:n,onSelectRange:i}){const{data:r,isLoading:y,error:d}=nn(s,{entityId:t},{slug:a}),u=N.useMemo(()=>(r??[]).map(p=>{const c=bt(p.date);return c?{date:c,count:p.count}:null}).filter(p=>p!==null).sort((p,c)=>p.date.getTime()-c.date.getTime()),[r]),l=N.useMemo(()=>{if(u.length===0)return[];if(u.length>1)return go(u);const[p]=u,c=jt(p.date),j=(o??[]).map(bt).filter(b=>b!==null&&jt(b)===c);return j.length===p.count?xo(j):[]},[u,o]),m=N.useCallback(p=>{const c=l[p.dataIndex];c&&i&&i(c.start,c.end)},[l,i]),g=N.useCallback(p=>{if(i&&p.startValue!==void 0&&p.endValue!==void 0){const c=new Date(p.startValue),j=new Date(p.endValue);i(c,j)}},[i]),f=N.useMemo(()=>{if(l.length<2)return null;let p;if(n){const[c,j]=n,b=l.filter(S=>S.start<j&&S.end>c);b.length>0&&(p=[[{xAxis:b[0].label},{xAxis:b[b.length-1].label}]])}return{tooltip:{trigger:"axis",axisPointer:{type:"line"},formatter:c=>{const j=c[0];return`${l[j.dataIndex]?.tooltip}: ${j.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:l.map(c=>c.label)},yAxis:{type:"value",minInterval:1,splitLine:{lineStyle:{color:"rgba(0,0,0,0.05)"}}},dataZoom:[{type:"slider",start:0,end:100,height:20,bottom:10,borderColor:"transparent",backgroundColor:"rgba(0,0,0,0.02)",fillerColor:"rgba(99, 102, 241, 0.1)",handleStyle:{color:"#6366f1"}}],series:[{type:"line",smooth:!0,areaStyle:{opacity:.3,color:new Un(0,0,0,1,[{offset:0,color:"rgba(99, 102, 241, 0.5)"},{offset:1,color:"rgba(99, 102, 241, 0.05)"}])},lineStyle:{width:2,color:"#6366f1"},itemStyle:{color:"#6366f1"},showSymbol:!1,data:l.map(c=>c.count),markLine:{silent:!0,symbol:"none",label:{position:"insideEndTop",formatter:"avg: {c}",fontSize:10,color:"#9ca3af"},lineStyle:{color:"#d1d5db",type:"dashed",width:1},data:[{type:"average",name:"Average"}]},markArea:p?{silent:!0,itemStyle:{color:"rgba(99, 102, 241, 0.1)"},data:p}:void 0}]}},[l,n]);if(y||d)return e.jsx("div",{className:xe(It,"p-4"),children:e.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:y?e.jsx(Wn,{}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load timeline"})})});if(u.length===0)return null;if(!f){const[p]=u;return e.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.count===1?"1 event":`All ${p.count} events`," on"," ",we(p.date),"."]})}return e.jsx(jo,{option:f,onClick:m,onDataZoom:g})}function jo({option:t,onClick:s,onDataZoom:a}){const{chartRef:o,setOption:n}=Qn({onClick:s,onDataZoom:a});return N.useEffect(()=>{n(t,!0)},[t,n]),e.jsx("div",{"data-testid":"events-timeline",className:xe(It,"p-4 relative"),children:e.jsx("div",{ref:o,className:"h-48 w-full"})})}const ve={config:"Configuration",deployment:"Applies"};function No({organizationId:t,ownerSlug:s,entityId:a,hideSourceFilter:o=!1,scopedEntityTypes:n,pinned:i,emptyState:r,toolbar:y=!1}){const{isAuthenticated:d,isReady:u}=on(),{isLoading:l}=_t(),{canManageWorkspace:m,canReadPublicWorkspace:g}=Bn(s),f=K(),p=Oe(),c=an(),{filters:j,updateFilters:b,clearFilters:S}=Lt({parse:ge,serialize:Te,filterKeys:Tt,replace:!1,merge:Ft}),[T,F]=N.useState(j.searchQuery||""),[E,P]=N.useState(Fe(j)||o&&(a!=null||!!n?.length)),V=T.trim(),D=V.length>=3?V:void 0,R=St(D,1e3),C=N.useRef(!1);N.useEffect(()=>c.history.subscribe(({location:h,action:v})=>{const k=ge(new URLSearchParams(h.search)).searchQuery??"";!(v.type==="BACK"||v.type==="FORWARD"||v.type==="GO")&&C.current&&(k===(j.searchQuery??"")||k===(D??""))||(C.current=!1,F(k))}),[c.history,D,j.searchQuery]);const x=N.useMemo(()=>{const{afterOccurredAt:h,afterId:v,...k}=j;return mt({...k,...n?.length?{entityTypes:n}:{}})},[j,n]),I=b;N.useEffect(()=>{C.current&&(j.searchQuery||void 0)!==R&&b({searchQuery:R})},[R,b,j.searchQuery]);const Ve=()=>{C.current=!1,F(""),o&&s?f({...Pe(s,p.search??{}),...a!==void 0&&!p.pathname.startsWith(`/${s}/events/`)?{to:p.pathname}:{}}):S()},ne=Fe(mt(j)),Ne=a===void 0,{data:Qt=[]}=rn(u&&m?t:null),{data:Wt=[]}=cn(g?s:null),Ge=m?Qt:Wt,{data:Ue=[]}=ln(m&&t?{organizationId:t}:void 0),oe=Zn(),ae=x.connectionIds,Ce=(ae?.length??0)>0,{data:Qe=[]}=dn(u&&m?t??"":"",{connectionIds:ae??void 0,enabled:!oe&&u&&m&&Ce}),We=x.feedIds,ke=(We?.length??0)>0,{data:He=[]}=Et(u&&m?t:null,{feedIds:We??void 0,enabled:u&&m&&ke}),ze=N.useMemo(()=>oe?oe.groups.flatMap(h=>h.connections.map(v=>({id:v.id,display_name:v.display_name,connector_name:h.connector_name,connector_key:h.connector_key}))):Qe,[Qe,oe]),Se=N.useMemo(()=>{const h=new Set(ae??[]);return[...new Set([...x.platforms??[],...ze.filter(v=>h.has(v.id)).map(v=>v.connector_key)])]},[ae,ze,x.platforms]),_e=N.useMemo(()=>He.map(h=>({connectorKey:h.connector_key,feedKey:h.feed_key})),[He]),Ht=N.useMemo(()=>Ce&&Se.length===0||ke&&_e.length===0?[]:Dn({connectors:Ge,entityTypes:Ue,selectedPlatforms:Se,selectedFeeds:_e,selectedEntityTypes:x.entityTypes}),[Ge,x.entityTypes,Ce,ke,Se,_e,Ue]),M=x.clientIds,ie=(M?.length??0)>0,{data:qe=[]}=Kn(null,{enabled:u&&m&&ie}),re=N.useMemo(()=>{if(!M)return[];const h=new Set(M);return Gn(qe).filter(v=>v.clientIds.some(k=>h.has(k)))},[M,qe]),Xe=N.useMemo(()=>{if(!ie||!M)return null;const h=re.map(v=>v.title);return h.length>0?h.join(", "):M.length>1?`${M.length} client registrations`:"Client registration"},[re,M,ie]),ce=re.length===1?re[0]:null,zt=s&&ce?to(s,ce.clientId):void 0,le=x.mcpActivityId??null,{data:Ze=[]}=Vn({enabled:u&&m&&ie&&!!le,clientIds:M??[],limit:100}),Ye=N.useMemo(()=>{if(!le)return null;const h=Ze.find(k=>k.activityId===le);if(!h)return"Selected conversation";const v=h.title?.trim();return v||(h.activityKind==="session"?"MCP session":h.clientId)},[le,Ze]),Q=x.agentId,W=x.schedule,{data:Je=[]}=Yn(Q??void 0),et=N.useMemo(()=>!W||!Q?null:Je.find(v=>v.id===W)?.description?.trim()||"Scheduled task",[Q,W,Je]),{data:qt}=un(u&&m?t:null,a),{data:Xt}=mn(g&&!Ne?s:null,a),tt=m?qt:Xt,de=N.useMemo(()=>{const h=new Map;for(const v of tt||[]){const k=v.automation_name??"__global__";let _=h.get(k);_||(_={automationName:v.automation_name??null,classifiers:[]},h.set(k,_));const w=v.attribute_values||{},$=Object.keys(w);let me=null;const H={};for(const[z,B]of Object.entries(w))if(B.parent)for(const[Re,q]of Object.entries(B.parent))me=Re,H[q]||(H[q]=[]),H[q].push(z);const L=_.classifiers.find(z=>z.slug===v.slug);if(L){const z=new Set([...L.values,...$]);L.values=[...z];for(const[B,Re]of Object.entries(H)){L.valuesByParentValue[B]||(L.valuesByParentValue[B]=[]);const q=new Set([...L.valuesByParentValue[B],...Re]);L.valuesByParentValue[B]=[...q]}me&&(L.parentSlug=me)}else _.classifiers.push({slug:v.slug,name:v.name,values:$,parentSlug:me,valuesByParentValue:H})}for(const v of h.values())v.classifiers.sort((k,_)=>k.parentSlug===null&&_.parentSlug!==null?-1:k.parentSlug!==null&&_.parentSlug===null?1:0);return[...h.values()]},[tt]),Zt=pn(u&&m?t:null,a,x,s),Yt=fn(g?s:null,a,x),Jt=g?Yt:Zt,{data:Ee,isLoading:es,error:ts}=Jt,ss=N.useMemo(()=>Ee?.pages.flatMap(h=>h.content.map(v=>v.occurred_at)),[Ee]),st=Ee?.pages[0],ns=(st?.content.length??0)>0,nt=de.some(h=>h.classifiers.length>0),os=hn(u&&m&&nt?t:null,a,x,s),as=yn(g&&nt?s:null,a,x),is=(g?as:os).data?.classification_stats,rs=N.useCallback(()=>{I({beforeOccurredAt:void 0,beforeId:void 0,afterOccurredAt:void 0,afterId:void 0}),window.scrollTo({top:0,behavior:"smooth"})},[I]),cs=(h,v)=>{I({dateRange:[h,v]})},ot=(h,v)=>{const k={...x.classificationFilters||{}};if(v.length>0)k[h]=v;else{delete k[h];for(const _ of de)for(const w of _.classifiers)w.parentSlug===h&&delete k[w.slug]}I({classificationFilters:k})},ls=(h,v)=>{const k=x.classificationFilters?.[h]||[];ot(h,k.includes(v)?k.filter(_=>_!==v):[...k,v])},ds=h=>ot(h,[]);if(ts)return e.jsx(vn,{label:"knowledge"});const at=!u||d&&l||m&&!t||es,ue={fields:[],chips:[]};for(const h of de)for(const v of h.classifiers){const k=x.classificationFilters?.[v.slug]??[],_=v.parentSlug?x.classificationFilters?.[v.parentSlug]??[]:void 0,w=_?[...new Set(_.flatMap($=>v.valuesByParentValue[$]??[]))]:v.values;w.length>0&&ue.fields.push({key:`clf:${v.slug}`,label:v.name,group:h.automationName??"Classifiers",icon:e.jsx(gn,{className:"h-4 w-4"}),editor:Z({searchPlaceholder:`Search ${v.name.toLowerCase()}...`,options:w.map($=>({value:$,label:$,count:is?.[v.slug]?.[$]})),selected:k,multiple:!0,onSelect:$=>ls(v.slug,$)})})}for(const[h,v]of Object.entries(x.classificationFilters??{})){if(v.length===0)continue;const k=de.flatMap(_=>_.classifiers).find(_=>_.slug===h);ue.chips.push({id:`clf:${h}`,field:`clf:${h}`,label:k?.name??h,op:v.length>1?"is any of":"is",value:v.join(", "),onRemove:()=>ds(h)})}const us=[x.contentIds?.length?pe({id:"contentIds",label:x.contentIds.length>1?"Events":"Event",value:`#${x.contentIds.join(", #")}`,onRemove:()=>I({contentIds:void 0})}):null,Ye?pe({id:"mcpActivityId",label:"Conversation",value:Ye,onRemove:()=>I({mcpActivityId:void 0})}):null,Xe?pe({id:"clientIds",label:"Connected app",value:Xe,sourceLink:zt,details:M&&M.length>0?e.jsx(oo,{ownerSlug:s,clientIds:M,linkedUser:ce?.linkedUser,linkedUserEntitySlug:ce?.linkedUserEntitySlug}):void 0,onRemove:()=>I({clientIds:void 0})}):null,et?pe({id:"schedule",label:"Schedule",value:et,sourceLink:s&&Q&&W?no(s,Q,W):void 0,onRemove:()=>I({schedule:void 0,runIds:void 0})}):null,...x.eventCategory?[ve[x.eventCategory]?{id:"event-category",label:ve[x.eventCategory],value:"",onRemove:()=>I({eventCategory:void 0,semanticTypes:void 0})}:{id:"event-category",label:"Category",op:"is",value:x.eventCategory,onRemove:()=>I({eventCategory:void 0})}]:[],...x.resourceKind||x.resourceId?[{id:"resource",label:"Resource",op:"is",value:`${x.resourceKind}: ${x.resourceId}`,onRemove:()=>I({resourceKind:void 0,resourceId:void 0})}]:[],...ue.chips].filter(h=>h!=null),ms=!!(m&&a&&t),ps=ne?null:i?.rows,it={fields:[],chips:[]};if(Ne&&m)for(const[h,v,k]of[["config",ve.config,Ct],["deployment",ve.deployment,xn]]){const _=j.eventCategory===h;it.fields.push({key:`category:${h}`,label:v,icon:e.jsx(k,{className:"h-4 w-4"}),editor:{kind:"toggle",checked:_,onToggle:()=>I({eventCategory:_?void 0:h,semanticTypes:_?void 0:[wt],resourceKind:void 0,resourceId:void 0})}})}const rt={quickFilters:it,toolbar:y,filterTrailing:ms?e.jsxs(te,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground","aria-pressed":E,onClick:()=>P(h=>!h),children:[e.jsx(jn,{className:"mr-1.5 h-3.5 w-3.5"}),"Timeline"]}):void 0,onClearFilters:Ve,filters:x,onFiltersChange:I,eventKinds:Ht,searchQuery:T,onSearchChange:h=>{C.current=!0,F(h)},extraFields:ue.fields,drillChips:us},fs=!at&&!!st&&!ns&&!ne,hs=d?m?"Activity is the workspace's live feed — every message, email, file, and record a connector pulls in lands here as an event. Connect your data to start collecting.":"Activity is the workspace's live feed of connector events. Join this workspace to add connectors and collect knowledge here.":"No public knowledge items are available yet",ct=!!(m&&s);return e.jsx(bn,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:o?"sticky top-0 z-10 -mx-4 bg-background px-4 pb-2 lg:-mx-6 lg:px-6":void 0,children:o&&s?e.jsx(Kt,{...rt,ownerSlug:s}):e.jsx(Bt,{...rt})}),E&&m&&a&&t&&e.jsx(bo,{entityId:a,organizationId:t,ownerSlug:s||"",eventTimes:ss,selectedRange:x.dateRange||void 0,onSelectRange:cs}),i?.needsYou,ps,at?e.jsx(Tn,{}):fs?r??e.jsx(pt,{icon:ft,title:"No activity yet",description:hs,actionLabel:ct?"Add a connector":void 0,onAction:ct&&s?()=>void f({to:"/$owner/connectors/create",params:{owner:s}}):void 0}):e.jsx(Mt,{organizationId:t,ownerSlug:s,entityId:a,filters:x,showEntityLinks:Ne,groupStretches:!0,onGoToLatest:x.beforeOccurredAt?rs:void 0,hiddenPinned:i?.hidden,emptyState:e.jsx(pt,{icon:ft,title:"No results found",description:"Try adjusting your filters to find what you are looking for",actionLabel:ne?"Clear filters":void 0,onAction:ne?Ve:void 0})})]})})}function Vt(t){return{failed:t.filter(s=>s.code!=="withheld"),withheld:[...new Set(t.filter(s=>s.code==="withheld").map(s=>s.error))]}}function Gt({reasons:t}){return t.length===0?null:e.jsx("div",{className:"space-y-1",children:t.map(s=>e.jsx("p",{className:"text-xs text-muted-foreground",children:s},s))})}function Le({failures:t,onRetry:s,isError:a=!1,isFetching:o=!1}){return t.length===0&&!a?null:e.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-3 rounded-md border border-destructive/40 px-3 py-2 text-xs",children:[e.jsxs("span",{children:[t.length<=1?"A source":`${t.length} sources`," could not be read, so some items may be missing."]}),e.jsx(te,{size:"sm",variant:"outline",className:"h-7",onClick:s,disabled:o,children:"Retry"})]})}function Ut({record:t,orgContext:s,filters:a}){const{orgContext:o}=Pt(),n=s??o,{data:i}=De({queryKey:["connector-definitions","source-record",n.organizationId,n.slug],queryFn:()=>En(n),enabled:!!(n.organizationId||n.slug),staleTime:6e4}),{data:r,isLoading:y,isError:d,refetch:u,fetchNextPage:l,hasNextPage:m,isFetching:g,isFetchingNextPage:f}=Nn(t,n,a),p=r?.pages.flatMap(b=>b.events)??[],{failed:c,withheld:j}=Vt(r?.pages.flatMap(b=>b.failures)??[]);return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(Le,{failures:c,isError:d,isFetching:g,onRetry:()=>void u()}),e.jsx(Gt,{reasons:j}),e.jsx(Pn,{isLoading:y,hasNextPage:!!m&&!d,autoLoadMore:c.length===0,isFetching:g,isFetchingNextPage:f,onLoadMore:()=>void l(),emptyState:d||c.length>0||m?null:e.jsx("p",{className:"text-xs text-muted-foreground",children:"No activity for this record in its connected sources."}),items:p.map(b=>({key:`${b.feed_id}:${b.origin_id}`,occurredAt:b.occurred_at,content:e.jsx("div",{className:"p-3",children:e.jsx(An,{ownerSlug:n.slug,connectorDefinitions:i,content:{...b,title:b.title||b.origin_type||b.origin_id,text_content:b.payload_text??""}})})}))})]})}function Go({record:t,ownerSlug:s,orgContext:a}){const{orgContext:o}=Pt(),{data:n,isLoading:i,isError:r,refetch:y,hasNextPage:d,fetchNextPage:u,isFetching:l,isFetchNextPageError:m,error:g}=Cn(t,a??o);if(i)return e.jsx(kn,{className:"h-12 w-full rounded-lg"});if(!n)return e.jsx(Le,{failures:[],isError:!0,isFetching:l,onRetry:()=>void y()});const{failed:f,withheld:p}=Vt(n.failures);return e.jsxs("div",{className:"space-y-2",children:[e.jsx(In,{count:n.relationshipFailures?.length??0,onRetry:()=>void y()}),e.jsx(Le,{failures:f,isError:r,isFetching:l,onRetry:()=>{if(l)return;const c=g instanceof Sn&&g.status===400;m&&!c||!r&&d?u():y()}}),e.jsx(Gt,{reasons:p}),n.links.length===0&&(n.relationships?.length??0)===0&&f.length===0&&(n.relationshipFailures?.length??0)===0&&!d&&!r&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No relationships for this record in its connected sources."}),n.links.length===0&&(n.relationships?.length??0)===0&&d&&!r&&f.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"More source records remain to check for relationships."}),e.jsxs("ul",{className:"space-y-1",children:[(n.relationships??[]).map(c=>e.jsx("li",{className:"rounded-lg border px-3 py-2",children:e.jsx(Fn,{row:c,entityId:t.key,entityType:t.type,ownerSlug:s})},`authored:${c.id}`)),n.links.map(c=>e.jsx("li",{children:e.jsx(ee,{to:_n(s,[{entity_type:c.entity_type,slug:c.key}]),className:"flex items-center justify-between rounded-lg border px-3 py-2 text-sm hover:bg-muted/50",children:e.jsxs("span",{children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.relationship_type.replaceAll("_"," "),c.direction==="incoming"?" (from)":""," ·"," ",c.entity_type," ·"," "]}),c.name]})})},`${c.relationship_type}:${c.direction}:${c.entity_type}:${c.key}`))]}),d&&!r&&f.length===0&&e.jsx(te,{variant:"outline",size:"sm",disabled:l,onClick:()=>void u(),children:l?"Loading…":"Load more"})]})}function Co({record:t,ownerSlug:s}){const a=Oe(),o=K(),{filters:n,updateFilters:i}=Lt({parse:ge,serialize:Te,filterKeys:Tt,replace:!1,merge:Ft}),r=Fe({...n,platforms:void 0,connectionIds:void 0,feedIds:void 0})||n.sortBy!=null&&n.sortBy!=="date"||n.sortOrder!=null&&n.sortOrder!=="desc",y=()=>{o({...Pe(s,a.search??{}),...a.pathname.startsWith(`/${s}/events/`)?{}:{to:a.pathname}})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Kt,{ownerSlug:s,sourceRead:!0,filters:n,onFiltersChange:i,searchQuery:n.searchQuery??"",onSearchChange:d=>i({searchQuery:d}),onClearFilters:y}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Live activity supports connector, connection and feed filters. Search and other event filters are available for saved activity."}),r?e.jsxs("div",{role:"alert",className:"space-y-2 rounded-md border p-3 text-sm",children:[e.jsx("p",{children:"Some selected filters aren't supported for live activity. Clear them to see results."}),e.jsx(te,{variant:"outline",size:"sm",onClick:()=>{const d=Te({platforms:n.platforms,connectionIds:n.connectionIds,feedIds:n.feedIds}),u={...Pe(s,a.search??{}).search,...d};o({to:a.pathname,search:u})},children:"Clear unsupported filters"})]}):e.jsx(Ut,{record:t,orgContext:{slug:s},filters:n})]})}function Uo({entity:t,organizationId:s,ownerSlug:a,pane:o=!1}){const n={type:t.entity_type,key:t.slug},i=typeof t.id=="number"?t.id:void 0,r=t.is_derived?o?e.jsx(Ut,{record:n,orgContext:{slug:a}}):e.jsx(Co,{ownerSlug:a,record:n}):o?e.jsx(Mt,{organizationId:s,ownerSlug:a,entityId:i,filters:{sortBy:"date",sortOrder:"desc"},emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has happened to this record yet."})}):e.jsx(No,{organizationId:s,ownerSlug:a,entityId:i,hideSourceFilter:!0});return e.jsx(qn,{organizationId:s,children:t.entity_type==="$member"?e.jsx(Hn,{children:r}):r})}const ko=320,So={},_o=()=>{};function Qo({view:t,orgSlug:s,scope:a,open:o}){const n=!t.untitled,i=n||!!o;return e.jsxs("section",{className:"min-w-0 rounded-lg border","data-testid":"view-card","data-view":t.key,"aria-label":n?void 0:t.name,children:[i?e.jsxs("header",{className:"flex items-center gap-2 px-3 pt-1.5 pb-1",children:[n?e.jsx("h3",{className:"min-w-0 flex-1 truncate text-xs font-medium text-muted-foreground",children:t.name}):null,o?e.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"ml-auto h-7 w-7 shrink-0 text-muted-foreground hover:text-foreground",onClick:o,"aria-label":`Open ${t.name}`,title:`Open ${t.name}`,children:e.jsx(Rn,{className:"h-3.5 w-3.5"})}):null]}):null,e.jsx("div",{className:i?"px-3 pb-3":"px-3 py-3",children:e.jsx(zn,{orgSlug:s,viewKey:t.key,scope:a,params:So,onParamsChange:_o,paramDecls:t.params,contentHash:t.content_hash,title:t.name,minHeight:64,displayMode:"inline",maxHeight:ko,onRequestDisplayMode:o?r=>{r==="fullscreen"&&o()}:void 0})})]})}export{No as E,qn as M,Uo as R,Ut as S,Qo as V,Go as a};
2
+ //# sourceMappingURL=view-card-Cg6PeEiV.js.map
@@ -0,0 +1,2 @@
1
+ import{eV as p,eW as mn,c as Ht,r as E,j as k,ad as yn,eX as vn,w as gn,y as St,eY as _n,eZ as xn,e_ as bn,e$ as kn,dB as wn,dC as Sn,f0 as En,dT as On,K as Tn,u as Cn,H as Nn,ah as Te,a5 as Ce,f1 as Rn,f2 as In,p as jn,f3 as An,i as $n,f4 as Zn,f5 as Mn,L as Ln,f6 as Vn}from"./index-DB2lVKuV.js";import{D as Pn,E as Dn}from"./app-bridge-B-L0rGz9.js";import{r as zn}from"./renderer-B8yZ5lql.js";import{F as Un,o as Fn,v as Bn}from"./filter-editors-D_Sfn0dv.js";var x;(function(n){n.assertEqual=s=>{};function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},n.getValidEnumValues=s=>{const a=n.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return n.objectValues(i)},n.objectValues=s=>n.objectKeys(s).map(function(a){return s[a]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},n.find=(s,a)=>{for(const i of s)if(a(i))return i},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}n.joinValues=r,n.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Et;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Et||(Et={}));const h=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Y=n=>{switch(typeof n){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(n)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(n)?h.array:n===null?h.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?h.promise:typeof Map<"u"&&n instanceof Map?h.map:typeof Set<"u"&&n instanceof Set?h.set:typeof Date<"u"&&n instanceof Date?h.date:h.object;default:return h.unknown}},d=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class J extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(i))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof J))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}J.create=n=>new J(n);const tt=(n,e)=>{let t;switch(n.code){case d.invalid_type:n.received===h.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,x.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(n.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(n.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:x.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case d.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case d.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(n)}return{message:t}};let qn=tt;function Wn(){return qn}const Hn=n=>{const{data:e,path:t,errorMaps:r,issueData:s}=n,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)o=c(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function u(n,e){const t=Wn(),r=Hn({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===tt?void 0:tt].filter(s=>!!s)});n.common.issues.push(r)}class ${constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const a=await s.key,i=await s.value;r.push({key:a,value:i})}return $.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const y=Object.freeze({status:"aborted"}),Ee=n=>({status:"dirty",value:n}),D=n=>({status:"valid",value:n}),Ot=n=>n.status==="aborted",Tt=n=>n.status==="dirty",pe=n=>n.status==="valid",Ve=n=>typeof Promise<"u"&&n instanceof Promise;var m;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));class W{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ct=(n,e)=>{if(pe(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new J(n.common.issues);return this._error=t,this._error}}};function g(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:s}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:l}=n;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:s}}class _{get description(){return this._def.description}_getType(e){return Y(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $,ctx:{common:e.parent.common,data:e.data,parsedType:Y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ve(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Ct(r,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return pe(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>pe(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(Ve(s)?s:Promise.resolve(s));return Ct(r,a)}refine(e,t){const r=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:d.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof t=="function"?t(r,s):t),!1))}_refinement(e){return new ve({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return G.create(this,this._def)}nullable(){return ge.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this)}promise(){return Fe.create(this,this._def)}or(e){return De.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new ve({...g(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new it({...g(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new yr({typeName:v.ZodBranded,type:this,...g(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ot({...g(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return ct.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Jn=/^c[^\s-]{8,}$/i,Xn=/^[0-9a-z]+$/,Yn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Gn=/^[a-z0-9_-]{21}$/i,Qn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,er=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ye;const rr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ar=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ir=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,or=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dr=new RegExp(`^${Jt}$`);function Xt(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function lr(n){return new RegExp(`^${Xt(n)}$`)}function ur(n){let e=`${Jt}T${Xt(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function fr(n,e){return!!((e==="v4"||!e)&&rr.test(n)||(e==="v6"||!e)&&ar.test(n))}function hr(n,e){if(!Qn.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function pr(n,e){return!!((e==="v4"||!e)&&sr.test(n)||(e==="v6"||!e)&&ir.test(n))}class H extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const a=this._getOrReturnCtx(e);return u(a,{code:d.invalid_type,expected:h.string,received:a.parsedType}),y}const r=new $;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?u(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&u(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")tr.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"email",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Ye||(Ye=new RegExp(nr,"u")),Ye.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"emoji",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Kn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"uuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Gn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Jn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cuid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Xn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Yn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"ulid",code:d.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),u(s,{validation:"url",code:d.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"regex",code:d.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?ur(a).test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?dr.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?lr(a).test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?er.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"duration",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?fr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"ip",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?hr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"jwt",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?pr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cidr",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?or.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?cr.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64url",code:d.invalid_string,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...m.errToObj(r)})}_addCheck(e){return new H({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new H({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new H({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new H({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}H.create=n=>new H({checks:[],typeName:v.ZodString,coerce:n?.coerce??!1,...g(n)});function mr(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=t>r?t:r,a=Number.parseInt(n.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class me extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){const a=this._getOrReturnCtx(e);return u(a,{code:d.invalid_type,expected:h.number,received:a.parsedType}),y}let r;const s=new $;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?mr(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,r,s){return new me({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:m.toString(s)}]})}_addCheck(e){return new me({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}me.create=n=>new me({checks:[],typeName:v.ZodNumber,coerce:n?.coerce||!1,...g(n)});class Ne extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let r;const s=new $;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,r,s){return new Ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:m.toString(s)}]})}_addCheck(e){return new Ne({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ne.create=n=>new Ne({checks:[],typeName:v.ZodBigInt,coerce:n?.coerce??!1,...g(n)});class nt extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.boolean,received:r.parsedType}),y}return D(e.data)}}nt.create=n=>new nt({typeName:v.ZodBoolean,coerce:n?.coerce||!1,...g(n)});class Pe extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const a=this._getOrReturnCtx(e);return u(a,{code:d.invalid_type,expected:h.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return u(a,{code:d.invalid_date}),y}const r=new $;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):x.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Pe.create=n=>new Pe({checks:[],coerce:n?.coerce||!1,typeName:v.ZodDate,...g(n)});class Nt extends _{_parse(e){if(this._getType(e)!==h.symbol){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.symbol,received:r.parsedType}),y}return D(e.data)}}Nt.create=n=>new Nt({typeName:v.ZodSymbol,...g(n)});class Rt extends _{_parse(e){if(this._getType(e)!==h.undefined){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.undefined,received:r.parsedType}),y}return D(e.data)}}Rt.create=n=>new Rt({typeName:v.ZodUndefined,...g(n)});class It extends _{_parse(e){if(this._getType(e)!==h.null){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.null,received:r.parsedType}),y}return D(e.data)}}It.create=n=>new It({typeName:v.ZodNull,...g(n)});class jt extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return D(e.data)}}jt.create=n=>new jt({typeName:v.ZodAny,...g(n)});class rt extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return D(e.data)}}rt.create=n=>new rt({typeName:v.ZodUnknown,...g(n)});class Q extends _{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),y}}Q.create=n=>new Q({typeName:v.ZodNever,...g(n)});class At extends _{_parse(e){if(this._getType(e)!==h.undefined){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.void,received:r.parsedType}),y}return D(e.data)}}At.create=n=>new At({typeName:v.ZodVoid,...g(n)});class B extends _{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==h.array)return u(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(u(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(u(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(u(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new W(t,i,t.path,o)))).then(i=>$.mergeArray(r,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new W(t,i,t.path,o)));return $.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new B({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new B({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new B({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}B.create=(n,e)=>new B({type:n,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...g(e)});function fe(n){if(n instanceof j){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=G.create(fe(r))}return new j({...n._def,shape:()=>e})}else return n instanceof B?new B({...n._def,type:fe(n.element)}):n instanceof G?G.create(fe(n.unwrap())):n instanceof ge?ge.create(fe(n.unwrap())):n instanceof se?se.create(n.items.map(e=>fe(e))):n}class j extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const c=this._getOrReturnCtx(e);return u(c,{code:d.invalid_type,expected:h.object,received:c.parsedType}),y}const{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Q&&this._def.unknownKeys==="strip"))for(const c in s.data)i.includes(c)||o.push(c);const l=[];for(const c of i){const f=a[c],N=s.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new W(s,N,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Q){const c=this._def.unknownKeys;if(c==="passthrough")for(const f of o)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(c==="strict")o.length>0&&(u(s,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const f of o){const N=s.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new W(s,N,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const f of l){const N=await f.key,w=await f.value;c.push({key:N,value:w,alwaysSet:f.alwaysSet})}return c}).then(c=>$.mergeObjectSync(r,c)):$.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new j({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{const s=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:m.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new j({...this._def,unknownKeys:"strip"})}passthrough(){return new j({...this._def,unknownKeys:"passthrough"})}extend(e){return new j({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new j({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new j({...this._def,catchall:e})}pick(e){const t={};for(const r of x.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new j({...this._def,shape:()=>t})}omit(e){const t={};for(const r of x.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new j({...this._def,shape:()=>t})}deepPartial(){return fe(this)}partial(e){const t={};for(const r of x.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}return new j({...this._def,shape:()=>t})}required(e){const t={};for(const r of x.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof G;)a=a._def.innerType;t[r]=a}return new j({...this._def,shape:()=>t})}keyof(){return Yt(x.objectKeys(this.shape))}}j.create=(n,e)=>new j({shape:()=>n,unknownKeys:"strip",catchall:Q.create(),typeName:v.ZodObject,...g(e)});j.strictCreate=(n,e)=>new j({shape:()=>n,unknownKeys:"strict",catchall:Q.create(),typeName:v.ZodObject,...g(e)});j.lazycreate=(n,e)=>new j({shape:n,unknownKeys:"strip",catchall:Q.create(),typeName:v.ZodObject,...g(e)});class De extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new J(o.ctx.common.issues));return u(t,{code:d.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(r.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const l of r){const c={...t,common:{...t.common,issues:[]},parent:null},f=l._parseSync({data:t.data,path:t.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(l=>new J(l));return u(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}De.create=(n,e)=>new De({options:n,typeName:v.ZodUnion,...g(e)});function st(n,e){const t=Y(n),r=Y(e);if(n===e)return{valid:!0,data:n};if(t===h.object&&r===h.object){const s=x.objectKeys(e),a=x.objectKeys(n).filter(o=>s.indexOf(o)!==-1),i={...n,...e};for(const o of a){const l=st(n[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===h.array&&r===h.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<n.length;a++){const i=n[a],o=e[a],l=st(i,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===h.date&&r===h.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class ze extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(Ot(a)||Ot(i))return y;const o=st(a.value,i.value);return o.valid?((Tt(a)||Tt(i))&&t.dirty(),{status:t.value,value:o.data}):(u(r,{code:d.invalid_intersection_types}),y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ze.create=(n,e,t)=>new ze({left:n,right:e,typeName:v.ZodIntersection,...g(t)});class se extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.array)return u(r,{code:d.invalid_type,expected:h.array,received:r.parsedType}),y;if(r.data.length<this._def.items.length)return u(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&r.data.length>this._def.items.length&&(u(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new W(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>$.mergeArray(t,i)):$.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new se({...this._def,rest:e})}}se.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new se({items:n,typeName:v.ZodTuple,rest:null,...g(e)})};class Ue extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.object)return u(r,{code:d.invalid_type,expected:h.object,received:r.parsedType}),y;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new W(r,o,r.path,o)),value:i._parse(new W(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?$.mergeObjectAsync(t,s):$.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof _?new Ue({keyType:e,valueType:t,typeName:v.ZodRecord,...g(r)}):new Ue({keyType:H.create(),valueType:e,typeName:v.ZodRecord,...g(t)})}}class $t extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.map)return u(r,{code:d.invalid_type,expected:h.map,received:r.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,l],c)=>({key:s._parse(new W(r,o,r.path,[c,"key"])),value:a._parse(new W(r,l,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return y;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(c.value,f.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return y;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(c.value,f.value)}return{status:t.value,value:o}}}}$t.create=(n,e,t)=>new $t({valueType:e,keyType:n,typeName:v.ZodMap,...g(t)});class Re extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.set)return u(r,{code:d.invalid_type,expected:h.set,received:r.parsedType}),y;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(u(r,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(u(r,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(l){const c=new Set;for(const f of l){if(f.status==="aborted")return y;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}const o=[...r.data.values()].map((l,c)=>a._parse(new W(r,l,r.path,c)));return r.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new Re({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new Re({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Re.create=(n,e)=>new Re({valueType:n,minSize:null,maxSize:null,typeName:v.ZodSet,...g(e)});class Zt extends _{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Zt.create=(n,e)=>new Zt({getter:n,typeName:v.ZodLazy,...g(e)});class at extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}at.create=(n,e)=>new at({value:n,typeName:v.ZodLiteral,...g(e)});function Yt(n,e){return new ye({values:n,typeName:v.ZodEnum,...g(e)})}class ye extends _{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return u(t,{expected:x.joinValues(r),received:t.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return u(t,{received:t.data,code:d.invalid_enum_value,options:r}),y}return D(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ye.create(e,{...this._def,...t})}exclude(e,t=this._def){return ye.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}ye.create=Yt;class Mt extends _{_parse(e){const t=x.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==h.string&&r.parsedType!==h.number){const s=x.objectValues(t);return u(r,{expected:x.joinValues(s),received:r.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=x.objectValues(t);return u(r,{received:r.data,code:d.invalid_enum_value,options:s}),y}return D(e.data)}get enum(){return this._def.values}}Mt.create=(n,e)=>new Mt({values:n,typeName:v.ZodNativeEnum,...g(e)});class Fe extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return u(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),y;const r=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return D(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Fe.create=(n,e)=>new Fe({type:n,typeName:v.ZodPromise,...g(e)});class ve extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{u(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?y:l.status==="dirty"||t.value==="dirty"?Ee(l.value):l});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?Ee(o.value):o}}if(s.type==="refinement"){const i=o=>{const l=s.refinement(o,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!pe(i))return y;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>pe(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);x.assertNever(s)}}ve.create=(n,e,t)=>new ve({schema:n,typeName:v.ZodEffects,effect:e,...g(t)});ve.createWithPreprocess=(n,e,t)=>new ve({schema:e,effect:{type:"preprocess",transform:n},typeName:v.ZodEffects,...g(t)});class G extends _{_parse(e){return this._getType(e)===h.undefined?D(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(n,e)=>new G({innerType:n,typeName:v.ZodOptional,...g(e)});class ge extends _{_parse(e){return this._getType(e)===h.null?D(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ge.create=(n,e)=>new ge({innerType:n,typeName:v.ZodNullable,...g(e)});class it extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===h.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}it.create=(n,e)=>new it({innerType:n,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class ot extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ve(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new J(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new J(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ot.create=(n,e)=>new ot({innerType:n,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class Lt extends _{_parse(e){if(this._getType(e)!==h.nan){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.nan,received:r.parsedType}),y}return{status:"valid",value:e.data}}}Lt.create=n=>new Lt({typeName:v.ZodNaN,...g(n)});class yr extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class dt extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),Ee(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,t){return new dt({in:e,out:t,typeName:v.ZodPipeline})}}class ct extends _{_parse(e){const t=this._def.innerType._parse(e),r=s=>(pe(s)&&(s.value=Object.freeze(s.value)),s);return Ve(t)?t.then(s=>r(s)):r(t)}unwrap(){return this._def.innerType}}ct.create=(n,e)=>new ct({innerType:n,typeName:v.ZodReadonly,...g(e)});var v;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(v||(v={}));const K=H.create,Ie=me.create,vr=nt.create,Kt=rt.create;Q.create;const gr=B.create,q=j.create,Be=De.create;ze.create;se.create;const _r=Ue.create,lt=at.create,Gt=ye.create;Fe.create;G.create;ge.create;const Ke=y,xr=p.String({pattern:"^[a-z0-9][a-z0-9-]{0,63}$",minLength:1,maxLength:64,description:"View key, e.g. 'pipeline'."}),br=p.Object({collection:p.Optional(mn),type:p.Optional(p.String({minLength:1,description:"Entity-type slug the view opens for."})),entity:p.Optional(p.Integer({description:"Entity id the view opens for."})),event:p.Optional(p.Integer({description:"Event id the view opens for. It names the event's supersede lineage, so the view shows the current version, and it opens at /events/<id>/-/views/<key>."}))},{description:"Required unless the view is attached to the workspace. Pass scope.type, scope.entity, or scope.event to select its subject."});function kr(n){return n.collection!==void 0&&(!n.type||n.entity!==void 0||n.event!==void 0)?"Collection selection requires scope.type without entity or event":n.event!==void 0&&(n.type!==void 0||n.entity!==void 0)?"scope.event names the view's subject on its own; drop scope.type and scope.entity":null}const wr=100,Qt=p.String({pattern:"^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$",description:"Stable id, unique across the whole document (sections and items). It names the menu entry, not its destination: two entries may open the same page."}),en=p.String({minLength:1,maxLength:80}),Sr=p.String({pattern:"^[a-z0-9-]{1,40}$",description:"A Lucide icon name in kebab-case (https://lucide.dev/icons), e.g. 'building-2'; former Lucide names resolve too. Unknown names render the default icon."}),Er=p.Union([p.String({maxLength:500}),p.Number(),p.Boolean()]),Or=p.Union([p.Object({kind:p.Literal("view"),key:xr,scope:p.Optional(p.Object(br.properties,{additionalProperties:!1})),params:p.Optional(p.Record(p.String({maxLength:64}),Er,{maxProperties:20,description:"Declared view params; validated against the view when resolved."}))},{additionalProperties:!1}),p.Object({kind:p.Literal("collection"),entityType:p.String({minLength:1,maxLength:120})},{additionalProperties:!1}),p.Object({kind:p.Literal("record"),entityId:p.Integer({minimum:1})},{additionalProperties:!1}),p.Object({kind:p.Literal("link"),href:p.String({minLength:1,maxLength:2048,description:"Workspace-root-relative path (e.g. 'deal?stage=won', resolved under /<workspace>/) or an absolute https:// URL."})},{additionalProperties:!1})],{description:"{ kind: 'view', key, scope?, params? } | { kind: 'collection', entityType } | { kind: 'record', entityId } | { kind: 'link', href }"}),Tr=p.Object({id:Qt,label:p.Optional(en),icon:p.Optional(Sr),target:p.Optional(Or),children:p.Optional(p.Array(p.Unknown(),{description:"Nested items, each the same shape as this one."}))},{additionalProperties:!1}),Cr=p.Object({id:Qt,label:p.Optional(en),items:p.Array(Tr)},{additionalProperties:!1});p.Object({schemaVersion:p.Literal(1),sections:p.Array(Cr,{maxItems:wr})},{additionalProperties:!1,description:"{ schemaVersion: 1, sections: [{ id, label?, items: [{ id, label?, icon?, target?, children? }] }] }. An item without a target is a labeled group; with both, the label opens the target and a separate control expands the children."});const Nr=p.Object({id:p.String(),label:p.String(),icon:p.Optional(p.String()),href:p.Optional(p.String()),external:p.Optional(p.Boolean()),children:p.Array(p.Unknown(),{description:"Nested items, each the same shape as this one."})});p.Object({id:p.String(),label:p.Optional(p.String()),items:p.Array(Nr)});function Rr(n,e,t){let r;try{r=new URL(n,`${e}/${encodeURIComponent(t)}/`)}catch{return null}if(r.username||r.password)return null;if(r.origin===e){const s=`/${encodeURIComponent(t)}`;return r.pathname!==s&&!r.pathname.startsWith(`${s}/`)?null:{kind:"internal",path:r.pathname+r.search+r.hash}}return r.protocol!=="https:"?null:{kind:"external",href:r.href}}const Ir="lobu/open-record";function jr(n,e){return n==="read_knowledge"?!0:n==="manage_entity"?e?.action==="list"||e?.action==="get"||e?.action==="list_links":n==="manage_feeds"?e?.action==="list_feeds"||e?.action==="read_feed"||e?.action==="read_feeds":n==="manage_automations"?e?.action==="list":n==="manage_agents"?e?.action==="get":n==="manage_connections"?e?.action==="list":n==="manage_catalog"?e?.action==="list_installed":n==="manage_entity_schema"&&e?.schema_type==="entity_type"&&(e.action==="list"||e.action==="get")}const Ar="lobu/embeds/sync",$r="lobu/embeds/focus",Zr="lobu/notifications/embed-size",Mr="lobu/notifications/embed-focus",Lr="lobu/notifications/focus-enter",Vr=8,Pr=2,Dr=20,Vt=q({method:lt(Ar),params:q({embeds:gr(Kt()).max(64)})}),Pt=q({method:lt($r),params:q({id:K().min(1).max(64),direction:Gt(["forward","backward"]).optional()})}),Ge="lobu:embed-focus-enter",Oe=Ie().finite(),Dt=q({x:Oe,y:Oe,width:Oe.nonnegative(),height:Oe.nonnegative()}),zr=q({id:K().regex(/^[A-Za-z0-9_-]{1,64}$/),view:K().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),scope:q({type:K().min(1).max(128).optional(),entity:Be([Ie().int().positive(),K().min(1).max(1024)]).optional(),event:Ie().int().positive().optional(),collection:Kt().optional()}).strict().transform((n,e)=>{const t=kr(n);if(t)return e.addIssue({code:d.custom,message:t}),Ke;if(typeof n.entity=="string"&&!n.type)return e.addIssue({code:d.custom,message:"type"}),Ke;if(n.collection===void 0)return n;try{return{...n,collection:vn(n.collection)}}catch(r){return e.addIssue({code:d.custom,message:String(r)}),Ke}}),params:_r(Be([K().max(2e3),Oe,vr()])).refine(n=>Object.keys(n).length<=Dr),rect:Dt.extend({clip:Dt.optional()})});function Ur(n){const{clip:e}=n;if(!e)return{};if(e.width<=0||e.height<=0)return{visibility:"hidden",pointerEvents:"none"};const t=Math.max(0,e.y-n.y),r=Math.max(0,e.x-n.x),s=Math.max(0,n.y+n.height-(e.y+e.height)),a=Math.max(0,n.x+n.width-(e.x+e.width));return t||r||s||a?{clipPath:`inset(${t}px ${a}px ${s}px ${r}px)`}:{}}function Fr(n,e){const t=[],r=[],s=new Set;for(const a of n){const i=zr.safeParse(a),o=i.success?i.data.id:typeof a?.id=="string"?a.id.slice(0,64):null;if(o===null)continue;if(!i.success||s.has(o)){r.push({id:o,status:"refused",reason:"invalid"});continue}s.add(o);const l=i.data;e.includes(l.view)?r.push({id:o,status:"refused",reason:"cycle"}):e.length>Pr?r.push({id:o,status:"refused",reason:"depth"}):t.length>=Vr?r.push({id:o,status:"refused",reason:"limit"}):(t.push(l),r.push({id:o,status:"mounted"}))}return{instances:t,statuses:r}}function tn(n){return JSON.stringify([n.id,n.view,n.scope])}const Br=n=>n instanceof Tn&&[400,401,403,404].includes(n.status);function qr(n,e,t){const r=gn({slug:n}),s=r.data?.find(c=>c.key===t.view),{scope:a}=t,i=St({queryKey:["embed-record",e,n,a.type??null,a.entity??null],enabled:!!s&&a.entity!==void 0,staleTime:6e4,retry:!1,queryFn:async()=>{try{const f=(await On("manage_entity",{action:"get",entity_id:a.entity,...typeof a.entity=="string"?{entity_type:a.type}:{}},{slug:n})).entity;return typeof f?.entity_type!="string"||typeof f.view_url!="string"||typeof f.id!="number"&&typeof f.id!="string"?null:{type:f.entity_type,id:f.id,path:new URL(f.view_url,window.location.origin).pathname}}catch(c){if(Br(c))return null;throw c}}}),o=St({..._n(n,s??{key:t.view,content_hash:null},a.event??0),enabled:!!s&&a.event!==void 0,retry:!1});if(!r.data)return r.isError?{kind:"failed",retry:()=>void r.refetch()}:{kind:"pending"};if(!s)return{kind:"missing"};const l=xn(s.key);if(a.event!==void 0)return o.isError?{kind:"failed",retry:()=>void o.refetch()}:o.data===void 0?{kind:"pending"}:o.data===null?{kind:"unattached"}:{kind:"ready",view:s,scope:{event:o.data},path:`/${n}/events/${o.data}${l}`};if(a.entity!==void 0){if(i.isError)return{kind:"failed",retry:()=>void i.refetch()};if(i.data===void 0)return{kind:"pending"};const c=i.data;return c===null?{kind:"unavailable"}:a.type!==void 0&&c.type!==a.type?{kind:"unattached"}:bn([s],{type:c.type,id:c.id}).length===0?{kind:"unattached"}:{kind:"ready",view:s,scope:{type:c.type,entity:a.entity},path:`${c.path}${l}`}}return a.type!==void 0?kn([s],a.type,a.collection).length===0?{kind:"unattached"}:{kind:"ready",view:s,scope:{type:a.type,...a.collection===void 0?{}:{collection:a.collection}},path:`/${n}/${encodeURIComponent(a.type)}${l}`}:wn([s]).length===0?{kind:"unattached"}:{kind:"ready",view:s,scope:{},path:Sn(n,s.key)}}function Wr(n,e){const t=new URLSearchParams;n.scope.collection!==void 0&&t.set(En,JSON.stringify(n.scope.collection));for(const[s,a]of Object.entries(e))n.view.params?.[s]?.default!==a&&t.set(s,String(a));const r=t.toString();return`${n.path}${r?`?${r}`:""}`}const Hr={pending:"Loading…",failed:"This view could not be loaded.",missing:"This view is no longer available.",unattached:"This view cannot be shown for what this slot names.",unavailable:"What this view shows is not available to you."},zt=28,Jr=64,he=new Map;function Xr(n,e){if(he.delete(n),he.set(n,e),he.size>Jr){const t=he.keys().next().value;t!==void 0&&he.delete(t)}}const Yr=({org:n,principal:e,home:t,ancestry:r,instance:s,onHeight:a,onFocusExit:i,renderFrame:o})=>{const l=Ht(),c=qr(n,e,s),f=JSON.stringify(s.params),N=JSON.stringify([t,tn(s)]),[w,A]=E.useState(()=>{const O=he.get(N);return O?.seed===f?O:{seed:f,params:s.params}}),Z=O=>{Xr(N,O),A(O)},je=w.seed===f?w.params:s.params;w.seed!==f&&Z({seed:f,params:s.params});const ee=c.kind==="ready"?Wr(c,je):null,[qe,_e]=E.useState(!1),ae=qe?0:-1,X=O=>{ee&&(O&&(O.defaultPrevented||O.button!==0||O.metaKey||O.ctrlKey||O.shiftKey||O.altKey)||(O?.preventDefault(),l({href:ee})))},ie=(c.kind==="ready"?c.view.name:null)??s.view;return k.jsxs("section",{"aria-label":ie,"aria-busy":c.kind==="pending"||void 0,"data-embed-id":s.id,"data-embed-state":c.kind,className:"pointer-events-auto absolute flex flex-col overflow-hidden rounded-md border border-border bg-background",style:{left:s.rect.x,top:s.rect.y,width:s.rect.width,height:s.rect.height,...Ur(s.rect)},onFocus:()=>_e(!0),onBlur:O=>{O.currentTarget.contains(O.relatedTarget)||_e(!1)},children:[k.jsx("span",{tabIndex:ae,"data-embed-trap":"start",onFocus:()=>i(s.id,"backward")}),k.jsx("div",{className:"min-h-0 flex-1",children:c.kind==="ready"?o({viewKey:s.view,scope:c.scope,params:je,onParamsChange:O=>Z({seed:f,params:O}),view:c.view,ancestry:r,onHeightChange:O=>a(s.id,O+zt),onRequestDisplayMode:O=>{O==="fullscreen"&&X()}}):k.jsxs("div",{role:c.kind==="pending"?void 0:"note",className:"flex h-full min-h-16 flex-col items-center justify-center gap-2 p-3 text-center text-xs text-muted-foreground",children:[k.jsx("span",{children:Hr[c.kind]}),c.kind==="failed"?k.jsx("button",{type:"button",onClick:c.retry,className:"rounded border border-border px-2 py-0.5 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:"Retry"}):null]})}),k.jsxs("div",{className:"order-first flex shrink-0 items-center justify-between gap-2 border-b border-border px-2 text-xs text-muted-foreground",style:{height:zt},children:[k.jsx("span",{className:"truncate",children:ie}),ee?k.jsxs("a",{href:ee,tabIndex:ae,onClick:X,className:"inline-flex items-center gap-1 rounded px-1 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:["Open",k.jsx(yn,{"aria-hidden":!0,className:"h-3 w-3"})]}):null]}),k.jsx("span",{tabIndex:ae,"data-embed-trap":"end",onFocus:()=>i(s.id,"forward")})]})},Kr=64,Gr=2e6,Qr=10*6e4,ne=new Map;let Ut=null;function es(n,e,t,r){const{title:s,...a}=r&&typeof r=="object"?r:{};return[n,e,t,JSON.stringify(a)].join("\0")}function Ft(n){return JSON.stringify(n.result)}function Bt(n,e,t){if(ne.delete(n),!(!e.ok||t===void 0||t.length>Gr))for(ne.set(n,{text:t,result:e.result,at:Date.now()});ne.size>Kr;){const r=ne.keys().next().value;if(r===void 0)break;ne.delete(r)}}function ts(n){return{ok:!1,result:{content:[{type:"text",text:String(n)}],isError:!0}}}function ns(n,e){Ut!==n&&(ne.clear(),Ut=n);let t=0;const r=new Set,s=new Map;return{invalidate(){t+=1,s.clear()},async read(a,i){const o=s.get(a);if(o)return s.delete(a),o;const l=!r.has(a);r.add(a);const c=ne.get(a);if(l&&c&&Date.now()-c.at<=Qr){const N=t,w=A=>{if(t!==N)return;const Z=Ft(A);Bt(a,A,Z),!(A.ok&&Z===c.text)&&(s.set(a,A),e())};return i().then(w,A=>w(ts(A))),{ok:!0,result:c.result}}const f=await i();return Bt(a,f,Ft(f)),f}}}const qt=q({method:lt(Ir),params:q({record:q({entity_id:Be([Ie().int().positive().max(Number.MAX_SAFE_INTEGER),K().min(1).max(1024)]),entity_type:Be([K().min(1),Ie().int().positive()]).optional()}),mode:Gt(["peek","page"])})}),rs=new Set(["query_sql","query_sdk"]),ss=200;function as(n,e){const t=n?.title;return typeof t=="string"&&t.trim()?n??{}:{...n,title:e.slice(0,ss)}}const Qe=new Map;function is(n,e){const t=`${e}\0${n}`,r=Qe.get(t);if(r)return r;const s=Te(`${Ce}/api/${n}/tools`,{method:"GET",credentials:"include",timeoutMs:15e3}).then(async a=>{if(!a.ok)throw new Error(`tool list failed: ${a.status}`);const i=await a.json();return new Set((i.tools??[]).flatMap(o=>typeof o.name=="string"&&o.annotations?.readOnlyHint===!0?[o.name]:[]))});return Qe.set(t,s),s.catch(()=>Qe.delete(t)),s}const os=[["--color-background-primary","--background"],["--color-background-secondary","--card"],["--color-background-tertiary","--muted"],["--color-background-inverse","--foreground"],["--color-text-primary","--foreground"],["--color-text-secondary","--muted-foreground"],["--color-text-inverse","--background"],["--color-text-info","--primary"],["--color-text-danger","--destructive"],["--color-border-primary","--border"],["--color-border-secondary","--input"],["--color-border-danger","--destructive"],["--color-ring-primary","--ring"],["--font-mono","--font-mono"],["--border-radius-sm","--radius-sm"],["--border-radius-md","--radius-md"],["--border-radius-lg","--radius-lg"],["--border-radius-xl","--radius-xl"]];function et(n){const e=document.documentElement,t=getComputedStyle(e),r={};for(const[a,i]of os){const o=t.getPropertyValue(i).trim();o&&(r[a]=o)}const s=document.body?getComputedStyle(document.body).fontFamily:"";return s&&(r["--font-sans"]=s),{theme:e.classList.contains("dark")?"dark":"light",displayMode:n.displayMode,availableDisplayModes:n.expandable?["inline","fullscreen"]:[n.displayMode],containerDimensions:{...n.width?{width:n.width}:{},...n.maxHeight?{maxHeight:n.maxHeight}:{}},platform:"web",styles:{variables:r}}}async function cs(n,e,t,r,s,a,i,o){if(i!=="invoke_view_action"){const Z=rs.has(i);return!Z&&!jr(i,o)&&!(await is(n,e)).has(i)?{error:`Views can only call read tools and their declared actions; "${i}" is neither`}:{url:`${Ce}/api/${n}/${encodeURIComponent(i)}`,body:Z?as(o,s):o??{}}}const{view:l,action:c,value:f,interaction_id:N,scope:w,expected:A}=o??{};return w!==void 0&&(typeof w!="object"||w===null||w.event!==a.event)?{error:"The event context changed. Reopen the event before submitting."}:l!==t?{error:`This frame hosts "${t}", not "${String(l)}"`}:typeof c!="string"||!c?{error:"action is required"}:{url:`${Ce}/api/${n}/views/${encodeURIComponent(t)}/actions/${encodeURIComponent(c)}`,body:{value:f??null,interaction_id:N,...A===void 0?{}:{expected:A},...r===null?{}:{expected_content_hash:r},...a.event===void 0?{}:{scope:{event:a.event}}}}}const Wt=24,F=new Map,re=new Map;function ds(n,e){const t=`${n}\0${e}`,r=F.get(t);return r!==void 0&&(F.delete(t),F.set(t,r)),r}function ls(n,e,t){re.delete(n),re.set(n,{hash:e,html:t});for(const s of re.keys()){if(re.size<=Wt)break;re.delete(s)}if(e===null)return;const r=`${n}\0${e}`;F.delete(r),F.set(r,t);for(const s of F.keys()){if(F.size<=Wt)break;F.delete(s)}}const Le=new Map;function us(n,e,t,r){const s=Le.get(n);if(s)return s;const a=Te(e,{credentials:"include"}).then(async i=>r&&(i.status===401||i.status===403)?Te(t,{credentials:"include"}):i).then(async i=>{if(!i.ok)throw new nn(i.status);return{html:await i.text(),hash:i.headers.get("X-Lobu-View-Hash")}});return Le.set(n,a),a.then(()=>Le.delete(n),()=>Le.delete(n)),a}class nn extends Error{constructor(e){super(`shell ${e}`),this.status=e}}function fs(n){re.delete(n);for(const e of F.keys())e.startsWith(`${n}\0`)&&F.delete(e)}const hs=({orgSlug:n,viewKey:e,scope:t,params:r,onParamsChange:s,paramDecls:a,contentHash:i,title:o,minHeight:l=96,fixedHeight:c,displayMode:f="fullscreen",maxHeight:N,onRequestDisplayMode:w,className:A,onLoadError:Z,embedAncestry:je,onHeightChange:ee,frameTabIndex:qe})=>{const _e=Ht(),ae=Cn(),X=E.useRef(ae);X.current=ae;const ie=E.useRef(_e);ie.current=_e;const{session:O,isReady:rn}=Nn(),We=rn&&!O,xe=O?.user.id??"anonymous",Ae=E.useRef(null),$e=E.useRef(null),[oe,He]=E.useState(null),[Ze,Je]=E.useState(null),[Xe,sn]=E.useState(l),ce=E.useRef(null),de=E.useRef(null),ut=E.useRef(l);ut.current=l;const ft=E.useRef(c);ft.current=c;const V=E.useRef({scope:t,params:r,paramDecls:a,onParamsChange:s,onLoadError:Z,onRequestDisplayMode:w,onHeightChange:ee,title:o});V.current={scope:t,params:r,paramDecls:a,onParamsChange:s,onLoadError:Z,onRequestDisplayMode:w,onHeightChange:ee,title:o};const[ht,pt]=E.useState([]),be=E.useRef(null),ke=[...je??[],e],an=ke.join("\0"),on=JSON.stringify([xe,n,ke,t]),mt=E.useRef(ke);mt.current=ke;const yt=E.useRef(null),cn=E.useCallback((R,b)=>{be.current?.(Zr,{id:R,height:b})},[]),dn=E.useCallback((R,b)=>{Ae.current?.focus(),be.current?.(Mr,{id:R,direction:b})},[]),[vt,ln]=E.useState(void 0),we=E.useRef({displayMode:f,expandable:!1});we.current={displayMode:f,maxHeight:N,width:vt,expandable:w!==void 0};const z=`${xe}\0${Zn(n,e)}`;E.useEffect(()=>{let R=!1;if(z!==de.current&&(He(null),de.current=null,ce.current=null),Je(null),i!=null&&i===ce.current&&z===de.current)return()=>{R=!0};const b=i==null?re.get(z):(()=>{const I=ds(z,i);return I===void 0?void 0:{hash:i,html:I}})();if(b!==void 0)return ce.current=b.hash??i??null,de.current=z,He(b.html),()=>{R=!0};const te=I=>`${Ce}/api/${n}${I?"/public":""}/views/${encodeURIComponent(e)}/shell`;return us(z,te(We),te(!0),!We).then(({html:I,hash:le})=>{ls(z,le,I),!R&&(le!==null&&le===ce.current&&z===de.current||(ce.current=le,de.current=z,Je(null),He(I)))}).catch(I=>{I instanceof nn&&[401,403,404,410].includes(I.status)&&fs(z),R||(Je(I instanceof Error?I.message:String(I)),V.current.onLoadError?.())}),()=>{R=!0}},[z,n,e,i,We]);const un=w!==void 0;E.useEffect(()=>{$e.current?.setHostContext(et(we.current))},[f,N,vt,un]),E.useEffect(()=>{const R=Ae.current;if(!R||typeof ResizeObserver>"u")return;const b=new ResizeObserver(([te])=>{const I=Math.round(te.contentRect.width);I>0&&ln(I)});return b.observe(R),()=>b.disconnect()},[oe]);const fn=JSON.stringify(r),hn=JSON.stringify(t);if(E.useEffect(()=>{$e.current?.sendToolInput({arguments:{scope:V.current.scope,params:V.current.params}})},[hn,fn]),E.useEffect(()=>{if(!oe||Ze)return;const R=Ae.current;if(!R?.contentWindow)return;const b=n,te=e,I=xe,le=ce.current;let M=!1;const _t=ns(I,()=>{M||bt()}),L=new Pn(null,{name:"Lobu",version:"1.0.0"},{openLinks:{},serverTools:{},updateModelContext:{structuredContent:{}}},{hostContext:et(we.current)});L.addEventListener("sizechange",({height:S})=>{ft.current||typeof S=="number"&&(sn(Math.max(ut.current,Math.ceil(S))),V.current.onHeightChange?.(Math.ceil(S)))}),L.setRequestHandler(qt,async S=>{const{params:T}=qt.parse(S);if(M)throw new Error("View unmounted");if(typeof T.record.entity_id=="string"&&!T.record.entity_type)throw new Error("String record keys require entity_type");const C=await Te(`${Ce}/api/${b}/manage_entity`,{method:"POST",credentials:"include",timeoutMs:15e3,headers:{"Content-Type":"application/json"},body:JSON.stringify({...T.record,action:"get"})});if(!C.ok)throw new Error(`Could not open record (${C.status})`);const P=(await C.json()).entity;if(M)throw new Error("View unmounted");if(!P?.view_url)throw new Error("Record is unavailable");return T.mode==="peek"&&X.current?(X.current.open(zn(typeof P.id=="number"&&P.parent_id!=null?{owner:b,entityId:P.id}:{owner:b,segments:[{entity_type:P.entity_type,slug:P.slug}]},P.name)),{mode:"peek"}):(await ie.current({href:P.view_url}),{mode:"page"})}),L.setRequestHandler(Vt,async S=>{const{params:T}=Vt.parse(S);if(M)throw new Error("View unmounted");const C=Fr(T.embeds,mt.current);return pt(C.instances),{embeds:C.statuses}}),L.setRequestHandler(Pt,async S=>{const{params:T}=Pt.parse(S);if(M)throw new Error("View unmounted");const U=[...yt.current?.querySelectorAll("[data-embed-id]")??[]].find(P=>P.dataset.embedId===T.id)?.querySelector("iframe");if(!U)throw new Error("No such embedded view");return U.focus(),U.dispatchEvent(new CustomEvent(Ge,{detail:T.direction??"forward"})),{}}),L.oncalltool=async({name:S,arguments:T})=>{if(M)return{content:[{type:"text",text:"view unmounted"}],isError:!0};let C;try{C=await cs(b,I,te,le,V.current.title??te,V.current.scope,S,T)}catch(Se){return{content:[{type:"text",text:String(Se)}],isError:!0}}if(M)return{content:[{type:"text",text:"view unmounted"}],isError:!0};if("error"in C)return{content:[{type:"text",text:C.error}],isError:!0};const U=async()=>{const Se=await Te(C.url,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(C.body),timeoutMs:3e4}),ue=await Se.json().catch(()=>null);if(!Se.ok){const wt=ue&&typeof ue.error=="string"&&ue.error||`API error: ${Se.status}`;return{ok:!1,result:{content:[{type:"text",text:wt}],isError:!0,structuredContent:{error:{message:wt,code:ue?.code}}}}}return{ok:!0,result:{content:[{type:"text",text:JSON.stringify(ue)}],structuredContent:ue??{}}}};return(S==="invoke_view_action"?await U():await _t.read(es(I,b,S,T),U)).result},L.onupdatemodelcontext=async({structuredContent:S})=>{if(M)return{};const T=Rn(S?.params,V.current.paramDecls);return T&&V.current.onParamsChange(T),{}},L.onopenlink=async({url:S})=>{if(M)return{};const T=Rr(S,window.location.origin,b);if(!T)return{isError:!0};if(T.kind==="external")return window.open(T.href,"_blank","noopener,noreferrer"),{};const C=new URL(T.path,window.location.origin);C.pathname=In(C.pathname);const U=C.pathname+C.search+C.hash;return jn(C.href)?.owner===b&&X.current?X.current.open({href:U,title:"Details"}):await ie.current({href:U}),{}},L.onrequestdisplaymode=async({mode:S})=>{const T=we.current.displayMode,C=V.current.onRequestDisplayMode;return!M&&C&&S!==T&&(S==="inline"||S==="fullscreen")&&C(S),{mode:T}},L.addEventListener("initialized",()=>{L.sendToolInput({arguments:{scope:V.current.scope,params:V.current.params}})});const Me=new Dn(R.contentWindow,R.contentWindow);be.current=(S,T)=>{M||Me.send({jsonrpc:"2.0",method:S,params:T}).catch(()=>{})};const xt=S=>{be.current?.(Lr,{direction:S.detail==="backward"?"backward":"forward"})};R.addEventListener(Ge,xt),L.connect(Me).catch(S=>{console.error("[view-frame] failed to initialize",S)}),$e.current=L;const bt=()=>{Me.send({jsonrpc:"2.0",method:"lobu/notifications/data-changed",params:{}}).catch(()=>{})},pn=An(()=>{M||(_t.invalidate(),bt())}),kt=new MutationObserver(()=>{L.setHostContext(et(we.current))});return kt.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{M=!0,be.current=null,R.removeEventListener(Ge,xt),pt([]),pn(),kt.disconnect(),$e.current=null,Me.close()}},[oe,Ze,n,e,xe]),Ze)return k.jsxs("div",{"data-testid":"view-frame-error",className:"text-sm text-destructive",children:["View failed to load: ",Ze]});const gt=!c&&N!==void 0&&Xe>N;return k.jsxs("div",{className:$n("relative",N!==void 0&&"overflow-hidden",A),style:N!==void 0?{maxHeight:N}:void 0,"data-testid":"view-frame","data-view":e,"data-clipped":gt||void 0,children:[oe?k.jsx("iframe",{ref:Ae,title:o??e,srcDoc:oe,sandbox:"allow-scripts",tabIndex:qe,style:{width:"100%",height:c??Xe,border:"none",display:"block"}}):k.jsx("div",{className:"animate-pulse rounded-md bg-muted/40",style:{height:l}}),ht.length>0&&oe?k.jsx("div",{ref:yt,"data-testid":"view-embeds",className:"pointer-events-none absolute inset-x-0 top-0 overflow-hidden",style:{height:c??Xe},children:ht.map(R=>k.jsx(Yr,{org:n,principal:xe,home:on,ancestry:ke,instance:R,onHeight:cn,onFocusExit:dn,renderFrame:b=>k.jsx(hs,{orgSlug:n,viewKey:b.viewKey,scope:b.scope,params:b.params,onParamsChange:b.onParamsChange,paramDecls:b.view.params,contentHash:b.view.content_hash,title:b.view.name,displayMode:"inline",minHeight:64,onRequestDisplayMode:b.onRequestDisplayMode,embedAncestry:b.ancestry,onHeightChange:b.onHeightChange,frameTabIndex:-1})},tn(R)))},an):null,gt?k.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-background to-transparent"}):null]})};function bs({viewKey:n,backTo:e,backLabel:t}){return k.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center","data-testid":"missing-view",children:[k.jsxs("h2",{className:"text-lg font-semibold",children:["No view named “",n,"” here"]}),k.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"It may have been renamed or detached from this page."}),k.jsx(Ln,{to:e,className:"mt-4 text-sm font-medium underline underline-offset-4",children:t})]})}function ks({error:n,onRetry:e}){const t=Mn(n,{subject:"Views"});return k.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center","data-testid":"views-unavailable",children:[k.jsx("h2",{className:"text-lg font-semibold",children:t.title}),k.jsx("p",{className:"text-muted-foreground mt-2 max-w-md text-sm",children:t.body}),t.retryable?k.jsx("button",{type:"button",onClick:e,className:"mt-4 text-sm font-medium underline underline-offset-4",children:"Try again"}):null]})}const ps=[{value:!0,label:"Yes"},{value:!1,label:"No"}];function ms(n,e,t){const r=[],s=[];for(const[a,i]of Object.entries(n??{})){const o=i.filter;if(!o)continue;const l=w=>t({...e,[a]:w}),c=o.options??(i.type==="boolean"?ps:void 0),f=e[a],N=c?Fn({searchPlaceholder:`Search ${o.label.toLowerCase()}...`,options:c.map(w=>({value:String(w.value),label:w.label})),selected:f===void 0?[]:[String(f)],onSelect:w=>{const A=c.find(Z=>String(Z.value)===w);A&&l(A.value)}}):Bn({type:i.type==="number"?"number":"text",label:o.label,value:typeof f=="boolean"?void 0:f,onApply:l});r.push({key:`param:${a}`,label:o.label,group:"View",icon:k.jsx(Vn,{className:"h-4 w-4"}),editor:N}),f!==void 0&&s.push({id:`param:${a}`,label:o.label,op:"is",value:c?.find(w=>w.value===f)?.label??(f===""?"(empty)":String(f)),onRemove:()=>{const{[a]:w,...A}=e;t(A)}})}return{fields:r,chips:s}}function ys(n,e){const t={...e};for(const[r,s]of Object.entries(n??{}))s.filter&&delete t[r];return t}function ws({decls:n,params:e,onParamsChange:t}){const{fields:r,chips:s}=ms(n,e,t);return r.length?k.jsx(Un,{label:"View filters",className:"mb-3",fields:r,chips:s,onClearAll:()=>t(ys(n,e))}):null}export{bs as M,ks as V,hs as a,ws as b,ms as v,ys as w};
2
+ //# sourceMappingURL=view-param-filters-CvrKw0mZ.js.map
@@ -113,8 +113,8 @@
113
113
  color: var(--muted-foreground, #a8a29e);
114
114
  }
115
115
  </style>
116
- <script type="module" crossorigin src="/assets/index-BoqrvLHQ.js"></script>
117
- <link rel="stylesheet" crossorigin href="/assets/index-Pae_f9LM.css">
116
+ <script type="module" crossorigin src="/assets/index-DB2lVKuV.js"></script>
117
+ <link rel="stylesheet" crossorigin href="/assets/index-SF2ni1Rs.css">
118
118
  </head>
119
119
  <body>
120
120
  <div id="root"></div>