@lobu/runtime-server 24.9.0 → 24.10.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 (221) hide show
  1. package/dist/catalogs/automations.json +2 -2
  2. package/dist/catalogs/connectors.json +16 -4
  3. package/dist/catalogs/skills.json +1 -1
  4. package/dist/component.json +1 -1
  5. package/dist/connectors/postgres.ts +39 -24
  6. package/dist/connectors/whatsapp-web-adapter.js +41 -10
  7. package/dist/connectors/whatsapp-web-helpers.ts +12 -2
  8. package/dist/connectors/whatsapp_web.ts +18 -2
  9. package/dist/db/migrations/20261112210000_instance_identity.sql +18 -0
  10. package/dist/dependencies.bun.lock +62 -60
  11. package/dist/embeddings-server.mjs +38 -5
  12. package/dist/owletto/dist/assets/_-CYvj1y65.js +3 -0
  13. package/dist/owletto/dist/assets/_-CeLTSYYY.js +2 -0
  14. package/dist/owletto/dist/assets/_agentId-BB5E-L6T.js +2 -0
  15. package/dist/owletto/dist/assets/{_agentId-bna2tPsW.js → _agentId-DN0EwMAC.js} +2 -2
  16. package/dist/owletto/dist/assets/_automationId-DvUl9CSd.js +2 -0
  17. package/dist/owletto/dist/assets/_connectorKey._connectionId-CVKfL9AG.js +2 -0
  18. package/dist/owletto/dist/assets/_connectorKey.index-Cv6FzK1v.js +2 -0
  19. package/dist/owletto/dist/assets/{_conversationId-zcs-S3dY.js → _conversationId-CPpNySjO.js} +2 -2
  20. package/dist/owletto/dist/assets/_eventId-DZKicuq6.js +2 -0
  21. package/dist/owletto/dist/assets/_owner-Dauk3YuD.js +3 -0
  22. package/dist/owletto/dist/assets/_shape-cKrEID3T.js +2 -0
  23. package/dist/owletto/dist/assets/_slug-DJx_8fsV.js +2 -0
  24. package/dist/owletto/dist/assets/_viewKey-CPVzVKEf.js +2 -0
  25. package/dist/owletto/dist/assets/_viewKey-CW8gexOQ.js +2 -0
  26. package/dist/owletto/dist/assets/accept-invitation-Dwq1GAnG.js +2 -0
  27. package/dist/owletto/dist/assets/activity-route-location-C1jcXC7v.js +2 -0
  28. package/dist/owletto/dist/assets/activity-route-view-D78Wj0RH.js +2 -0
  29. package/dist/owletto/dist/assets/agent-connect-pages-DoI9UR0a.js +4 -0
  30. package/dist/owletto/dist/assets/{agent-editor-form-Bnc_q5WD.js → agent-editor-form-DlavYg2q.js} +2 -2
  31. package/dist/owletto/dist/assets/{agent-loading-shells-xteN-pyK.js → agent-loading-shells-DYqQphN7.js} +2 -2
  32. package/dist/owletto/dist/assets/agent-permissions-matrix-C1L8IcYR.js +2 -0
  33. package/dist/owletto/dist/assets/{agent-skill-context-r0O0BVOu.js → agent-skill-context-D1nMrVod.js} +2 -2
  34. package/dist/owletto/dist/assets/{agent-subpage-shell-C2KpYdu3.js → agent-subpage-shell-2w7vTeXw.js} +2 -2
  35. package/dist/owletto/dist/assets/{agent-thread-Bv_chdPy.js → agent-thread-BopD-2k1.js} +3 -3
  36. package/dist/owletto/dist/assets/{app._appId-BUcNaSMS.js → app._appId-BXeFXW1w.js} +2 -2
  37. package/dist/owletto/dist/assets/{assist-composer-B1LykXpD.js → assist-composer-CL5x8pNt.js} +2 -2
  38. package/dist/owletto/dist/assets/automation-run-now-MtxUTfzd.js +2 -0
  39. package/dist/owletto/dist/assets/{callback-kSLa4n5s.js → callback-BgfwP1Eo.js} +2 -2
  40. package/dist/owletto/dist/assets/{card-C01y1O-W.js → card-DtLIFq7D.js} +2 -2
  41. package/dist/owletto/dist/assets/{claim-Dnux9Lqf.js → claim-CT3hYVMF.js} +2 -2
  42. package/dist/owletto/dist/assets/{client-activity-scopes-BBIq16tG.js → client-activity-scopes-BPbRX-Pe.js} +2 -2
  43. package/dist/owletto/dist/assets/{client-rows-DGh1O-Fu.js → client-rows-vrNA6FLs.js} +2 -2
  44. package/dist/owletto/dist/assets/clients-xnzZeEdZ.js +2 -0
  45. package/dist/owletto/dist/assets/{code-editor-BdRMYojw.js → code-editor-mrKkAfcE.js} +2 -2
  46. package/dist/owletto/dist/assets/connect-NUCSay8X.js +2 -0
  47. package/dist/owletto/dist/assets/{connect-menu-D4w-JhJW.js → connect-menu-C6iVtuSo.js} +2 -2
  48. package/dist/owletto/dist/assets/connect._clientId-Cp-d9Q5b.js +2 -0
  49. package/dist/owletto/dist/assets/{connected._clientId-BsDzltNz.js → connected._clientId-ROfVgp9h.js} +2 -2
  50. package/dist/owletto/dist/assets/connection-BMz740Wi.js +2 -0
  51. package/dist/owletto/dist/assets/{connection-feed-detail-CJju0qiw.js → connection-feed-detail-0VAJiZTP.js} +2 -2
  52. package/dist/owletto/dist/assets/connector-page-shell-BFv21yuv.js +2 -0
  53. package/dist/owletto/dist/assets/{connector-provenance-B2C2cjBg.js → connector-provenance-b59RfBtk.js} +2 -2
  54. package/dist/owletto/dist/assets/connectors-nYS31lO2.js +2 -0
  55. package/dist/owletto/dist/assets/consent-cPRF9JQv.js +2 -0
  56. package/dist/owletto/dist/assets/{copy-button-BhXeXLIm.js → copy-button-C3wMMv63.js} +2 -2
  57. package/dist/owletto/dist/assets/{core.esm-CJUp2aNZ.js → core.esm-C9QlSrgK.js} +3 -3
  58. package/dist/owletto/dist/assets/{create-DUlRsFNn.js → create-ASRN3Obq.js} +2 -2
  59. package/dist/owletto/dist/assets/create-CBcodaSO.js +2 -0
  60. package/dist/owletto/dist/assets/create-CGOWfMk4.js +2 -0
  61. package/dist/owletto/dist/assets/{create-automation-form-D141prEG.js → create-automation-form-CLicoPH5.js} +3 -3
  62. package/dist/owletto/dist/assets/create._connectorKey-s4xkktTC.js +2 -0
  63. package/dist/owletto/dist/assets/{custom-guardrail-edits-DuQ28xv3.js → custom-guardrail-edits-BUL7nmuO.js} +2 -2
  64. package/dist/owletto/dist/assets/{definition-comparison-BUDNuAN_.js → definition-comparison-4UYMI6BK.js} +2 -2
  65. package/dist/owletto/dist/assets/{detail-page-skeleton-BRHaq5Sj.js → detail-page-skeleton-C8v3rJXK.js} +2 -2
  66. package/dist/owletto/dist/assets/device-BBwsOi7q.js +2 -0
  67. package/dist/owletto/dist/assets/{device-pin-tombstone-BIM-ziCH.js → device-pin-tombstone-Bcpe7nAA.js} +2 -2
  68. package/dist/owletto/dist/assets/{device._deviceId-BnPqTgK1.js → device._deviceId-DLT4jh0Z.js} +2 -2
  69. package/dist/owletto/dist/assets/{dynamic-schema-form-OkIZImgp.js → dynamic-schema-form-BDT8x0Vg.js} +2 -2
  70. package/dist/owletto/dist/assets/{entity-options-CpeX7iiX.js → entity-options-B9hm9V87.js} +2 -2
  71. package/dist/owletto/dist/assets/entity-page-DZjzQ2V4.js +2 -0
  72. package/dist/owletto/dist/assets/entity-pages-BWBpttz3.js +2 -0
  73. package/dist/owletto/dist/assets/entity-schema-graph-lMMx3HhR.js +2 -0
  74. package/dist/owletto/dist/assets/{entity-type-page-MgZ7_0oh.js → entity-type-page-CkQm0yEu.js} +2 -2
  75. package/dist/owletto/dist/assets/{event-detail-D6AH6a2C.js → event-detail-CkzfakTK.js} +2 -2
  76. package/dist/owletto/dist/assets/events-feed-DmRzikZW.js +2 -0
  77. package/dist/owletto/dist/assets/{filter-editors-DDTwyYt0.js → filter-editors-CQoSj-20.js} +3 -3
  78. package/dist/owletto/dist/assets/{full-page-spinner-DWo519BU.js → full-page-spinner-CYyCnKve.js} +2 -2
  79. package/dist/owletto/dist/assets/index-BE7eb2kE.js +2 -0
  80. package/dist/owletto/dist/assets/index-BFR0uiKY.js +2 -0
  81. package/dist/owletto/dist/assets/{index-Cd8jMsz8.js → index-BS5Ty3tf.js} +2 -2
  82. package/dist/owletto/dist/assets/index-C38OzBpB.js +2 -0
  83. package/dist/owletto/dist/assets/{index-D1UCJQl1.js → index-C3hz9tzx.js} +2 -2
  84. package/dist/owletto/dist/assets/index-CDyFQ32o.js +2 -0
  85. package/dist/owletto/dist/assets/{index-BW7IFKXC.js → index-CUndAH6o.js} +2 -2
  86. package/dist/owletto/dist/assets/index-CiKysEhV.js +2 -0
  87. package/dist/owletto/dist/assets/{index-CdDNNAx2.js → index-DByaMzsG.js} +274 -274
  88. package/dist/owletto/dist/assets/index-DfdinB7B.js +2 -0
  89. package/dist/owletto/dist/assets/index-DgMM4Zt5.css +1 -0
  90. package/dist/owletto/dist/assets/index-Xk711gVC.js +2 -0
  91. package/dist/owletto/dist/assets/{index-DmqnKGqW.js → index-ittfA0k8.js} +2 -2
  92. package/dist/owletto/dist/assets/{json-diff-C-WQqyIf.js → json-diff-mcDgyct_.js} +2 -2
  93. package/dist/owletto/dist/assets/{list-skeleton-0B1bTrAK.js → list-skeleton-DsYGUHxi.js} +2 -2
  94. package/dist/owletto/dist/assets/login-EoLq136v.js +2 -0
  95. package/dist/owletto/dist/assets/{logout-D474YsYQ.js → logout-gLgEQOiX.js} +2 -2
  96. package/dist/owletto/dist/assets/{member-scope-gate-CH_0jHiM.js → member-scope-gate-vvkgSAb2.js} +2 -2
  97. package/dist/owletto/dist/assets/memory-browse-page-DvDtwrEI.js +74 -0
  98. package/dist/owletto/dist/assets/{model-selector-XYmk7Iru.js → model-selector-D3vSMLO2.js} +2 -2
  99. package/dist/owletto/dist/assets/{needs-you-list-Bd4iiiqm.js → needs-you-list-B5Bgd05M.js} +2 -2
  100. package/dist/owletto/dist/assets/{new-CJ6TF3Vc.js → new-BPW3V0Y1.js} +2 -2
  101. package/dist/owletto/dist/assets/new-Bk_flKQO.js +2 -0
  102. package/dist/owletto/dist/assets/new-C5HtQdM_.js +2 -0
  103. package/dist/owletto/dist/assets/new-dLXsCHBd.js +2 -0
  104. package/dist/owletto/dist/assets/organization-DBfgBkzq.js +2 -0
  105. package/dist/owletto/dist/assets/{peek-pane-content-Cc8YX1oy.js → peek-pane-content-c2PG3TEX.js} +2 -2
  106. package/dist/owletto/dist/assets/{pending-seed-D7-ld7as.js → pending-seed-CBhx2Ql-.js} +2 -2
  107. package/dist/owletto/dist/assets/{proposal-review-shell-BWRJidwb.js → proposal-review-shell-B-jYcKfB.js} +2 -2
  108. package/dist/owletto/dist/assets/public-shell-ready-D8TijlRY.js +2 -0
  109. package/dist/owletto/dist/assets/record-activity-DnRVOrG2.js +2 -0
  110. package/dist/owletto/dist/assets/{record-session-ClKBr1_C.js → record-session-CAmGHMyM.js} +2 -2
  111. package/dist/owletto/dist/assets/{renderer-DZ0w2k2r.js → renderer-olRv_HMI.js} +3 -3
  112. package/dist/owletto/dist/assets/reset-password-B9_xi8Pq.js +2 -0
  113. package/dist/owletto/dist/assets/{run-initiator-B8IRlRd-.js → run-initiator-DhE5v4z0.js} +2 -2
  114. package/dist/owletto/dist/assets/runs-C8sZQr4o.js +2 -0
  115. package/dist/owletto/dist/assets/{runs-list-8gUPWjP4.js → runs-list-CwtH-wmk.js} +2 -2
  116. package/dist/owletto/dist/assets/{schema-value-k19Ata7u.js → schema-value-zTJGE4eh.js} +3 -3
  117. package/dist/owletto/dist/assets/{scoped-feed-bar-L7h-Ca4u.js → scoped-feed-bar-BKyJSa3_.js} +2 -2
  118. package/dist/owletto/dist/assets/{settings-BZqntV3E.js → settings-z02cvVS3.js} +2 -2
  119. package/dist/owletto/dist/assets/source-record-panels-CGmKIJdN.js +2 -0
  120. package/dist/owletto/dist/assets/{status-variants-BR_iGWN5.js → status-variants-DyRCXBzM.js} +2 -2
  121. package/dist/owletto/dist/assets/subDays-D8nHthaS.js +2 -0
  122. package/dist/owletto/dist/assets/{table-C3DMoL4K.js → table-C637cQxG.js} +2 -2
  123. package/dist/owletto/dist/assets/use-automations-CgWNoYio.js +2 -0
  124. package/dist/owletto/dist/assets/use-login-redirect-tDdhXTpt.js +2 -0
  125. package/dist/owletto/dist/assets/{use-mention-search-CtbixPEE.js → use-mention-search-D-kIKchD.js} +2 -2
  126. package/dist/owletto/dist/assets/view-param-filters-CUCj9Df-.js +2 -0
  127. package/dist/owletto/dist/assets/{views-access-required-CvIIxdS_.js → views-access-required-C35Dyt91.js} +2 -2
  128. package/dist/owletto/dist/index.html +2 -2
  129. package/dist/server-main.bundle.mjs +2733 -1795
  130. package/npm-shrinkwrap.json +238 -221
  131. package/package.json +1 -1
  132. package/vendor/connector-sdk/dist/connector-types.d.ts +6 -0
  133. package/vendor/connector-sdk/dist/index.d.ts +1 -0
  134. package/vendor/connector-sdk/dist/index.js +1 -0
  135. package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
  136. package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
  137. package/vendor/connector-sdk/dist/logger.d.ts +1 -1
  138. package/vendor/connector-sdk/dist/logger.js +1 -1
  139. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
  140. package/vendor/connector-sdk/dist/retry.d.ts +1 -1
  141. package/vendor/connector-sdk/dist/retry.js +1 -1
  142. package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
  143. package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
  144. package/vendor/connector-sdk/package.json +1 -1
  145. package/vendor/core/dist/classify-error.d.ts +1 -1
  146. package/vendor/core/dist/classify-error.js +2 -2
  147. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +28 -3
  148. package/vendor/core/dist/contracts/tools/manage-automations.js +27 -8
  149. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
  150. package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
  151. package/vendor/core/dist/contracts/tools/save-memory.d.ts +11 -1
  152. package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
  153. package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
  154. package/vendor/core/dist/credentials.d.ts +12 -0
  155. package/vendor/core/dist/credentials.js +1 -0
  156. package/vendor/core/dist/errors.js +2 -2
  157. package/vendor/core/dist/worker/auth.d.ts +5 -0
  158. package/vendor/core/dist/worker/auth.js +15 -4
  159. package/vendor/core/package.json +1 -1
  160. package/vendor/postgres/cf/src/connection.js +7 -2
  161. package/vendor/postgres/cjs/src/connection.js +7 -2
  162. package/vendor/postgres/src/connection.js +7 -2
  163. package/vendor/views/dist/native.d.ts +33 -1
  164. package/vendor/views/dist/native.js +3 -0
  165. package/vendor/views/package.json +1 -1
  166. package/dist/owletto/dist/assets/_-B2C9B2RM.js +0 -2
  167. package/dist/owletto/dist/assets/_-CjyiGzwB.js +0 -3
  168. package/dist/owletto/dist/assets/_agentId-DKHXGvS2.js +0 -2
  169. package/dist/owletto/dist/assets/_automationId-CowRFD4E.js +0 -2
  170. package/dist/owletto/dist/assets/_connectorKey._connectionId-dE6im18z.js +0 -2
  171. package/dist/owletto/dist/assets/_connectorKey.index-DqwSv8Zs.js +0 -2
  172. package/dist/owletto/dist/assets/_eventId-BVOVizs4.js +0 -2
  173. package/dist/owletto/dist/assets/_owner-DsvIC94q.js +0 -3
  174. package/dist/owletto/dist/assets/_shape-CWjpzcvv.js +0 -2
  175. package/dist/owletto/dist/assets/_slug-DuCxYsJk.js +0 -2
  176. package/dist/owletto/dist/assets/_viewKey-BqVeHB6Z.js +0 -2
  177. package/dist/owletto/dist/assets/_viewKey-DzyOCG5U.js +0 -2
  178. package/dist/owletto/dist/assets/accept-invitation-k1u3zBcn.js +0 -2
  179. package/dist/owletto/dist/assets/activity-route-view-jTBMW7a9.js +0 -2
  180. package/dist/owletto/dist/assets/agent-connect-pages-D3mVM_q4.js +0 -4
  181. package/dist/owletto/dist/assets/agent-permissions-matrix-C_ayr0pd.js +0 -2
  182. package/dist/owletto/dist/assets/automation-run-now-CjkJIkaZ.js +0 -2
  183. package/dist/owletto/dist/assets/clients-BCvjAJDT.js +0 -2
  184. package/dist/owletto/dist/assets/connect-DZeFSGIH.js +0 -2
  185. package/dist/owletto/dist/assets/connect._clientId-IZEMQJ64.js +0 -2
  186. package/dist/owletto/dist/assets/connection-C7glVpPE.js +0 -2
  187. package/dist/owletto/dist/assets/connector-page-shell-BeuyjiB2.js +0 -2
  188. package/dist/owletto/dist/assets/connectors-DSQ5AWPf.js +0 -2
  189. package/dist/owletto/dist/assets/consent-B6Aw_89N.js +0 -2
  190. package/dist/owletto/dist/assets/create-CWcza8NT.js +0 -2
  191. package/dist/owletto/dist/assets/create-bGOYifof.js +0 -2
  192. package/dist/owletto/dist/assets/create._connectorKey-Ds4tpwHP.js +0 -2
  193. package/dist/owletto/dist/assets/device-D3fzoIrM.js +0 -2
  194. package/dist/owletto/dist/assets/entity-page-Cjc8oXA2.js +0 -2
  195. package/dist/owletto/dist/assets/entity-pages-18xSANrS.js +0 -2
  196. package/dist/owletto/dist/assets/entity-schema-graph-uwZ-P0t8.js +0 -2
  197. package/dist/owletto/dist/assets/events-feed-BI7wNRUY.js +0 -2
  198. package/dist/owletto/dist/assets/index-9tTjJo_J.css +0 -1
  199. package/dist/owletto/dist/assets/index-BYcFrinP.js +0 -2
  200. package/dist/owletto/dist/assets/index-BhJsTy-C.js +0 -2
  201. package/dist/owletto/dist/assets/index-CEcsgXDj.js +0 -2
  202. package/dist/owletto/dist/assets/index-CPscKk2u.js +0 -2
  203. package/dist/owletto/dist/assets/index-CfJ2-EpK.js +0 -2
  204. package/dist/owletto/dist/assets/index-D5DM4g2w.js +0 -2
  205. package/dist/owletto/dist/assets/index-DznAbTOF.js +0 -2
  206. package/dist/owletto/dist/assets/login-CH7P2AyR.js +0 -2
  207. package/dist/owletto/dist/assets/memory-browse-page-Ba4aYavw.js +0 -74
  208. package/dist/owletto/dist/assets/new-BOsrRqp8.js +0 -2
  209. package/dist/owletto/dist/assets/new-DGPOjak2.js +0 -2
  210. package/dist/owletto/dist/assets/new-Q0XqiZq2.js +0 -2
  211. package/dist/owletto/dist/assets/organization-hD_Z6TSd.js +0 -2
  212. package/dist/owletto/dist/assets/public-shell-ready-CRyAZATw.js +0 -2
  213. package/dist/owletto/dist/assets/record-activity-9ux6SfCd.js +0 -2
  214. package/dist/owletto/dist/assets/reset-password-D2RfrEVZ.js +0 -2
  215. package/dist/owletto/dist/assets/runs-CuC7WMtd.js +0 -2
  216. package/dist/owletto/dist/assets/source-record-panels-C4UItfdk.js +0 -2
  217. package/dist/owletto/dist/assets/subDays-hOwerOLo.js +0 -2
  218. package/dist/owletto/dist/assets/use-automations-CdtiVLCv.js +0 -2
  219. package/dist/owletto/dist/assets/use-login-redirect-CYlVkAhE.js +0 -2
  220. package/dist/owletto/dist/assets/view-param-filters-BdN8OU35.js +0 -2
  221. /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
@@ -1,2 +0,0 @@
1
- import{gA as mn,j as k,L as yn,gD as p,gE as gn,c as Ht,r as E,a7 as vn,gf as _n,w as xn,dA as St,gF as bn,gs as kn,gG as wn,gl as Sn,gz as En,g5 as On,dM as Tn,bR as Cn,u as Nn,z as Rn,aa as Te,$ as Ce,gH as In,gI as jn,p as An,gJ as $n,i as Zn,gK as Mn,gL as Ln}from"./index-CdDNNAx2.js";import{D as Vn,E as Pn}from"./app-bridge-C4nPtae3.js";import{l as Dn}from"./renderer-DZ0w2k2r.js";import{F as zn,o as Un,v as Fn}from"./filter-editors-DDTwyYt0.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"]),K=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 Bn=tt;function qn(){return Bn}const Wn=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=qn(),r=Wn({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}),P=n=>({status:"valid",value:n}),Ot=n=>n.status==="aborted",Tt=n=>n.status==="dirty",me=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(me(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 v(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 K(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:K(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:K(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:K(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:K(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return me(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=>me(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:K(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:g.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 Q.create(this,this._def)}nullable(){return _e.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({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new it({...v(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new mr({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ot({...v(this._def),innerType:this,catchValue:t,typeName:g.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 Hn=/^c[^\s-]{8,}$/i,Jn=/^[0-9a-z]+$/,Xn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Yn=/^[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,Kn=/^[a-z0-9_-]{21}$/i,Gn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qn=/^[-+]?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)?)??$/,er=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ye;const nr=/^(?:(?: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])$/,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])\/(3[0-2]|[12]?[0-9])$/,sr=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ir=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,or=/^([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])))",cr=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 dr(n){return new RegExp(`^${Xt(n)}$`)}function lr(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 ur(n,e){return!!((e==="v4"||!e)&&nr.test(n)||(e==="v6"||!e)&&sr.test(n))}function fr(n,e){if(!Gn.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 hr(n,e){return!!((e==="v4"||!e)&&rr.test(n)||(e==="v6"||!e)&&ar.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")er.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(tr,"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")Yn.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")Kn.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")Hn.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")Jn.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")Xn.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"?lr(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"?cr.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?dr(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"?Qn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"duration",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?ur(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"?fr(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"?hr(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"?ir.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64",code:d.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?or.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:g.ZodString,coerce:n?.coerce??!1,...v(n)});function pr(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 ye 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"?pr(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 ye({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:m.toString(s)}]})}_addCheck(e){return new ye({...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)}}ye.create=n=>new ye({checks:[],typeName:g.ZodNumber,coerce:n?.coerce||!1,...v(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:g.ZodBigInt,coerce:n?.coerce??!1,...v(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 P(e.data)}}nt.create=n=>new nt({typeName:g.ZodBoolean,coerce:n?.coerce||!1,...v(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:g.ZodDate,...v(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 P(e.data)}}Nt.create=n=>new Nt({typeName:g.ZodSymbol,...v(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 P(e.data)}}Rt.create=n=>new Rt({typeName:g.ZodUndefined,...v(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 P(e.data)}}It.create=n=>new It({typeName:g.ZodNull,...v(n)});class jt extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}}jt.create=n=>new jt({typeName:g.ZodAny,...v(n)});class rt extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}}rt.create=n=>new rt({typeName:g.ZodUnknown,...v(n)});class ee extends _{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),y}}ee.create=n=>new ee({typeName:g.ZodNever,...v(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 P(e.data)}}At.create=n=>new At({typeName:g.ZodVoid,...v(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:g.ZodArray,...v(e)});function he(n){if(n instanceof j){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=Q.create(he(r))}return new j({...n._def,shape:()=>e})}else return n instanceof B?new B({...n._def,type:he(n.element)}):n instanceof Q?Q.create(he(n.unwrap())):n instanceof _e?_e.create(he(n.unwrap())):n instanceof ae?ae.create(n.items.map(e=>he(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 ee&&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 ee){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:g.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 he(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 Q;)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:ee.create(),typeName:g.ZodObject,...v(e)});j.strictCreate=(n,e)=>new j({shape:()=>n,unknownKeys:"strict",catchall:ee.create(),typeName:g.ZodObject,...v(e)});j.lazycreate=(n,e)=>new j({shape:n,unknownKeys:"strip",catchall:ee.create(),typeName:g.ZodObject,...v(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:g.ZodUnion,...v(e)});function st(n,e){const t=K(n),r=K(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:g.ZodIntersection,...v(t)});class ae 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 ae({...this._def,rest:e})}}ae.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ae({items:n,typeName:g.ZodTuple,rest:null,...v(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:g.ZodRecord,...v(r)}):new Ue({keyType:H.create(),valueType:e,typeName:g.ZodRecord,...v(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:g.ZodMap,...v(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:g.ZodSet,...v(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:g.ZodLazy,...v(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:g.ZodLiteral,...v(e)});function Yt(n,e){return new ge({values:n,typeName:g.ZodEnum,...v(e)})}class ge 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 P(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 ge.create(e,{...this._def,...t})}exclude(e,t=this._def){return ge.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}ge.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 P(e.data)}get enum(){return this._def.values}}Mt.create=(n,e)=>new Mt({values:n,typeName:g.ZodNativeEnum,...v(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 P(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Fe.create=(n,e)=>new Fe({type:n,typeName:g.ZodPromise,...v(e)});class ve extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.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(!me(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=>me(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:g.ZodEffects,effect:e,...v(t)});ve.createWithPreprocess=(n,e,t)=>new ve({schema:e,effect:{type:"preprocess",transform:n},typeName:g.ZodEffects,...v(t)});class Q extends _{_parse(e){return this._getType(e)===h.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Q.create=(n,e)=>new Q({innerType:n,typeName:g.ZodOptional,...v(e)});class _e extends _{_parse(e){return this._getType(e)===h.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_e.create=(n,e)=>new _e({innerType:n,typeName:g.ZodNullable,...v(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:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(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:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(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:g.ZodNaN,...v(n)});class mr 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:g.ZodPipeline})}}class ct extends _{_parse(e){const t=this._def.innerType._parse(e),r=s=>(me(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:g.ZodReadonly,...v(e)});var g;(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"})(g||(g={}));const G=H.create,Ie=ye.create,yr=nt.create,Kt=rt.create;ee.create;const gr=B.create,q=j.create,Be=De.create;ze.create;ae.create;const vr=Ue.create,lt=at.create,Gt=ge.create;Fe.create;Q.create;_e.create;const Ke=y;function xs({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(yn,{to:e,className:"mt-4 text-sm font-medium underline underline-offset-4",children:t})]})}function bs({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 _r=p.String({pattern:"^[a-z0-9][a-z0-9-]{0,63}$",minLength:1,maxLength:64,description:"View key, e.g. 'pipeline'."}),xr=p.Object({collection:p.Optional(gn),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 br(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 kr=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}),wr=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."}),Sr=p.Union([p.String({maxLength:500}),p.Number(),p.Boolean()]),Er=p.Union([p.Object({kind:p.Literal("view"),key:_r,scope:p.Optional(p.Object(xr.properties,{additionalProperties:!1})),params:p.Optional(p.Record(p.String({maxLength:64}),Sr,{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 }"}),Or=p.Object({id:Qt,label:p.Optional(en),icon:p.Optional(wr),target:p.Optional(Er),children:p.Optional(p.Array(p.Unknown(),{description:"Nested items, each the same shape as this one."}))},{additionalProperties:!1}),Tr=p.Object({id:Qt,label:p.Optional(en),items:p.Array(Or)},{additionalProperties:!1});p.Object({schemaVersion:p.Literal(1),sections:p.Array(Tr,{maxItems:kr})},{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 Cr=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(Cr)});function Nr(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 Rr="lobu/open-record";function Ir(n,e){return n==="read_knowledge"?!0:n==="manage_entity"?e?.action==="list"||e?.action==="get"||e?.action==="list_links":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 jr="lobu/embeds/sync",Ar="lobu/embeds/focus",$r="lobu/notifications/embed-size",Zr="lobu/notifications/embed-focus",Mr="lobu/notifications/focus-enter",Lr=8,Vr=2,Pr=20,Vt=q({method:lt(jr),params:q({embeds:gr(Kt()).max(64)})}),Pt=q({method:lt(Ar),params:q({id:G().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()}),Dr=q({id:G().regex(/^[A-Za-z0-9_-]{1,64}$/),view:G().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),scope:q({type:G().min(1).max(128).optional(),entity:Be([Ie().int().positive(),G().min(1).max(1024)]).optional(),event:Ie().int().positive().optional(),collection:Kt().optional()}).strict().transform((n,e)=>{const t=br(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:_n(n.collection)}}catch(r){return e.addIssue({code:d.custom,message:String(r)}),Ke}}),params:vr(Be([G().max(2e3),Oe,yr()])).refine(n=>Object.keys(n).length<=Pr),rect:Dt.extend({clip:Dt.optional()})});function zr(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 Ur(n,e){const t=[],r=[],s=new Set;for(const a of n){const i=Dr.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>Vr?r.push({id:o,status:"refused",reason:"depth"}):t.length>=Lr?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 Fr=n=>n instanceof Cn&&[400,401,403,404].includes(n.status);function Br(n,e,t){const r=xn({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 Tn("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(Fr(c))return null;throw c}}}),o=St({...bn(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=kn(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"}:wn([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?Sn([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}`}:En([s]).length===0?{kind:"unattached"}:{kind:"ready",view:s,scope:{},path:`/${n}/data${l}`}}function qr(n,e){const t=new URLSearchParams;n.scope.collection!==void 0&&t.set(On,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 Wr={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,Hr=64,pe=new Map;function Jr(n,e){if(pe.delete(n),pe.set(n,e),pe.size>Hr){const t=pe.keys().next().value;t!==void 0&&pe.delete(t)}}const Xr=({org:n,principal:e,home:t,ancestry:r,instance:s,onHeight:a,onFocusExit:i,renderFrame:o})=>{const l=Ht(),c=Br(n,e,s),f=JSON.stringify(s.params),N=JSON.stringify([t,tn(s)]),[w,A]=E.useState(()=>{const O=pe.get(N);return O?.seed===f?O:{seed:f,params:s.params}}),Z=O=>{Jr(N,O),A(O)},je=w.seed===f?w.params:s.params;w.seed!==f&&Z({seed:f,params:s.params});const te=c.kind==="ready"?qr(c,je):null,[qe,xe]=E.useState(!1),ie=qe?0:-1,X=O=>{te&&(O&&(O.defaultPrevented||O.button!==0||O.metaKey||O.ctrlKey||O.shiftKey||O.altKey)||(O?.preventDefault(),l({href:te})))},oe=(c.kind==="ready"?c.view.name:null)??s.view;return k.jsxs("section",{"aria-label":oe,"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,...zr(s.rect)},onFocus:()=>xe(!0),onBlur:O=>{O.currentTarget.contains(O.relatedTarget)||xe(!1)},children:[k.jsx("span",{tabIndex:ie,"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:Wr[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:oe}),te?k.jsxs("a",{href:te,tabIndex:ie,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(vn,{"aria-hidden":!0,className:"h-3 w-3"})]}):null]}),k.jsx("span",{tabIndex:ie,"data-embed-trap":"end",onFocus:()=>i(s.id,"forward")})]})},Yr=64,Kr=2e6,Gr=10*6e4,re=new Map;let Ut=null;function Qr(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(re.delete(n),!(!e.ok||t===void 0||t.length>Kr))for(re.set(n,{text:t,result:e.result,at:Date.now()});re.size>Yr;){const r=re.keys().next().value;if(r===void 0)break;re.delete(r)}}function es(n){return{ok:!1,result:{content:[{type:"text",text:String(n)}],isError:!0}}}function ts(n,e){Ut!==n&&(re.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=re.get(a);if(l&&c&&Date.now()-c.at<=Gr){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(es(A))),{ok:!0,result:c.result}}const f=await i();return Bt(a,f,Ft(f)),f}}}const qt=q({method:lt(Rr),params:q({record:q({entity_id:Be([Ie().int().positive().max(Number.MAX_SAFE_INTEGER),G().min(1).max(1024)]),entity_type:Be([G().min(1),Ie().int().positive()]).optional()}),mode:Gt(["peek","page"])})}),ns=new Set(["query_sql","query_sdk"]),rs=200;function ss(n,e){const t=n?.title;return typeof t=="string"&&t.trim()?n??{}:{...n,title:e.slice(0,rs)}}const Qe=new Map;function as(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 is=[["--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 is){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 os(n,e,t,r,s,a,i,o){if(i!=="invoke_view_action"){const Z=ns.has(i);return!Z&&!Ir(i,o)&&!(await as(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?ss(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,se=new Map;function cs(n,e){const t=`${n}\0${e}`,r=F.get(t);return r!==void 0&&(F.delete(t),F.set(t,r)),r}function ds(n,e,t){se.delete(n),se.set(n,{hash:e,html:t});for(const s of se.keys()){if(se.size<=Wt)break;se.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 ls(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 us(n){se.delete(n);for(const e of F.keys())e.startsWith(`${n}\0`)&&F.delete(e)}const fs=({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:te,frameTabIndex:qe})=>{const xe=Ht(),ie=Nn(),X=E.useRef(ie);X.current=ie;const oe=E.useRef(xe);oe.current=xe;const{session:O,isReady:rn}=Rn(),We=rn&&!O,be=O?.user.id??"anonymous",Ae=E.useRef(null),$e=E.useRef(null),[ce,He]=E.useState(null),[Ze,Je]=E.useState(null),[Xe,sn]=E.useState(l),de=E.useRef(null),le=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:te,title:o});V.current={scope:t,params:r,paramDecls:a,onParamsChange:s,onLoadError:Z,onRequestDisplayMode:w,onHeightChange:te,title:o};const[ht,pt]=E.useState([]),ke=E.useRef(null),we=[...je??[],e],an=we.join("\0"),on=JSON.stringify([be,n,we,t]),mt=E.useRef(we);mt.current=we;const yt=E.useRef(null),cn=E.useCallback((R,b)=>{ke.current?.($r,{id:R,height:b})},[]),dn=E.useCallback((R,b)=>{Ae.current?.focus(),ke.current?.(Zr,{id:R,direction:b})},[]),[gt,ln]=E.useState(void 0),Se=E.useRef({displayMode:f,expandable:!1});Se.current={displayMode:f,maxHeight:N,width:gt,expandable:w!==void 0};const D=`${be}\0${Mn(n,e)}`;E.useEffect(()=>{let R=!1;if(D!==le.current&&(He(null),le.current=null,de.current=null),Je(null),i!=null&&i===de.current&&D===le.current)return()=>{R=!0};const b=i==null?se.get(D):(()=>{const I=cs(D,i);return I===void 0?void 0:{hash:i,html:I}})();if(b!==void 0)return de.current=b.hash??i??null,le.current=D,He(b.html),()=>{R=!0};const ne=I=>`${Ce}/api/${n}${I?"/public":""}/views/${encodeURIComponent(e)}/shell`;return ls(D,ne(We),ne(!0),!We).then(({html:I,hash:ue})=>{ds(D,ue,I),!R&&(ue!==null&&ue===de.current&&D===le.current||(de.current=ue,le.current=D,Je(null),He(I)))}).catch(I=>{I instanceof nn&&[401,403,404,410].includes(I.status)&&us(D),R||(Je(I instanceof Error?I.message:String(I)),V.current.onLoadError?.())}),()=>{R=!0}},[D,n,e,i,We]);const un=w!==void 0;E.useEffect(()=>{$e.current?.setHostContext(et(Se.current))},[f,N,gt,un]),E.useEffect(()=>{const R=Ae.current;if(!R||typeof ResizeObserver>"u")return;const b=new ResizeObserver(([ne])=>{const I=Math.round(ne.contentRect.width);I>0&&ln(I)});return b.observe(R),()=>b.disconnect()},[ce]);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(!ce||Ze)return;const R=Ae.current;if(!R?.contentWindow)return;const b=n,ne=e,I=be,ue=de.current;let M=!1;const _t=ts(I,()=>{M||bt()}),L=new Vn(null,{name:"Lobu",version:"1.0.0"},{openLinks:{},serverTools:{},updateModelContext:{structuredContent:{}}},{hostContext:et(Se.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 z=(await C.json()).entity;if(M)throw new Error("View unmounted");if(!z?.view_url)throw new Error("Record is unavailable");if(T.mode==="peek"&&X.current){const Y={ownerSlug:b,orgContext:{slug:b},name:z.name};return X.current.open(Dn(typeof z.id=="number"?{...Y,entityId:z.id}:{...Y,record:{type:z.entity_type,key:z.slug}})),{mode:"peek"}}return await oe.current({href:z.view_url}),{mode:"page"}}),L.setRequestHandler(Vt,async S=>{const{params:T}=Vt.parse(S);if(M)throw new Error("View unmounted");const C=Ur(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(z=>z.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 os(b,I,ne,ue,V.current.title??ne,V.current.scope,S,T)}catch(Y){return{content:[{type:"text",text:String(Y)}],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 Y=await Te(C.url,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(C.body),timeoutMs:3e4}),fe=await Y.json().catch(()=>null);if(!Y.ok){const wt=fe&&typeof fe.error=="string"&&fe.error||`API error: ${Y.status}`;return{ok:!1,result:{content:[{type:"text",text:wt}],isError:!0,structuredContent:{error:{message:wt,code:fe?.code}}}}}return{ok:!0,result:{content:[{type:"text",text:JSON.stringify(fe)}],structuredContent:fe??{}}}};return(S==="invoke_view_action"?await U():await _t.read(Qr(I,b,S,T),U)).result},L.onupdatemodelcontext=async({structuredContent:S})=>{if(M)return{};const T=In(S?.params,V.current.paramDecls);return T&&V.current.onParamsChange(T),{}},L.onopenlink=async({url:S})=>{if(M)return{};const T=Nr(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=jn(C.pathname);const U=C.pathname+C.search+C.hash;return An(C.href)?.owner===b&&X.current?X.current.open({href:U,title:"Details"}):await oe.current({href:U}),{}},L.onrequestdisplaymode=async({mode:S})=>{const T=Se.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 Pn(R.contentWindow,R.contentWindow);ke.current=(S,T)=>{M||Me.send({jsonrpc:"2.0",method:S,params:T}).catch(()=>{})};const xt=S=>{ke.current?.(Mr,{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=$n(()=>{M||(_t.invalidate(),bt())}),kt=new MutationObserver(()=>{L.setHostContext(et(Se.current))});return kt.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{M=!0,ke.current=null,R.removeEventListener(Ge,xt),pt([]),pn(),kt.disconnect(),$e.current=null,Me.close()}},[ce,Ze,n,e,be]),Ze)return k.jsxs("div",{"data-testid":"view-frame-error",className:"text-sm text-destructive",children:["View failed to load: ",Ze]});const vt=!c&&N!==void 0&&Xe>N;return k.jsxs("div",{className:Zn("relative",N!==void 0&&"overflow-hidden",A),style:N!==void 0?{maxHeight:N}:void 0,"data-testid":"view-frame","data-view":e,"data-clipped":vt||void 0,children:[ce?k.jsx("iframe",{ref:Ae,title:o??e,srcDoc:ce,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&&ce?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(Xr,{org:n,principal:be,home:on,ancestry:we,instance:R,onHeight:cn,onFocusExit:dn,renderFrame:b=>k.jsx(fs,{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,vt?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]})},hs=[{value:!0,label:"Yes"},{value:!1,label:"No"}];function ps(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"?hs:void 0),f=e[a],N=c?Un({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)}}):Fn({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(Ln,{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 ms(n,e){const t={...e};for(const[r,s]of Object.entries(n??{}))s.filter&&delete t[r];return t}function ks({decls:n,params:e,onParamsChange:t}){const{fields:r,chips:s}=ps(n,e,t);return r.length?k.jsx(zn,{label:"View filters",className:"mb-3",fields:r,chips:s,onClearAll:()=>t(ms(n,e))}):null}export{xs as M,bs as V,fs as a,ks as b,ps as v,ms as w};
2
- //# sourceMappingURL=view-param-filters-BdN8OU35.js.map