@ai-development-environment/server 0.0.43 → 0.0.44

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 (508) hide show
  1. package/package.json +1 -1
  2. package/standalone/.next/BUILD_ID +1 -1
  3. package/standalone/.next/build-manifest.json +3 -3
  4. package/standalone/.next/prerender-manifest.json +3 -3
  5. package/standalone/.next/server/app/[locale]/actions/page.js.nft.json +1 -1
  6. package/standalone/.next/server/app/[locale]/actions/page_client-reference-manifest.js +1 -1
  7. package/standalone/.next/server/app/[locale]/actions-cache/page.js.nft.json +1 -1
  8. package/standalone/.next/server/app/[locale]/actions-cache/page_client-reference-manifest.js +1 -1
  9. package/standalone/.next/server/app/[locale]/agents/[id]/page.js.nft.json +1 -1
  10. package/standalone/.next/server/app/[locale]/agents/[id]/page_client-reference-manifest.js +1 -1
  11. package/standalone/.next/server/app/[locale]/agents/page.js.nft.json +1 -1
  12. package/standalone/.next/server/app/[locale]/agents/page_client-reference-manifest.js +1 -1
  13. package/standalone/.next/server/app/[locale]/analytics-events/page.js.nft.json +1 -1
  14. package/standalone/.next/server/app/[locale]/analytics-events/page_client-reference-manifest.js +1 -1
  15. package/standalone/.next/server/app/[locale]/build-data/page.js.nft.json +1 -1
  16. package/standalone/.next/server/app/[locale]/build-data/page_client-reference-manifest.js +1 -1
  17. package/standalone/.next/server/app/[locale]/builds/[buildId]/coverage/page.js.nft.json +1 -1
  18. package/standalone/.next/server/app/[locale]/builds/[buildId]/coverage/page_client-reference-manifest.js +1 -1
  19. package/standalone/.next/server/app/[locale]/builds/[buildId]/page.js.nft.json +1 -1
  20. package/standalone/.next/server/app/[locale]/builds/[buildId]/page_client-reference-manifest.js +1 -1
  21. package/standalone/.next/server/app/[locale]/builds/page.js.nft.json +1 -1
  22. package/standalone/.next/server/app/[locale]/builds/page_client-reference-manifest.js +1 -1
  23. package/standalone/.next/server/app/[locale]/codebases/[codebaseId]/page.js.nft.json +1 -1
  24. package/standalone/.next/server/app/[locale]/codebases/[codebaseId]/page_client-reference-manifest.js +1 -1
  25. package/standalone/.next/server/app/[locale]/codebases/page.js.nft.json +1 -1
  26. package/standalone/.next/server/app/[locale]/codebases/page_client-reference-manifest.js +1 -1
  27. package/standalone/.next/server/app/[locale]/codebases/repositories/[repositoryId]/page.js.nft.json +1 -1
  28. package/standalone/.next/server/app/[locale]/codebases/repositories/[repositoryId]/page_client-reference-manifest.js +1 -1
  29. package/standalone/.next/server/app/[locale]/comments/page.js.nft.json +1 -1
  30. package/standalone/.next/server/app/[locale]/comments/page_client-reference-manifest.js +1 -1
  31. package/standalone/.next/server/app/[locale]/console-logs/page.js.nft.json +1 -1
  32. package/standalone/.next/server/app/[locale]/console-logs/page_client-reference-manifest.js +1 -1
  33. package/standalone/.next/server/app/[locale]/credentials/page.js.nft.json +1 -1
  34. package/standalone/.next/server/app/[locale]/credentials/page_client-reference-manifest.js +1 -1
  35. package/standalone/.next/server/app/[locale]/devices/[id]/page.js.nft.json +1 -1
  36. package/standalone/.next/server/app/[locale]/devices/[id]/page_client-reference-manifest.js +1 -1
  37. package/standalone/.next/server/app/[locale]/devices/enroll/page.js.nft.json +1 -1
  38. package/standalone/.next/server/app/[locale]/devices/enroll/page_client-reference-manifest.js +1 -1
  39. package/standalone/.next/server/app/[locale]/devices/page.js.nft.json +1 -1
  40. package/standalone/.next/server/app/[locale]/devices/page_client-reference-manifest.js +1 -1
  41. package/standalone/.next/server/app/[locale]/jira/cache/page.js.nft.json +1 -1
  42. package/standalone/.next/server/app/[locale]/jira/cache/page_client-reference-manifest.js +1 -1
  43. package/standalone/.next/server/app/[locale]/jira/cache/tickets/[issueKey]/page.js.nft.json +1 -1
  44. package/standalone/.next/server/app/[locale]/jira/cache/tickets/[issueKey]/page_client-reference-manifest.js +1 -1
  45. package/standalone/.next/server/app/[locale]/jira/tickets/[issueKey]/page.js.nft.json +1 -1
  46. package/standalone/.next/server/app/[locale]/jira/tickets/[issueKey]/page_client-reference-manifest.js +1 -1
  47. package/standalone/.next/server/app/[locale]/jira/tickets/page.js.nft.json +1 -1
  48. package/standalone/.next/server/app/[locale]/jira/tickets/page_client-reference-manifest.js +1 -1
  49. package/standalone/.next/server/app/[locale]/jobs/[jobId]/page.js.nft.json +1 -1
  50. package/standalone/.next/server/app/[locale]/jobs/[jobId]/page_client-reference-manifest.js +1 -1
  51. package/standalone/.next/server/app/[locale]/notifications/page.js.nft.json +1 -1
  52. package/standalone/.next/server/app/[locale]/notifications/page_client-reference-manifest.js +1 -1
  53. package/standalone/.next/server/app/[locale]/page.js.nft.json +1 -1
  54. package/standalone/.next/server/app/[locale]/page_client-reference-manifest.js +1 -1
  55. package/standalone/.next/server/app/[locale]/provisioning-profiles/[profileId]/page.js.nft.json +1 -1
  56. package/standalone/.next/server/app/[locale]/provisioning-profiles/[profileId]/page_client-reference-manifest.js +1 -1
  57. package/standalone/.next/server/app/[locale]/provisioning-profiles/page.js.nft.json +1 -1
  58. package/standalone/.next/server/app/[locale]/provisioning-profiles/page_client-reference-manifest.js +1 -1
  59. package/standalone/.next/server/app/[locale]/pull-requests/[owner]/[repository]/[number]/page.js.nft.json +1 -1
  60. package/standalone/.next/server/app/[locale]/pull-requests/[owner]/[repository]/[number]/page_client-reference-manifest.js +1 -1
  61. package/standalone/.next/server/app/[locale]/pull-requests/page.js.nft.json +1 -1
  62. package/standalone/.next/server/app/[locale]/pull-requests/page_client-reference-manifest.js +1 -1
  63. package/standalone/.next/server/app/[locale]/push-notifications/page.js.nft.json +1 -1
  64. package/standalone/.next/server/app/[locale]/push-notifications/page_client-reference-manifest.js +1 -1
  65. package/standalone/.next/server/app/[locale]/settings/page.js.nft.json +1 -1
  66. package/standalone/.next/server/app/[locale]/settings/page_client-reference-manifest.js +1 -1
  67. package/standalone/.next/server/app/[locale]/skills/[skillId]/page.js.nft.json +1 -1
  68. package/standalone/.next/server/app/[locale]/skills/[skillId]/page_client-reference-manifest.js +1 -1
  69. package/standalone/.next/server/app/[locale]/skills/groups/[groupId]/page.js.nft.json +1 -1
  70. package/standalone/.next/server/app/[locale]/skills/groups/[groupId]/page_client-reference-manifest.js +1 -1
  71. package/standalone/.next/server/app/[locale]/skills/groups/page.js.nft.json +1 -1
  72. package/standalone/.next/server/app/[locale]/skills/groups/page_client-reference-manifest.js +1 -1
  73. package/standalone/.next/server/app/[locale]/skills/page.js.nft.json +1 -1
  74. package/standalone/.next/server/app/[locale]/skills/page_client-reference-manifest.js +1 -1
  75. package/standalone/.next/server/app/[locale]/skills/sync/[runId]/page.js.nft.json +1 -1
  76. package/standalone/.next/server/app/[locale]/skills/sync/[runId]/page_client-reference-manifest.js +1 -1
  77. package/standalone/.next/server/app/[locale]/tools/page.js.nft.json +1 -1
  78. package/standalone/.next/server/app/[locale]/tools/page_client-reference-manifest.js +1 -1
  79. package/standalone/.next/server/app/[locale]/unified-events/page.js.nft.json +1 -1
  80. package/standalone/.next/server/app/[locale]/unified-events/page_client-reference-manifest.js +1 -1
  81. package/standalone/.next/server/app/[locale]/usage/page.js.nft.json +1 -1
  82. package/standalone/.next/server/app/[locale]/usage/page_client-reference-manifest.js +1 -1
  83. package/standalone/.next/server/app/[locale]/worktrees/[worktreeId]/page.js.nft.json +1 -1
  84. package/standalone/.next/server/app/[locale]/worktrees/[worktreeId]/page_client-reference-manifest.js +1 -1
  85. package/standalone/.next/server/app/[locale]/worktrees/page.js.nft.json +1 -1
  86. package/standalone/.next/server/app/[locale]/worktrees/page_client-reference-manifest.js +1 -1
  87. package/standalone/.next/server/app/_global-error.html +1 -1
  88. package/standalone/.next/server/app/_global-error.rsc +1 -1
  89. package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  90. package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  91. package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  92. package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  93. package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  94. package/standalone/.next/server/app/_not-found.html +1 -1
  95. package/standalone/.next/server/app/_not-found.rsc +1 -1
  96. package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  97. package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  98. package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  99. package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  100. package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  101. package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  102. package/standalone/.next/server/app/api/build-artifact-uploads/[uploadId]/route.js +1 -1
  103. package/standalone/.next/server/app/api/build-artifact-uploads/[uploadId]/route.js.nft.json +1 -1
  104. package/standalone/.next/server/app/api/builds/[buildId]/artifacts/[artifactId]/manifest.plist/route.js +1 -1
  105. package/standalone/.next/server/app/api/builds/[buildId]/artifacts/[artifactId]/manifest.plist/route.js.nft.json +1 -1
  106. package/standalone/.next/server/app/api/builds/[buildId]/artifacts/[artifactId]/route.js +1 -1
  107. package/standalone/.next/server/app/api/builds/[buildId]/artifacts/[artifactId]/route.js.nft.json +1 -1
  108. package/standalone/.next/server/app/api/codebases/by-path/route.js +1 -1
  109. package/standalone/.next/server/app/api/codebases/by-path/route.js.nft.json +1 -1
  110. package/standalone/.next/server/app/api/codebases/route.js +1 -1
  111. package/standalone/.next/server/app/api/codebases/route.js.nft.json +1 -1
  112. package/standalone/.next/server/app/api/graphql/route.js +1 -1
  113. package/standalone/.next/server/app/api/graphql/route.js.nft.json +1 -1
  114. package/standalone/.next/server/app/api/ios/apns-devices/route.js +1 -1
  115. package/standalone/.next/server/app/api/ios/apns-devices/route.js.nft.json +1 -1
  116. package/standalone/.next/server/app/api/ios/devices/export.tsv/route.js +1 -1
  117. package/standalone/.next/server/app/api/ios/devices/export.tsv/route.js.nft.json +1 -1
  118. package/standalone/.next/server/app/api/ios/enrollment/start/route.js +1 -1
  119. package/standalone/.next/server/app/api/ios/enrollment/start/route.js.nft.json +1 -1
  120. package/standalone/.next/server/app/api/ios/enrollment-profile/route.js +1 -1
  121. package/standalone/.next/server/app/api/ios/enrollment-profile/route.js.nft.json +1 -1
  122. package/standalone/.next/server/app/api/ios/profile-response/route.js +1 -1
  123. package/standalone/.next/server/app/api/ios/profile-response/route.js.nft.json +1 -1
  124. package/standalone/.next/server/app/api/mcp/route.js +1 -1
  125. package/standalone/.next/server/app/api/mcp/route.js.nft.json +1 -1
  126. package/standalone/.next/server/app/api/openapi.json/route.js +1 -1
  127. package/standalone/.next/server/app/api/openapi.json/route.js.nft.json +1 -1
  128. package/standalone/.next/server/app/api/telemetry/analytics-events/route.js +1 -1
  129. package/standalone/.next/server/app/api/telemetry/analytics-events/route.js.nft.json +1 -1
  130. package/standalone/.next/server/app/api/telemetry/console-logs/route.js +1 -1
  131. package/standalone/.next/server/app/api/telemetry/console-logs/route.js.nft.json +1 -1
  132. package/standalone/.next/server/app/api/telemetry/export/route.js +1 -1
  133. package/standalone/.next/server/app/api/telemetry/export/route.js.nft.json +1 -1
  134. package/standalone/.next/server/app/api/tools/call/route.js +1 -1
  135. package/standalone/.next/server/app/api/tools/call/route.js.nft.json +1 -1
  136. package/standalone/.next/server/app/api/tools/catalog/route.js +1 -1
  137. package/standalone/.next/server/app/api/tools/catalog/route.js.nft.json +1 -1
  138. package/standalone/.next/server/app/api/worktrees/[worktreeId]/diff-image/route.js +1 -1
  139. package/standalone/.next/server/app/api/worktrees/[worktreeId]/diff-image/route.js.nft.json +1 -1
  140. package/standalone/.next/server/chunks/{[root-of-the-server]__00h1t-5._.js → [root-of-the-server]__0-ptbns._.js} +1 -1
  141. package/standalone/.next/server/chunks/{[root-of-the-server]__0lrv7jk._.js → [root-of-the-server]__0-rk-gw._.js} +1 -1
  142. package/standalone/.next/server/chunks/{[root-of-the-server]__0783dgt._.js → [root-of-the-server]__0-siu15._.js} +1 -1
  143. package/standalone/.next/server/chunks/{[root-of-the-server]__0fbv1bw._.js → [root-of-the-server]__00l1ur7._.js} +1 -1
  144. package/standalone/.next/server/chunks/{[root-of-the-server]__09--bpf._.js → [root-of-the-server]__00pz9u-._.js} +1 -1
  145. package/standalone/.next/server/chunks/{[root-of-the-server]__00pg8ki._.js → [root-of-the-server]__00q730m._.js} +1 -1
  146. package/standalone/.next/server/chunks/{[root-of-the-server]__2195vvu._.js → [root-of-the-server]__03l7uod._.js} +2 -2
  147. package/standalone/.next/server/chunks/{[root-of-the-server]__09n1yz-._.js → [root-of-the-server]__04ytt8c._.js} +1 -1
  148. package/standalone/.next/server/chunks/{[root-of-the-server]__1t1-x5a._.js → [root-of-the-server]__05l-vh9._.js} +1 -1
  149. package/standalone/.next/server/chunks/{[root-of-the-server]__0gyqdmk._.js → [root-of-the-server]__05o3hc7._.js} +1 -1
  150. package/standalone/.next/server/chunks/{[root-of-the-server]__0kmxj4m._.js → [root-of-the-server]__0661gy0._.js} +1 -1
  151. package/standalone/.next/server/chunks/{[root-of-the-server]__03i41aw._.js → [root-of-the-server]__06v-y44._.js} +1 -1
  152. package/standalone/.next/server/chunks/{[root-of-the-server]__027a5vb._.js → [root-of-the-server]__0730ihs._.js} +1 -1
  153. package/standalone/.next/server/chunks/{[root-of-the-server]__1yxu--t._.js → [root-of-the-server]__076321a._.js} +1 -1
  154. package/standalone/.next/server/chunks/{[root-of-the-server]__0o-m0xx._.js → [root-of-the-server]__076y818._.js} +1 -1
  155. package/standalone/.next/server/chunks/[root-of-the-server]__0_d9q6w._.js +3 -0
  156. package/standalone/.next/server/chunks/{[root-of-the-server]__16u_xzt._.js → [root-of-the-server]__0_smoou._.js} +2 -2
  157. package/standalone/.next/server/chunks/{[root-of-the-server]__1pan46j._.js → [root-of-the-server]__0a61u23._.js} +1 -1
  158. package/standalone/.next/server/chunks/{[root-of-the-server]__0gm8rnl._.js → [root-of-the-server]__0a8ssv2._.js} +1 -1
  159. package/standalone/.next/server/chunks/{[root-of-the-server]__04ws4jm._.js → [root-of-the-server]__0cusg9h._.js} +1 -1
  160. package/standalone/.next/server/chunks/{[root-of-the-server]__0dfk0up._.js → [root-of-the-server]__0czmmn3._.js} +2 -2
  161. package/standalone/.next/server/chunks/{[root-of-the-server]__0gvldsm._.js → [root-of-the-server]__0d157q5._.js} +1 -1
  162. package/standalone/.next/server/chunks/[root-of-the-server]__0dq1b6t._.js +3 -0
  163. package/standalone/.next/server/chunks/[root-of-the-server]__0duw2z9._.js +3 -0
  164. package/standalone/.next/server/chunks/{[root-of-the-server]__0i8jv9o._.js → [root-of-the-server]__0f4mi_7._.js} +1 -1
  165. package/standalone/.next/server/chunks/[root-of-the-server]__0gwt8xn._.js +3 -0
  166. package/standalone/.next/server/chunks/{[root-of-the-server]__1mofk4t._.js → [root-of-the-server]__0jc7f-h._.js} +2 -2
  167. package/standalone/.next/server/chunks/{[root-of-the-server]__01k_3ze._.js → [root-of-the-server]__0ji4_aa._.js} +1 -1
  168. package/standalone/.next/server/chunks/[root-of-the-server]__0kffrvp._.js +3 -0
  169. package/standalone/.next/server/chunks/{[root-of-the-server]__1mlcdp1._.js → [root-of-the-server]__0lqruq_._.js} +1 -1
  170. package/standalone/.next/server/chunks/{[root-of-the-server]__0_yro61._.js → [root-of-the-server]__0m-o7gg._.js} +2 -2
  171. package/standalone/.next/server/chunks/[root-of-the-server]__0ny_w4c._.js +3 -0
  172. package/standalone/.next/server/chunks/[root-of-the-server]__0qay7yq._.js +3 -0
  173. package/standalone/.next/server/chunks/{[root-of-the-server]__0ksul8g._.js → [root-of-the-server]__0qpwbwq._.js} +1 -1
  174. package/standalone/.next/server/chunks/[root-of-the-server]__0r73w_w._.js +3 -0
  175. package/standalone/.next/server/chunks/[root-of-the-server]__0srh8bm._.js +3 -0
  176. package/standalone/.next/server/chunks/[root-of-the-server]__0syu0s0._.js +3 -0
  177. package/standalone/.next/server/chunks/{[root-of-the-server]__154lh-5._.js → [root-of-the-server]__0t0z79p._.js} +2 -2
  178. package/standalone/.next/server/chunks/{[root-of-the-server]__0olwy-c._.js → [root-of-the-server]__0tt2s67._.js} +1 -1
  179. package/standalone/.next/server/chunks/{[root-of-the-server]__1ric9t-._.js → [root-of-the-server]__0uz7ud6._.js} +2 -2
  180. package/standalone/.next/server/chunks/{[root-of-the-server]__0s5dxd3._.js → [root-of-the-server]__0x7nzft._.js} +1 -1
  181. package/standalone/.next/server/chunks/[root-of-the-server]__0xro-tn._.js +3 -0
  182. package/standalone/.next/server/chunks/{[root-of-the-server]__01lu84h._.js → [root-of-the-server]__10784d-._.js} +2 -2
  183. package/standalone/.next/server/chunks/[root-of-the-server]__123on-v._.js +3 -0
  184. package/standalone/.next/server/chunks/{[root-of-the-server]__1wn2s2e._.js → [root-of-the-server]__12i2_e-._.js} +2 -2
  185. package/standalone/.next/server/chunks/[root-of-the-server]__133en1z._.js +3 -0
  186. package/standalone/.next/server/chunks/[root-of-the-server]__13njn4x._.js +3 -0
  187. package/standalone/.next/server/chunks/[root-of-the-server]__145nk5b._.js +3 -0
  188. package/standalone/.next/server/chunks/[root-of-the-server]__14p-wic._.js +3 -0
  189. package/standalone/.next/server/chunks/[root-of-the-server]__14v5hwd._.js +3 -0
  190. package/standalone/.next/server/chunks/[root-of-the-server]__1549etm._.js +3 -0
  191. package/standalone/.next/server/chunks/[root-of-the-server]__15zod2l._.js +3 -0
  192. package/standalone/.next/server/chunks/{[root-of-the-server]__0xc-tua._.js → [root-of-the-server]__16lxm7i._.js} +2 -2
  193. package/standalone/.next/server/chunks/[root-of-the-server]__176ofx1._.js +3 -0
  194. package/standalone/.next/server/chunks/{[root-of-the-server]__1z2wsgn._.js → [root-of-the-server]__17yxr8i._.js} +1 -1
  195. package/standalone/.next/server/chunks/{[root-of-the-server]__1sfzs44._.js → [root-of-the-server]__18_g5so._.js} +2 -2
  196. package/standalone/.next/server/chunks/{[root-of-the-server]__0iayrsu._.js → [root-of-the-server]__198g-0l._.js} +1 -1
  197. package/standalone/.next/server/chunks/[root-of-the-server]__19n37bl._.js +3 -0
  198. package/standalone/.next/server/chunks/[root-of-the-server]__1_z0-o0._.js +3 -0
  199. package/standalone/.next/server/chunks/[root-of-the-server]__1c91-d3._.js +3 -0
  200. package/standalone/.next/server/chunks/[root-of-the-server]__1cmajoo._.js +3 -0
  201. package/standalone/.next/server/chunks/[root-of-the-server]__1cpfh84._.js +3 -0
  202. package/standalone/.next/server/chunks/[root-of-the-server]__1dn92tm._.js +3 -0
  203. package/standalone/.next/server/chunks/[root-of-the-server]__1elf__p._.js +3 -0
  204. package/standalone/.next/server/chunks/{[root-of-the-server]__0ynkv_7._.js → [root-of-the-server]__1f2c4fv._.js} +1 -1
  205. package/standalone/.next/server/chunks/[root-of-the-server]__1fnqwa3._.js +3 -0
  206. package/standalone/.next/server/chunks/[root-of-the-server]__1fumbd9._.js +3 -0
  207. package/standalone/.next/server/chunks/{[root-of-the-server]__0eaabcp._.js → [root-of-the-server]__1fwcg2w._.js} +2 -2
  208. package/standalone/.next/server/chunks/[root-of-the-server]__1gl82vr._.js +3 -0
  209. package/standalone/.next/server/chunks/{[root-of-the-server]__1f9ug94._.js → [root-of-the-server]__1j88891._.js} +1 -1
  210. package/standalone/.next/server/chunks/[root-of-the-server]__1j89nx9._.js +3 -0
  211. package/standalone/.next/server/chunks/[root-of-the-server]__1ke6fy2._.js +3 -0
  212. package/standalone/.next/server/chunks/{[root-of-the-server]__0bl-go3._.js → [root-of-the-server]__1kr6xrb._.js} +2 -2
  213. package/standalone/.next/server/chunks/[root-of-the-server]__1kvooj6._.js +3 -0
  214. package/standalone/.next/server/chunks/[root-of-the-server]__1m7y79-._.js +3 -0
  215. package/standalone/.next/server/chunks/[root-of-the-server]__1md2i2u._.js +3 -0
  216. package/standalone/.next/server/chunks/[root-of-the-server]__1mnaj5t._.js +3 -0
  217. package/standalone/.next/server/chunks/{[root-of-the-server]__1bfswt2._.js → [root-of-the-server]__1ohhyet._.js} +1 -1
  218. package/standalone/.next/server/chunks/{[root-of-the-server]__1v2l-cb._.js → [root-of-the-server]__1pf55w3._.js} +2 -2
  219. package/standalone/.next/server/chunks/[root-of-the-server]__1q247bc._.js +3 -0
  220. package/standalone/.next/server/chunks/[root-of-the-server]__1qaicnm._.js +3 -0
  221. package/standalone/.next/server/chunks/{[root-of-the-server]__15zmuuw._.js → [root-of-the-server]__1qpos_f._.js} +2 -2
  222. package/standalone/.next/server/chunks/[root-of-the-server]__1qr-aka._.js +3 -0
  223. package/standalone/.next/server/chunks/{[root-of-the-server]__0i2ljnx._.js → [root-of-the-server]__1syo7nr._.js} +2 -2
  224. package/standalone/.next/server/chunks/[root-of-the-server]__1v9n3yu._.js +3 -0
  225. package/standalone/.next/server/chunks/[root-of-the-server]__1xi2k6g._.js +3 -0
  226. package/standalone/.next/server/chunks/{[root-of-the-server]__1j0txpm._.js → [root-of-the-server]__1yta_xv._.js} +2 -2
  227. package/standalone/.next/server/chunks/[root-of-the-server]__1zadv3h._.js +3 -0
  228. package/standalone/.next/server/chunks/{[root-of-the-server]__13l3v-v._.js → [root-of-the-server]__1zdk-iw._.js} +2 -2
  229. package/standalone/.next/server/chunks/[root-of-the-server]__1zwqj_g._.js +3 -0
  230. package/standalone/.next/server/chunks/[root-of-the-server]__20rr3br._.js +3 -0
  231. package/standalone/.next/server/chunks/_00pgex-._.js +68 -66
  232. package/standalone/.next/server/chunks/_03k34hm._.js +4 -4
  233. package/standalone/.next/server/chunks/_04tltxp._.js +4 -4
  234. package/standalone/.next/server/chunks/_05ieldc._.js +4 -4
  235. package/standalone/.next/server/chunks/_0_3-lke._.js +2 -0
  236. package/standalone/.next/server/chunks/_1bpbnrs._.js +4 -4
  237. package/standalone/.next/server/chunks/_1hcmg6g._.js +4 -4
  238. package/standalone/.next/server/chunks/_1javz-p._.js +4 -4
  239. package/standalone/.next/server/chunks/_1qvlhr_._.js +4 -4
  240. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e80fhr._.js +3 -3
  241. package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__03nc3bp._.js → [root-of-the-server]__0k74961._.js} +4 -4
  242. package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__04fj378._.js → [root-of-the-server]__0tz354o._.js} +3 -3
  243. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__1i04gpy._.js +27 -0
  244. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__1wpef1o._.js +3 -0
  245. package/standalone/.next/server/chunks/ssr/_0-_e-ox._.js +1 -1
  246. package/standalone/.next/server/chunks/ssr/_0-ih50c._.js +3 -0
  247. package/standalone/.next/server/chunks/ssr/{_08lb8p6._.js → _00_gb4o._.js} +2 -2
  248. package/standalone/.next/server/chunks/ssr/_012q7w6._.js +10 -10
  249. package/standalone/.next/server/chunks/ssr/_03kzeos._.js +3 -0
  250. package/standalone/.next/server/chunks/ssr/_05ohevo._.js +1 -1
  251. package/standalone/.next/server/chunks/ssr/{_0jum_1m._.js → _0759zq8._.js} +2 -2
  252. package/standalone/.next/server/chunks/ssr/_07a5zv1._.js +3 -0
  253. package/standalone/.next/server/chunks/ssr/{_117jkyy._.js → _09wh5xv._.js} +8 -3
  254. package/standalone/.next/server/chunks/ssr/_0c7yfj8._.js +3 -0
  255. package/standalone/.next/server/chunks/ssr/{_01cun29._.js → _0cynmyr._.js} +2 -2
  256. package/standalone/.next/server/chunks/ssr/_0dir-eb._.js +34 -0
  257. package/standalone/.next/server/chunks/ssr/_0dvnys0._.js +5 -5
  258. package/standalone/.next/server/chunks/ssr/_0fha4pb._.js +1 -1
  259. package/standalone/.next/server/chunks/ssr/_0fk_1t_._.js +3 -0
  260. package/standalone/.next/server/chunks/ssr/_0k5jx04._.js +5 -5
  261. package/standalone/.next/server/chunks/ssr/_0n98rd4._.js +3 -0
  262. package/standalone/.next/server/chunks/ssr/_0nnwpvt._.js +3 -0
  263. package/standalone/.next/server/chunks/ssr/{_1c_ojfs._.js → _0pk2e_s._.js} +2 -2
  264. package/standalone/.next/server/chunks/ssr/_0pm3j9j._.js +3 -0
  265. package/standalone/.next/server/chunks/ssr/_0rcby6e._.js +5 -5
  266. package/standalone/.next/server/chunks/ssr/{_170xw1h._.js → _0rx-o1y._.js} +2 -2
  267. package/standalone/.next/server/chunks/ssr/_0ry7kff._.js +3 -0
  268. package/standalone/.next/server/chunks/ssr/_0t2jwg3._.js +31 -31
  269. package/standalone/.next/server/chunks/ssr/_0t5lgno._.js +1 -1
  270. package/standalone/.next/server/chunks/ssr/_0tc_1s_._.js +3 -0
  271. package/standalone/.next/server/chunks/ssr/{_0m5obko._.js → _0w9r25f._.js} +2 -2
  272. package/standalone/.next/server/chunks/ssr/_0ysjbys._.js +11 -0
  273. package/standalone/.next/server/chunks/ssr/_17q5b-5._.js +9 -0
  274. package/standalone/.next/server/chunks/ssr/{_1q79umx._.js → _196iuum._.js} +2 -2
  275. package/standalone/.next/server/chunks/ssr/_1bga6ml._.js +3 -0
  276. package/standalone/.next/server/chunks/ssr/_1biqcz_._.js +3 -0
  277. package/standalone/.next/server/chunks/ssr/_1bzibio._.js +31 -31
  278. package/standalone/.next/server/chunks/ssr/_1c34qp8._.js +2 -2
  279. package/standalone/.next/server/chunks/ssr/_1d-qtbz._.js +1 -1
  280. package/standalone/.next/server/chunks/ssr/{_04jk-xk._.js → _1ecln95._.js} +2 -2
  281. package/standalone/.next/server/chunks/ssr/_1eoq6hs._.js +3 -0
  282. package/standalone/.next/server/chunks/ssr/{_1zqt7an._.js → _1h2b2b5._.js} +2 -2
  283. package/standalone/.next/server/chunks/ssr/_1kwnjml._.js +34 -0
  284. package/standalone/.next/server/chunks/ssr/_1o8-fvv._.js +3 -0
  285. package/standalone/.next/server/chunks/ssr/_1pqjzks._.js +3 -0
  286. package/standalone/.next/server/chunks/ssr/{_1u7742_._.js → _1r1e3_z._.js} +2 -2
  287. package/standalone/.next/server/chunks/ssr/_1rqnk8t._.js +3 -0
  288. package/standalone/.next/server/chunks/ssr/_1sjzp8l._.js +3 -0
  289. package/standalone/.next/server/chunks/ssr/_1tmllxv._.js +24 -0
  290. package/standalone/.next/server/chunks/ssr/_1uoc7zb._.js +6 -0
  291. package/standalone/.next/server/chunks/ssr/_1xs2spu._.js +3 -3
  292. package/standalone/.next/server/chunks/ssr/_1zgu74l._.js +7 -7
  293. package/standalone/.next/server/chunks/ssr/{_0y9d64c._.js → _1zsu_6o._.js} +2 -2
  294. package/standalone/.next/server/chunks/ssr/_20pbep2._.js +2 -2
  295. package/standalone/.next/server/chunks/ssr/messages_de_json_[json]_cjs_1uig1ud._.js +1 -1
  296. package/standalone/.next/server/chunks/ssr/messages_en_json_[json]_cjs_206072-._.js +1 -1
  297. package/standalone/.next/server/chunks/ssr/messages_es_json_[json]_cjs_082yukd._.js +1 -1
  298. package/standalone/.next/server/chunks/ssr/messages_fr_json_[json]_cjs_0j6-w0i._.js +1 -1
  299. package/standalone/.next/server/chunks/ssr/node_modules_1fko13n._.js +3 -0
  300. package/standalone/.next/server/chunks/ssr/node_modules_1qembts._.js +3 -0
  301. package/standalone/.next/server/chunks/ssr/node_modules_@radix-ui_1nipfj2._.js +3 -0
  302. package/standalone/.next/server/chunks/ssr/node_modules_@radix-ui_react-popper_dist_index_mjs_0428afp._.js +3 -0
  303. package/standalone/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_icons_1b76nr4._.js → node_modules_lucide-react_dist_esm_icons_15-ly7n._.js} +2 -2
  304. package/standalone/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1ye04e4._.js +3 -0
  305. package/standalone/.next/server/chunks/ssr/src_components_agents_agent-detail_tsx_0lfa4ui._.js +16 -16
  306. package/standalone/.next/server/chunks/ssr/src_components_build-data_build-data-page_tsx_1t2rrh0._.js +11 -11
  307. package/standalone/.next/server/chunks/ssr/src_components_builds_build-detail-page_tsx_0q1lvps._.js +10 -10
  308. package/standalone/.next/server/chunks/ssr/src_components_builds_builds-page_tsx_17qzmsl._.js +8 -8
  309. package/standalone/.next/server/chunks/ssr/src_components_builds_configuration-icon_tsx_1v42ztc._.js +2 -2
  310. package/standalone/.next/server/chunks/ssr/src_components_cache-server_cache-page_tsx_0_-eo_e._.js +5 -5
  311. package/standalone/.next/server/chunks/ssr/src_components_codebases_codebase-detail-page_tsx_0qfum00._.js +11 -11
  312. package/standalone/.next/server/chunks/ssr/src_components_codebases_codebases-page_tsx_0wcj3k1._.js +10 -10
  313. package/standalone/.next/server/chunks/ssr/src_components_codebases_repository-detail-page_tsx_20_7wk_._.js +17 -17
  314. package/standalone/.next/server/chunks/ssr/src_components_devices_device-detail-page_tsx_1mut_l4._.js +7 -7
  315. package/standalone/.next/server/chunks/ssr/src_components_devices_devices-page_tsx_1y45lv2._.js +8 -8
  316. package/standalone/.next/server/chunks/ssr/src_components_github_actions-page_tsx_18434xt._.js +4 -4
  317. package/standalone/.next/server/chunks/ssr/src_components_github_pull-request-detail-page_tsx_1etlamp._.js +2 -2
  318. package/standalone/.next/server/chunks/ssr/src_components_github_pull-requests-page_tsx_1il3ga-._.js +12 -12
  319. package/standalone/.next/server/chunks/ssr/src_components_jira_cache-page_tsx_1znt1yl._.js +3 -3
  320. package/standalone/.next/server/chunks/ssr/src_components_jira_ticket-detail-page_tsx_0vmf8nk._.js +15 -15
  321. package/standalone/.next/server/chunks/ssr/src_components_jira_tickets-page_tsx_0_ocldp._.js +3 -3
  322. package/standalone/.next/server/chunks/ssr/src_components_notifications_notifications-page_tsx_19f4ztg._.js +18 -18
  323. package/standalone/.next/server/chunks/ssr/src_components_push-notifications_push-notifications-page_tsx_1c_b-t4._.js +2 -2
  324. package/standalone/.next/server/chunks/ssr/src_components_settings-page_tsx_06dxqc7._.js +31 -31
  325. package/standalone/.next/server/chunks/ssr/src_components_signing-assets_provisioning-profiles-page_tsx_1zr20o7._.js +9 -9
  326. package/standalone/.next/server/chunks/ssr/src_components_skills_skills-page_tsx_0o1nlbg._.js +3 -3
  327. package/standalone/.next/server/chunks/ssr/src_components_telemetry_telemetry-page_tsx_0yzdpy6._.js +14 -14
  328. package/standalone/.next/server/chunks/ssr/src_components_ui_date-time_tsx_0zuage9._.js +3 -0
  329. package/standalone/.next/server/chunks/ssr/src_components_worktrees_worktree-detail-page_tsx_1oexgu_._.js +4 -4
  330. package/standalone/.next/server/middleware-build-manifest.js +3 -3
  331. package/standalone/.next/server/pages/404.html +1 -1
  332. package/standalone/.next/server/pages/500.html +1 -1
  333. package/standalone/.next/server/server-reference-manifest.js +1 -1
  334. package/standalone/.next/server/server-reference-manifest.json +1 -1
  335. package/standalone/.next/static/chunks/000lif3c0zhvu.js +80 -0
  336. package/standalone/.next/static/chunks/02wsz0adffqp8.js +28 -0
  337. package/standalone/.next/static/chunks/{2mth_pn5d54qo.js → 02zr1fj6sg9gn.js} +33 -33
  338. package/standalone/.next/static/chunks/{1k02pmb5ikjwl.js → 03cte61olt23o.js} +3 -3
  339. package/standalone/.next/static/chunks/{1ezpx5-kghuo6.js → 04inif3zp27ql.js} +11 -11
  340. package/standalone/.next/static/chunks/{2qe7etuh1bwv3.js → 04twsuitu09qc.js} +1 -1
  341. package/standalone/.next/static/chunks/{1g0hwagd4q811.js → 0ejnphkok3cbc.js} +1 -1
  342. package/standalone/.next/static/chunks/0f822nit06dft.js +9 -0
  343. package/standalone/.next/static/chunks/0fovjx-g7eta0.js +65 -0
  344. package/standalone/.next/static/chunks/{0b0w_wac5cqbn.js → 0fw1be4ry6k_r.js} +2 -2
  345. package/standalone/.next/static/chunks/{1ywyjstd4f1px.js → 0ikbwsq-7rewz.js} +1 -1
  346. package/standalone/.next/static/chunks/0ir2jvw5qtwnj.js +1 -0
  347. package/standalone/.next/static/chunks/0iwqaqr66hgne.js +1 -0
  348. package/standalone/.next/static/chunks/0k8int7jsgtz3.js +30 -0
  349. package/standalone/.next/static/chunks/{2a6rrto2ktoc_.js → 0nutq5ctjfc37.js} +5 -5
  350. package/standalone/.next/static/chunks/0u2tsyv0tassx.js +12 -0
  351. package/standalone/.next/static/chunks/0xaamcimitizu.js +1 -0
  352. package/standalone/.next/static/chunks/1-_hzodjvgft7.js +1 -0
  353. package/standalone/.next/static/chunks/10xbozbf30cv-.js +1 -0
  354. package/standalone/.next/static/chunks/{0579din_nqxhf.js → 14jtogt0f0nsh.js} +3 -3
  355. package/standalone/.next/static/chunks/169-gif_99pjd.js +41 -0
  356. package/standalone/.next/static/chunks/{349ls84c4dbp9.js → 18zmneu2dpo8s.js} +3 -3
  357. package/standalone/.next/static/chunks/{3bnkoq89szbzx.js → 1a4de2uh02g6b.js} +2 -2
  358. package/standalone/.next/static/chunks/1ch1iiugfh7pr.js +1 -0
  359. package/standalone/.next/static/chunks/1edawd0o38cx6.js +28 -0
  360. package/standalone/.next/static/chunks/1gz-q30e1qzuf.js +35 -0
  361. package/standalone/.next/static/chunks/{37kyqfr93cgmv.js → 1h5cc0dmoomfs.js} +33 -33
  362. package/standalone/.next/static/chunks/1hzt4mwdfnmv2.js +33 -0
  363. package/standalone/.next/static/chunks/{2b6qj3i_of-b7.js → 1k2n9o4o5p8s6.js} +1 -1
  364. package/standalone/.next/static/chunks/1ufkqj87rj6-i.js +1 -0
  365. package/standalone/.next/static/chunks/1z77ayhor3gtg.js +36 -0
  366. package/standalone/.next/static/chunks/2-1-vmcvalx28.js +1 -0
  367. package/standalone/.next/static/chunks/{1zqoc_5v6sshl.js → 28-e9fkcgfk62.js} +11 -11
  368. package/standalone/.next/static/chunks/{3rolhb6l918f3.js → 28jwnowa-b2u5.js} +5 -5
  369. package/standalone/.next/static/chunks/2ar0jmg8yo3_q.js +13 -0
  370. package/standalone/.next/static/chunks/{0duto9u8a-gcp.js → 2f9kasslyd1ss.js} +16 -16
  371. package/standalone/.next/static/chunks/{1jtaoae30sltr.js → 2ly2npblvc-_j.js} +17 -17
  372. package/standalone/.next/static/chunks/2vv30t-8y66id.js +1 -0
  373. package/standalone/.next/static/chunks/2x3_xry-6de68.css +1 -0
  374. package/standalone/.next/static/chunks/{1nc0w3yg2nwys.js → 2y3w6cb0dlmzd.js} +5 -5
  375. package/standalone/.next/static/chunks/2yayf07873iy6.js +1 -0
  376. package/standalone/.next/static/chunks/2yfhr6so_34cy.js +33 -0
  377. package/standalone/.next/static/chunks/{1jp3oxzet05xp.js → 2zftfpd-e3i12.js} +1 -1
  378. package/standalone/.next/static/chunks/{16n8heazfxgkp.js → 2zho87usah-sc.js} +1 -1
  379. package/standalone/.next/static/chunks/2zypdpeeqzci1.js +10 -0
  380. package/standalone/.next/static/chunks/{30xpb_0lt8jpx.js → 347ov6pk6gcg2.js} +11 -11
  381. package/standalone/.next/static/chunks/36h9gn_o83hax.js +4 -0
  382. package/standalone/.next/static/chunks/{0az2qcfmxe26_.js → 377e8qofcd6up.js} +9 -9
  383. package/standalone/.next/static/chunks/388484eodm15m.js +8 -0
  384. package/standalone/.next/static/chunks/3_as3_z1u3nnb.js +1 -0
  385. package/standalone/.next/static/chunks/3_g7zsn_y38wy.js +1 -0
  386. package/standalone/.next/static/chunks/{31pn-_jxgdd7h.js → 3ajafpxyeycth.js} +5 -5
  387. package/standalone/.next/static/chunks/3bqm7ynezy7eb.js +7 -0
  388. package/standalone/.next/static/chunks/3c4-hisg3lm8z.js +9 -0
  389. package/standalone/.next/static/chunks/{1h5y3qq56veer.js → 3f6axekan26k2.js} +3 -3
  390. package/standalone/.next/static/chunks/3gx3ywvr2ggbb.js +1 -0
  391. package/standalone/.next/static/chunks/3jqmoapzyq5tx.js +8 -0
  392. package/standalone/.next/static/chunks/3llcyep7mkp-i.js +155 -0
  393. package/standalone/.next/static/chunks/{1n1t0xlcfflb5.js → 3nmfnes9vz7cm.js} +8 -8
  394. package/standalone/.next/static/chunks/{2vu5ny7yd8uz6.js → 3o31isuqgjdgf.js} +17 -17
  395. package/standalone/.next/static/chunks/3u04m_dram50f.js +1 -0
  396. package/standalone/.next/static/chunks/3y3ginr-kriqa.js +39 -0
  397. package/standalone/.next/static/chunks/{1pmegdso5i73a.js → 40f0gc3x_52ei.js} +1 -1
  398. package/standalone/.next/static/chunks/40j-6wiq8b9d7.js +1 -0
  399. package/standalone/.next/static/chunks/{3tmt2fscg4x0a.js → 44pprg5jd-0j8.js} +13 -13
  400. package/standalone/.next/server/chunks/[root-of-the-server]__0hmxoy-._.js +0 -3
  401. package/standalone/.next/server/chunks/[root-of-the-server]__0na0kf5._.js +0 -3
  402. package/standalone/.next/server/chunks/[root-of-the-server]__0o2r2g3._.js +0 -3
  403. package/standalone/.next/server/chunks/[root-of-the-server]__0qn2s4y._.js +0 -3
  404. package/standalone/.next/server/chunks/[root-of-the-server]__0s36z37._.js +0 -3
  405. package/standalone/.next/server/chunks/[root-of-the-server]__0sl88nm._.js +0 -3
  406. package/standalone/.next/server/chunks/[root-of-the-server]__0tx5g5o._.js +0 -3
  407. package/standalone/.next/server/chunks/[root-of-the-server]__0uyjad8._.js +0 -3
  408. package/standalone/.next/server/chunks/[root-of-the-server]__0vwq0xl._.js +0 -3
  409. package/standalone/.next/server/chunks/[root-of-the-server]__0wtla_4._.js +0 -3
  410. package/standalone/.next/server/chunks/[root-of-the-server]__0z-lmzl._.js +0 -3
  411. package/standalone/.next/server/chunks/[root-of-the-server]__11bmvex._.js +0 -3
  412. package/standalone/.next/server/chunks/[root-of-the-server]__11zhw_f._.js +0 -3
  413. package/standalone/.next/server/chunks/[root-of-the-server]__12yyk-v._.js +0 -3
  414. package/standalone/.next/server/chunks/[root-of-the-server]__152ip4m._.js +0 -3
  415. package/standalone/.next/server/chunks/[root-of-the-server]__1a28vw2._.js +0 -3
  416. package/standalone/.next/server/chunks/[root-of-the-server]__1bo7dgt._.js +0 -3
  417. package/standalone/.next/server/chunks/[root-of-the-server]__1bzm9rj._.js +0 -3
  418. package/standalone/.next/server/chunks/[root-of-the-server]__1dc6__1._.js +0 -3
  419. package/standalone/.next/server/chunks/[root-of-the-server]__1duupjc._.js +0 -3
  420. package/standalone/.next/server/chunks/[root-of-the-server]__1dyeloz._.js +0 -3
  421. package/standalone/.next/server/chunks/[root-of-the-server]__1e5dea0._.js +0 -3
  422. package/standalone/.next/server/chunks/[root-of-the-server]__1f4gxqa._.js +0 -3
  423. package/standalone/.next/server/chunks/[root-of-the-server]__1gejcnd._.js +0 -3
  424. package/standalone/.next/server/chunks/[root-of-the-server]__1l-0_di._.js +0 -3
  425. package/standalone/.next/server/chunks/[root-of-the-server]__1l33gc2._.js +0 -3
  426. package/standalone/.next/server/chunks/[root-of-the-server]__1nm1v2v._.js +0 -3
  427. package/standalone/.next/server/chunks/[root-of-the-server]__1nzw_pg._.js +0 -3
  428. package/standalone/.next/server/chunks/[root-of-the-server]__1o02rgu._.js +0 -3
  429. package/standalone/.next/server/chunks/[root-of-the-server]__1ofzum5._.js +0 -3
  430. package/standalone/.next/server/chunks/[root-of-the-server]__1qf_jx0._.js +0 -3
  431. package/standalone/.next/server/chunks/[root-of-the-server]__1rz3t-8._.js +0 -3
  432. package/standalone/.next/server/chunks/[root-of-the-server]__1rzexif._.js +0 -3
  433. package/standalone/.next/server/chunks/[root-of-the-server]__1s_2-hp._.js +0 -3
  434. package/standalone/.next/server/chunks/[root-of-the-server]__1tl4gde._.js +0 -3
  435. package/standalone/.next/server/chunks/[root-of-the-server]__1u283f9._.js +0 -3
  436. package/standalone/.next/server/chunks/[root-of-the-server]__1uek0dm._.js +0 -3
  437. package/standalone/.next/server/chunks/[root-of-the-server]__1v1kr7z._.js +0 -3
  438. package/standalone/.next/server/chunks/[root-of-the-server]__1vhxr5_._.js +0 -3
  439. package/standalone/.next/server/chunks/[root-of-the-server]__1w36m17._.js +0 -3
  440. package/standalone/.next/server/chunks/[root-of-the-server]__1xws3pt._.js +0 -3
  441. package/standalone/.next/server/chunks/[root-of-the-server]__1z15fu5._.js +0 -3
  442. package/standalone/.next/server/chunks/[root-of-the-server]__20gqolc._.js +0 -3
  443. package/standalone/.next/server/chunks/[root-of-the-server]__20no38f._.js +0 -3
  444. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__04beow0._.js +0 -3
  445. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0b4pivw._.js +0 -6
  446. package/standalone/.next/server/chunks/ssr/_00pb_-u._.js +0 -3
  447. package/standalone/.next/server/chunks/ssr/_08ux-xx._.js +0 -35
  448. package/standalone/.next/server/chunks/ssr/_0_c2ksk._.js +0 -3
  449. package/standalone/.next/server/chunks/ssr/_0_nha02._.js +0 -3
  450. package/standalone/.next/server/chunks/ssr/_0bpm26t._.js +0 -3
  451. package/standalone/.next/server/chunks/ssr/_0e64d91._.js +0 -3
  452. package/standalone/.next/server/chunks/ssr/_0ho0wc7._.js +0 -3
  453. package/standalone/.next/server/chunks/ssr/_0jxepjk._.js +0 -3
  454. package/standalone/.next/server/chunks/ssr/_0l6y7z2._.js +0 -3
  455. package/standalone/.next/server/chunks/ssr/_0sdizo4._.js +0 -34
  456. package/standalone/.next/server/chunks/ssr/_0zg79hi._.js +0 -3
  457. package/standalone/.next/server/chunks/ssr/_11oshuh._.js +0 -3
  458. package/standalone/.next/server/chunks/ssr/_11z-hcq._.js +0 -34
  459. package/standalone/.next/server/chunks/ssr/_123h643._.js +0 -3
  460. package/standalone/.next/server/chunks/ssr/_1cc_dsb._.js +0 -34
  461. package/standalone/.next/server/chunks/ssr/_1mke0us._.js +0 -3
  462. package/standalone/.next/server/chunks/ssr/_1qy-wes._.js +0 -3
  463. package/standalone/.next/server/chunks/ssr/_1r4w1io._.js +0 -24
  464. package/standalone/.next/server/chunks/ssr/_1upie3e._.js +0 -3
  465. package/standalone/.next/server/chunks/ssr/_1vx9bqg._.js +0 -14
  466. package/standalone/.next/server/chunks/ssr/_1wmzpjb._.js +0 -3
  467. package/standalone/.next/server/chunks/ssr/node_modules_0blr8x6._.js +0 -3
  468. package/standalone/.next/server/chunks/ssr/node_modules_0ylkf4l._.js +0 -3
  469. package/standalone/.next/server/chunks/ssr/node_modules_@radix-ui_1n5j09z._.js +0 -3
  470. package/standalone/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1_ugphm._.js +0 -3
  471. package/standalone/.next/server/chunks/ssr/src_components_ui_select_tsx_0m__-6s._.js +0 -3
  472. package/standalone/.next/static/chunks/06711eeflvyu7.js +0 -1
  473. package/standalone/.next/static/chunks/0c9r1f3che9mf.css +0 -1
  474. package/standalone/.next/static/chunks/0ddp859-x81j2.js +0 -1
  475. package/standalone/.next/static/chunks/0evao2rpxqreq.js +0 -80
  476. package/standalone/.next/static/chunks/0nt5uq75yrfm2.js +0 -13
  477. package/standalone/.next/static/chunks/0okpg2ejyn95o.js +0 -9
  478. package/standalone/.next/static/chunks/0udza_i0n8xhm.js +0 -36
  479. package/standalone/.next/static/chunks/0vtavvo7gx3rr.js +0 -33
  480. package/standalone/.next/static/chunks/0xybrwnbju35k.js +0 -41
  481. package/standalone/.next/static/chunks/0y-5_7jbnsr0m.js +0 -1
  482. package/standalone/.next/static/chunks/12qdfeyqgqh62.js +0 -1
  483. package/standalone/.next/static/chunks/193m8crej9xrt.js +0 -7
  484. package/standalone/.next/static/chunks/1nkkb5gu3-rhf.js +0 -28
  485. package/standalone/.next/static/chunks/1ny7skwqcfglg.js +0 -39
  486. package/standalone/.next/static/chunks/1qebx-2i3ao34.js +0 -28
  487. package/standalone/.next/static/chunks/1zt6tg-4jpdru.js +0 -1
  488. package/standalone/.next/static/chunks/2-5c1n7c9ncu0.js +0 -12
  489. package/standalone/.next/static/chunks/29axmq_boxoc_.js +0 -1
  490. package/standalone/.next/static/chunks/2giql1u6bn9gi.js +0 -33
  491. package/standalone/.next/static/chunks/2nco50dwradd6.js +0 -8
  492. package/standalone/.next/static/chunks/2nr9sxr9bqwin.js +0 -8
  493. package/standalone/.next/static/chunks/31_9e-uzmy7vp.js +0 -35
  494. package/standalone/.next/static/chunks/31t_wgps20fl1.js +0 -4
  495. package/standalone/.next/static/chunks/331lb29dcb1ta.js +0 -1
  496. package/standalone/.next/static/chunks/369biqq4fd0sk.js +0 -1
  497. package/standalone/.next/static/chunks/37dd1jthysw7j.js +0 -10
  498. package/standalone/.next/static/chunks/3apliool1acey.js +0 -155
  499. package/standalone/.next/static/chunks/3d95bb1fej1i5.js +0 -1
  500. package/standalone/.next/static/chunks/3eumqpi7f1fek.js +0 -30
  501. package/standalone/.next/static/chunks/3f1yh13gawn34.js +0 -1
  502. package/standalone/.next/static/chunks/3mtxpg0cke1s1.js +0 -9
  503. package/standalone/.next/static/chunks/3qovaml41zb61.js +0 -1
  504. package/standalone/.next/static/chunks/3vuv-wz2jb38o.js +0 -65
  505. package/standalone/.next/static/chunks/44sbqm3y2mvct.js +0 -1
  506. /package/standalone/.next/static/{z7DvrCFcDrWcS4YaEvaXP → CD2ohdtyd8xVfYLr1u3bY}/_buildManifest.js +0 -0
  507. /package/standalone/.next/static/{z7DvrCFcDrWcS4YaEvaXP → CD2ohdtyd8xVfYLr1u3bY}/_clientMiddlewareManifest.js +0 -0
  508. /package/standalone/.next/static/{z7DvrCFcDrWcS4YaEvaXP → CD2ohdtyd8xVfYLr1u3bY}/_ssgManifest.js +0 -0
@@ -118,7 +118,7 @@ ${A.format(e)}`.trim())}}},332410,(A,e,t)=>{"use strict";let{InvalidArgumentErro
118
118
  )
119
119
  `)}close(){this.#AZ.close()}get(A){i(A);let e=this.#A2(A);return e?{body:e.body?Buffer.from(e.body.buffer,e.body.byteOffset,e.body.byteLength):void 0,statusCode:e.statusCode,statusMessage:e.statusMessage,headers:e.headers?JSON.parse(e.headers):void 0,etag:e.etag?e.etag:void 0,vary:e.vary?JSON.parse(e.vary):void 0,cacheControlDirectives:e.cacheControlDirectives?JSON.parse(e.cacheControlDirectives):void 0,cachedAt:e.cachedAt,staleAt:e.staleAt,deleteAt:e.deleteAt}:void 0}set(A,e){i(A);let t=this.#A8(A),r=Array.isArray(e.body)?Buffer.concat(e.body):e.body,n=r?.byteLength;if(n&&n>this.#AB)return;let a=this.#A2(A,!0);a?this.#Az.run(r,e.deleteAt,e.statusCode,e.statusMessage,e.headers?JSON.stringify(e.headers):null,e.etag?e.etag:null,e.cacheControlDirectives?JSON.stringify(e.cacheControlDirectives):null,e.vary?JSON.stringify(e.vary):null,e.cachedAt,e.staleAt,a.id):(this.#Aj.run(t,A.method,r,e.deleteAt,e.statusCode,e.statusMessage,e.headers?JSON.stringify(e.headers):null,e.etag?e.etag:null,e.cacheControlDirectives?JSON.stringify(e.cacheControlDirectives):null,e.vary?JSON.stringify(e.vary):null,e.cachedAt,e.staleAt),this.#A1())}createWriteStream(A,e){i(A),a(e);let t=0,r=[],s=this;return new n({decodeStrings:!0,write(A,e,n){(t+=A.byteLength)<=s.#AB?r.push(A):this.destroy(),n()},final(t){s.set(A,{...e,body:r}),t()}})}delete(A){if("object"!=typeof A)throw TypeError(`expected key to be object, got ${typeof A}`);this.#AX.run(this.#A8(A))}#A1(){if(Number.isFinite(this.#Ah)&&this.size<=this.#Ah)return 0;{let A=this.#A$.run(Date.now()).changes;if(A)return A}{let A=this.#A4?.run(Math.max(Math.floor(.1*this.#Ah),1)).changes;if(A)return A}return 0}get size(){let{total:A}=this.#A0.get();return A}#A8(A){return`${A.origin}/${A.path}`}#A2(A,e=!1){let t=this.#A8(A),{headers:r,method:n}=A,i=this.#AW.all(t,n);if(0===i.length)return;let a=Date.now();for(let A of i){if(a>=A.deleteAt&&!e)continue;let t=!0;if(A.vary){let e=JSON.parse(A.vary);for(let A in e)if(!function(A,e){return null==A&&null==e||(null!=A||null==e)&&(null==A||null!=e)&&(Array.isArray(A)&&Array.isArray(e)?A.length===e.length&&A.every((A,t)=>A===e[t]):A===e)}(r[A],e[A])){t=!1;break}}if(t)return A}}}},761883,(A,e,t)=>{"use strict";let{kConstruct:r}=A.r(35634),{kEnumerableProperty:n}=A.r(780405),{iteratorMixin:i,isValidHeaderName:a,isValidHeaderValue:s}=A.r(359401),{webidl:o}=A.r(704143),g=A.r(57328),C=A.r(812057);function Q(A){return 10===A||13===A||9===A||32===A}function l(A){let e=0,t=A.length;for(;t>e&&Q(A.charCodeAt(t-1));)--t;for(;t>e&&Q(A.charCodeAt(e));)++e;return 0===e&&t===A.length?A:A.substring(e,t)}function I(A,e){if(Array.isArray(e))for(let t=0;t<e.length;++t){let r=e[t];if(2!==r.length)throw o.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});d(A,r[0],r[1])}else if("object"==typeof e&&null!==e){let t=Object.keys(e);for(let r=0;r<t.length;++r)d(A,t[r],e[t[r]])}else throw o.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function d(A,e,t){if(t=l(t),a(e)){if(!s(t))throw o.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header value"})}else throw o.errors.invalidArgument({prefix:"Headers.append",value:e,type:"header name"});if("immutable"===B(A))throw TypeError("immutable");return w(A).append(e,t,!1)}function E(A,e){return A[0]<e[0]?-1:1}class c{cookies=null;sortedMap;headersMap;constructor(A){A instanceof c?(this.headersMap=new Map(A.headersMap),this.sortedMap=A.sortedMap,this.cookies=null===A.cookies?null:[...A.cookies]):(this.headersMap=new Map(A),this.sortedMap=null)}contains(A,e){return this.headersMap.has(e?A:A.toLowerCase())}clear(){this.headersMap.clear(),this.sortedMap=null,this.cookies=null}append(A,e,t){this.sortedMap=null;let r=t?A:A.toLowerCase(),n=this.headersMap.get(r);if(n){let A="cookie"===r?"; ":", ";this.headersMap.set(r,{name:n.name,value:`${n.value}${A}${e}`})}else this.headersMap.set(r,{name:A,value:e});"set-cookie"===r&&(this.cookies??=[]).push(e)}set(A,e,t){this.sortedMap=null;let r=t?A:A.toLowerCase();"set-cookie"===r&&(this.cookies=[e]),this.headersMap.set(r,{name:A,value:e})}delete(A,e){this.sortedMap=null,e||(A=A.toLowerCase()),"set-cookie"===A&&(this.cookies=null),this.headersMap.delete(A)}get(A,e){return this.headersMap.get(e?A:A.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:A,1:{value:e}}of this.headersMap)yield[A,e]}get entries(){let A={};if(0!==this.headersMap.size)for(let{name:e,value:t}of this.headersMap.values())A[e]=t;return A}rawValues(){return this.headersMap.values()}get entriesList(){let A=[];if(0!==this.headersMap.size)for(let{0:e,1:{name:t,value:r}}of this.headersMap)if("set-cookie"===e)for(let e of this.cookies)A.push([t,e]);else A.push([t,r]);return A}toSortedArray(){let A=this.headersMap.size,e=Array(A);if(A<=32){if(0===A)return e;let t=this.headersMap[Symbol.iterator](),r=t.next().value;e[0]=[r[0],r[1].value],g(null!==r[1].value);for(let r=1,n=0,i=0,a=0,s=0,o,C;r<A;++r){for(C=t.next().value,g(null!==(o=e[r]=[C[0],C[1].value])[1]),a=0,i=r;a<i;)e[s=a+(i-a>>1)][0]<=o[0]?a=s+1:i=s;if(r!==s){for(n=r;n>a;)e[n]=e[--n];e[a]=o}}if(!t.next().done)throw TypeError("Unreachable");return e}{let A=0;for(let{0:t,1:{value:r}}of this.headersMap)e[A++]=[t,r],g(null!==r);return e.sort(E)}}}class h{#A3;#A5;constructor(A){if(o.util.markAsUncloneable(this),A===r)return;this.#A5=new c,this.#A3="none",void 0!==A&&I(this,A=o.converters.HeadersInit(A,"Headers constructor","init"))}append(A,e){o.brandCheck(this,h),o.argumentLengthCheck(arguments,2,"Headers.append");let t="Headers.append";return A=o.converters.ByteString(A,t,"name"),e=o.converters.ByteString(e,t,"value"),d(this,A,e)}delete(A){if(o.brandCheck(this,h),o.argumentLengthCheck(arguments,1,"Headers.delete"),!a(A=o.converters.ByteString(A,"Headers.delete","name")))throw o.errors.invalidArgument({prefix:"Headers.delete",value:A,type:"header name"});if("immutable"===this.#A3)throw TypeError("immutable");this.#A5.contains(A,!1)&&this.#A5.delete(A,!1)}get(A){o.brandCheck(this,h),o.argumentLengthCheck(arguments,1,"Headers.get");let e="Headers.get";if(!a(A=o.converters.ByteString(A,e,"name")))throw o.errors.invalidArgument({prefix:e,value:A,type:"header name"});return this.#A5.get(A,!1)}has(A){o.brandCheck(this,h),o.argumentLengthCheck(arguments,1,"Headers.has");let e="Headers.has";if(!a(A=o.converters.ByteString(A,e,"name")))throw o.errors.invalidArgument({prefix:e,value:A,type:"header name"});return this.#A5.contains(A,!1)}set(A,e){o.brandCheck(this,h),o.argumentLengthCheck(arguments,2,"Headers.set");let t="Headers.set";if(A=o.converters.ByteString(A,t,"name"),e=l(e=o.converters.ByteString(e,t,"value")),a(A)){if(!s(e))throw o.errors.invalidArgument({prefix:t,value:e,type:"header value"})}else throw o.errors.invalidArgument({prefix:t,value:A,type:"header name"});if("immutable"===this.#A3)throw TypeError("immutable");this.#A5.set(A,e,!1)}getSetCookie(){o.brandCheck(this,h);let A=this.#A5.cookies;return A?[...A]:[]}[C.inspect.custom](A,e){return e.depth??=A,`Headers ${C.formatWithOptions(e,this.#A5.entries)}`}static getHeadersGuard(A){return A.#A3}static setHeadersGuard(A,e){A.#A3=e}static getHeadersList(A){return A.#A5}static setHeadersList(A,e){A.#A5=e}}let{getHeadersGuard:B,setHeadersGuard:D,getHeadersList:w,setHeadersList:u}=h;Reflect.deleteProperty(h,"getHeadersGuard"),Reflect.deleteProperty(h,"setHeadersGuard"),Reflect.deleteProperty(h,"getHeadersList"),Reflect.deleteProperty(h,"setHeadersList"),i("Headers",h,function(A){let e=w(A);if(!e)return[];if(e.sortedMap)return e.sortedMap;let t=[],r=e.toSortedArray(),n=e.cookies;if(null===n||1===n.length)return e.sortedMap=r;for(let A=0;A<r.length;++A){let{0:e,1:i}=r[A];if("set-cookie"===e)for(let A=0;A<n.length;++A)t.push([e,n[A]]);else t.push([e,i])}return e.sortedMap=t},0,1),Object.defineProperties(h.prototype,{append:n,delete:n,get:n,has:n,set:n,getSetCookie:n,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[C.inspect.custom]:{enumerable:!1}}),o.converters.HeadersInit=function(A,e,t){if(o.util.Type(A)===o.util.Types.OBJECT){let r=Reflect.get(A,Symbol.iterator);if(!C.types.isProxy(A)&&r===h.prototype.entries)try{return w(A).entriesList}catch{}return"function"==typeof r?o.converters["sequence<sequence<ByteString>>"](A,e,t,r.bind(A)):o.converters["record<ByteString, ByteString>"](A,e,t)}throw o.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})},e.exports={fill:I,compareHeaderName:E,Headers:h,HeadersList:c,getHeadersGuard:B,setHeadersGuard:D,setHeadersList:u,getHeadersList:w}},650801,(A,e,t)=>{"use strict";let{Headers:r,HeadersList:n,fill:i,getHeadersGuard:a,setHeadersGuard:s,setHeadersList:o}=A.r(761883),{extractBody:g,cloneBody:C,mixinBody:Q,streamRegistry:l,bodyUnusable:I}=A.r(57700),d=A.r(780405),E=A.r(812057),{kEnumerableProperty:c}=d,{isValidReasonPhrase:h,isCancelled:B,isAborted:D,isErrorLike:w,environmentSettingsObject:u}=A.r(359401),{redirectStatusSet:p,nullBodyStatus:f}=A.r(719640),{webidl:y}=A.r(704143),{URLSerializer:M}=A.r(561743),{kConstruct:m}=A.r(35634),N=A.r(57328),{isomorphicEncode:S,serializeJavascriptValueToJSONString:k}=A.r(677682),U=new TextEncoder("utf-8");class F{#z;#d;static error(){return V(G(),"immutable")}static json(A,e){y.argumentLengthCheck(arguments,1,"Response.json"),null!==e&&(e=y.converters.ResponseInit(e));let t=g(U.encode(k(A))),r=V(O({}),"response");return x(r,e,{body:t[0],type:"application/json"}),r}static redirect(A,e=302){let t;y.argumentLengthCheck(arguments,1,"Response.redirect"),A=y.converters.USVString(A),e=y.converters["unsigned short"](e);try{t=new URL(A,u.settingsObject.baseUrl)}catch(e){throw TypeError(`Failed to parse URL from ${A}`,{cause:e})}if(!p.has(e))throw RangeError(`Invalid status code ${e}`);let r=V(O({}),"immutable");r.#d.status=e;let n=S(M(t));return r.#d.headersList.append("location",n,!0),r}constructor(A=null,e){if(y.util.markAsUncloneable(this),A===m)return;null!==A&&(A=y.converters.BodyInit(A,"Response","body")),e=y.converters.ResponseInit(e),this.#d=O({}),this.#z=new r(m),s(this.#z,"response"),o(this.#z,this.#d.headersList);let t=null;if(null!=A){const[e,r]=g(A);t={body:e,type:r}}x(this,e,t)}get type(){return y.brandCheck(this,F),this.#d.type}get url(){y.brandCheck(this,F);let A=this.#d.urlList,e=A[A.length-1]??null;return null===e?"":M(e,!0)}get redirected(){return y.brandCheck(this,F),this.#d.urlList.length>1}get status(){return y.brandCheck(this,F),this.#d.status}get ok(){return y.brandCheck(this,F),this.#d.status>=200&&this.#d.status<=299}get statusText(){return y.brandCheck(this,F),this.#d.statusText}get headers(){return y.brandCheck(this,F),this.#z}get body(){return y.brandCheck(this,F),this.#d.body?this.#d.body.stream:null}get bodyUsed(){return y.brandCheck(this,F),!!this.#d.body&&d.isDisturbed(this.#d.body.stream)}clone(){if(y.brandCheck(this,F),I(this.#d))throw y.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let A=L(this.#d);return 0!==this.#d.urlList.length&&this.#d.body?.stream&&l.register(this,new WeakRef(this.#d.body.stream)),V(A,a(this.#z))}[E.inspect.custom](A,e){null===e.depth&&(e.depth=2),e.colors??=!0;let t={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${E.formatWithOptions(e,t)}`}static getResponseHeaders(A){return A.#z}static setResponseHeaders(A,e){A.#z=e}static getResponseState(A){return A.#d}static setResponseState(A,e){A.#d=e}}let{getResponseHeaders:R,setResponseHeaders:T,getResponseState:b,setResponseState:H}=F;function L(A){if(A.internalResponse)return v(L(A.internalResponse),A.type);let e=O({...A,body:null});return null!=A.body&&(e.body=C(A.body)),e}function O(A){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...A,headersList:A?.headersList?new n(A?.headersList):new n,urlList:A?.urlList?[...A.urlList]:[]}}function G(A){return O({type:"error",status:0,error:w(A)?A:Error(A?String(A):A),aborted:A&&"AbortError"===A.name})}function J(A,e){return e={internalResponse:A,...e},new Proxy(A,{get:(A,t)=>t in e?e[t]:A[t],set:(A,t,r)=>(N(!(t in e)),A[t]=r,!0)})}function v(A,e){return"basic"===e?J(A,{type:"basic",headersList:A.headersList}):"cors"===e?J(A,{type:"cors",headersList:A.headersList}):"opaque"===e?J(A,{type:"opaque",urlList:[],status:0,statusText:"",body:null}):"opaqueredirect"===e?J(A,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null}):void N(!1)}function x(A,e,t){if(null!==e.status&&(e.status<200||e.status>599))throw RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in e&&null!=e.statusText&&!h(String(e.statusText)))throw TypeError("Invalid statusText");if("status"in e&&null!=e.status&&(b(A).status=e.status),"statusText"in e&&null!=e.statusText&&(b(A).statusText=e.statusText),"headers"in e&&null!=e.headers&&i(R(A),e.headers),t){if(f.includes(A.status))throw y.errors.exception({header:"Response constructor",message:`Invalid response status code ${A.status}`});b(A).body=t.body,null==t.type||b(A).headersList.contains("content-type",!0)||b(A).headersList.append("content-type",t.type,!0)}}function V(A,e){let t=new F(m);H(t,A);let n=new r(m);return T(t,n),o(n,A.headersList),s(n,e),0!==A.urlList.length&&A.body?.stream&&l.register(t,new WeakRef(A.body.stream)),t}Reflect.deleteProperty(F,"getResponseHeaders"),Reflect.deleteProperty(F,"setResponseHeaders"),Reflect.deleteProperty(F,"getResponseState"),Reflect.deleteProperty(F,"setResponseState"),Q(F,b),Object.defineProperties(F.prototype,{type:c,url:c,status:c,ok:c,redirected:c,statusText:c,headers:c,clone:c,body:c,bodyUsed:c,[Symbol.toStringTag]:{value:"Response",configurable:!0}}),Object.defineProperties(F,{json:c,redirect:c,error:c}),y.converters.XMLHttpRequestBodyInit=function(A,e,t){return"string"==typeof A?y.converters.USVString(A,e,t):y.is.Blob(A)||y.is.BufferSource(A)||y.is.FormData(A)||y.is.URLSearchParams(A)?A:y.converters.DOMString(A,e,t)},y.converters.BodyInit=function(A,e,t){return y.is.ReadableStream(A)||A?.[Symbol.asyncIterator]?A:y.converters.XMLHttpRequestBodyInit(A,e,t)},y.converters.ResponseInit=y.dictionaryConverter([{key:"status",converter:y.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:y.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:y.converters.HeadersInit}]),y.is.Response=y.util.MakeTypeAssertion(F),e.exports={isNetworkError:function(A){return"error"===A.type&&0===A.status},makeNetworkError:G,makeResponse:O,makeAppropriateNetworkError:function(A,e=null){return N(B(A)),D(A)?G(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:e})):G(Object.assign(new DOMException("Request was cancelled."),{cause:e}))},filterResponse:v,Response:F,cloneResponse:L,fromInnerResponse:V,getResponseState:b}},341716,(A,e,t)=>{"use strict";let r,{extractBody:n,mixinBody:i,cloneBody:a,bodyUnusable:s}=A.r(57700),{Headers:o,fill:g,HeadersList:C,setHeadersGuard:Q,getHeadersGuard:l,setHeadersList:I,getHeadersList:d}=A.r(761883),E=A.r(780405),c=A.r(812057),{isValidHTTPToken:h,sameOrigin:B,environmentSettingsObject:D}=A.r(359401),{forbiddenMethodsSet:w,corsSafeListedMethodsSet:u,referrerPolicy:p,requestRedirect:f,requestMode:y,requestCredentials:M,requestCache:m,requestDuplex:N}=A.r(719640),{kEnumerableProperty:S,normalizedMethodRecordsBase:k,normalizedMethodRecords:U}=E,{webidl:F}=A.r(704143),{URLSerializer:R}=A.r(561743),{kConstruct:T}=A.r(35634),b=A.r(57328),{getMaxListeners:H,setMaxListeners:L,defaultMaxListeners:O}=A.r(687769),G=Symbol("abortController"),J=new FinalizationRegistry(({signal:A,abort:e})=>{A.removeEventListener("abort",e)}),v=new WeakMap;try{r=H(new AbortController().signal)>0}catch{r=!1}function x(A){return function e(){let t=A.deref();if(void 0!==t){J.unregister(e),this.removeEventListener("abort",e),t.abort(this.reason);let A=v.get(t.signal);if(void 0!==A){if(0!==A.size){for(let e of A){let A=e.deref();void 0!==A&&A.abort(this.reason)}A.clear()}v.delete(t.signal)}}}}let V=!1;class P{#A9;#h;#z;#d;#A6=null;constructor(A,e){let t;if(F.util.markAsUncloneable(this),A===T)return;F.argumentLengthCheck(arguments,1,"Request constructor"),A=F.converters.RequestInfo(A),e=F.converters.RequestInit(e);let i=null,a=null;const l=D.settingsObject.baseUrl;let c=null;if("string"==typeof A){let t;this.#h=e.dispatcher;try{t=new URL(A,l)}catch(e){throw TypeError("Failed to parse URL from "+A,{cause:e})}if(t.username||t.password)throw TypeError("Request cannot be constructed from a URL that includes credentials: "+A);i=j({urlList:[t]}),a="cors"}else b(F.is.Request(A)),i=A.#d,c=A.#A9,this.#h=e.dispatcher||A.#h;const p=D.settingsObject.origin;let f="client";if(i.window?.constructor?.name==="EnvironmentSettingsObject"&&B(i.window,p)&&(f=i.window),null!=e.window)throw TypeError(`'window' option '${f}' must be null`);"window"in e&&(f="no-window"),i=j({method:i.method,headersList:i.headersList,unsafeRequest:i.unsafeRequest,client:D.settingsObject,window:f,priority:i.priority,origin:i.origin,referrer:i.referrer,referrerPolicy:i.referrerPolicy,mode:i.mode,credentials:i.credentials,cache:i.cache,redirect:i.redirect,integrity:i.integrity,keepalive:i.keepalive,reloadNavigation:i.reloadNavigation,historyNavigation:i.historyNavigation,urlList:[...i.urlList]});const y=0!==Object.keys(e).length;if(y&&("navigate"===i.mode&&(i.mode="same-origin"),i.reloadNavigation=!1,i.historyNavigation=!1,i.origin="client",i.referrer="client",i.referrerPolicy="",i.url=i.urlList[i.urlList.length-1],i.urlList=[i.url]),void 0!==e.referrer){const A=e.referrer;if(""===A)i.referrer="no-referrer";else{let e;try{e=new URL(A,l)}catch(e){throw TypeError(`Referrer "${A}" is not a valid URL.`,{cause:e})}"about:"===e.protocol&&"client"===e.hostname||p&&!B(e,D.settingsObject.baseUrl)?i.referrer="client":i.referrer=e}}if(void 0!==e.referrerPolicy&&(i.referrerPolicy=e.referrerPolicy),"navigate"===(t=void 0!==e.mode?e.mode:a))throw F.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(null!=t&&(i.mode=t),void 0!==e.credentials&&(i.credentials=e.credentials),void 0!==e.cache&&(i.cache=e.cache),"only-if-cached"===i.cache&&"same-origin"!==i.mode)throw TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(void 0!==e.redirect&&(i.redirect=e.redirect),null!=e.integrity&&(i.integrity=String(e.integrity)),void 0!==e.keepalive&&(i.keepalive=!!e.keepalive),void 0!==e.method){let A=e.method;const t=U[A];if(void 0!==t)i.method=t;else{if(!h(A))throw TypeError(`'${A}' is not a valid HTTP method.`);const e=A.toUpperCase();if(w.has(e))throw TypeError(`'${A}' HTTP method is unsupported.`);A=k[e]??A,i.method=A}V||"patch"!==i.method||(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),V=!0)}void 0!==e.signal&&(c=e.signal),this.#d=i;const M=new AbortController;if(this.#A9=M.signal,null!=c)if(c.aborted)M.abort(c.reason);else{this[G]=M;const A=x(new WeakRef(M));r&&H(c)===O&&L(1500,c);const e=E.addAbortListener(c,A);J.register(M,{signal:c,abort:A},A),this.#A6=()=>{J.unregister(A),e(),this.#A6=null}}if(this.#z=new o(T),I(this.#z,i.headersList),Q(this.#z,"request"),"no-cors"===t){if(!u.has(i.method))throw TypeError(`'${i.method} is unsupported in no-cors mode.`);Q(this.#z,"request-no-cors")}if(y){const A=d(this.#z),t=void 0!==e.headers?e.headers:new C(A);if(A.clear(),t instanceof C){for(const{name:e,value:r}of t.rawValues())A.append(e,r,!1);A.cookies=t.cookies}else g(this.#z,t)}const m=F.is.Request(A)?A.#d.body:null;if((null!=e.body||null!=m)&&("GET"===i.method||"HEAD"===i.method))throw TypeError("Request with GET/HEAD method cannot have body.");let N=null;if(null!=e.body){const[A,t]=n(e.body,i.keepalive);N=A,t&&!d(this.#z).contains("content-type",!0)&&this.#z.append("content-type",t,!0)}const S=N??m;if(null!=S&&null==S.source){if(null!=N&&null==e.duplex)throw TypeError("RequestInit: duplex option is required when sending a body.");if("same-origin"!==i.mode&&"cors"!==i.mode)throw TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');i.useCORSPreflightFlag=!0}let R=S;if(null==N&&null!=m){if(s(A.#d))throw TypeError("Cannot construct a Request with a Request object that has already been used.");const e=new TransformStream;m.stream.pipeThrough(e),R={source:m.source,length:m.length,stream:e.readable}}this.#d.body=R}get method(){return F.brandCheck(this,P),this.#d.method}get url(){return F.brandCheck(this,P),R(this.#d.url)}get headers(){return F.brandCheck(this,P),this.#z}get destination(){return F.brandCheck(this,P),this.#d.destination}get referrer(){return(F.brandCheck(this,P),"no-referrer"===this.#d.referrer)?"":"client"===this.#d.referrer?"about:client":this.#d.referrer.toString()}get referrerPolicy(){return F.brandCheck(this,P),this.#d.referrerPolicy}get mode(){return F.brandCheck(this,P),this.#d.mode}get credentials(){return F.brandCheck(this,P),this.#d.credentials}get cache(){return F.brandCheck(this,P),this.#d.cache}get redirect(){return F.brandCheck(this,P),this.#d.redirect}get integrity(){return F.brandCheck(this,P),this.#d.integrity}get keepalive(){return F.brandCheck(this,P),this.#d.keepalive}get isReloadNavigation(){return F.brandCheck(this,P),this.#d.reloadNavigation}get isHistoryNavigation(){return F.brandCheck(this,P),this.#d.historyNavigation}get signal(){return F.brandCheck(this,P),this.#A9}get body(){return F.brandCheck(this,P),this.#d.body?this.#d.body.stream:null}get bodyUsed(){return F.brandCheck(this,P),!!this.#d.body&&E.isDisturbed(this.#d.body.stream)}get duplex(){return F.brandCheck(this,P),"half"}clone(){if(F.brandCheck(this,P),s(this.#d))throw TypeError("unusable");let A=$(this.#d),e=new AbortController;if(this.signal.aborted)e.abort(this.signal.reason);else{let A=v.get(this.signal);void 0===A&&(A=new Set,v.set(this.signal,A));let t=new WeakRef(e);A.add(t),E.addAbortListener(e.signal,x(t))}return X(A,this.#h,e.signal,l(this.#z))}[c.inspect.custom](A,e){null===e.depth&&(e.depth=2),e.colors??=!0;let t={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${c.formatWithOptions(e,t)}`}static setRequestSignal(A,e){return A.#A9=e,A}static getRequestDispatcher(A){return A.#h}static setRequestDispatcher(A,e){A.#h=e}static setRequestHeaders(A,e){A.#z=e}static getRequestState(A){return A.#d}static setRequestState(A,e){A.#d=e}static removeRequestAbortListener(A){A.#A6?.()}}let{setRequestSignal:Y,getRequestDispatcher:_,setRequestDispatcher:K,setRequestHeaders:q,getRequestState:Z,setRequestState:W,removeRequestAbortListener:z}=P;function j(A){return{method:A.method??"GET",localURLsOnly:A.localURLsOnly??!1,unsafeRequest:A.unsafeRequest??!1,body:A.body??null,client:A.client??null,reservedClient:A.reservedClient??null,replacesClientId:A.replacesClientId??"",window:A.window??"client",keepalive:A.keepalive??!1,serviceWorkers:A.serviceWorkers??"all",initiator:A.initiator??"",destination:A.destination??"",priority:A.priority??null,origin:A.origin??"client",policyContainer:A.policyContainer??"client",referrer:A.referrer??"client",referrerPolicy:A.referrerPolicy??"",mode:A.mode??"no-cors",useCORSPreflightFlag:A.useCORSPreflightFlag??!1,credentials:A.credentials??"same-origin",useCredentials:A.useCredentials??!1,cache:A.cache??"default",redirect:A.redirect??"follow",integrity:A.integrity??"",cryptoGraphicsNonceMetadata:A.cryptoGraphicsNonceMetadata??"",parserMetadata:A.parserMetadata??"",reloadNavigation:A.reloadNavigation??!1,historyNavigation:A.historyNavigation??!1,userActivation:A.userActivation??!1,taintedOrigin:A.taintedOrigin??!1,redirectCount:A.redirectCount??0,responseTainting:A.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:A.preventNoCacheCacheControlHeaderModification??!1,done:A.done??!1,timingAllowFailed:A.timingAllowFailed??!1,useURLCredentials:A.useURLCredentials??void 0,traversableForUserPrompts:A.traversableForUserPrompts??"client",urlList:A.urlList,url:A.urlList[0],headersList:A.headersList?new C(A.headersList):new C}}function $(A){let e=j({...A,body:null});return null!=A.body&&(e.body=a(A.body)),e}function X(A,e,t,r){let n=new P(T);W(n,A),K(n,e),Y(n,t);let i=new o(T);return q(n,i),I(i,A.headersList),Q(i,r),n}Reflect.deleteProperty(P,"setRequestSignal"),Reflect.deleteProperty(P,"getRequestDispatcher"),Reflect.deleteProperty(P,"setRequestDispatcher"),Reflect.deleteProperty(P,"setRequestHeaders"),Reflect.deleteProperty(P,"getRequestState"),Reflect.deleteProperty(P,"setRequestState"),Reflect.deleteProperty(P,"removeRequestAbortListener"),i(P,Z),Object.defineProperties(P.prototype,{method:S,url:S,headers:S,redirect:S,clone:S,signal:S,duplex:S,destination:S,body:S,bodyUsed:S,isHistoryNavigation:S,isReloadNavigation:S,keepalive:S,integrity:S,cache:S,credentials:S,attribute:S,referrerPolicy:S,referrer:S,mode:S,[Symbol.toStringTag]:{value:"Request",configurable:!0}}),F.is.Request=F.util.MakeTypeAssertion(P),F.converters.RequestInfo=function(A){return"string"==typeof A?F.converters.USVString(A):F.is.Request(A)?A:F.converters.USVString(A)},F.converters.RequestInit=F.dictionaryConverter([{key:"method",converter:F.converters.ByteString},{key:"headers",converter:F.converters.HeadersInit},{key:"body",converter:F.nullableConverter(F.converters.BodyInit)},{key:"referrer",converter:F.converters.USVString},{key:"referrerPolicy",converter:F.converters.DOMString,allowedValues:p},{key:"mode",converter:F.converters.DOMString,allowedValues:y},{key:"credentials",converter:F.converters.DOMString,allowedValues:M},{key:"cache",converter:F.converters.DOMString,allowedValues:m},{key:"redirect",converter:F.converters.DOMString,allowedValues:f},{key:"integrity",converter:F.converters.DOMString},{key:"keepalive",converter:F.converters.boolean},{key:"signal",converter:F.nullableConverter(A=>F.converters.AbortSignal(A,"RequestInit","signal"))},{key:"window",converter:F.converters.any},{key:"duplex",converter:F.converters.DOMString,allowedValues:N},{key:"dispatcher",converter:F.converters.any},{key:"priority",converter:F.converters.DOMString,allowedValues:["high","low","auto"],defaultValue:()=>"auto"}]),e.exports={Request:P,makeRequest:j,fromInnerRequest:X,cloneRequest:$,getRequestDispatcher:_,getRequestState:Z,removeRequestAbortListener:z}},188014,(A,e,t)=>{"use strict";let r,n=A.r(57328),{runtimeFeatures:i}=A.r(509849),a=new Map([["sha256",0],["sha384",1],["sha512",2]]);if(i.has("crypto")){let e=(r=A.r(666680)).getHashes();for(let A of(0===e.length&&a.clear(),a.keys()))!1===e.includes(A)&&a.delete(A)}else a.clear();let s=Map.prototype.get.bind(a),o=Map.prototype.has.bind(a),g=!1===i.has("crypto")||0===a.size?()=>!0:(A,e)=>{let t=Q(e);if(0===t.length)return!0;for(let e of C(t)){let t=e.alg,r=e.val;if(I(l(t,A),r))return!0}return!1};function C(A){let e=[],t=null;for(let r of A){if(n(o(r.alg),"Invalid SRI hash algorithm token"),0===e.length){e.push(r),t=r;continue}let A=s(t.alg),i=s(r.alg);i<A||(i>A?(t=r,e[0]=r,e.length=1):e.push(r))}return e}function Q(A){let e=[];for(let t of A.split(" ")){let A=t.split("?",1)[0],r="",n=[A.slice(0,6),A.slice(7)],i=n[0];if(!o(i))continue;n[1]&&(r=n[1]);let a={alg:i,val:r};e.push(a)}return e}let l=(A,e)=>r.hash(A,e,"base64");function I(A,e){let t=A.length;0!==t&&"="===A[t-1]&&(t-=1),0!==t&&"="===A[t-1]&&(t-=1);let r=e.length;if(0!==r&&"="===e[r-1]&&(r-=1),0!==r&&"="===e[r-1]&&(r-=1),t!==r)return!1;for(let r=0;r<t;++r)if(A[r]!==e[r]&&("+"!==A[r]||"-"!==e[r])&&("/"!==A[r]||"_"!==e[r]))return!1;return!0}e.exports={applyAlgorithmToBytes:l,bytesMatch:g,caseSensitiveMatch:I,isValidSRIHashAlgorithm:o,getStrongestMetadata:C,parseMetadata:Q}},817906,(A,e,t)=>{"use strict";let r,{makeNetworkError:n,makeAppropriateNetworkError:i,filterResponse:a,makeResponse:s,fromInnerResponse:o,getResponseState:g}=A.r(650801),{HeadersList:C}=A.r(761883),{Request:Q,cloneRequest:l,getRequestDispatcher:I,getRequestState:d,removeRequestAbortListener:E}=A.r(341716),c=A.r(727028),{makePolicyContainer:h,clonePolicyContainer:B,requestBadPort:D,TAOCheck:w,appendRequestOriginHeader:u,responseLocationURL:p,requestCurrentURL:f,setRequestReferrerPolicyOnRedirect:y,tryUpgradeRequestToAPotentiallyTrustworthyURL:M,createOpaqueTimingInfo:m,appendFetchMetadata:N,corsCheck:S,crossOriginResourcePolicyCheck:k,determineRequestsReferrer:U,coarsenedSharedCurrentTime:F,sameOrigin:R,isCancelled:T,isAborted:b,isErrorLike:H,fullyReadBody:L,readableStreamClose:O,urlIsLocal:G,urlIsHttpHttpsScheme:J,urlHasHttpsScheme:v,clampAndCoarsenConnectionTimingInfo:x,simpleRangeHeaderValue:V,buildContentRange:P,createInflate:Y,extractMimeType:_,hasAuthenticationEntry:K,includesCredentials:q,isTraversableNavigable:Z}=A.r(359401),W=A.r(57328),{safelyExtractBody:z,extractBody:j}=A.r(57700),{redirectStatusSet:$,nullBodyStatus:X,safeMethodsSet:AA,requestBodyHeader:Ae,subresourceSet:At}=A.r(719640),Ar=A.r(687769),{Readable:An,pipeline:Ai,finished:Aa,isErrored:As,isReadable:Ao}=A.r(81111),{addAbortListener:Ag,bufferToLowerCasedHeaderName:AC}=A.r(780405),{dataURLProcessor:AQ,serializeAMimeType:Al,minimizeSupportedMimeType:AI}=A.r(561743),{getGlobalDispatcher:Ad}=A.r(403264),{webidl:AE}=A.r(704143),{STATUS_CODES:Ac}=A.r(347299),{bytesMatch:Ah}=A.r(188014),{isomorphicEncode:AB}=A.r(677682),AD=["GET","HEAD"],Aw="u">typeof __UNDICI_IS_NODE__||"u">typeof esbuildDetection?"node":"undici";function Au(A,e,t){if(Array.isArray(t)){for(let e=0;e<t.length;e+=2){let r=AC(t[e]),n=t[e+1];if(Array.isArray(n)&&!Buffer.isBuffer(n))for(let e of n)A.append(r,e.toString("latin1"),!0);else A.append(r,n.toString("latin1"),!0)}return}for(let[t,r]of Object.entries(e??{}))if(Array.isArray(r))for(let e of r)A.append(t,`${e}`,!0);else A.append(t,`${r}`,!0)}class Ap extends Ar{constructor(A){super(),this.dispatcher=A,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(A){"ongoing"===this.state&&(this.state="terminated",this.connection?.destroy(A),this.emit("terminated",A))}abort(A){"ongoing"===this.state&&(this.state="aborted",A||(A=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=A,this.connection?.destroy(A),this.emit("terminated",A))}}function Af(A,e="other"){if("error"===A.type&&A.aborted||!A.urlList?.length)return;let t=A.urlList[0],r=A.timingInfo,n=A.cacheState;J(t)&&null!==r&&(A.timingAllowPassed||(r=m({startTime:r.startTime}),n=""),r.endTime=F(),A.timingInfo=r,Ay(r,t.href,e,globalThis,n,"",A.status))}let Ay=performance.markResourceTiming;function AM(A,e,t,r,n){if(A&&A.reject(r),e.body?.stream!=null&&Ao(e.body.stream)&&e.body.stream.cancel(r).catch(A=>{if("ERR_INVALID_STATE"!==A.code)throw A}),null==t)return;let i=g(t);i.body?.stream!=null&&Ao(i.body.stream)&&n.error(r)}function Am({request:A,processRequestBodyChunkLength:e,processRequestEndOfBody:t,processResponse:r,processResponseEndOfBody:n,processResponseConsumeBody:i,useParallelQueue:a=!1,dispatcher:s=Ad(),requestObject:o=null}){W(s);let g=null,C=!1;null!=A.client&&(g=A.client.globalObject,C=A.client.crossOriginIsolatedCapability);let Q=m({startTime:F(C)}),l={controller:new Ap(s),request:A,timingInfo:Q,processRequestBodyChunkLength:e,processRequestEndOfBody:t,processResponse:r,processResponseConsumeBody:i,processResponseEndOfBody:n,taskDestination:g,crossOriginIsolatedCapability:C,requestObject:o};return W(!A.body||A.body.stream),"client"===A.window&&(A.window=A.client?.globalObject?.constructor?.name==="Window"?A.client:"no-window"),"client"===A.origin&&(A.origin=A.client.origin),"client"===A.policyContainer&&(null!=A.client?A.policyContainer=B(A.client.policyContainer):A.policyContainer=h()),A.headersList.contains("accept",!0)||A.headersList.append("accept","*/*",!0),A.headersList.contains("accept-language",!0)||A.headersList.append("accept-language","*",!0),A.priority,At.has(A.destination),AN(l,!1),l.controller}async function AN(A,e){try{let t=A.request,r=null;if(t.localURLsOnly&&!G(f(t))&&(r=n("local URLs only")),M(t),"blocked"===D(t)&&(r=n("bad port")),""===t.referrerPolicy&&(t.referrerPolicy=t.policyContainer.referrerPolicy),"no-referrer"!==t.referrer&&(t.referrer=U(t)),null===r){let e=f(t);R(e,t.url)&&"basic"===t.responseTainting||"data:"===e.protocol||"navigate"===t.mode||"websocket"===t.mode?(t.responseTainting="basic",r=await AS(A)):"same-origin"===t.mode?r=n('request mode cannot be "same-origin"'):"no-cors"===t.mode?"follow"!==t.redirect?r=n('redirect mode cannot be "follow" for "no-cors" request'):(t.responseTainting="opaque",r=await AS(A)):J(f(t))?(t.responseTainting="cors",r=await AU(A)):r=n("URL scheme must be a HTTP(S) scheme")}if(e)return r;0===r.status||r.internalResponse||(t.responseTainting,"basic"===t.responseTainting?r=a(r,"basic"):"cors"===t.responseTainting?r=a(r,"cors"):"opaque"===t.responseTainting?r=a(r,"opaque"):W(!1));let i=0===r.status?r:r.internalResponse;if(0===i.urlList.length&&i.urlList.push(...t.urlList),t.timingAllowFailed||(r.timingAllowPassed=!0),"opaque"===r.type&&206===i.status&&i.rangeRequested&&!t.headers.contains("range",!0)&&(r=i=n()),0!==r.status&&("HEAD"===t.method||"CONNECT"===t.method||X.includes(i.status))&&(i.body=null,A.controller.dump=!0),t.integrity){let e=e=>Ak(A,n(e));if("opaque"===t.responseTainting||null==r.body)return void e(r.error);L(r.body,n=>{Ah(n,t.integrity)?(r.body=z(n)[0],Ak(A,r)):e("integrity mismatch")},e)}else Ak(A,r)}catch(e){A.controller.terminate(e)}}function AS(e){if(T(e)&&0===e.request.redirectCount)return Promise.resolve(i(e));let{request:t}=e,{protocol:a}=f(t);switch(a){case"about:":return Promise.resolve(n("about scheme is not supported"));case"blob:":{r||(r=A.r(951615).resolveObjectURL);let e=f(t);if(0!==e.search.length)return Promise.resolve(n("NetworkError when attempting to fetch resource."));let i=r(e.toString());if("GET"!==t.method||!AE.is.Blob(i))return Promise.resolve(n("invalid method"));let a=s(),o=i.size,g=AB(`${o}`),C=i.type;if(t.headersList.contains("range",!0)){a.rangeRequested=!0;let A=V(t.headersList.get("range",!0),!0);if("failure"===A)return Promise.resolve(n("failed to fetch the data URL"));let{rangeStartValue:e,rangeEndValue:r}=A;if(null===e)r=(e=o-r)+r-1;else{if(e>=o)return Promise.resolve(n("Range start is greater than the blob's size."));(null===r||r>=o)&&(r=o-1)}let s=i.slice(e,r+1,C);a.body=j(s)[0];let g=AB(`${s.size}`),Q=P(e,r,o);a.status=206,a.statusText="Partial Content",a.headersList.set("content-length",g,!0),a.headersList.set("content-type",C,!0),a.headersList.set("content-range",Q,!0)}else{let A=j(i);a.statusText="OK",a.body=A[0],a.headersList.set("content-length",g,!0),a.headersList.set("content-type",C,!0)}return Promise.resolve(a)}case"data:":{let A=AQ(f(t));if("failure"===A)return Promise.resolve(n("failed to fetch the data URL"));return Promise.resolve(s({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:Al(A.mimeType)}]],body:z(A.body)[0]}))}case"file:":return Promise.resolve(n("not implemented... yet..."));case"http:":case"https:":return AU(e).catch(A=>n(A));default:return Promise.resolve(n("unknown scheme"))}}function Ak(A,e){let t=A.timingInfo,r=()=>{let r=Date.now();"document"===A.request.destination&&(A.controller.fullTimingInfo=t),A.controller.reportTimingSteps=()=>{if(!J(A.request.url))return;t.endTime=r;let n=e.cacheState,i=e.bodyInfo;e.timingAllowPassed||(t=m(t),n="");let a=0;if("navigate"!==A.request.mode||!e.hasCrossOriginRedirects){a=e.status;let A=_(e.headersList);"failure"!==A&&(i.contentType=AI(A))}null!=A.request.initiatorType&&Ay(t,A.request.url.href,A.request.initiatorType,globalThis,n,i,a)},queueMicrotask(()=>void(A.request.done=!0,null!=A.processResponseEndOfBody&&queueMicrotask(()=>A.processResponseEndOfBody(e)),null!=A.request.initiatorType&&A.controller.reportTimingSteps()))};null!=A.processResponse&&queueMicrotask(()=>{A.processResponse(e),A.processResponse=null});let n="error"===e.type?e:e.internalResponse??e;null==n.body?r():Aa(n.body.stream,()=>{r()})}async function AU(A){let e=A.request,t=null,r=null,i=A.timingInfo;if(e.serviceWorkers,null===t){if("follow"===e.redirect&&(e.serviceWorkers="none"),r=t=await AF(A),"cors"===e.responseTainting&&"failure"===S(e,t))return n("cors failure");"failure"===w(e,t)&&(e.timingAllowFailed=!0)}return("opaque"===e.responseTainting||"opaque"===t.type)&&"blocked"===k(e.origin,e.client,e.destination,r)?n("blocked"):($.has(r.status)&&("manual"!==e.redirect&&A.controller.connection.destroy(void 0,!1),"error"===e.redirect?t=n("unexpected redirect"):"manual"===e.redirect?t=r:"follow"===e.redirect?t=await function(A,e){let t,r=A.request,i=e.internalResponse?e.internalResponse:e;try{if(t=p(i,f(r).hash),null==t)return e}catch(A){return Promise.resolve(n(A))}if(!J(t))return Promise.resolve(n("URL scheme must be a HTTP(S) scheme"));if(20===r.redirectCount)return Promise.resolve(n("redirect count exceeded"));if(r.redirectCount+=1,"cors"===r.mode&&(t.username||t.password)&&!R(r,t))return Promise.resolve(n('cross origin not allowed for request mode "cors"'));if("cors"===r.responseTainting&&(t.username||t.password))return Promise.resolve(n('URL cannot contain credentials for request mode "cors"'));if(303!==i.status&&null!=r.body&&null==r.body.source)return Promise.resolve(n());if([301,302].includes(i.status)&&"POST"===r.method||303===i.status&&!AD.includes(r.method))for(let A of(r.method="GET",r.body=null,Ae))r.headersList.delete(A);R(f(r),t)||(r.headersList.delete("authorization",!0),r.headersList.delete("proxy-authorization",!0),r.headersList.delete("cookie",!0),r.headersList.delete("host",!0)),null!=r.body&&(W(null!=r.body.source),r.body=z(r.body.source)[0]);let a=A.timingInfo;return a.redirectEndTime=a.postRedirectStartTime=F(A.crossOriginIsolatedCapability),0===a.redirectStartTime&&(a.redirectStartTime=a.startTime),r.urlList.push(t),y(r,i),AN(A,!0)}(A,t):W(!1)),t.timingInfo=i,t)}async function AF(A,e=!1,t=!1){let r=A.request,a=null,s=null,o=null;"no-window"===r.window&&"error"===r.redirect?(a=A,s=r):(r.body?.source!=null?s=l(r):(s=l({...r,body:null})).body=r.body,(a={...A}).request=s);let g="include"===r.credentials||"same-origin"===r.credentials&&"basic"===r.responseTainting,C=s.body?s.body.length:null,Q=null;if(null==s.body&&["POST","PUT"].includes(s.method)&&(Q="0"),null!=C&&(Q=AB(`${C}`)),null==Q||s.headersList.contains("content-length",!0)||s.headersList.append("content-length",Q,!0),null!=C&&s.keepalive,AE.is.URL(s.referrer)&&s.headersList.append("referer",AB(s.referrer.href),!0),u(s),N(s),s.headersList.contains("user-agent",!0)||s.headersList.append("user-agent",Aw,!0),"default"===s.cache&&(s.headersList.contains("if-modified-since",!0)||s.headersList.contains("if-none-match",!0)||s.headersList.contains("if-unmodified-since",!0)||s.headersList.contains("if-match",!0)||s.headersList.contains("if-range",!0))&&(s.cache="no-store"),"no-cache"!==s.cache||s.preventNoCacheCacheControlHeaderModification||s.headersList.contains("cache-control",!0)||s.headersList.append("cache-control","max-age=0",!0),("no-store"===s.cache||"reload"===s.cache)&&(s.headersList.contains("pragma",!0)||s.headersList.append("pragma","no-cache",!0),s.headersList.contains("cache-control",!0)||s.headersList.append("cache-control","no-cache",!0)),s.headersList.contains("range",!0)&&s.headersList.append("accept-encoding","identity",!0),s.headersList.contains("accept-encoding",!0)||(v(f(s))?s.headersList.append("accept-encoding","br, gzip, deflate, zstd",!0):s.headersList.append("accept-encoding","gzip, deflate",!0)),s.headersList.delete("host",!0),g&&!s.headersList.contains("authorization",!0)){let A=null;if(K(s)&&(void 0===s.useURLCredentials||!q(f(s))));else if(q(f(s))&&e){let{username:e,password:t}=f(s);A=`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}null!==A&&s.headersList.append("Authorization",A,!1)}if(s.cache="no-store","no-store"!==s.cache&&s.cache,null==o){if("only-if-cached"===s.cache)return n("only if cached");let A=await AR(a,g,t);!AA.has(s.method)&&A.status>=200&&A.status,null==o&&(o=A)}if(o.urlList=[...s.urlList],s.headersList.contains("range",!0)&&(o.rangeRequested=!0),o.requestIncludesCredentials=g,401===o.status&&"cors"!==s.responseTainting&&g&&(void 0!==r.useURLCredentials||Z(r.traversableForUserPrompts))){if(null!=r.body){if(null==r.body.source)return o;r.body=z(r.body.source)[0]}if(void 0===r.useURLCredentials||e)return T(A)?i(A):o;A.controller.connection.destroy(),o=await AF(A,!0)}if(407===o.status)return"no-window"===r.window?n():T(A)?i(A):n("proxy authentication required");if(421===o.status&&!t&&(null==r.body||null!=r.body.source)){if(T(A))return i(A);A.controller.connection.destroy(),o=await AF(A,e,!0)}return o}async function AR(A,e=!1,t=!1){W(!A.controller.connection||A.controller.connection.destroyed),A.controller.connection={abort:null,destroyed:!1,destroy(A,e=!0){!this.destroyed&&(this.destroyed=!0,e&&this.abort?.(A??new DOMException("The operation was aborted.","AbortError")))}};let r=A.request,a=null,o=A.timingInfo;r.cache="no-store",r.mode;let g=null;if(null==r.body&&A.processRequestEndOfBody)queueMicrotask(()=>A.processRequestEndOfBody());else if(null!=r.body){let e=async function*(e){T(A)||(yield e,A.processRequestBodyChunkLength?.(e.byteLength))};g=async function*(){try{for await(let A of r.body.stream)yield*e(A);!T(A)&&A.processRequestEndOfBody&&A.processRequestEndOfBody()}catch(e){T(A)||("AbortError"===e.name?A.controller.abort():A.controller.terminate(e))}}()}try{let{body:e,status:t,statusText:n,headersList:i,socket:Q}=await function({body:e}){let t=f(r),n=A.controller.dispatcher,i=t.pathname+t.search,a=0===t.search.length&&"?"===t.href[t.href.length-t.hash.length-1];return function e(s,g){return new Promise((Q,l)=>n.dispatch({path:a?`${i}?`:i,origin:t.origin,method:r.method,body:n.isMockActive?r.body&&(r.body.source||r.body.stream):s,__mockAgentBodyForDispatch:s,headers:r.headersList.entries,maxRedirections:0,upgrade:"websocket"===r.mode?"websocket":void 0,...!1===g?{allowH2:g}:null},{body:null,abort:null,onRequestStart(e){let{connection:t}=A.controller;o.finalConnectionTimingInfo=x(void 0,o.postRedirectStartTime,A.crossOriginIsolatedCapability);let r=A=>e.abort(A);t.destroyed?r(new DOMException("The operation was aborted.","AbortError")):(A.controller.on("terminated",r),this.abort=t.abort=r),o.finalNetworkRequestStartTime=F(A.crossOriginIsolatedCapability)},onResponseStarted(){o.finalNetworkResponseStartTime=F(A.crossOriginIsolatedCapability)},onResponseStart(A,e,t,n){if(e<200)return;let i=A?.rawHeaders??[],a=new C;Au(a,t,i);let s=a.get("location",!0);this.body=new An({read:()=>A.resume()});let o=s&&"follow"===r.redirect&&$.has(e),g=[];if("HEAD"!==r.method&&"CONNECT"!==r.method&&!X.includes(e)&&!o){let A=a.get("content-encoding",!0),e=A?A.toLowerCase().split(","):[];if(e.length>5)return void l(Error(`too many content-encodings in response: ${e.length}, maximum allowed is 5`));for(let A=e.length-1;A>=0;--A){let t=e[A].trim();if("x-gzip"===t||"gzip"===t)g.push(c.createGunzip({flush:c.constants.Z_SYNC_FLUSH,finishFlush:c.constants.Z_SYNC_FLUSH}));else if("deflate"===t)g.push(Y({flush:c.constants.Z_SYNC_FLUSH,finishFlush:c.constants.Z_SYNC_FLUSH}));else if("br"===t)g.push(c.createBrotliDecompress({flush:c.constants.BROTLI_OPERATION_FLUSH,finishFlush:c.constants.BROTLI_OPERATION_FLUSH}));else if("zstd"===t)g.push(c.createZstdDecompress({flush:c.constants.ZSTD_e_continue,finishFlush:c.constants.ZSTD_e_end}));else{g.length=0;break}}}let I=e=>this.onResponseError(A,e);Q({status:e,statusText:n,headersList:a,body:g.length?Ai(this.body,...g,e=>{e&&this.onResponseError(A,e)}).on("error",I):this.body.on("error",I)})},onResponseData(e,t){A.controller.dump||(o.encodedBodySize+=t.byteLength,!1===this.body.push(t)&&e.pause())},onResponseEnd(){this.abort&&A.controller.off("terminated",this.abort),A.controller.ended=!0,this.body?.push(null)},onResponseError(t,n){(this.abort&&A.controller.off("terminated",this.abort),"websocket"===r.mode&&!1!==g&&n?.code==="UND_ERR_INFO"&&n?.message==="HTTP/2: Extended CONNECT protocol not supported by server")?Q(e(s,!1)):(this.body?.destroy(n),A.controller.terminate(n),l(n))},onRequestUpgrade(A,e,t,r){if(null!=r.session&&200!==e||null==r.session&&101!==e)return!1;let n=A?.rawHeaders??[],i=new C;return Au(i,t,n),Q({status:e,statusText:Ac[e],headersList:i,socket:r}),!0}}))}(e)}({body:g});if(Q)a=s({status:t,statusText:n,headersList:i,socket:Q});else{let r=e[Symbol.asyncIterator]();A.controller.next=()=>r.next(),a=s({status:t,statusText:n,headersList:i})}}catch(e){if("AbortError"===e.name)return A.controller.connection.destroy(),i(A,e);return n(e)}let Q=new ReadableStream({start(e){A.controller.controller=e},pull:()=>A.controller.resume(),cancel:e=>{T(A)||A.controller.abort(e)},type:"bytes"});return a.body={stream:Q,source:null,length:null},A.controller.resume||A.controller.on("terminated",function(e){b(A)?(a.aborted=!0,Ao(Q)&&A.controller.controller.error(A.controller.serializedAbortReason)):Ao(Q)&&A.controller.controller.error(TypeError("terminated",{cause:H(e)?e:void 0})),A.controller.connection.destroy()}),A.controller.resume=async()=>{for(;;){let e,t;try{let{done:t,value:r}=await A.controller.next();if(b(A))break;e=t?void 0:r}catch(r){A.controller.ended&&!o.encodedBodySize?e=void 0:(e=r,t=!0)}if(void 0===e){O(A.controller.controller),function(A,e){A.request.done=!0,null!=A.processResponseDone&&queueMicrotask(()=>A.processResponseDone(e))}(A,a);return}if(o.decodedBodySize+=e?.byteLength??0,t)return void A.controller.terminate(e);let r=new Uint8Array(e);if(r.byteLength&&A.controller.controller.enqueue(r),As(Q))return void A.controller.terminate();if(A.controller.controller.desiredSize<=0)return}},a}e.exports={fetch:function(A,e){let t;AE.argumentLengthCheck(arguments,1,"globalThis.fetch");let r=Promise.withResolvers();try{t=new Q(A,e)}catch(A){return r.reject(A),r.promise}let n=d(t);if(t.signal.aborted)return AM(r,n,null,t.signal.reason,null),r.promise;let i=n.client.globalObject;i?.constructor?.name==="ServiceWorkerGlobalScope"&&(n.serviceWorkers="none");let a=null,s=!1,g=null,C=Ag(t.signal,()=>{s=!0,W(null!=g),g.abort(t.signal.reason);let A=a?.deref();AM(r,n,A,t.signal.reason,g.controller)}),l=()=>{C(),E(t)};return g=Am({request:n,processResponseEndOfBody:A=>{Af(A,"fetch"),l()},processResponse:A=>{if(!s){if(A.aborted){AM(r,n,a,g.serializedAbortReason,g.controller),l();return}if("error"===A.type){r.reject(TypeError("fetch failed",{cause:A.error})),l();return}a=new WeakRef(o(A,"immutable")),r.resolve(a.deref()),r=null}},dispatcher:I(t),requestObject:t}),r.promise},Fetch:Ap,fetching:Am,finalizeAndReportTiming:Af}},744032,(A,e,t)=>{"use strict";let r=A.r(57328),{URLSerializer:n}=A.r(561743),{isValidHeaderName:i}=A.r(359401);e.exports={urlEquals:function(A,e,t=!1){return n(A,t)===n(e,t)},getFieldValues:function(A){r(null!==A);let e=[];for(let t of A.split(","))i(t=t.trim())&&e.push(t);return e}}},845853,(A,e,t)=>{"use strict";let r=A.r(57328),{kConstruct:n}=A.r(35634),{urlEquals:i,getFieldValues:a}=A.r(744032),{kEnumerableProperty:s,isDisturbed:o}=A.r(780405),{webidl:g}=A.r(704143),{cloneResponse:C,fromInnerResponse:Q,getResponseState:l}=A.r(650801),{Request:I,fromInnerRequest:d,getRequestState:E}=A.r(341716),{fetching:c}=A.r(817906),{urlIsHttpHttpsScheme:h,readAllBytes:B}=A.r(359401);class D{#A7;constructor(){arguments[0]!==n&&g.illegalConstructor(),g.util.markAsUncloneable(this),this.#A7=arguments[1]}async match(A,e={}){g.brandCheck(this,D);let t="Cache.match";g.argumentLengthCheck(arguments,1,t),A=g.converters.RequestInfo(A),e=g.converters.CacheQueryOptions(e,t,"options");let r=this.#eA(A,e,1);if(0!==r.length)return r[0]}async matchAll(A,e={}){return g.brandCheck(this,D),void 0!==A&&(A=g.converters.RequestInfo(A)),e=g.converters.CacheQueryOptions(e,"Cache.matchAll","options"),this.#eA(A,e)}async add(A){g.brandCheck(this,D),g.argumentLengthCheck(arguments,1,"Cache.add");let e=[A=g.converters.RequestInfo(A)],t=this.addAll(e);return await t}async addAll(A){g.brandCheck(this,D);let e="Cache.addAll";g.argumentLengthCheck(arguments,1,e);let t=[],r=[];for(let t of A){if(void 0===t)throw g.errors.conversionFailed({prefix:e,argument:"Argument 1",types:["undefined is not allowed"]});if("string"==typeof(t=g.converters.RequestInfo(t)))continue;let A=E(t);if(!h(A.url)||"GET"!==A.method)throw g.errors.exception({header:e,message:"Expected http/s scheme when method is not GET."})}let n=[];for(let i of A){let A=E(new I(i));if(!h(A.url))throw g.errors.exception({header:e,message:"Expected http/s scheme."});A.initiator="fetch",A.destination="subresource",r.push(A);let s=Promise.withResolvers();n.push(c({request:A,processResponse(A){if("error"===A.type||206===A.status||A.status<200||A.status>299)s.reject(g.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(A.headersList.contains("vary")){for(let e of a(A.headersList.get("vary")))if("*"===e){for(let A of(s.reject(g.errors.exception({header:"Cache.addAll",message:"invalid vary field value"})),n))A.abort();return}}},processResponseEndOfBody(A){A.aborted?s.reject(new DOMException("aborted","AbortError")):s.resolve(A)}})),t.push(s.promise)}let i=Promise.all(t),s=await i,o=[],C=0;for(let A of s){let e={type:"put",request:r[C],response:A};o.push(e),C++}let Q=Promise.withResolvers(),l=null;try{this.#ee(o)}catch(A){l=A}return queueMicrotask(()=>{null===l?Q.resolve(void 0):Q.reject(l)}),Q.promise}async put(A,e){g.brandCheck(this,D);let t="Cache.put";g.argumentLengthCheck(arguments,2,t),A=g.converters.RequestInfo(A),e=g.converters.Response(e,t,"response");let r=null;if(!h((r=g.is.Request(A)?E(A):E(new I(A))).url)||"GET"!==r.method)throw g.errors.exception({header:t,message:"Expected an http/s scheme when method is not GET"});let n=l(e);if(206===n.status)throw g.errors.exception({header:t,message:"Got 206 status"});if(n.headersList.contains("vary")){for(let A of a(n.headersList.get("vary")))if("*"===A)throw g.errors.exception({header:t,message:"Got * vary field value"})}if(n.body&&(o(n.body.stream)||n.body.stream.locked))throw g.errors.exception({header:t,message:"Response body is locked or disturbed"});let i=C(n),s=Promise.withResolvers();null!=n.body?B(n.body.stream.getReader(),s.resolve,s.reject):s.resolve(void 0);let Q=[],d={type:"put",request:r,response:i};Q.push(d);let c=await s.promise;null!=i.body&&(i.body.source=c);let w=Promise.withResolvers(),u=null;try{this.#ee(Q)}catch(A){u=A}return queueMicrotask(()=>{null===u?w.resolve():w.reject(u)}),w.promise}async delete(A,e={}){let t;g.brandCheck(this,D);let n="Cache.delete";g.argumentLengthCheck(arguments,1,n),A=g.converters.RequestInfo(A),e=g.converters.CacheQueryOptions(e,n,"options");let i=null;if(g.is.Request(A)){if("GET"!==(i=E(A)).method&&!e.ignoreMethod)return!1}else r("string"==typeof A),i=E(new I(A));let a=[],s={type:"delete",request:i,options:e};a.push(s);let o=Promise.withResolvers(),C=null;try{t=this.#ee(a)}catch(A){C=A}return queueMicrotask(()=>{null===C?o.resolve(!!t?.length):o.reject(C)}),o.promise}async keys(A,e={}){g.brandCheck(this,D),void 0!==A&&(A=g.converters.RequestInfo(A)),e=g.converters.CacheQueryOptions(e,"Cache.keys","options");let t=null;if(void 0!==A)if(g.is.Request(A)){if("GET"!==(t=E(A)).method&&!e.ignoreMethod)return[]}else"string"==typeof A&&(t=E(new I(A)));let r=Promise.withResolvers(),n=[];if(void 0===A)for(let A of this.#A7)n.push(A[0]);else for(let A of this.#et(t,e))n.push(A[0]);return queueMicrotask(()=>{let A=[];for(let e of n){let t=d(e,void 0,new AbortController().signal,"immutable");A.push(t)}r.resolve(Object.freeze(A))}),r.promise}#ee(A){let e=this.#A7,t=[...e],n=[],i=[];try{for(let t of A){let A;if("delete"!==t.type&&"put"!==t.type)throw g.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if("delete"===t.type&&null!=t.response)throw g.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#et(t.request,t.options,n).length)throw new DOMException("???","InvalidStateError");if("delete"===t.type){if(A=this.#et(t.request,t.options),0===A.length)return[];for(let t of A){let A=e.indexOf(t);r(-1!==A),e.splice(A,1)}}else if("put"===t.type){if(null==t.response)throw g.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let i=t.request;if(!h(i.url))throw g.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if("GET"!==i.method)throw g.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(null!=t.options)throw g.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});for(let n of A=this.#et(t.request)){let A=e.indexOf(n);r(-1!==A),e.splice(A,1)}e.push([t.request,t.response]),n.push([t.request,t.response])}i.push([t.request,t.response])}return i}catch(A){throw this.#A7.length=0,this.#A7=t,A}}#et(A,e,t){let r=[];for(let n of t??this.#A7){let[t,i]=n;this.#er(A,t,i,e)&&r.push(n)}return r}#er(A,e,t=null,r){let n=new URL(A.url),s=new URL(e.url);if(r?.ignoreSearch&&(s.search="",n.search=""),!i(n,s,!0))return!1;if(null==t||r?.ignoreVary||!t.headersList.contains("vary"))return!0;for(let r of a(t.headersList.get("vary")))if("*"===r||e.headersList.get(r)!==A.headersList.get(r))return!1;return!0}#eA(A,e,t=1/0){let r=null;if(void 0!==A)if(g.is.Request(A)){if("GET"!==(r=E(A)).method&&!e.ignoreMethod)return[]}else"string"==typeof A&&(r=E(new I(A)));let n=[];if(void 0===A)for(let A of this.#A7)n.push(A[1]);else for(let A of this.#et(r,e))n.push(A[1]);let i=[];for(let A of n){let e=Q(C(A),"immutable");if(i.push(e),i.length>=t)break}return Object.freeze(i)}}Object.defineProperties(D.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:s,matchAll:s,add:s,addAll:s,put:s,delete:s,keys:s});let w=[{key:"ignoreSearch",converter:g.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:g.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:g.converters.boolean,defaultValue:()=>!1}];g.converters.CacheQueryOptions=g.dictionaryConverter(w),g.converters.MultiCacheQueryOptions=g.dictionaryConverter([...w,{key:"cacheName",converter:g.converters.DOMString}]),g.converters.Response=g.interfaceConverter(g.is.Response,"Response"),g.converters["sequence<RequestInfo>"]=g.sequenceConverter(g.converters.RequestInfo),e.exports={Cache:D}},562899,(A,e,t)=>{"use strict";let{Cache:r}=A.r(845853),{webidl:n}=A.r(704143),{kEnumerableProperty:i}=A.r(780405),{kConstruct:a}=A.r(35634);class s{#en=new Map;constructor(){arguments[0]!==a&&n.illegalConstructor(),n.util.markAsUncloneable(this)}async match(A,e={}){if(n.brandCheck(this,s),n.argumentLengthCheck(arguments,1,"CacheStorage.match"),A=n.converters.RequestInfo(A),null!=(e=n.converters.MultiCacheQueryOptions(e)).cacheName){if(this.#en.has(e.cacheName)){let t=new r(a,this.#en.get(e.cacheName));return await t.match(A,e)}}else for(let t of this.#en.values()){let n=new r(a,t),i=await n.match(A,e);if(void 0!==i)return i}}async has(A){n.brandCheck(this,s);let e="CacheStorage.has";return n.argumentLengthCheck(arguments,1,e),A=n.converters.DOMString(A,e,"cacheName"),this.#en.has(A)}async open(A){n.brandCheck(this,s);let e="CacheStorage.open";if(n.argumentLengthCheck(arguments,1,e),A=n.converters.DOMString(A,e,"cacheName"),this.#en.has(A))return new r(a,this.#en.get(A));let t=[];return this.#en.set(A,t),new r(a,t)}async delete(A){n.brandCheck(this,s);let e="CacheStorage.delete";return n.argumentLengthCheck(arguments,1,e),A=n.converters.DOMString(A,e,"cacheName"),this.#en.delete(A)}async keys(){return n.brandCheck(this,s),[...this.#en.keys()]}}Object.defineProperties(s.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:i,has:i,open:i,delete:i,keys:i}),e.exports={CacheStorage:s}},301473,(A,e,t)=>{"use strict";e.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}},435708,(A,e,t)=>{"use strict";function r(A){for(let e=0;e<A.length;++e){let t=A.charCodeAt(e);if(t<33||t>126||34===t||40===t||41===t||60===t||62===t||64===t||44===t||59===t||58===t||92===t||47===t||91===t||93===t||63===t||61===t||123===t||125===t)throw Error("Invalid cookie name")}}function n(A){let e=A.length,t=0;if('"'===A[0]){if(1===e||'"'!==A[e-1])throw Error("Invalid cookie value");--e,++t}for(;t<e;){let e=A.charCodeAt(t++);if(e<33||e>126||34===e||44===e||59===e||92===e)throw Error("Invalid cookie value")}}function i(A){for(let e=0;e<A.length;++e){let t=A.charCodeAt(e);if(t<32||t>126||59===t)throw Error("Invalid cookie path")}}let a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=Array(61).fill(0).map((A,e)=>e.toString().padStart(2,"0"));function g(A){return"number"==typeof A&&(A=new Date(A)),`${a[A.getUTCDay()]}, ${o[A.getUTCDate()]} ${s[A.getUTCMonth()]} ${A.getUTCFullYear()} ${o[A.getUTCHours()]}:${o[A.getUTCMinutes()]}:${o[A.getUTCSeconds()]} GMT`}e.exports={isCTLExcludingHtab:function(A){for(let e=0;e<A.length;++e){let t=A.charCodeAt(e);if(t>=0&&t<=8||t>=10&&t<=31||127===t)return!0}return!1},validateCookieName:r,validateCookiePath:i,validateCookieValue:n,toIMFDate:g,stringify:function(A){if(0===A.name.length)return null;r(A.name),n(A.value);let e=[`${A.name}=${A.value}`];if(A.name.startsWith("__Secure-")&&(A.secure=!0),A.name.startsWith("__Host-")&&(A.secure=!0,A.domain=null,A.path="/"),A.secure&&e.push("Secure"),A.httpOnly&&e.push("HttpOnly"),"number"==typeof A.maxAge){if(A.maxAge<0)throw Error("Invalid cookie max-age");e.push(`Max-Age=${A.maxAge}`)}if(A.domain){var t=A.domain;if(t.startsWith("-")||t.endsWith(".")||t.endsWith("-"))throw Error("Invalid cookie domain");e.push(`Domain=${A.domain}`)}for(let t of(A.path&&(i(A.path),e.push(`Path=${A.path}`)),A.expires&&"Invalid Date"!==A.expires.toString()&&e.push(`Expires=${g(A.expires)}`),A.sameSite&&e.push(`SameSite=${A.sameSite}`),A.unparsed)){if(!t.includes("="))throw Error("Invalid unparsed");let[A,...r]=t.split("=");e.push(`${A.trim()}=${r.join("=")}`)}return e.join("; ")}}},798989,(A,e,t)=>{"use strict";let{collectASequenceOfCodePointsFast:r}=A.r(677682),{maxNameValuePairSize:n,maxAttributeValueSize:i}=A.r(301473),{isCTLExcludingHtab:a}=A.r(435708),s=A.r(57328);function o(A,e={}){if(0===A.length)return e;s(";"===A[0]);let t="";(A=A.slice(1)).includes(";")?(t=r(";",A,{position:0}),A=A.slice(t.length)):(t=A,A="");let n="",a="";if(t.includes("=")){let A={position:0};n=r("=",t,A),a=t.slice(A.position+1)}else n=t;if(n=n.trim(),(a=a.trim()).length>i)return o(A,e);let g=n.toLowerCase();if("expires"===g){let A=new Date(a);Number.isNaN(A.getTime())||(e.expires=A)}else if("max-age"===g){let t=a.charCodeAt(0);if((t<48||t>57)&&"-"!==a[0]||!/^\d+$/.test(a))return o(A,e);e.maxAge=Number(a)}else if("domain"===g){let A=a;"."===A[0]&&(A=A.slice(1)),e.domain=A=A.toLowerCase()}else if("path"===g)e.path=0===a.length||"/"!==a[0]?"/":a;else if("secure"===g)e.secure=!0;else if("httponly"===g)e.httpOnly=!0;else if("samesite"===g){let A=a.toLowerCase();"none"===A?e.sameSite="None":"strict"===A?e.sameSite="Strict":"lax"===A&&(e.sameSite="Lax")}else e.unparsed??=[],e.unparsed.push(`${n}=${a}`);return o(A,e)}e.exports={parseSetCookie:function(A){if(a(A))return null;let e="",t="",i="",s="";if(A.includes(";")){let n={position:0};e=r(";",A,n),t=A.slice(n.position)}else e=A;if(e.includes("=")){let A={position:0};i=r("=",e,A),s=e.slice(A.position+1)}else s=e;return(i=i.trim(),s=s.trim(),i.length+s.length>n)?null:{name:i,value:s,...o(t)}},parseUnparsedAttributes:o}},75864,(A,e,t)=>{"use strict";let{parseSetCookie:r}=A.r(798989),{stringify:n}=A.r(435708),{webidl:i}=A.r(704143),{Headers:a}=A.r(761883),s=i.brandCheckMultiple([a,globalThis.Headers].filter(Boolean));function o(A,e){i.argumentLengthCheck(arguments,2,"setCookie"),s(A);let t=n(e=i.converters.Cookie(e));t&&A.append("set-cookie",t,!0)}i.converters.DeleteCookieAttributes=i.dictionaryConverter([{converter:i.nullableConverter(i.converters.DOMString),key:"path",defaultValue:()=>null},{converter:i.nullableConverter(i.converters.DOMString),key:"domain",defaultValue:()=>null}]),i.converters.Cookie=i.dictionaryConverter([{converter:i.converters.DOMString,key:"name"},{converter:i.converters.DOMString,key:"value"},{converter:i.nullableConverter(A=>"number"==typeof A?i.converters["unsigned long long"](A):new Date(A)),key:"expires",defaultValue:()=>null},{converter:i.nullableConverter(i.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:i.nullableConverter(i.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:i.nullableConverter(i.converters.DOMString),key:"path",defaultValue:()=>null},{converter:i.nullableConverter(i.converters.boolean),key:"secure",defaultValue:()=>null},{converter:i.nullableConverter(i.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:i.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:i.sequenceConverter(i.converters.DOMString),key:"unparsed",defaultValue:()=>[]}]),e.exports={getCookies:function(A){i.argumentLengthCheck(arguments,1,"getCookies"),s(A);let e=A.get("cookie"),t={};if(!e)return t;for(let A of e.split(";")){let[e,...r]=A.split("=");t[e.trim()]=r.join("=")}return t},deleteCookie:function(A,e,t){s(A);let r="deleteCookie";i.argumentLengthCheck(arguments,2,r),e=i.converters.DOMString(e,r,"name"),t=i.converters.DeleteCookieAttributes(t),o(A,{name:e,value:"",expires:new Date(0),...t})},getSetCookies:function(A){i.argumentLengthCheck(arguments,1,"getSetCookies"),s(A);let e=A.getSetCookie();return e?e.map(A=>r(A)):[]},setCookie:o,parseCookie:function(A){return r(A=i.converters.DOMString(A))}}},124672,(A,e,t)=>{"use strict";let{webidl:r}=A.r(704143),{kEnumerableProperty:n}=A.r(780405),{kConstruct:i}=A.r(35634);class a extends Event{#ei;constructor(A,e={}){if(A===i){super(arguments[1],arguments[2]),r.util.markAsUncloneable(this);return}const t="MessageEvent constructor";r.argumentLengthCheck(arguments,1,t),super(A=r.converters.DOMString(A,t,"type"),e=r.converters.MessageEventInit(e,t,"eventInitDict")),this.#ei=e,r.util.markAsUncloneable(this)}get data(){return r.brandCheck(this,a),this.#ei.data}get origin(){return r.brandCheck(this,a),this.#ei.origin}get lastEventId(){return r.brandCheck(this,a),this.#ei.lastEventId}get source(){return r.brandCheck(this,a),this.#ei.source}get ports(){return r.brandCheck(this,a),Object.isFrozen(this.#ei.ports)||Object.freeze(this.#ei.ports),this.#ei.ports}initMessageEvent(A,e=!1,t=!1,n=null,i="",s="",o=null,g=[]){return r.brandCheck(this,a),r.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new a(A,{bubbles:e,cancelable:t,data:n,origin:i,lastEventId:s,source:o,ports:g})}static createFastMessageEvent(A,e){let t=new a(i,A,e);return t.#ei=e,t.#ei.data??=null,t.#ei.origin??="",t.#ei.lastEventId??="",t.#ei.source??=null,t.#ei.ports??=[],t}}let{createFastMessageEvent:s}=a;delete a.createFastMessageEvent;class o extends Event{#ei;constructor(A,e={}){const t="CloseEvent constructor";r.argumentLengthCheck(arguments,1,t),super(A=r.converters.DOMString(A,t,"type"),e=r.converters.CloseEventInit(e)),this.#ei=e,r.util.markAsUncloneable(this)}get wasClean(){return r.brandCheck(this,o),this.#ei.wasClean}get code(){return r.brandCheck(this,o),this.#ei.code}get reason(){return r.brandCheck(this,o),this.#ei.reason}}class g extends Event{#ei;constructor(A,e){const t="ErrorEvent constructor";r.argumentLengthCheck(arguments,1,t),super(A,e),r.util.markAsUncloneable(this),A=r.converters.DOMString(A,t,"type"),e=r.converters.ErrorEventInit(e??{}),this.#ei=e}get message(){return r.brandCheck(this,g),this.#ei.message}get filename(){return r.brandCheck(this,g),this.#ei.filename}get lineno(){return r.brandCheck(this,g),this.#ei.lineno}get colno(){return r.brandCheck(this,g),this.#ei.colno}get error(){return r.brandCheck(this,g),this.#ei.error}}Object.defineProperties(a.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:n,origin:n,lastEventId:n,source:n,ports:n,initMessageEvent:n}),Object.defineProperties(o.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:n,code:n,wasClean:n}),Object.defineProperties(g.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:n,filename:n,lineno:n,colno:n,error:n}),r.converters.MessagePort=r.interfaceConverter(r.is.MessagePort,"MessagePort"),r.converters["sequence<MessagePort>"]=r.sequenceConverter(r.converters.MessagePort);let C=[{key:"bubbles",converter:r.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:r.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:r.converters.boolean,defaultValue:()=>!1}];r.converters.MessageEventInit=r.dictionaryConverter([...C,{key:"data",converter:r.converters.any,defaultValue:()=>null},{key:"origin",converter:r.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:r.converters.DOMString,defaultValue:()=>""},{key:"source",converter:r.nullableConverter(r.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:r.converters["sequence<MessagePort>"],defaultValue:()=>[]}]),r.converters.CloseEventInit=r.dictionaryConverter([...C,{key:"wasClean",converter:r.converters.boolean,defaultValue:()=>!1},{key:"code",converter:r.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:r.converters.USVString,defaultValue:()=>""}]),r.converters.ErrorEventInit=r.dictionaryConverter([...C,{key:"message",converter:r.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:r.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:r.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:r.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:r.converters.any}]),e.exports={MessageEvent:a,CloseEvent:o,ErrorEvent:g,createFastMessageEvent:s}},175512,(A,e,t)=>{"use strict";e.exports={uid:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",sentCloseFrameState:{SENT:1,RECEIVED:2},staticPropertyDescriptors:{enumerable:!0,writable:!1,configurable:!1},states:{CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},opcodes:{CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},maxUnsigned16Bit:65535,parserStates:{INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},emptyBuffer:Buffer.allocUnsafe(0),sendHints:{text:1,typedArray:2,arrayBuffer:3,blob:4}}},666578,(A,e,t)=>{"use strict";let{states:r,opcodes:n}=A.r(175512),{isUtf8:i}=A.r(951615),{removeHTTPWhitespace:a}=A.r(561743),{collectASequenceOfCodePointsFast:s}=A.r(677682);function o(A){return A===n.CLOSE||A===n.PING||A===n.PONG}function g(A){return A===n.CONTINUATION}function C(A){return A===n.TEXT||A===n.BINARY}e.exports={isConnecting:function(A){return A===r.CONNECTING},isEstablished:function(A){return A===r.OPEN},isClosing:function(A){return A===r.CLOSING},isClosed:function(A){return A===r.CLOSED},fireEvent:function(A,e,t=(A,e)=>new Event(A,e),r={}){let n=t(A,r);e.dispatchEvent(n)},isValidSubprotocol:function(A){if(0===A.length)return!1;for(let e=0;e<A.length;++e){let t=A.charCodeAt(e);if(t<33||t>126||34===t||40===t||41===t||44===t||47===t||58===t||59===t||60===t||61===t||62===t||63===t||64===t||91===t||92===t||93===t||123===t||125===t)return!1}return!0},isValidStatusCode:function(A){return A>=1e3&&A<1015?1004!==A&&1005!==A&&1006!==A:A>=3e3&&A<=4999},websocketMessageReceived:function(A,e,t){A.onMessage(e,t)},utf8Decode:(()=>{if("string"==typeof process.versions.icu){let A=new TextDecoder("utf-8",{fatal:!0});return A.decode.bind(A)}return function(A){if(i(A))return A.toString("utf-8");throw TypeError("Invalid utf-8 received.")}})(),isControlFrame:o,isContinuationFrame:g,isTextBinaryFrame:C,isValidOpcode:function(A){return C(A)||g(A)||o(A)},parseExtensions:function(A){let e={position:0},t=new Map;for(;e.position<A.length;){let[r,n=""]=s(";",A,e).split("=",2);t.set(a(r,!0,!1),a(n,!1,!0)),e.position++}return t},isValidClientWindowBits:function(A){if(0===A.length)return!1;for(let e=0;e<A.length;e++){let t=A.charCodeAt(e);if(t<48||t>57)return!1}let e=Number.parseInt(A,10);return e>=8&&e<=15},toArrayBuffer:function(A){return A.byteLength===A.buffer.byteLength?A.buffer:new Uint8Array(A).buffer},getURLRecord:function(A,e){let t;try{t=new URL(A,e)}catch(A){throw new DOMException(A,"SyntaxError")}if("http:"===t.protocol?t.protocol="ws:":"https:"===t.protocol&&(t.protocol="wss:"),"ws:"!==t.protocol&&"wss:"!==t.protocol)throw new DOMException("expected a ws: or wss: url","SyntaxError");if(t.hash.length||t.href.endsWith("#"))throw new DOMException("hash","SyntaxError");return t},validateCloseCodeAndReason:function(A,e){if(null!==A&&1e3!==A&&(A<3e3||A>4999))throw new DOMException("invalid code","InvalidAccessError");if(null!==e){let A=Buffer.byteLength(e);if(A>123)throw new DOMException(`Reason must be less than 123 bytes; received ${A}`,"SyntaxError")}}}},659541,(A,e,t)=>{"use strict";let{runtimeFeatures:r}=A.r(509849),{maxUnsigned16Bit:n,opcodes:i}=A.r(175512),a=null,s=8192,o=r.has("crypto")?A.r(666680).randomFillSync:null;function g(){return 8192===s&&(s=0,o(a??=Buffer.allocUnsafeSlow(8192),0,8192)),[a[s++],a[s++],a[s++],a[s++]]}e.exports={WebsocketFrameSend:class{constructor(A){this.frameData=A}createFrame(A){let e=this.frameData,t=g(),r=e?.byteLength??0,i=r,a=6;r>n?(a+=8,i=127):r>125&&(a+=2,i=126);let s=Buffer.allocUnsafe(r+a);s[0]=s[1]=0,s[0]|=128,s[0]=(240&s[0])+A,s[a-4]=t[0],s[a-3]=t[1],s[a-2]=t[2],s[a-1]=t[3],s[1]=i,126===i?s.writeUInt16BE(r,2):127===i&&(s[2]=s[3]=0,s.writeUIntBE(r,4,6)),s[1]|=128;for(let A=0;A<r;++A)s[a+A]=e[A]^t[3&A];return s}static createFastTextFrame(A){let e=g(),t=A.length;for(let r=0;r<t;++r)A[r]^=e[3&r];let r=t,a=6;t>n?(a+=8,r=127):t>125&&(a+=2,r=126);let s=Buffer.allocUnsafeSlow(a);return s[0]=128|i.TEXT,s[1]=128|r,s[a-4]=e[0],s[a-3]=e[1],s[a-2]=e[2],s[a-1]=e[3],126===r?s.writeUInt16BE(t,2):127===r&&(s[2]=s[3]=0,s.writeUIntBE(t,4,6)),[s,A]}},generateMask:g}},856986,(A,e,t)=>{"use strict";let{uid:r,states:n,sentCloseFrameState:i,emptyBuffer:a,opcodes:s}=A.r(175512),{parseExtensions:o,isClosed:g,isClosing:C,isEstablished:Q,isConnecting:l,validateCloseCodeAndReason:I}=A.r(666578),{makeRequest:d}=A.r(341716),{fetching:E}=A.r(817906),{Headers:c,getHeadersList:h}=A.r(761883),{getDecodeSplit:B}=A.r(359401),{WebsocketFrameSend:D}=A.r(659541),w=A.r(57328),{runtimeFeatures:u}=A.r(509849),p=u.has("crypto")?A.r(666680):null,f=!1;function y(A,e,t,r=!1){if(e??=null,t??="",r&&I(e,t),g(A.readyState)||C(A.readyState));else if(Q(A.readyState))if(A.closeState.has(i.SENT)||A.closeState.has(i.RECEIVED))A.readyState=n.CLOSING;else{let r=new D;0!==t.length&&null===e&&(e=1e3),w(null===e||Number.isInteger(e)),null===e&&0===t.length?r.frameData=a:null!==e&&null===t?(r.frameData=Buffer.allocUnsafe(2),r.frameData.writeUInt16BE(e,0)):null!==e&&null!==t?(r.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(t)),r.frameData.writeUInt16BE(e,0),r.frameData.write(t,2,"utf-8")):r.frameData=a,A.socket.write(r.createFrame(s.CLOSE)),A.closeState.add(i.SENT),A.readyState=n.CLOSING}else M(A),A.readyState=n.CLOSING}function M(A,e,t,r){Q(A.readyState)&&y(A,e,t,!1),A.controller.abort(),l(A.readyState)?A.onSocketClose():A.socket?.destroyed===!1&&A.socket.destroy()}e.exports={establishWebSocketConnection:function(A,e,t,n,i){A.protocol="ws:"===A.protocol?"http:":"https:";let a=d({urlList:[A],client:t,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error",useURLCredentials:!0});i.headers&&(a.headersList=h(new c(i.headers)));let s=p.randomBytes(16).toString("base64");for(let A of(a.headersList.append("sec-websocket-key",s,!0),a.headersList.append("sec-websocket-version","13",!0),e))a.headersList.append("sec-websocket-protocol",A,!0);return a.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits",!0),E({request:a,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(A){let t;if("error"===A.type||101!==A.status){if(A.socket?.session==null)return void M(n,1002,"Received network error or non-101 status code.",A.error);if(200!==A.status)return void M(n,1002,"Received network error or non-200 status code.",A.error)}if(!1===f&&A.socket?.session!=null&&(process.emitWarning("WebSocket over HTTP2 is experimental, and subject to change.","ExperimentalWarning"),f=!0),0!==e.length&&!A.headersList.get("Sec-WebSocket-Protocol"))return void M(n,1002,"Server did not respond with sent protocols.");if(null==A.socket.session&&A.headersList.get("Upgrade")?.toLowerCase()!=="websocket")return void M(n,1002,'Server did not set Upgrade header to "websocket".');if(null==A.socket.session&&A.headersList.get("Connection")?.toLowerCase()!=="upgrade")return void M(n,1002,'Server did not set Connection header to "upgrade".');if(A.headersList.get("Sec-WebSocket-Accept")!==p.hash("sha1",s+r,"base64"))return void M(n,1002,"Incorrect hash received in Sec-WebSocket-Accept header.");let i=A.headersList.get("Sec-WebSocket-Extensions");if(null!==i&&!(t=o(i)).has("permessage-deflate"))return void M(n,1002,"Sec-WebSocket-Extensions header does not match.");let g=A.headersList.get("Sec-WebSocket-Protocol");null===g||B("sec-websocket-protocol",a.headersList).includes(g)?(A.socket.on("data",n.onSocketData),A.socket.on("close",n.onSocketClose),A.socket.on("error",n.onSocketError),n.wasEverConnected=!0,n.onConnectionEstablished(A,t)):M(n,1002,"Protocol was not set in the opening handshake.")}})},failWebsocketConnection:M,closeWebSocketConnection:y}},49044,(A,e,t)=>{"use strict";let{createInflateRaw:r,Z_DEFAULT_WINDOWBITS:n}=A.r(727028),{isValidClientWindowBits:i}=A.r(666578),{MessageSizeExceededError:a}=A.r(920788),s=Buffer.from([0,0,255,255]),o=Symbol("kBuffer"),g=Symbol("kLength");e.exports={PerMessageDeflate:class{#ea;#r={};#es=0;constructor(A,e){this.#r.serverNoContextTakeover=A.has("server_no_context_takeover"),this.#r.serverMaxWindowBits=A.get("server_max_window_bits"),this.#es=e.maxPayloadSize}decompress(A,e,t){if(!this.#ea){let A=n;if(this.#r.serverMaxWindowBits){if(!i(this.#r.serverMaxWindowBits))return void t(Error("Invalid server_max_window_bits"));A=Number.parseInt(this.#r.serverMaxWindowBits)}try{this.#ea=r({windowBits:A})}catch(A){t(A);return}this.#ea[o]=[],this.#ea[g]=0,this.#ea.on("data",A=>{if(this.#ea[g]+=A.length,this.#es>0&&this.#ea[g]>this.#es){t(new a),this.#ea.removeAllListeners(),this.#ea=null;return}this.#ea[o].push(A)}),this.#ea.on("error",A=>{this.#ea=null,t(A)})}this.#ea.write(A),e&&this.#ea.write(s),this.#ea.flush(()=>{if(!this.#ea)return;let A=Buffer.concat(this.#ea[o],this.#ea[g]);this.#ea[o].length=0,this.#ea[g]=0,t(null,A)})}}}},928694,(A,e,t)=>{"use strict";let{Writable:r}=A.r(81111),n=A.r(57328),{parserStates:i,opcodes:a,states:s,emptyBuffer:o,sentCloseFrameState:g}=A.r(175512),{isValidStatusCode:C,isValidOpcode:Q,websocketMessageReceived:l,utf8Decode:I,isControlFrame:d,isTextBinaryFrame:E,isContinuationFrame:c}=A.r(666578),{failWebsocketConnection:h}=A.r(856986),{WebsocketFrameSend:B}=A.r(659541),{PerMessageDeflate:D}=A.r(49044),{MessageSizeExceededError:w}=A.r(920788);class u extends r{#eo=[];#eg=0;#eC=0;#eQ=!1;#d=i.INFO;#el={};#eI=[];#ed;#c;#eE;#es;constructor(A,e,t={}){super(),this.#c=A,this.#ed=null==e?new Map:e,this.#eE=t.maxFragments??0,this.#es=t.maxPayloadSize??0,this.#ed.has("permessage-deflate")&&this.#ed.set("permessage-deflate",new D(e,t))}_write(A,e,t){this.#eo.push(A),this.#eC+=A.length,this.#eQ=!0,this.run(t)}#ec(){return!(this.#es>0)||!!d(this.#el.opcode)||!(this.#el.payloadLength+this.#eg>this.#es)||(h(this.#c,1009,"Payload size exceeds maximum allowed size"),!1)}run(A){for(;this.#eQ;)if(this.#d===i.INFO){if(this.#eC<2)return A();let e=this.consume(2),t=(128&e[0])!=0,r=15&e[0],n=(128&e[1])==128,s=!t&&r!==a.CONTINUATION,o=127&e[1],g=64&e[0],C=32&e[0],l=16&e[0];if(!Q(r))return h(this.#c,1002,"Invalid opcode received"),A();if(n)return h(this.#c,1002,"Frame cannot be masked"),A();if(0!==g&&!this.#ed.has("permessage-deflate"))return void h(this.#c,1002,"Expected RSV1 to be clear.");if(0!==C||0!==l)return void h(this.#c,1002,"RSV1, RSV2, RSV3 must be clear");if(s&&!E(r))return void h(this.#c,1002,"Invalid frame type was fragmented.");if(E(r)&&this.#eI.length>0)return void h(this.#c,1002,"Expected continuation frame");if(this.#el.fragmented&&s)return void h(this.#c,1002,"Fragmented frame exceeded 125 bytes.");if((o>125||s)&&d(r))return void h(this.#c,1002,"Control frame either too large or fragmented");if(c(r)&&0===this.#eI.length&&!this.#el.compressed)return void h(this.#c,1002,"Unexpected continuation frame");if(o<=125){if(this.#el.payloadLength=o,this.#d=i.READ_DATA,!this.#ec())return}else 126===o?this.#d=i.PAYLOADLENGTH_16:127===o&&(this.#d=i.PAYLOADLENGTH_64);E(r)&&(this.#el.binaryType=r,this.#el.compressed=0!==g),this.#el.opcode=r,this.#el.masked=n,this.#el.fin=t,this.#el.fragmented=s}else if(this.#d===i.PAYLOADLENGTH_16){if(this.#eC<2)return A();let e=this.consume(2);if(this.#el.payloadLength=e.readUInt16BE(0),this.#d=i.READ_DATA,!this.#ec())return}else if(this.#d===i.PAYLOADLENGTH_64){if(this.#eC<8)return A();let e=this.consume(8),t=e.readUInt32BE(0),r=e.readUInt32BE(4);if(0!==t||r>0x80000000-1)return void h(this.#c,1009,"Received payload length > 2^31 bytes.");if(this.#el.payloadLength=r,this.#d=i.READ_DATA,!this.#ec())return}else if(this.#d===i.READ_DATA){if(this.#eC<this.#el.payloadLength)return A();let e=this.consume(this.#el.payloadLength);if(d(this.#el.opcode))this.#eQ=this.parseControlFrame(e),this.#d=i.INFO;else if(this.#el.compressed){this.#ed.get("permessage-deflate").decompress(e,this.#el.fin,(e,t)=>{if(e){let A=e instanceof w?1009:1007;h(this.#c,A,e.message);return}if(this.writeFragments(t)){if(this.#es>0&&this.#eg>this.#es)return void h(this.#c,1009,new w().message);if(!this.#el.fin){this.#d=i.INFO,this.#eQ=!0,this.run(A);return}l(this.#c,this.#el.binaryType,this.consumeFragments()),this.#eQ=!0,this.#d=i.INFO,this.run(A)}},this.#eg),this.#eQ=!1;break}else{if(!this.writeFragments(e))return;!this.#el.fragmented&&this.#el.fin&&l(this.#c,this.#el.binaryType,this.consumeFragments()),this.#d=i.INFO}}}consume(A){if(A>this.#eC)throw Error("Called consume() before buffers satiated.");if(0===A)return o;this.#eC-=A;let e=this.#eo[0];if(e.length>A)return this.#eo[0]=e.subarray(A,e.length),e.subarray(0,A);{if(e.length===A)return this.#eo.shift();let t=0,r=Buffer.allocUnsafeSlow(A);for(;t!==A;){let e=this.#eo[0],n=e.length;if(n+t===A){r.set(this.#eo.shift(),t);break}if(n+t>A){r.set(e.subarray(0,A-t),t),this.#eo[0]=e.subarray(A-t);break}r.set(this.#eo.shift(),t),t+=n}return r}}writeFragments(A){return this.#eE>0&&this.#eI.length===this.#eE?(h(this.#c,1008,"Too many message fragments"),!1):(this.#eg+=A.length,this.#eI.push(A),!0)}consumeFragments(){let A=this.#eI;if(1===A.length)return this.#eg=0,A.shift();let e=0,t=Buffer.allocUnsafeSlow(this.#eg);for(let r=0;r<A.length;++r){let n=A[r];t.set(n,e),e+=n.length}return this.#eI=[],this.#eg=0,t}parseCloseBody(A){let e;if(n(1!==A.length),A.length>=2&&(e=A.readUInt16BE(0)),void 0!==e&&!C(e))return{code:1002,reason:"Invalid status code",error:!0};let t=A.subarray(2);239===t[0]&&187===t[1]&&191===t[2]&&(t=t.subarray(3));try{t=I(t)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:e,reason:t,error:!1}}parseControlFrame(A){let{opcode:e,payloadLength:t}=this.#el;if(e===a.CLOSE){if(1===t)return h(this.#c,1002,"Received close frame with a 1-byte body."),!1;if(this.#el.closeInfo=this.parseCloseBody(A),this.#el.closeInfo.error){let{code:A,reason:e}=this.#el.closeInfo;return h(this.#c,A,e),!1}if(!this.#c.closeState.has(g.SENT)&&!this.#c.closeState.has(g.RECEIVED)){let A=o;this.#el.closeInfo.code&&(A=Buffer.allocUnsafe(2)).writeUInt16BE(this.#el.closeInfo.code,0);let e=new B(A);this.#c.socket.write(e.createFrame(a.CLOSE)),this.#c.closeState.add(g.SENT)}return this.#c.readyState=s.CLOSING,this.#c.closeState.add(g.RECEIVED),!1}if(e===a.PING){if(!this.#c.closeState.has(g.RECEIVED)){let e=new B(A);this.#c.socket.write(e.createFrame(a.PONG)),this.#c.onPing(A)}}else e===a.PONG&&this.#c.onPong(A);return!0}get closingInfo(){return this.#el.closeInfo}}e.exports={ByteParser:u}},643802,(A,e,t)=>{"use strict";let{WebsocketFrameSend:r}=A.r(659541),{opcodes:n,sendHints:i}=A.r(175512),a=A.r(21842);class s{#eh=new a;#eB=!1;#eD;constructor(A){this.#eD=A}add(A,e,t){if(t!==i.blob){if(this.#eB){let r={promise:null,callback:e,frame:o(A,t)};this.#eh.push(r)}else if(t===i.text){let{0:t,1:n}=r.createFastTextFrame(A);this.#eD.cork(),this.#eD.write(t),this.#eD.write(n,e),this.#eD.uncork()}else this.#eD.write(o(A,t),e);return}let n={promise:A.arrayBuffer().then(A=>{n.promise=null,n.frame=o(A,t)}),callback:e,frame:null};this.#eh.push(n),this.#eB||this.#ew()}async #ew(){this.#eB=!0;let A=this.#eh;for(;!A.isEmpty();){let e=A.shift();null!==e.promise&&await e.promise,this.#eD.write(e.frame,e.callback),e.callback=e.frame=null}this.#eB=!1}}function o(A,e){return new r(function(A,e){switch(e){case i.text:case i.typedArray:return new Uint8Array(A.buffer,A.byteOffset,A.byteLength);case i.arrayBuffer:case i.blob:return new Uint8Array(A)}}(A,e)).createFrame(e===i.text?n.TEXT:n.BINARY)}e.exports={SendQueue:s}},126507,(A,e,t)=>{"use strict";let{isArrayBuffer:r}=A.r(107417),{webidl:n}=A.r(704143),{URLSerializer:i}=A.r(561743),{environmentSettingsObject:a}=A.r(359401),{staticPropertyDescriptors:s,states:o,sentCloseFrameState:g,sendHints:C,opcodes:Q}=A.r(175512),{isConnecting:l,isEstablished:I,isClosing:d,isClosed:E,isValidSubprotocol:c,fireEvent:h,utf8Decode:B,toArrayBuffer:D,getURLRecord:w}=A.r(666578),{establishWebSocketConnection:u,closeWebSocketConnection:p,failWebsocketConnection:f}=A.r(856986),{ByteParser:y}=A.r(928694),{kEnumerableProperty:M}=A.r(780405),{getGlobalDispatcher:m}=A.r(403264),{ErrorEvent:N,CloseEvent:S,createFastMessageEvent:k}=A.r(124672),{SendQueue:U}=A.r(643802),{WebsocketFrameSend:F}=A.r(659541),{channels:R}=A.r(519842);class T extends EventTarget{#eu={open:null,error:null,close:null,message:null};#ep=0;#ef="";#ed="";#ey;#c={onConnectionEstablished:(A,e)=>this.#eM(A,e),onMessage:(A,e)=>this.#em(A,e),onParserError:A=>f(this.#c,null,A.message),onParserDrain:()=>this.#eN(),onSocketData:A=>{this.#eS.write(A)||this.#c.socket.pause()},onSocketError:A=>{this.#c.readyState=o.CLOSING,R.socketError.hasSubscribers&&R.socketError.publish(A),this.#c.socket.destroy()},onSocketClose:()=>this.#ek(),onPing:A=>{R.ping.hasSubscribers&&R.ping.publish({payload:A,websocket:this})},onPong:A=>{R.pong.hasSubscribers&&R.pong.publish({payload:A,websocket:this})},readyState:o.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#eU;#eF;#eS;constructor(A,e=[]){super(),n.util.markAsUncloneable(this);const t="WebSocket constructor";n.argumentLengthCheck(arguments,1,t);const r=n.converters["DOMString or sequence<DOMString> or WebSocketInit"](e,t,"options");A=n.converters.USVString(A),e=r.protocols;const i=w(A,a.settingsObject.baseUrl);if("string"==typeof e&&(e=[e]),e.length!==new Set(e.map(A=>A.toLowerCase())).size||e.length>0&&!e.every(A=>c(A)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this.#eU=new URL(i.href);const s=a.settingsObject;this.#c.controller=u(i,e,s,this.#c,r),this.#c.readyState=T.CONNECTING,this.#eF="blob"}close(A,e){n.brandCheck(this,T),void 0!==A&&(A=n.converters["unsigned short"](A,"WebSocket.close","code",n.attributes.Clamp)),void 0!==e&&(e=n.converters.USVString(e)),A??=null,e??="",p(this.#c,A,e,!0)}send(A){n.brandCheck(this,T);let e="WebSocket.send";if(n.argumentLengthCheck(arguments,1,e),A=n.converters.WebSocketSendData(A,e,"data"),l(this.#c.readyState))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!I(this.#c.readyState)||d(this.#c.readyState)))if("string"==typeof A){let e=Buffer.from(A);this.#ep+=e.byteLength,this.#ey.add(e,()=>{this.#ep-=e.byteLength},C.text)}else r(A)?(this.#ep+=A.byteLength,this.#ey.add(A,()=>{this.#ep-=A.byteLength},C.arrayBuffer)):ArrayBuffer.isView(A)?(this.#ep+=A.byteLength,this.#ey.add(A,()=>{this.#ep-=A.byteLength},C.typedArray)):n.is.Blob(A)&&(this.#ep+=A.size,this.#ey.add(A,()=>{this.#ep-=A.size},C.blob))}get readyState(){return n.brandCheck(this,T),this.#c.readyState}get bufferedAmount(){return n.brandCheck(this,T),this.#ep}get url(){return n.brandCheck(this,T),i(this.#eU)}get extensions(){return n.brandCheck(this,T),this.#ed}get protocol(){return n.brandCheck(this,T),this.#ef}get onopen(){return n.brandCheck(this,T),this.#eu.open}set onopen(A){n.brandCheck(this,T),this.#eu.open&&this.removeEventListener("open",this.#eu.open);let e=n.converters.EventHandlerNonNull(A);null!==e?(this.addEventListener("open",e),this.#eu.open=A):this.#eu.open=null}get onerror(){return n.brandCheck(this,T),this.#eu.error}set onerror(A){n.brandCheck(this,T),this.#eu.error&&this.removeEventListener("error",this.#eu.error);let e=n.converters.EventHandlerNonNull(A);null!==e?(this.addEventListener("error",e),this.#eu.error=A):this.#eu.error=null}get onclose(){return n.brandCheck(this,T),this.#eu.close}set onclose(A){n.brandCheck(this,T),this.#eu.close&&this.removeEventListener("close",this.#eu.close);let e=n.converters.EventHandlerNonNull(A);null!==e?(this.addEventListener("close",e),this.#eu.close=A):this.#eu.close=null}get onmessage(){return n.brandCheck(this,T),this.#eu.message}set onmessage(A){n.brandCheck(this,T),this.#eu.message&&this.removeEventListener("message",this.#eu.message);let e=n.converters.EventHandlerNonNull(A);null!==e?(this.addEventListener("message",e),this.#eu.message=A):this.#eu.message=null}get binaryType(){return n.brandCheck(this,T),this.#eF}set binaryType(A){n.brandCheck(this,T),"blob"!==A&&"arraybuffer"!==A?this.#eF="blob":this.#eF=A}#eM(A,e){this.#c.socket=A.socket;let t=this.#c.controller.dispatcher?.webSocketOptions?.maxFragments,r=this.#c.controller.dispatcher?.webSocketOptions?.maxPayloadSize,n=new y(this.#c,e,{maxFragments:t,maxPayloadSize:r});n.on("drain",()=>this.#c.onParserDrain()),n.on("error",A=>this.#c.onParserError(A)),this.#eS=n,this.#ey=new U(A.socket),this.#c.readyState=o.OPEN;let i=A.headersList.get("sec-websocket-extensions");null!==i&&(this.#ed=i);let a=A.headersList.get("sec-websocket-protocol");if(null!==a&&(this.#ef=a),h("open",this),R.open.hasSubscribers){var s;let e=A.headersList.entries;R.open.publish({address:(s=A.socket,"function"==typeof s?.address?s.address():"function"==typeof s?.session?.socket?.address?s.session.socket.address():null),protocol:this.#ef,extensions:this.#ed,websocket:this,handshakeResponse:{status:A.status,statusText:A.statusText,headers:e}})}}#em(A,e){let t;if(this.#c.readyState===o.OPEN){if(A===Q.TEXT)try{t=B(e)}catch{f(this.#c,1007,"Received invalid UTF-8 in text frame.");return}else A===Q.BINARY&&(t="blob"===this.#eF?new Blob([e]):D(e));h("message",this,k,{origin:this.#eU.origin,data:t})}}#eN(){this.#c.socket.resume()}#ek(){let A=this.#c.closeState.has(g.SENT)&&this.#c.closeState.has(g.RECEIVED),e=1005,t="",r=this.#eS?.closingInfo;r&&!r.error&&(e=r.code??1005,t=r.reason),this.#c.readyState=o.CLOSED,this.#c.closeState.has(g.RECEIVED)||(e=1006,h("error",this,(A,e)=>new N(A,e),{error:TypeError(t)})),h("close",this,(A,e)=>new S(A,e),{wasClean:A,code:e,reason:t}),R.close.hasSubscribers&&R.close.publish({websocket:this,code:e,reason:t})}static ping(A,e){if(Buffer.isBuffer(e)){if(e.length>125)throw TypeError("A PING frame cannot have a body larger than 125 bytes.")}else if(void 0!==e)throw TypeError("Expected buffer payload");let t=A.#c.readyState;if(I(t)&&!d(t)&&!E(t)){let t=new F(e);A.#c.socket.write(t.createFrame(Q.PING))}}}let{ping:b}=T;Reflect.deleteProperty(T,"ping"),T.CONNECTING=T.prototype.CONNECTING=o.CONNECTING,T.OPEN=T.prototype.OPEN=o.OPEN,T.CLOSING=T.prototype.CLOSING=o.CLOSING,T.CLOSED=T.prototype.CLOSED=o.CLOSED,Object.defineProperties(T.prototype,{CONNECTING:s,OPEN:s,CLOSING:s,CLOSED:s,url:M,readyState:M,bufferedAmount:M,onopen:M,onerror:M,onclose:M,close:M,onmessage:M,binaryType:M,send:M,extensions:M,protocol:M,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}}),Object.defineProperties(T,{CONNECTING:s,OPEN:s,CLOSING:s,CLOSED:s}),n.converters["sequence<DOMString>"]=n.sequenceConverter(n.converters.DOMString),n.converters["DOMString or sequence<DOMString>"]=function(A,e,t){return n.util.Type(A)===n.util.Types.OBJECT&&Symbol.iterator in A?n.converters["sequence<DOMString>"](A):n.converters.DOMString(A,e,t)},n.converters.WebSocketInit=n.dictionaryConverter([{key:"protocols",converter:n.converters["DOMString or sequence<DOMString>"],defaultValue:()=>[]},{key:"dispatcher",converter:n.converters.any,defaultValue:()=>m()},{key:"headers",converter:n.nullableConverter(n.converters.HeadersInit)}]),n.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(A){return n.util.Type(A)!==n.util.Types.OBJECT||Symbol.iterator in A?{protocols:n.converters["DOMString or sequence<DOMString>"](A)}:n.converters.WebSocketInit(A)},n.converters.WebSocketSendData=function(A){return n.util.Type(A)===n.util.Types.OBJECT&&(n.is.Blob(A)||n.is.BufferSource(A))?A:n.converters.USVString(A)},e.exports={WebSocket:T,ping:b}},691168,(A,e,t)=>{"use strict";let{webidl:r}=A.r(704143),{validateCloseCodeAndReason:n}=A.r(666578),{kConstruct:i}=A.r(35634),{kEnumerableProperty:a}=A.r(780405);function s(){class A extends DOMException{get reason(){return""}}return void 0!==new A().reason?DOMException:new Proxy(DOMException,{construct(A,e,t){let r=Reflect.construct(A,e,A);return Object.setPrototypeOf(r,t.prototype),r}})}class o extends s(){#eR;#i;constructor(A="",e){if(super(A=r.converters.DOMString(A,"WebSocketError","message"),"WebSocketError"),e===i)return;null!==e&&(e=r.converters.WebSocketCloseInfo(e));let t=e.closeCode??null;const a=e.reason??"";n(t,a),0!==a.length&&null===t&&(t=1e3),this.#eR=t,this.#i=a}get closeCode(){return this.#eR}get reason(){return this.#i}static createUnvalidatedWebSocketError(A,e,t){let r=new o(A,i);return r.#eR=e,r.#i=t,r}}let{createUnvalidatedWebSocketError:g}=o;delete o.createUnvalidatedWebSocketError,Object.defineProperties(o.prototype,{closeCode:a,reason:a,[Symbol.toStringTag]:{value:"WebSocketError",writable:!1,enumerable:!1,configurable:!0}}),r.is.WebSocketError=r.util.MakeTypeAssertion(o),e.exports={WebSocketError:o,createUnvalidatedWebSocketError:g}},326101,(A,e,t)=>{"use strict";let{addAbortListener:r}=A.r(687769),{environmentSettingsObject:n,readableStreamClose:i}=A.r(359401),{states:a,opcodes:s,sentCloseFrameState:o}=A.r(175512),{webidl:g}=A.r(704143),{getURLRecord:C,isValidSubprotocol:Q,isEstablished:l,utf8Decode:I}=A.r(666578),{establishWebSocketConnection:d,failWebsocketConnection:E,closeWebSocketConnection:c}=A.r(856986),{channels:h}=A.r(519842),{WebsocketFrameSend:B}=A.r(659541),{ByteParser:D}=A.r(928694),{WebSocketError:w,createUnvalidatedWebSocketError:u}=A.r(691168),{kEnumerableProperty:p}=A.r(780405),{utf8DecodeBytes:f}=A.r(668242),y=!1;class M{#eU;#eT;#eb;#eH;#eL;#eO;#eG=!1;#c={onConnectionEstablished:(A,e)=>this.#eM(A,e),onMessage:(A,e)=>this.#em(A,e),onParserError:A=>E(this.#c,null,A.message),onParserDrain:()=>this.#c.socket.resume(),onSocketData:A=>{this.#eS.write(A)||this.#c.socket.pause()},onSocketError:A=>{this.#c.readyState=a.CLOSING,h.socketError.hasSubscribers&&h.socketError.publish(A),this.#c.socket.destroy()},onSocketClose:()=>this.#ek(),onPing:()=>{},onPong:()=>{},readyState:a.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#eS;constructor(A,e){y||(process.emitWarning("WebSocketStream is experimental! Expect it to change at any time.",{code:"UNDICI-WSS"}),y=!0),g.argumentLengthCheck(arguments,1,"WebSocket"),A=g.converters.USVString(A),null!==e&&(e=g.converters.WebSocketStreamOptions(e));const t=C(A,n.settingsObject.baseUrl),i=e.protocols;if(i.length!==new Set(i.map(A=>A.toLowerCase())).size||i.length>0&&!i.every(A=>Q(A)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(this.#eU=t.toString(),this.#eT=Promise.withResolvers(),this.#eb=Promise.withResolvers(),null!=e.signal){const A=e.signal;if(A.aborted){this.#eT.reject(A.reason),this.#eb.reject(A.reason);return}r(A,()=>{l(this.#c.readyState)||(E(this.#c),this.#c.readyState=a.CLOSING,this.#eT.reject(A.reason),this.#eb.reject(A.reason),this.#eG=!0)})}const s=n.settingsObject;this.#c.controller=d(t,i,s,this.#c,e)}get url(){return this.#eU.toString()}get opened(){return this.#eT.promise}get closed(){return this.#eb.promise}close(A){null!==A&&(A=g.converters.WebSocketCloseInfo(A));let e=A.closeCode??null,t=A.reason;c(this.#c,e,t,!0)}#eJ(A){A=g.converters.WebSocketStreamWrite(A);let e=Promise.withResolvers(),t=null,r=null;if(g.is.BufferSource(A))t=new Uint8Array(ArrayBuffer.isView(A)?new Uint8Array(A.buffer,A.byteOffset,A.byteLength):A.slice()),r=s.BINARY;else{let n;try{n=g.converters.DOMString(A)}catch(A){return e.reject(A),e.promise}t=new TextEncoder().encode(n),r=s.TEXT}if(!this.#c.closeState.has(o.SENT)&&!this.#c.closeState.has(o.RECEIVED)){let A=new B(t);this.#c.socket.write(A.createFrame(r),()=>{e.resolve(void 0)})}return e.promise}#eM(A,e){this.#c.socket=A.socket;let t=this.#c.controller.dispatcher?.webSocketOptions?.maxFragments,r=this.#c.controller.dispatcher?.webSocketOptions?.maxPayloadSize,n=new D(this.#c,e,{maxFragments:t,maxPayloadSize:r});n.on("drain",()=>this.#c.onParserDrain()),n.on("error",A=>this.#c.onParserError(A)),this.#eS=n,this.#c.readyState=a.OPEN;let i=e??"",s=A.headersList.get("sec-websocket-protocol")??"",o=new ReadableStream({start:A=>{this.#eL=A},cancel:A=>this.#ev(A)}),g=new WritableStream({write:A=>this.#eJ(A),close:()=>c(this.#c,null,null),abort:A=>this.#ex(A)});this.#eH=o,this.#eO=g,this.#eT.resolve({extensions:i,protocol:s,readable:o,writable:g})}#em(A,e){let t;if(this.#c.readyState===a.OPEN){if(A===s.TEXT)try{t=I(e)}catch{E(this.#c,1007,"Received invalid UTF-8 in text frame.");return}else A===s.BINARY&&(t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength));this.#eL.enqueue(t)}}#ek(){let A=this.#c.closeState.has(o.SENT)&&this.#c.closeState.has(o.RECEIVED);if(this.#c.readyState=a.CLOSED,this.#eG)return;this.#c.wasEverConnected||this.#eT.reject(new w("Socket never opened"));let e=this.#eS?.closingInfo,t=e?.code??1005;this.#c.closeState.has(o.SENT)||this.#c.closeState.has(o.RECEIVED)||(t=1006);let r=e?.reason==null?"":f(Buffer.from(e.reason));if(A)i(this.#eL),this.#eO.locked||this.#eO.abort(new DOMException("A closed WebSocketStream cannot be written to","InvalidStateError")),this.#eb.resolve({closeCode:t,reason:r});else{let A=u("unclean close",t,r);this.#eL?.error(A),this.#eO?.abort(A),this.#eb.reject(A)}}#ex(A){let e=null,t="";g.is.WebSocketError(A)&&(e=A.closeCode,t=A.reason),c(this.#c,e,t)}#ev(A){this.#ex(A)}}Object.defineProperties(M.prototype,{url:p,opened:p,closed:p,close:p,[Symbol.toStringTag]:{value:"WebSocketStream",writable:!1,enumerable:!1,configurable:!0}}),g.converters.WebSocketStreamOptions=g.dictionaryConverter([{key:"protocols",converter:g.sequenceConverter(g.converters.USVString),defaultValue:()=>[]},{key:"signal",converter:g.nullableConverter(g.converters.AbortSignal),defaultValue:()=>null}]),g.converters.WebSocketCloseInfo=g.dictionaryConverter([{key:"closeCode",converter:A=>g.converters["unsigned short"](A,g.attributes.EnforceRange)},{key:"reason",converter:g.converters.USVString,defaultValue:()=>""}]),g.converters.WebSocketStreamWrite=function(A){return"string"==typeof A?g.converters.USVString(A):g.converters.BufferSource(A)},e.exports={WebSocketStream:M}},535488,(A,e,t)=>{"use strict";let{makeRequest:r}=A.r(341716);e.exports={isValidLastEventId:function(A){return -1===A.indexOf("\0")},isASCIINumber:function(A){if(0===A.length)return!1;for(let e=0;e<A.length;e++)if(48>A.charCodeAt(e)||A.charCodeAt(e)>57)return!1;return!0},createPotentialCORSRequest:function(A,e,t,n){let i="no cors"===t?"no-cors":"cors";n&&"no-cors"===i&&(i="same-origin");let a="include";return"anonymous"===t&&(a="same-origin"),r({urlList:[A],destination:e,mode:i,credentials:a,useURLCredentials:!0})}}},28534,(A,e,t)=>{"use strict";let{Transform:r}=A.r(81111),{isASCIINumber:n,isValidLastEventId:i}=A.r(535488),a=Buffer.from("data"),s=Buffer.from("event"),o=Buffer.from("id"),g=Buffer.from("retry");function C(A,e,t){if(e!==t.length)return!1;for(let r=0;r<e;r++)if(A[r]!==t[r])return!1;return!0}e.exports={EventSourceStream:class extends r{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;chunks=[];chunkIndex=0;pos=0;lineChunkIndex=0;linePos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(A={}){A.readableObjectMode=!0,super(A),this.state=A.eventSourceSettings||{},A.push&&(this.push=A.push)}_transform(A,e,t){if(0===A.length||(this.chunks.push(A),this.checkBOM&&this.handleBOM()))return void t();for(;this.hasCurrentByte();){let A=this.currentByte();if(this.eventEndCheck){if(this.crlfCheck){if(10===A){this.crlfCheck=!1,this.consumeCurrentByte();continue}this.crlfCheck=!1}if(10===A||13===A){13===A&&(this.crlfCheck=!0),this.consumeCurrentByte(),this.hasPendingEvent()&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(10===A||13===A){13===A&&(this.crlfCheck=!0),this.parseLine(this.readLine(),this.event),this.consumeCurrentByte(),this.eventEndCheck=!0;continue}this.advanceCursor()}t()}parseLine(A,e){if(0===A.length)return;let t=A.indexOf(58);if(0===t)return;let r=A.length,n=A.length;if(-1!==t&&(r=t,32===A[n=t+1]&&++n),C(A,r,a)){let t=A.toString("utf8",n);void 0===e.data?e.data=t:e.data+=`
120
120
  ${t}`;return}if(C(A,r,g)){(function(A,e){if(e>=A.length)return!1;for(let t=e;t<A.length;t++)if(A[t]<48||A[t]>57)return!1;return!0})(A,n)&&(e.retry=A.toString("utf8",n));return}if(C(A,r,o)){(function(A,e){for(let t=e;t<A.length;t++)if(0===A[t])return!1;return!0})(A,n)&&(e.id=A.toString("utf8",n));return}if(C(A,r,s)){let t=A.toString("utf8",n);t.length>0&&(e.event=t)}}processEvent(A){A.retry&&n(A.retry)&&(this.state.reconnectionTime=parseInt(A.retry,10)),void 0!==A.id&&i(A.id)&&(this.state.lastEventId=A.id),void 0!==A.data&&this.push({type:A.event||"message",options:{data:A.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event.data=void 0,this.event.event=void 0,this.event.id=void 0,this.event.retry=void 0}hasPendingEvent(){return void 0!==this.event.data||void 0!==this.event.event||void 0!==this.event.id||void 0!==this.event.retry}hasCurrentByte(){return this.chunkIndex<this.chunks.length&&this.pos<this.chunks[this.chunkIndex].length}currentByte(){return this.chunks[this.chunkIndex][this.pos]}consumeCurrentByte(){this.advanceCursor(),this.syncLineStartToCursor()}advanceCursor(){for(this.pos++;this.chunkIndex<this.chunks.length&&this.pos>=this.chunks[this.chunkIndex].length;)this.chunkIndex++,this.pos=0}syncLineStartToCursor(){this.lineChunkIndex=this.chunkIndex,this.linePos=this.pos,this.dropConsumedChunks()}dropConsumedChunks(){for(;this.lineChunkIndex>0;)this.chunks.shift(),this.lineChunkIndex--,this.chunkIndex--;this.chunkIndex===this.chunks.length&&(this.chunks.length=0,this.chunkIndex=0,this.pos=0,this.lineChunkIndex=0,this.linePos=0)}readLine(){if(this.lineChunkIndex===this.chunkIndex)return this.chunks[this.chunkIndex].subarray(this.linePos,this.pos);let A=[],e=0;for(let t=this.lineChunkIndex;t<=this.chunkIndex;t++){let r=this.chunks[t],n=t===this.lineChunkIndex?this.linePos:0,i=t===this.chunkIndex?this.pos:r.length,a=r.subarray(n,i);e+=a.length,A.push(a)}return Buffer.concat(A,e)}peekBufferedByte(A){let e=this.lineChunkIndex,t=this.linePos;for(;e<this.chunks.length;){let r=this.chunks[e],n=r.length-t;if(A<n)return r[t+A];A-=n,e++,t=0}}discardLeadingBytes(A){for(;A>0&&this.lineChunkIndex<this.chunks.length;){let e=this.chunks[this.lineChunkIndex].length-this.linePos;A<e?(this.linePos+=A,A=0):(A-=e,this.lineChunkIndex++,this.linePos=0)}this.chunkIndex=this.lineChunkIndex,this.pos=this.linePos,this.dropConsumedChunks()}handleBOM(){let A=this.peekBufferedByte(0),e=this.peekBufferedByte(1),t=this.peekBufferedByte(2);return void 0===e?239===A||(this.checkBOM=!1,!0):void 0===t?239===A&&187===e||(this.checkBOM=!1,!1):(239===A&&187===e&&191===t&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}}}},763785,(A,e,t)=>{"use strict";let{pipeline:r}=A.r(81111),{fetching:n}=A.r(817906),{webidl:i}=A.r(704143),{EventSourceStream:a}=A.r(28534),{parseMIMEType:s}=A.r(561743),{createFastMessageEvent:o}=A.r(124672),{isNetworkError:g}=A.r(650801),{kEnumerableProperty:C}=A.r(780405),{environmentSettingsObject:Q}=A.r(359401),{createPotentialCORSRequest:l}=A.r(535488),I=!1;class d extends EventTarget{#eu={open:null,error:null,message:null};#eU;#eV=!1;#eP=0;#eY=null;#At=null;#h;#d;constructor(A,e={}){let t;super(),i.util.markAsUncloneable(this);const r="EventSource constructor";i.argumentLengthCheck(arguments,1,r),I||(I=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),A=i.converters.USVString(A),e=i.converters.EventSourceInitDict(e,r,"eventSourceInitDict"),this.#h=e.node.dispatcher||e.dispatcher,this.#d={lastEventId:"",reconnectionTime:e.node.reconnectionTime};try{t=new URL(A,Q.settingsObject.baseUrl),this.#d.origin=t.origin}catch(A){throw new DOMException(A,"SyntaxError")}this.#eU=t.href;let n="anonymous";!0===e.withCredentials&&(n="use-credentials",this.#eV=!0);const a=l(t,"",n);a.client=Q.settingsObject,a.headersList.set("Accept","text/event-stream"),a.cache="no-store",a.initiator="other",this.#eY=a,this.#e_()}get readyState(){return this.#eP}get url(){return this.#eU}get withCredentials(){return this.#eV}#e_(){if(2===this.#eP)return;this.#eP=0;let A={request:this.#eY,dispatcher:this.#h};A.processResponseEndOfBody=A=>{if(!g(A))return this.#eK()},A.processResponse=A=>{if(g(A))if(!A.aborted)return void this.#eK();else{this.close(),this.dispatchEvent(new Event("error"));return}let e=A.headersList.get("content-type",!0),t=null!==e?s(e):"failure",n="failure"!==t&&"text/event-stream"===t.essence;if(200!==A.status||!1===n){this.close(),this.dispatchEvent(new Event("error"));return}this.#eP=1,this.dispatchEvent(new Event("open")),this.#d.origin=A.urlList[A.urlList.length-1].origin;let i=new a({eventSourceSettings:this.#d,push:A=>{this.dispatchEvent(o(A.type,A.options))}});r(A.body.stream,i,A=>{A?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#At=n(A)}#eK(){2!==this.#eP&&(this.#eP=0,this.dispatchEvent(new Event("error")),setTimeout(()=>{0===this.#eP&&(this.#d.lastEventId.length&&this.#eY.headersList.set("last-event-id",this.#d.lastEventId,!0),this.#e_())},this.#d.reconnectionTime)?.unref())}close(){i.brandCheck(this,d),2!==this.#eP&&(this.#eP=2,this.#At.abort(),this.#eY=null)}get onopen(){return this.#eu.open}set onopen(A){this.#eu.open&&this.removeEventListener("open",this.#eu.open);let e=i.converters.EventHandlerNonNull(A);null!==e?(this.addEventListener("open",e),this.#eu.open=A):this.#eu.open=null}get onmessage(){return this.#eu.message}set onmessage(A){this.#eu.message&&this.removeEventListener("message",this.#eu.message);let e=i.converters.EventHandlerNonNull(A);null!==e?(this.addEventListener("message",e),this.#eu.message=A):this.#eu.message=null}get onerror(){return this.#eu.error}set onerror(A){this.#eu.error&&this.removeEventListener("error",this.#eu.error);let e=i.converters.EventHandlerNonNull(A);null!==e?(this.addEventListener("error",e),this.#eu.error=A):this.#eu.error=null}}let E={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:0,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:1,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:2,writable:!1}};Object.defineProperties(d,E),Object.defineProperties(d.prototype,E),Object.defineProperties(d.prototype,{close:C,onerror:C,onmessage:C,onopen:C,readyState:C,url:C,withCredentials:C}),i.converters.EventSourceInitDict=i.dictionaryConverter([{key:"withCredentials",converter:i.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:i.converters.any},{key:"node",converter:i.dictionaryConverter([{key:"reconnectionTime",converter:i.converters["unsigned long"],defaultValue:()=>3e3},{key:"dispatcher",converter:i.converters.any}]),defaultValue:()=>({})}]),e.exports={EventSource:d,defaultReconnectionTime:3e3}},936689,(A,e,t)=>{"use strict";let r=A.r(261273),n=A.r(590706),i=A.r(767084),a=A.r(195209),s=A.r(60133),o=A.r(520404),g=A.r(758681),C=A.r(791290),Q=A.r(641294),l=A.r(56965),I=A.r(41755),d=A.r(416546),E=A.r(920788),c=A.r(780405),{InvalidArgumentError:h}=E,B=A.r(351783),D=A.r(451650),w=A.r(437157),{MockCallHistory:u,MockCallHistoryLog:p}=A.r(64241),f=A.r(919030),y=A.r(698097),M=A.r(707121),m=A.r(535750),N=A.r(734919),{getGlobalDispatcher:S,setGlobalDispatcher:k}=A.r(403264),U=A.r(156516),F=A.r(841459);Object.assign(n.prototype,B),e.exports.Dispatcher=n,e.exports.Client=r,e.exports.Pool=i,e.exports.BalancedPool=a,e.exports.RoundRobinPool=s,e.exports.Agent=o,e.exports.Dispatcher1Wrapper=g,e.exports.ProxyAgent=C,e.exports.Socks5ProxyAgent=Q,e.exports.EnvHttpProxyAgent=l,e.exports.RetryAgent=I,e.exports.H2CClient=d,e.exports.RetryHandler=N,e.exports.DecoratorHandler=U,e.exports.RedirectHandler=F,e.exports.interceptors={redirect:A.r(194094),responseError:A.r(791990),retry:A.r(480472),dump:A.r(161695),dns:A.r(384858),cache:A.r(117137),decompress:A.r(280699),deduplicate:A.r(378135)},e.exports.cacheStores={MemoryCacheStore:A.r(814574)};let R=A.r(467569);function T(A){return(e,t,r)=>{if("function"==typeof t&&(r=t,t=null),!e||"string"!=typeof e&&"object"!=typeof e&&!(e instanceof URL))throw new h("invalid url");if(null!=t&&"object"!=typeof t)throw new h("invalid opts");if(t&&null!=t.path){if("string"!=typeof t.path)throw new h("invalid opts.path");let A=t.path;t.path.startsWith("/")||(A=`/${A}`),e=new URL(c.parseOrigin(e).origin+A)}else t||(t="object"==typeof e?e:{}),e=c.parseURL(e);let{agent:n,dispatcher:i=S(),...a}=t;if(n)throw new h("unsupported opts.agent. Did you mean opts.client?");return A.call(i,{...a,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:t.method||(t.body?"PUT":"GET")},r)}}e.exports.cacheStores.SqliteCacheStore=R,e.exports.buildConnector=D,e.exports.errors=E,e.exports.util={parseHeaders:c.parseHeaders,headerNameToString:c.headerNameToString},e.exports.setGlobalDispatcher=k,e.exports.getGlobalDispatcher=S;let b=A.r(817906).fetch,H="/ROOT/node_modules/undici/index.js";e.exports.fetch=function(A,t){return b(A,t).catch(A=>{throw H?!function A(e,t){if(!e||"object"!=typeof e)return;let r="string"==typeof e.stack?e.stack:"",n=t.replace(/\\/g,"/");if(r&&(r.includes(t)||r.includes(n)))return;let i={};if(Error.captureStackTrace(i,A),!i.stack)return;let a=i.stack.split("\n").slice(1).join("\n");e.stack=r?`${r}
121
- ${a}`:i.stack}(A,H):A&&"object"==typeof A&&Error.captureStackTrace(A,e.exports.fetch),A})},e.exports.Headers=A.r(761883).Headers,e.exports.Response=A.r(650801).Response,e.exports.Request=A.r(341716).Request,e.exports.FormData=A.r(740526).FormData;let{setGlobalOrigin:L,getGlobalOrigin:O}=A.r(65616);e.exports.setGlobalOrigin=L,e.exports.getGlobalOrigin=O;let{CacheStorage:G}=A.r(562899),{kConstruct:J}=A.r(35634);e.exports.caches=new G(J);let{deleteCookie:v,getCookies:x,getSetCookies:V,setCookie:P,parseCookie:Y}=A.r(75864);e.exports.deleteCookie=v,e.exports.getCookies=x,e.exports.getSetCookies=V,e.exports.setCookie=P,e.exports.parseCookie=Y;let{parseMIMEType:_,serializeAMimeType:K}=A.r(561743);e.exports.parseMIMEType=_,e.exports.serializeAMimeType=K;let{CloseEvent:q,ErrorEvent:Z,MessageEvent:W}=A.r(124672),{WebSocket:z,ping:j}=A.r(126507);e.exports.WebSocket=z,e.exports.CloseEvent=q,e.exports.ErrorEvent=Z,e.exports.MessageEvent=W,e.exports.ping=j,e.exports.WebSocketStream=A.r(326101).WebSocketStream,e.exports.WebSocketError=A.r(691168).WebSocketError,e.exports.request=T(B.request),e.exports.stream=T(B.stream),e.exports.pipeline=T(B.pipeline),e.exports.connect=T(B.connect),e.exports.upgrade=T(B.upgrade),e.exports.MockClient=w,e.exports.MockCallHistory=u,e.exports.MockCallHistoryLog=p,e.exports.MockPool=y,e.exports.MockAgent=f,e.exports.SnapshotAgent=M,e.exports.mockErrors=m;let{EventSource:$}=A.r(763785);e.exports.EventSource=$,e.exports.install=function(){globalThis.fetch=e.exports.fetch,globalThis.Headers=e.exports.Headers,globalThis.Response=e.exports.Response,globalThis.Request=e.exports.Request,globalThis.FormData=e.exports.FormData,globalThis.WebSocket=e.exports.WebSocket,globalThis.CloseEvent=e.exports.CloseEvent,globalThis.ErrorEvent=e.exports.ErrorEvent,globalThis.MessageEvent=e.exports.MessageEvent,globalThis.EventSource=e.exports.EventSource}},582482,318905,91022,A=>{"use strict";var e=A.i(666680);function t(A){return(0,e.createHash)("sha256").update(A).digest("hex")}function r(A,e){return Buffer.from(JSON.stringify({id:A.id,kind:A.kind,version:e}),"utf8")}function n(A,n,i){let a=(0,e.randomBytes)(12),s=(0,e.createCipheriv)("aes-256-gcm",i,a,{authTagLength:16});return s.setAAD(r(A,1)),{payload:Buffer.concat([s.update(Buffer.from(n)),s.final()]),encryptionVersion:1,nonce:a,authTag:s.getAuthTag(),keyFingerprint:t(i)}}let i="secret",a="ai-development-environment/credentials",s=new Set(["accept","connection","content-length","content-type","expect","host","transfer-encoding","upgrade","x-vault-request"]);function o(A,e){return{code:A,message:e}}function g(A,e){let t=A.replace(/^\/+|\/+$/g,""),r=t.split("/");if(!t||r.some(A=>!A||"."===A||".."===A||A.includes("\\")))throw Error(`${e} must contain non-empty Vault path segments`);return t}function C(A,e){return Object.keys(A).some(A=>A.toLowerCase()===e.toLowerCase())}function Q(A=process.env,e=process.platform){let r,n=A.CREDENTIAL_STORAGE_TYPE?.trim().toLowerCase()||"database";if("database"!==n&&"vault"!==n&&"keychain"!==n)return{requestedStorageType:n,storageType:"unknown",config:null,warnings:[],errors:[o("CREDENTIAL_STORAGE_TYPE_INVALID","CREDENTIAL_STORAGE_TYPE must be database, vault, or keychain")],details:[{label:"Configured value",value:n}]};if("database"===n){let e=A.CREDENTIAL_ENCRYPTION_KEY;if(!e)return{requestedStorageType:n,storageType:"database",config:{storageType:"database",encryptionKey:null,keyFingerprint:null},warnings:[o("DATABASE_UNENCRYPTED","Database credentials are stored as plaintext until CREDENTIAL_ENCRYPTION_KEY is configured")],errors:[],details:[{label:"Location",value:"Application database"},{label:"Encryption key",value:"Not configured"}]};try{let A=function(A){if(!A||A.length%4!=0||!/^[A-Za-z0-9+/]+={0,2}$/.test(A))throw Error("CREDENTIAL_ENCRYPTION_KEY must be strict base64 encoding of exactly 32 bytes");let e=Buffer.from(A,"base64");if(32!==e.length||e.toString("base64")!==A)throw Error("CREDENTIAL_ENCRYPTION_KEY must be strict base64 encoding of exactly 32 bytes");return e}(e);return{requestedStorageType:n,storageType:"database",config:{storageType:"database",encryptionKey:A,keyFingerprint:t(A)},warnings:[],errors:[],details:[{label:"Location",value:"Application database"},{label:"Encryption key",value:"Configured"}]}}catch(A){return{requestedStorageType:n,storageType:"database",config:null,warnings:[],errors:[o("CREDENTIAL_ENCRYPTION_KEY_INVALID",A instanceof Error?A.message:"The encryption key is invalid")],details:[{label:"Location",value:"Application database"},{label:"Encryption key",value:"Invalid"}]}}}if("keychain"===n)return{requestedStorageType:n,storageType:"keychain",config:{storageType:"keychain",platform:e,service:"com.bludesign.ai-development-environment.credentials"},warnings:[],errors:"darwin"===e?[]:[o("KEYCHAIN_UNSUPPORTED_PLATFORM","macOS Keychain storage is only available when the Next.js host runs on macOS")],details:[{label:"Service",value:"com.bludesign.ai-development-environment.credentials"},{label:"Host platform",value:e}]};let l=[],I=[],d={},E=i,c=a,h=!1;try{if(!A.VAULT_ADDR?.trim())throw Error("VAULT_ADDR is required");if(r=new URL(A.VAULT_ADDR),"https:"!==r.protocol&&"http:"!==r.protocol)throw Error("VAULT_ADDR must use http or https");if(r.username||r.password||r.search||r.hash)throw Error("VAULT_ADDR cannot contain credentials, query parameters, or a fragment");if(r.pathname=r.pathname.replace(/\/+$/,""),d=function(A){let e;if(!A?.trim())return{};try{e=JSON.parse(A)}catch{throw Error("CREDENTIAL_VAULT_HEADERS must be a JSON object")}if("object"!=typeof e||null===e||Array.isArray(e))throw Error("CREDENTIAL_VAULT_HEADERS must be a JSON object");let t={};for(let[A,r]of Object.entries(e)){let e=A.trim();if(!e||"string"!=typeof r)throw Error("CREDENTIAL_VAULT_HEADERS must contain only string header values");try{new Headers({[e]:r})}catch{throw Error(`CREDENTIAL_VAULT_HEADERS contains invalid header ${e}`)}if(s.has(e.toLowerCase()))throw Error(`CREDENTIAL_VAULT_HEADERS cannot override the managed ${e} header`);if(Object.keys(t).find(A=>A.toLowerCase()===e.toLowerCase()))throw Error(`CREDENTIAL_VAULT_HEADERS repeats the ${e} header`);t[e]=r}return t}(A.CREDENTIAL_VAULT_HEADERS),E=g(A.CREDENTIAL_VAULT_MOUNT||i,"CREDENTIAL_VAULT_MOUNT"),c=g(A.CREDENTIAL_VAULT_PATH_PREFIX||a,"CREDENTIAL_VAULT_PATH_PREFIX"),h=function(A,e){if(!A||"0"===A||"false"===A.toLowerCase())return!1;if("1"===A||"true"===A.toLowerCase())return!0;throw Error(`${e} must be true, false, 1, or 0`)}(A.VAULT_SKIP_VERIFY,"VAULT_SKIP_VERIFY"),A.VAULT_TOKEN&&C(d,"x-vault-token"))throw Error("VAULT_TOKEN conflicts with X-Vault-Token in CREDENTIAL_VAULT_HEADERS");if(A.VAULT_NAMESPACE&&C(d,"x-vault-namespace"))throw Error("VAULT_NAMESPACE conflicts with X-Vault-Namespace in CREDENTIAL_VAULT_HEADERS")}catch(A){l.push(o("VAULT_CONFIGURATION_INVALID",A instanceof Error?A.message:"Vault configuration is invalid")),r=new URL("https://invalid.local")}"http:"===r.protocol&&I.push(o("VAULT_INSECURE_HTTP","VAULT_ADDR uses plaintext HTTP; Vault credentials and authentication headers are not protected in transit")),h&&I.push(o("VAULT_TLS_VERIFICATION_DISABLED","VAULT_SKIP_VERIFY disables certificate verification for Vault connections"));let B=Object.keys(d).sort((A,e)=>A.localeCompare(e)),D=[{label:"Address",value:l.length?"Invalid":r.toString()},{label:"KV v2 mount",value:E},{label:"Path prefix",value:c},{label:"Namespace",value:A.VAULT_NAMESPACE?"Configured":"Not configured"},{label:"Authentication token",value:A.VAULT_TOKEN||C(d,"x-vault-token")?"Configured":"Not configured"},{label:"Additional headers",value:B.length?B.join(", "):"None"},{label:"Custom CA",value:A.VAULT_CACERT?"Configured":"Not configured"},{label:"TLS server name",value:A.VAULT_TLS_SERVER_NAME?"Configured":"Not configured"}];return{requestedStorageType:n,storageType:"vault",config:0===l.length?{storageType:"vault",address:r,token:A.VAULT_TOKEN||null,namespace:A.VAULT_NAMESPACE||null,mount:E,pathPrefix:c,headers:d,caCertPath:A.VAULT_CACERT||null,tlsServerName:A.VAULT_TLS_SERVER_NAME||null,skipVerify:h}:null,warnings:I,errors:l,details:D}}var l=A.i(243783);class I extends Error{code;constructor(A,e){super(A),this.code=e,this.name="CredentialStoreOperationError"}}function d(A){return new I(A,"CREDENTIAL_DATA_INVALID")}function E(A){return Uint8Array.from(A)}async function c(A){let[e]=await A.$queryRawUnsafe("PRAGMA wal_checkpoint(TRUNCATE);");if(!e||0!==Number(e.busy))throw Error("SQLite WAL could not be truncated after credential encryption")}async function h(A){await c(A),await A.$executeRawUnsafe("VACUUM;"),await c(A)}class B{prisma;config;storageType;constructor(A,e){this.prisma=A,this.config=e,this.storageType="database"}async initialize(){let A=await this.prisma.credential.findMany({where:{storageType:this.storageType,encrypted:!0},select:{id:!0,keyFingerprint:!0,encryptionVersion:!0,nonce:!0,authTag:!0,payload:!0}});if(A.length&&!this.config.encryptionKey)throw new I("Encrypted credentials exist, but CREDENTIAL_ENCRYPTION_KEY is not configured. Restore the original key and restart the server.","CREDENTIAL_ENCRYPTION_KEY_MISSING");if(this.config.encryptionKey){let e=this.config.encryptionKey;if(A.some(A=>A.keyFingerprint!==this.config.keyFingerprint))throw new I("CREDENTIAL_ENCRYPTION_KEY does not match existing credentials. Restore the original key and restart the server.","CREDENTIAL_ENCRYPTION_KEY_MISMATCH");if(A.some(A=>!A.payload||1!==A.encryptionVersion||!A.nonce||!A.authTag))throw d("One or more encrypted credential records have invalid encryption metadata");await this.prisma.$queryRawUnsafe("PRAGMA secure_delete = ON;"),await this.prisma.$transaction(async A=>{let t=await A.credential.findMany({where:{storageType:this.storageType,encrypted:!1},select:{id:!0,kind:!0,payload:!0}});for(let r of t){if(!r.payload)throw d(`Credential metadata for ${r.id} has no database payload`);let t=n({id:r.id,kind:r.kind},r.payload,e);await A.credential.update({where:{id:r.id},data:{payload:E(t.payload),encrypted:!0,encryptionVersion:t.encryptionVersion,nonce:E(t.nonce),authTag:E(t.authTag),keyFingerprint:t.keyFingerprint}})}return t.length})>0&&await h(this.prisma)}}async get(A){let e=await this.prisma.credential.findUnique({where:{id:A.id}});return e?this.getFromRecord(A,e):null}getFromRecord(A,t){if(t.kind!==A.kind)throw d(`Credential ${A.id} has unexpected kind metadata`);if(t.storageType!==this.storageType)throw new I(`Credential ${A.id} was stored in ${t.storageType}; re-enter it for database storage`,"BACKEND_MISMATCH");if(!t.payload)throw d(`Credential ${A.id} has no database payload`);if(!t.encrypted)return Buffer.from(t.payload);if(!this.config.encryptionKey)throw new I("CREDENTIAL_ENCRYPTION_KEY is required to read encrypted credentials","CREDENTIAL_ENCRYPTION_KEY_MISSING");if(t.keyFingerprint!==this.config.keyFingerprint)throw new I("CREDENTIAL_ENCRYPTION_KEY does not match this credential","CREDENTIAL_ENCRYPTION_KEY_MISMATCH");if(!t.encryptionVersion||!t.nonce||!t.authTag)throw d(`Credential ${A.id} has invalid encryption metadata`);return function(A,t,n){if(1!==t.encryptionVersion)throw Error("The credential encryption envelope version is unsupported");if(12!==t.nonce.byteLength||16!==t.authTag.byteLength)throw Error("The credential encryption envelope is invalid");try{let i=(0,e.createDecipheriv)("aes-256-gcm",n,t.nonce,{authTagLength:16});return i.setAAD(r(A,t.encryptionVersion)),i.setAuthTag(Buffer.from(t.authTag)),Buffer.concat([i.update(Buffer.from(t.payload)),i.final()])}catch{throw Error("The credential could not be decrypted; restore the original encryption key or re-enter the credential")}}(A,{payload:t.payload,encryptionVersion:t.encryptionVersion,nonce:t.nonce,authTag:t.authTag},this.config.encryptionKey)}async set(A,e){await this.prisma.$transaction(t=>this.setInTransaction(t,A,e))}async setInTransaction(A,e,t){let r=this.config.encryptionKey?n(e,t,this.config.encryptionKey):null,i={kind:e.kind,ownerId:e.ownerId??null,storageType:this.storageType,payload:E(r?.payload??t),encrypted:!!r,encryptionVersion:r?.encryptionVersion??null,nonce:r?E(r.nonce):null,authTag:r?E(r.authTag):null,keyFingerprint:r?.keyFingerprint??null};await A.credential.upsert({where:{id:e.id},create:{id:e.id,...i},update:i})}async delete(A){await this.prisma.$transaction(e=>this.deleteInTransaction(e,A))}async deleteInTransaction(A,e){await A.credential.deleteMany({where:{id:e.id}})}}let D=()=>A.A(12202);class w{config;moduleLoader;storageType;constructor(A,e=D){this.config=A,this.moduleLoader=e,this.storageType="keychain"}async initialize(){this.assertSupported()}assertSupported(){if("darwin"!==this.config.platform)throw new I("macOS Keychain credential storage is unavailable on this host. Select database or Vault storage and restart the server.","KEYCHAIN_UNSUPPORTED_PLATFORM")}async entry(A){this.assertSupported();let{AsyncEntry:e}=await this.moduleLoader();return new e(this.config.service,A)}async get(A){try{let e=await (await this.entry(A.id)).getSecret();return e?Buffer.from(e):null}catch(e){throw Error(`macOS Keychain could not read ${A.id}: ${e instanceof Error?e.message:"credential operation failed"}`)}}async set(A,e){try{await (await this.entry(A.id)).setSecret(Buffer.from(e))}catch(e){throw Error(`macOS Keychain could not store ${A.id}: ${e instanceof Error?e.message:"credential operation failed"}`)}}async delete(A){try{await (await this.entry(A.id)).deleteCredential()}catch(e){throw Error(`macOS Keychain could not delete ${A.id}: ${e instanceof Error?e.message:"credential operation failed"}`)}}}let u="jira-api-token",p="github-personal-access-token",f="github-app-private-key",y="cache-server-api-key",M="cache-server-headers",m="external-mcp-server-headers",N="ios-profile-signer-private-key",S="app-store-connect-private-key",k="apns-token-private-key",U="apns-certificate-bundle",F="web-push-vapid-private-key";function R(A){return Buffer.from(JSON.stringify({version:1,value:A}),"utf8")}function T(A){let e;try{e=JSON.parse(Buffer.from(A).toString("utf8"))}catch{throw Error("The stored credential envelope is invalid")}if("object"!=typeof e||null===e||1!==e.version||!("value"in e))throw Error("The stored credential envelope version is unsupported");return e.value}function b(A){switch(A){case u:return"Jira";case p:case f:return"GitHub";case y:case M:return"Actions cache";case m:return"External MCP server";case N:case S:return"iOS devices";case k:case U:return"Push notifications";case F:return"Notifications";default:return"Unknown"}}A.s(["CREDENTIALS",0,{jiraApiToken:{id:"jira/default/api-token",kind:u,ownerId:"default"},githubPersonalAccessToken:{id:"github/default/personal-access-token",kind:p,ownerId:"default"},githubAppPrivateKey:{id:"github-app/default/private-key",kind:f,ownerId:"default"},cacheServerApiKey:{id:"cache-server/default/api-key",kind:y,ownerId:"default"},cacheServerHeaders:{id:"cache-server/default/headers",kind:M,ownerId:"default"},iosProfileSignerPrivateKey:{id:"ios-devices/default/profile-signer-private-key",kind:N,ownerId:"default"},appStoreConnectPrivateKey:{id:"ios-devices/default/app-store-connect-private-key",kind:S,ownerId:"default"},apnsTokenPrivateKey:{id:"push-notifications/default/token-private-key",kind:k,ownerId:"default"},webPushVapidPrivateKey:{id:"notifications/default/web-push-vapid-private-key",kind:F,ownerId:"default"}},"apnsCertificateCredential",0,function(A){return{id:`apns-certificate/${A}/bundle`,kind:U,ownerId:A}},"credentialOwnerFeature",0,b,"decodeJsonCredential",0,T,"encodeJsonCredential",0,R,"externalMcpHeadersCredential",0,function(A){return{id:`external-mcp-server/${A}/headers`,kind:m,ownerId:A}}],318905);var H=A.i(912714),L=A.i(936689);function O(A){return A.split("/").map(encodeURIComponent).join("/")}class G{config;requestImplementation;dispatcherFactory;storageType;dispatcherPromise;constructor(A,e=L.request,t=A=>new L.Agent(A)){this.config=A,this.requestImplementation=e,this.dispatcherFactory=t,this.storageType="vault",this.dispatcherPromise=null}async initialize(){await this.dispatcher()}dispatcher(){return this.dispatcherPromise||(this.dispatcherPromise=(async()=>{let A="https:"===this.config.address.protocol&&this.config.caCertPath?await (0,H.readFile)(this.config.caCertPath):void 0;return this.dispatcherFactory({connect:{...A?{ca:A}:{},...this.config.tlsServerName?{servername:this.config.tlsServerName}:{},rejectUnauthorized:!this.config.skipVerify},connectTimeout:1e4,headersTimeout:1e4,bodyTimeout:1e4,maxResponseSize:0x4000000})})()),this.dispatcherPromise}endpoint(A,e){let t=this.config.address.toString().replace(/\/+$/,"");return`${t}/v1/${O(this.config.mount)}/${A}/${O(this.config.pathPrefix)}/${O(e)}`}headers(A){let e={...this.config.headers,accept:"application/json","x-vault-request":"true"};return A&&(e["content-type"]="application/json"),this.config.token&&(e["x-vault-token"]=this.config.token),this.config.namespace&&(e["x-vault-namespace"]=this.config.namespace),e}async call(A,e,t){try{let A=await this.requestImplementation(e,{method:t.method,headers:this.headers(!!t.body),body:t.body,dispatcher:await this.dispatcher(),signal:AbortSignal.timeout(1e4),headersTimeout:1e4,bodyTimeout:1e4});return{statusCode:A.statusCode,body:await A.body.text()}}catch(t){let e="object"==typeof t&&null!==t&&"code"in t&&"string"==typeof t.code?t.code:null;throw Error(`Vault credential ${A} failed${e?` (${e})`:""}`)}}async get(A){let e=await this.call("read",this.endpoint("data",A.id),{method:"GET"});if(404===e.statusCode)return null;if(e.statusCode<200||e.statusCode>=300)throw Error(`Vault credential read failed (HTTP ${e.statusCode})`);try{let t=JSON.parse(e.body),r=t.data?.data?.value;if("string"!=typeof r||t.data?.data?.version!==1||t.data?.data?.kind!==A.kind)throw Error("invalid payload");return Buffer.from(r,"base64")}catch{throw Error("Vault returned an invalid credential payload")}}async set(A,e){let t=await this.call("write",this.endpoint("data",A.id),{method:"POST",body:JSON.stringify({data:{value:Buffer.from(e).toString("base64"),version:1,kind:A.kind}})});if(t.statusCode<200||t.statusCode>=300)throw Error(`Vault credential write failed (HTTP ${t.statusCode})`)}async delete(A){let e=await this.call("delete",this.endpoint("metadata",A.id),{method:"DELETE"});if(404!==e.statusCode&&(e.statusCode<200||e.statusCode>=300))throw Error(`Vault credential delete failed (HTTP ${e.statusCode})`)}}function J(A){return"database"===A||"vault"===A||"keychain"===A?A:"unknown"}let v=new Map;async function x(A,e){let t,r=[...new Set(A)].sort();if(!r.length)return e();let n=r.flatMap(A=>{let e=v.get(A);return e?[e]:[]}),i=new Promise(A=>{t=A});for(let A of r)v.set(A,i);await Promise.all(n);try{return await e()}finally{for(let A of(t(),r))v.get(A)===i&&v.delete(A)}}A.s(["CredentialService",0,class{env;platform;configResult;prismaFactory;prismaPromise=null;driverPromise=null;initializationPromise=null;runtimeIssue=null;keychainModuleLoader;vaultRequest;vaultDispatcherFactory;constructor(A={}){this.env=A.env??process.env,this.platform=A.platform??process.platform,this.configResult=Q(this.env,this.platform),this.prismaFactory=A.prisma?async()=>A.prisma:A.prismaFactory??l.getPrismaClient,this.keychainModuleLoader=A.keychainModuleLoader,this.vaultRequest=A.vaultRequest,this.vaultDispatcherFactory=A.vaultDispatcherFactory}prisma(){return this.prismaPromise??=this.prismaFactory()}configurationError(){let A=this.configResult.errors[0];return A?Error(`Credential storage is not configured: ${A.message}`):null}async createDriver(A){return"database"===A.storageType?new B(await this.prisma(),A):"vault"===A.storageType?new G(A,this.vaultRequest,this.vaultDispatcherFactory):new w(A,this.keychainModuleLoader)}driver(){return this.driverPromise||(this.driverPromise=(async()=>{let A=this.configurationError();if(A)throw A;if(!this.configResult.config)throw Error("Credential storage is not configured");return this.createDriver(this.configResult.config)})()),this.driverPromise}async ensureInitialized(){return this.initializationPromise||(this.initializationPromise=(async()=>{let A=await this.driver();await A.initialize()})().catch(A=>{throw 0===this.configResult.errors.length&&(this.runtimeIssue=this.issueForInitializationError(A)),A})),this.initializationPromise}issueForInitializationError(A){return A instanceof I?{code:A.code,message:A.message}:"vault"===this.configResult.storageType?{code:"VAULT_CONFIGURATION_INVALID",message:"Vault TLS configuration could not be initialized"}:{code:"CREDENTIAL_STORE_UNAVAILABLE",message:A instanceof Error?A.message:"Credential storage could not be initialized"}}async requireCurrentDriver(){return await this.ensureInitialized(),this.driver()}async get(A){let e=await this.requireCurrentDriver(),t=await this.prisma(),r=await t.credential.findUnique({where:{id:A.id}});if(!r)return null;if(r.kind!==A.kind)throw new I(`Credential ${A.id} has unexpected kind metadata`,"CREDENTIAL_DATA_INVALID");if(r.storageType!==e.storageType)throw new I(`Credential ${A.id} was stored in ${r.storageType}; re-enter it for ${e.storageType} storage`,"BACKEND_MISMATCH");let n=e instanceof B?e.getFromRecord(A,r):await e.get(A);if(!n)throw Error(`Credential ${A.id} is missing from ${e.storageType}; re-enter it in its owning settings form`);return n}async getText(A){let e=await this.get(A);return e?e.toString("utf8"):null}async getJson(A){let e=await this.get(A);return e?T(e):null}async isConfigured(A){let e=await (await this.prisma()).credential.findUnique({where:{id:A.id},select:{kind:!0,storageType:!0}});return!!(e&&e.kind===A.kind&&e.storageType===this.configResult.storageType)}async set(A,e,t){await this.setMany([{descriptor:A,value:e}],t)}async setMany(A,e){let t=A.map(A=>A.descriptor.id);if(new Set(t).size!==t.length)throw Error("Credential writes must use unique IDs");let r=await this.requireCurrentDriver(),n=await this.prisma();await x(t,async()=>{if(r instanceof B)return void await n.$transaction(async t=>{for(let e of A)await r.setInTransaction(t,e.descriptor,e.value);await e?.(t)});let t=new Map;for(let e of A)t.set(e.descriptor.id,await r.get(e.descriptor));let i=[];try{for(let e of A)i.push(e),await r.set(e.descriptor,e.value);await n.$transaction(async t=>{for(let{descriptor:e}of A)await t.credential.upsert({where:{id:e.id},create:{id:e.id,kind:e.kind,ownerId:e.ownerId??null,storageType:r.storageType},update:{kind:e.kind,ownerId:e.ownerId??null,storageType:r.storageType,payload:null,encrypted:!1,encryptionVersion:null,nonce:null,authTag:null,keyFingerprint:null}});await e?.(t)})}catch(A){try{for(let A of i.reverse()){let e=t.get(A.descriptor.id);e?await r.set(A.descriptor,e):await r.delete(A.descriptor)}}catch{throw Error(`Credential metadata could not be saved and the ${r.storageType} rollback also failed; re-enter the affected credentials`,{cause:A})}throw A}})}async setText(A,e,t){await this.set(A,Buffer.from(e,"utf8"),t)}async setJson(A,e,t){await this.set(A,R(e),t)}async driverForRecordedStorage(A){if(0===this.configResult.errors.length&&this.configResult.config?.storageType===A){let A=await this.driver();return await A.initialize(),A}let e=Q({...this.env,CREDENTIAL_STORAGE_TYPE:A},this.platform);if(!e.config||e.errors.length)throw Error(`Cannot delete the credential from its recorded ${A} backend: ${e.errors[0]?.message??"backend configuration is unavailable"}`);let t=await this.createDriver(e.config);return await t.initialize(),t}clearRecoverableDatabaseInitializationIssue(){(this.runtimeIssue?.code==="CREDENTIAL_ENCRYPTION_KEY_MISSING"||this.runtimeIssue?.code==="CREDENTIAL_ENCRYPTION_KEY_MISMATCH"||this.runtimeIssue?.code==="CREDENTIAL_DATA_INVALID")&&(this.initializationPromise=null,this.runtimeIssue=null)}async delete(A,e){await this.deleteMany([A],e)}async deleteMany(A,e){let t=A.map(A=>A.id);if(new Set(t).size!==t.length)throw Error("Credential deletes must use unique IDs");let r=await this.prisma();await x(t,async()=>{let n=await r.credential.findMany({where:{id:{in:t}},select:{id:!0,kind:!0,storageType:!0}});if(!n.length){e&&await r.$transaction(e);return}let i=new Map(A.map(A=>[A.id,A])),a=[];for(let A of n){let e=i.get(A.id);if(A.kind!==e.kind)throw new I(`Credential ${e.id} has unexpected kind metadata`,"CREDENTIAL_DATA_INVALID");let t=J(A.storageType);if("unknown"===t)throw new I(`Credential ${e.id} has an unknown backend`,"CREDENTIAL_DATA_INVALID");if("database"===t)continue;let r=await this.driverForRecordedStorage(t);a.push({descriptor:e,driver:r,previous:await r.get(e)})}let s=[];try{for(let A of a)s.push(A),await A.driver.delete(A.descriptor);await r.$transaction(async A=>{await A.credential.deleteMany({where:{id:{in:n.map(A=>A.id)}}}),await e?.(A)})}catch(A){try{for(let A of s.reverse())A.previous&&await A.driver.set(A.descriptor,A.previous)}catch{throw Error("Credential metadata could not be deleted and an external-backend rollback also failed; re-enter the affected credentials",{cause:A})}throw A}n.some(A=>"database"===A.storageType)&&this.clearRecoverableDatabaseInitializationIssue()})}async list(){return(await (await this.prisma()).credential.findMany({select:{id:!0,kind:!0,ownerId:!0,storageType:!0,encrypted:!0,createdAt:!0,updatedAt:!0},orderBy:[{kind:"asc"},{id:"asc"}]})).map(A=>({id:A.id,kind:A.kind,ownerId:A.ownerId,ownerFeature:b(A.kind),storageType:J(A.storageType),protection:"vault"===A.storageType?"VAULT":"keychain"===A.storageType?"KEYCHAIN":A.encrypted?"ENCRYPTED":"PLAINTEXT",createdAt:A.createdAt.toISOString(),updatedAt:A.updatedAt.toISOString()}))}async status(){var A;let e;try{await this.ensureInitialized()}catch{}let t=await (await this.prisma()).credential.findMany({select:{storageType:!0,encrypted:!0}}),r=t.filter(A=>A.storageType!==this.configResult.storageType).length,n=r?[{code:"BACKEND_MISMATCH",message:`${r} credential item${1===r?" was":"s were"} stored with another backend and must be re-entered`}]:[],i=t.some(A=>"database"===A.storageType&&A.encrypted),a=(A=[...this.configResult.warnings.filter(A=>"DATABASE_UNENCRYPTED"!==A.code||!i),...this.configResult.errors,...this.runtimeIssue?[this.runtimeIssue]:[],...n],e=new Set,A.filter(A=>{let t=`${A.code}:${A.message}`;return!e.has(t)&&(e.add(t),!0)})),s=this.configResult.errors.length>0||!!this.runtimeIssue,o=s?"ERROR":"database"===this.configResult.storageType?this.configResult.config?.storageType==="database"&&this.configResult.config.encryptionKey?"ENCRYPTED":"PLAINTEXT":"EXTERNAL";return{storageType:this.configResult.storageType,state:s?"ERROR":a.length?"WARNING":"READY",encryptionState:o,details:this.configResult.details,itemCount:t.length,mismatchCount:r,warnings:a}}}],91022),A.s([],582482)},661983,A=>{"use strict";class e{subscribers=new Map;publish(A,e){for(let t of this.subscribers.get(A)??[])(!t.predicate||t.predicate(e))&&t.push(e)}iterate(A,e){let t=[],r=[],n=!0,i={predicate:e,push(A){let e=r.shift();e?e({value:A,done:!1}):t.push(A)}},a=this.subscribers.get(A)??new Set;a.add(i),this.subscribers.set(A,a);let s=()=>{if(n)for(let e of(n=!1,a.delete(i),0===a.size&&this.subscribers.delete(A),r.splice(0)))e({value:void 0,done:!0})};return{[Symbol.asyncIterator](){return this},next(){if(!n)return Promise.resolve({value:void 0,done:!0});let A=t.shift();return void 0!==A?Promise.resolve({value:A,done:!1}):new Promise(A=>r.push(A))},return:()=>(s(),Promise.resolve({value:void 0,done:!0})),throw:A=>(s(),Promise.reject(A))}}}let t=globalThis,r=t.agentEventBus??(t.agentEventBus=new e);A.s(["AGENT_CHANGED_TOPIC",0,"agent.changed","APP_NOTIFICATIONS_CHANGED_TOPIC",0,"app-notifications.changed","BUILDS_CHANGED_TOPIC",0,"builds.changed","CODEBASE_CHANGED_TOPIC",0,"codebase.changed","IOS_DEVICES_CHANGED_TOPIC",0,"ios-devices.changed","PUSH_NOTIFICATIONS_CHANGED_TOPIC",0,"push-notifications.changed","SIGNING_ASSETS_CHANGED_TOPIC",0,"signing-assets.changed","SKILLS_CHANGED_TOPIC",0,"skills.changed","TELEMETRY_CHANGED_TOPIC",0,"telemetry.changed","TELEMETRY_SETTINGS_CHANGED_TOPIC",0,"telemetry.settings.changed","WORKTREE_CHANGED_TOPIC",0,"worktree.changed","agentEventBus",0,r,"agentEventsTopic",0,A=>`agent.${A}.events`,"agentJobChangedTopic",0,A=>`job.${A}.changed`,"agentJobLogTopic",0,A=>`job.${A}.log`,"buildDataCollectionChangedTopic",0,A=>`build-data.${A}.changed`,"buildLogTopic",0,A=>`build.${A}.log`,"buildTopic",0,A=>`build.${A}.changed`,"ccusageCollectionChangedTopic",0,A=>`ccusage.${A}.changed`,"skillSyncRunTopic",0,A=>`skills.sync.${A}.changed`,"worktreeInspectionTopic",0,A=>`worktree.${A}.inspection`])},397554,827957,A=>{"use strict";let e;function t(A,e,...r){if((r=r.filter(Boolean)).length>2){let e=r.pop();A+=`one of type ${r.join(", ")}, or ${e}.`}else 2===r.length?A+=`one of type ${r[0]} or ${r[1]}.`:A+=`of type ${r[0]}.`;return null==e?A+=` Received ${e}`:"function"==typeof e&&e.name?A+=` Received function ${e.name}`:"object"==typeof e&&null!=e&&e.constructor?.name&&(A+=` Received an instance of ${e.constructor.name}`),A}let r=(A,e,...r)=>t(`Key for the ${A} algorithm must be `,e,...r);function n(A){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(A);let e=atob(A),t=new Uint8Array(e.length);for(let A=0;A<e.length;A++)t[A]=e.charCodeAt(A);return t}class i extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(A,e){super(A,e),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class a extends i{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class s extends i{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class o extends i{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class g extends i{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(A="multiple matching keys found in the JSON Web Key Set",e){super(A,e)}}let C=A=>{if(A?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return A instanceof CryptoKey}catch{return!1}},Q=A=>A?.[Symbol.toStringTag]==="KeyObject",l=A=>C(A)||Q(A),I=(A,e)=>{if(A.byteLength!==e.length)return!1;for(let t=0;t<A.byteLength;t++)if(A[t]!==e[t])return!1;return!0},d=A=>{let e=A.data[A.pos++];if(128&e){let t=127&e,r=0;for(let e=0;e<t;e++)r=r<<8|A.data[A.pos++];return r}return e},E=(A,e,t)=>{if(A.data[A.pos++]!==e)throw Error(t)},c=(A,e)=>{let t=A.data.subarray(A.pos,A.pos+e);return A.pos+=e,t},h=async(A,e,t,r)=>{let n,i,s="spki"===A,o=()=>s?["verify"]:["sign"];switch(t){case"PS256":case"PS384":case"PS512":n={name:"RSA-PSS",hash:`SHA-${t.slice(-3)}`},i=o();break;case"RS256":case"RS384":case"RS512":n={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.slice(-3)}`},i=o();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":n={name:"RSA-OAEP",hash:`SHA-${parseInt(t.slice(-3),10)||1}`},i=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":n={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[t]},i=o();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{let A=r.getNamedCurve(e);n="X25519"===A?{name:"X25519"}:{name:"ECDH",namedCurve:A}}catch(A){throw new a("Invalid or unsupported key format")}i=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":n={name:"Ed25519"},i=o();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":n={name:t},i=o();break;default:throw new a('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(A,e,n,r?.extractable??!!s,i)};async function B(A,e,t){let r,i,a;if("string"!=typeof A||0!==A.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return r=/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,i=n(A.replace(r,"")),a=t,e?.startsWith?.("ECDH-ES")&&((a||={}).getNamedCurve=A=>{let e,t={data:A,pos:0};return E(t,48,"Invalid PKCS#8 structure"),d(t),E(t,2,"Expected version field"),e=d(t),t.pos+=e,E(t,48,"Expected algorithm identifier"),d(t),t.pos,(A=>{let e,t=(E(A,6,"Expected algorithm OID"),e=d(A),c(A,e));if(I(t,[43,101,110]))return"X25519";if(!I(t,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");E(A,6,"Expected curve OID");let r=d(A),n=c(A,r);for(let{name:A,oid:e}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(I(n,e))return A;throw Error("Unsupported named curve")})(t)}),h("pkcs8",i,e,a)}A.s(["importPKCS8",0,B],397554);let D=new TextEncoder,w=new TextDecoder;function u(A){let e=new Uint8Array(A.length);for(let t=0;t<A.length;t++){let r=A.charCodeAt(t);if(r>127)throw TypeError("non-ASCII string encountered in encode()");e[t]=r}return e}function p(A){let e=A;return("string"==typeof e&&(e=D.encode(e)),Uint8Array.prototype.toBase64)?e.toBase64({alphabet:"base64url",omitPadding:!0}):(function(A){if(Uint8Array.prototype.toBase64)return A.toBase64();let e=[];for(let t=0;t<A.length;t+=32768)e.push(String.fromCharCode.apply(null,A.subarray(t,t+32768)));return btoa(e.join(""))})(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}let f=(A,e="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${e} must be ${A}`);function y(A,e){if(parseInt(A.hash.name.slice(4),10)!==e)throw f(`SHA-${e}`,"algorithm.hash")}async function M(A,e,r){if(e instanceof Uint8Array){if(!A.startsWith("HS"))throw TypeError(((A,...e)=>t("Key must be ",A,...e))(e,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",e,{hash:`SHA-${A.slice(-3)}`,name:"HMAC"},!1,[r])}return!function(A,e,t){switch(e){case"HS256":case"HS384":case"HS512":if("HMAC"!==A.algorithm.name)throw f("HMAC");y(A.algorithm,parseInt(e.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==A.algorithm.name)throw f("RSASSA-PKCS1-v1_5");y(A.algorithm,parseInt(e.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==A.algorithm.name)throw f("RSA-PSS");y(A.algorithm,parseInt(e.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==A.algorithm.name)throw f("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let r;if(r=A.algorithm,r.name!==e)throw f(e);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==A.algorithm.name)throw f("ECDSA");let t=function(A){switch(A){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(e);if(A.algorithm.namedCurve!==t)throw f(t,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(t&&!A.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}(e,A,r),e}async function m(A,e,t){let r=await M(A,e,"sign");return!function(A,e){if(A.startsWith("RS")||A.startsWith("PS")){let{modulusLength:t}=e.algorithm;if("number"!=typeof t||t<2048)throw TypeError(`${A} requires key modulusLength to be 2048 bits or larger`)}}(A,r),new Uint8Array(await crypto.subtle.sign(function(A,e){let t=`SHA-${A.slice(-3)}`;switch(A){case"HS256":case"HS384":case"HS512":return{hash:t,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:t,name:"RSA-PSS",saltLength:parseInt(A.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:t,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:t,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:A};default:throw new a(`alg ${A} is not supported either by JOSE or your javascript runtime`)}}(A,r.algorithm),r,t))}function N(A){if("object"!=typeof A||null===A||"[object Object]"!==Object.prototype.toString.call(A))return!1;if(null===Object.getPrototypeOf(A))return!0;let e=A;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(A)===e}let S=A=>N(A)&&"string"==typeof A.kty,k=A=>A?.[Symbol.toStringTag],U=(A,e,t)=>{if(void 0!==e.use){let A;switch(t){case"sign":case"verify":A="sig";break;case"encrypt":case"decrypt":A="enc"}if(e.use!==A)throw TypeError(`Invalid key for this operation, its "use" must be "${A}" when present`)}if(void 0!==e.alg&&e.alg!==A)throw TypeError(`Invalid key for this operation, its "alg" must be "${A}" when present`);if(Array.isArray(e.key_ops)){let r;switch(!0){case"sign"===t||"verify"===t:case"dir"===A:case A.includes("CBC-HS"):r=t;break;case A.startsWith("PBES2"):r="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(A):r=!A.includes("GCM")&&A.endsWith("KW")?"encrypt"===t?"wrapKey":"unwrapKey":t;break;case"encrypt"===t&&A.startsWith("RSA"):r="wrapKey";break;case"decrypt"===t:r=A.startsWith("RSA")?"unwrapKey":"deriveBits"}if(r&&e.key_ops?.includes?.(r)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${r}" when present`)}return!0},F='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function R(A){if(!A.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:e,keyUsages:t}=function(A){let e,t;switch(A.kty){case"AKP":switch(A.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":e={name:A.alg},t=A.priv?["sign"]:["verify"];break;default:throw new a(F)}break;case"RSA":switch(A.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${A.alg.slice(-3)}`},t=A.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${A.alg.slice(-3)}`},t=A.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(A.alg.slice(-3),10)||1}`},t=A.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new a(F)}break;case"EC":switch(A.alg){case"ES256":case"ES384":case"ES512":e={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[A.alg]},t=A.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:A.crv},t=A.d?["deriveBits"]:[];break;default:throw new a(F)}break;case"OKP":switch(A.alg){case"Ed25519":case"EdDSA":e={name:"Ed25519"},t=A.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:A.crv},t=A.d?["deriveBits"]:[];break;default:throw new a(F)}break;default:throw new a('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:t}}(A),r={...A};return"AKP"!==r.kty&&delete r.alg,delete r.use,crypto.subtle.importKey("jwk",r,e,A.ext??(!A.d&&!A.priv),A.key_ops??t)}let T="given KeyObject instance cannot be used for this algorithm",b=async(A,t,r,n=!1)=>{let i=(e||=new WeakMap).get(A);if(i?.[r])return i[r];let a=await R({...t,alg:r});return n&&Object.freeze(A),i?i[r]=a:e.set(A,{[r]:a}),a};async function H(A,t){if(A instanceof Uint8Array||C(A))return A;if(Q(A)){if("secret"===A.type)return A.export();if("toCryptoKey"in A&&"function"==typeof A.toCryptoKey)try{return((A,t)=>{let r,n=(e||=new WeakMap).get(A);if(n?.[t])return n[t];let i="public"===A.type,a=!!i;if("x25519"===A.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(T)}r=A.toCryptoKey(A.asymmetricKeyType,a,i?[]:["deriveBits"])}if("ed25519"===A.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw TypeError(T);r=A.toCryptoKey(A.asymmetricKeyType,a,[i?"verify":"sign"])}switch(A.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==A.asymmetricKeyType.toUpperCase())throw TypeError(T);r=A.toCryptoKey(A.asymmetricKeyType,a,[i?"verify":"sign"])}if("rsa"===A.asymmetricKeyType){let e;switch(t){case"RSA-OAEP":e="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":e="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":e="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":e="SHA-512";break;default:throw TypeError(T)}if(t.startsWith("RSA-OAEP"))return A.toCryptoKey({name:"RSA-OAEP",hash:e},a,i?["encrypt"]:["decrypt"]);r=A.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:e},a,[i?"verify":"sign"])}if("ec"===A.asymmetricKeyType){let e=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(A.asymmetricKeyDetails?.namedCurve);if(!e)throw TypeError(T);let n={ES256:"P-256",ES384:"P-384",ES512:"P-521"};n[t]&&e===n[t]&&(r=A.toCryptoKey({name:"ECDSA",namedCurve:e},a,[i?"verify":"sign"])),t.startsWith("ECDH-ES")&&(r=A.toCryptoKey({name:"ECDH",namedCurve:e},a,i?[]:["deriveBits"]))}if(!r)throw TypeError(T);return n?n[t]=r:e.set(A,{[t]:r}),r})(A,t)}catch(A){if(A instanceof TypeError)throw A}let r=A.export({format:"jwk"});return b(A,r,t)}if(S(A)){if(A.k){var r=A.k;if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof r?r:w.decode(r),{alphabet:"base64url"});let e=r;e instanceof Uint8Array&&(e=w.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/");try{return n(e)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}return b(A,A,t,!0)}throw Error("unreachable")}function L(A,e){if(A)throw TypeError(`${e} can only be called once`)}Symbol();class O{#eq;#eZ;#eW;constructor(A){if(!(A instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#eq=A}setProtectedHeader(A){return L(this.#eZ,"setProtectedHeader"),this.#eZ=A,this}setUnprotectedHeader(A){return L(this.#eW,"setUnprotectedHeader"),this.#eW=A,this}async sign(A,e){let t,n,i,o;if(!this.#eZ&&!this.#eW)throw new s("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!function(...A){let e,t=A.filter(Boolean);if(0===t.length||1===t.length)return!0;for(let A of t){let t=Object.keys(A);if(!e||0===e.size){e=new Set(t);continue}for(let A of t){if(e.has(A))return!1;e.add(A)}}return!0}(this.#eZ,this.#eW))throw new s("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let g={...this.#eZ,...this.#eW},C=function(A,e,t,r,n){let i;if(void 0!==n.crit&&r?.crit===void 0)throw new A('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||void 0===r.crit)return new Set;if(!Array.isArray(r.crit)||0===r.crit.length||r.crit.some(A=>"string"!=typeof A||0===A.length))throw new A('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let s of(i=void 0!==t?new Map([...Object.entries(t),...e.entries()]):e,r.crit)){if(!i.has(s))throw new a(`Extension Header Parameter "${s}" is not recognized`);if(void 0===n[s])throw new A(`Extension Header Parameter "${s}" is missing`);if(i.get(s)&&void 0===r[s])throw new A(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)}(s,new Map([["b64",!0]]),e?.crit,this.#eZ,g),Q=!0;if(C.has("b64")&&"boolean"!=typeof(Q=this.#eZ.b64))throw new s('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:I}=g;if("string"!=typeof I||!I)throw new s('JWS "alg" (Algorithm) Header Parameter missing or invalid');var d="sign";switch(I.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((A,e,t)=>{if(!(e instanceof Uint8Array)){if(S(e)){if("oct"===e.kty&&"string"==typeof e.k&&U(A,e,t))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!l(e))throw TypeError(r(A,e,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==e.type)throw TypeError(`${k(e)} instances for symmetric algorithms must be of type "secret"`)}})(I,A,d);break;default:((A,e,t)=>{if(S(e))switch(t){case"decrypt":case"sign":if("oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d)&&U(A,e,t))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==e.kty&&void 0===e.d&&void 0===e.priv&&U(A,e,t))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!l(e))throw TypeError(r(A,e,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===e.type)throw TypeError(`${k(e)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===e.type)switch(t){case"sign":throw TypeError(`${k(e)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${k(e)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===e.type)switch(t){case"verify":throw TypeError(`${k(e)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${k(e)} instances for asymmetric algorithm encryption must be of type "public"`)}})(I,A,d)}Q?n=u(t=p(this.#eq)):(n=this.#eq,t=""),this.#eZ?o=u(i=p(JSON.stringify(this.#eZ))):(i="",o=new Uint8Array);let E=function(...A){let e=new Uint8Array(A.reduce((A,{length:e})=>A+e,0)),t=0;for(let r of A)e.set(r,t),t+=r.length;return e}(o,u("."),n),c=await H(A,I),h={signature:p(await m(I,c,E)),payload:t};return this.#eW&&(h.header=this.#eW),this.#eZ&&(h.protected=i),h}}class G{#ez;constructor(A){this.#ez=new O(A)}setProtectedHeader(A){return this.#ez.setProtectedHeader(A),this}async sign(A,e){let t=await this.#ez.sign(A,e);if(void 0===t.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${t.protected}.${t.payload}.${t.signature}`}}let J=A=>Math.floor(A.getTime()/1e3),v=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function x(A){let e,t=v.exec(A);if(!t||t[4]&&t[1])throw TypeError("Invalid time period format");let r=parseFloat(t[2]);switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":e=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":e=Math.round(60*r);break;case"hour":case"hours":case"hr":case"hrs":case"h":e=Math.round(3600*r);break;case"day":case"days":case"d":e=Math.round(86400*r);break;case"week":case"weeks":case"w":e=Math.round(604800*r);break;default:e=Math.round(0x1e187e0*r)}return"-"===t[1]||"ago"===t[4]?-e:e}function V(A,e){if(!Number.isFinite(e))throw TypeError(`Invalid ${A} input`);return e}class P{#eq;constructor(A){if(!N(A))throw TypeError("JWT Claims Set MUST be an object");this.#eq=structuredClone(A)}data(){return D.encode(JSON.stringify(this.#eq))}get iss(){return this.#eq.iss}set iss(A){this.#eq.iss=A}get sub(){return this.#eq.sub}set sub(A){this.#eq.sub=A}get aud(){return this.#eq.aud}set aud(A){this.#eq.aud=A}set jti(A){this.#eq.jti=A}set nbf(A){"number"==typeof A?this.#eq.nbf=V("setNotBefore",A):A instanceof Date?this.#eq.nbf=V("setNotBefore",J(A)):this.#eq.nbf=J(new Date)+x(A)}set exp(A){"number"==typeof A?this.#eq.exp=V("setExpirationTime",A):A instanceof Date?this.#eq.exp=V("setExpirationTime",J(A)):this.#eq.exp=J(new Date)+x(A)}set iat(A){void 0===A?this.#eq.iat=J(new Date):A instanceof Date?this.#eq.iat=V("setIssuedAt",J(A)):"string"==typeof A?this.#eq.iat=V("setIssuedAt",J(new Date)+x(A)):this.#eq.iat=V("setIssuedAt",A)}}A.s(["SignJWT",0,class{#eZ;#ej;constructor(A={}){this.#ej=new P(A)}setIssuer(A){return this.#ej.iss=A,this}setSubject(A){return this.#ej.sub=A,this}setAudience(A){return this.#ej.aud=A,this}setJti(A){return this.#ej.jti=A,this}setNotBefore(A){return this.#ej.nbf=A,this}setExpirationTime(A){return this.#ej.exp=A,this}setIssuedAt(A){return this.#ej.iat=A,this}setProtectedHeader(A){return this.#eZ=A,this}async sign(A,e){let t=new G(this.#ej.data());if(t.setProtectedHeader(this.#eZ),Array.isArray(this.#eZ?.crit)&&this.#eZ.crit.includes("b64")&&!1===this.#eZ.b64)throw new o("JWTs MUST NOT use unencoded payload");return t.sign(A,e)}}],827957)},986847,807055,885418,A=>{"use strict";let e=RegExp("^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$");function t(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function r(A,e){if("number"!=typeof A||!Number.isFinite(A)||A<0)throw Error(`${e} must be a non-negative finite number`);return A}function n(A,e){if("string"!=typeof A||0===A.length)throw Error(`${e} must be a non-empty string`);return A}function i(A,e){if(!Array.isArray(A))throw Error(`${e} must be an array`);return A.map((A,t)=>n(A,`${e}[${t}]`))}function a(A,e){return{inputTokens:r(A.inputTokens,`${e}.inputTokens`),outputTokens:r(A.outputTokens,`${e}.outputTokens`),cacheCreationTokens:r(A.cacheCreationTokens,`${e}.cacheCreationTokens`),cacheReadTokens:r(A.cacheReadTokens,`${e}.cacheReadTokens`),totalTokens:r(A.totalTokens,`${e}.totalTokens`),totalCost:r(A.totalCost,`${e}.totalCost`)}}A.s(["CCUSAGE_REPORT_JOB_KIND",0,"ccusage.report","TUNNEL_NAME_REGEX",0,e,"parseCcusageJobResult",0,function(A){let e=t(A,"ccusage job result");if(null!==e.exitCode&&("number"!=typeof e.exitCode||!Number.isInteger(e.exitCode)))throw Error("ccusage job result.exitCode must be an integer or null");if(null!==e.signal&&"string"!=typeof e.signal)throw Error("ccusage job result.signal must be a string or null");if("boolean"!=typeof e.timedOut)throw Error("ccusage job result.timedOut must be a boolean");if("boolean"!=typeof e.cancelled)throw Error("ccusage job result.cancelled must be a boolean");return{exitCode:e.exitCode,signal:e.signal,timedOut:e.timedOut,cancelled:e.cancelled,report:function(A){let e=t(A,"ccusage report");if(!Array.isArray(e.daily))throw Error("ccusage.daily must be an array");return{daily:e.daily.map((A,e)=>(function(A,e){let s=`ccusage.daily[${e}]`,o=t(A,s),g=t(o.metadata,`${s}.metadata`);if(!Array.isArray(o.modelBreakdowns))throw Error(`${s}.modelBreakdowns must be an array`);let C=n(o.period,`${s}.period`);if(!/^\d{4}-\d{2}-\d{2}$/.test(C))throw Error(`${s}.period must use YYYY-MM-DD`);return{...a(o,s),agent:n(o.agent,`${s}.agent`),period:C,metadata:{agents:i(g.agents,`${s}.metadata.agents`)},modelBreakdowns:o.modelBreakdowns.map((A,e)=>{var i;let a;return{modelName:n((a=t(A,i=`${s}.modelBreakdowns[${e}]`)).modelName,`${i}.modelName`),inputTokens:r(a.inputTokens,`${i}.inputTokens`),outputTokens:r(a.outputTokens,`${i}.outputTokens`),cacheCreationTokens:r(a.cacheCreationTokens,`${i}.cacheCreationTokens`),cacheReadTokens:r(a.cacheReadTokens,`${i}.cacheReadTokens`),cost:r(a.cost,`${i}.cost`)}}),modelsUsed:i(o.modelsUsed,`${s}.modelsUsed`)}})(A,e)),totals:a(t(e.totals,"ccusage.totals"),"ccusage.totals")}}(e.report)}}],986847);let s="ios.source.discover",o="ios.source.parse",g="ios.destinations.inspect",C="ios.runDestinations.inspect",Q="ios.build.run",l="ios.build.delete",I="ios.artifact.download",d="ios.build.deploy",E="ios.archive.export",c="ios.test-results.parse",h="ios.coverage.generate",B="ios.signing.inspect",D=[s,o,g,C,Q,l,I,d,E,c,h,B],w=["BUILD","TEST","ANALYZE","ARCHIVE","BUILD_FOR_TESTING","TEST_WITHOUT_BUILDING"],u=["BUILD","ANALYZE","ARCHIVE","BUILD_FOR_TESTING"],p=["PROJECT","WORKSPACE","PACKAGE"],f=["SIMULATOR","PHYSICAL_DEVICE"],y=["FAIL_BUILD","CONTINUE"],M=["ONLY_ACTIVE_ARCH","SWIFT_ACTIVE_COMPILATION_CONDITIONS","SWIFT_OPTIMIZATION_LEVEL","GCC_PREPROCESSOR_DEFINITIONS","OTHER_SWIFT_FLAGS","ENABLE_TESTABILITY","DEBUG_INFORMATION_FORMAT","VALIDATE_PRODUCT","MARKETING_VERSION","CURRENT_PROJECT_VERSION"],m={packageResolution:"DEFAULT",disablePackageRepositoryCache:!1,signingStyle:"PROJECT_DEFAULT",developmentTeam:null,codeSignIdentity:null,provisioningProfileSpecifier:null,productBundleIdentifier:null,allowProvisioningUpdates:!1,allowProvisioningDeviceRegistration:!1,testPlan:null,codeCoverage:!1,parseTestResults:!0,parallelTesting:null,parallelTestingWorkers:null,onlyTesting:[],skipTesting:[],buildSettingOverrides:{},priorBuildForTestingId:null,priorTestProductsPath:null,priorXctestrunPath:null},N=["TEST_RESULTS","CODE_COVERAGE"];function S(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function k(A,e){if("string"!=typeof A||!A.trim())throw Error(`${e} must be a non-empty string`);return A}function U(A,e){return null==A?null:k(A,e)}function F(A,e){if("boolean"!=typeof A)throw Error(`${e} must be a boolean`);return A}function R(A,e,t){if("string"!=typeof A||!e.includes(A))throw Error(`${t} is invalid`);return A}function T(A,e){let t=k(A,e);if(t.startsWith("/")||/^[A-Za-z]:[\\/]/.test(t)||t.split(/[\\/]/).includes("..")||t.includes("\0"))throw Error(`${e} must stay within the worktree`);return t.replaceAll("\\","/")}function b(A,e){let t=k(A,e);if(!t.startsWith("/")||t.split("/").includes("..")||t.includes("\0"))throw Error(`${e} must be an absolute normalized path`);return t}function H(A){return{codebaseId:k(A.codebaseId,"build payload.codebaseId"),worktreeId:k(A.worktreeId,"build payload.worktreeId"),branch:U(A.branch,"build payload.branch"),folder:k(A.folder,"build payload.folder"),gitDirectory:k(A.gitDirectory,"build payload.gitDirectory"),expectedOrigin:k(A.expectedOrigin,"build payload.expectedOrigin"),headSha:U(A.headSha,"build payload.headSha"),baseBranch:U(A.baseBranch,"build payload.baseBranch")}}function L(A){let e=S(A,"build source"),t=R(e.kind,p,"build source.kind"),r=T(e.relativePath,"build source.relativePath");if("PROJECT"===t&&!r.endsWith(".xcodeproj"))throw Error("Project sources must end in .xcodeproj");if("WORKSPACE"===t&&!r.endsWith(".xcworkspace"))throw Error("Workspace sources must end in .xcworkspace");if("PACKAGE"===t&&"Package.swift"!==r)throw Error("Package.swift must be at the worktree root");return{kind:t,relativePath:r}}function O(A){let e=S(A,"build destination");return{type:R(e.type,f,"build destination.type"),id:k(e.id,"build destination.id"),name:k(e.name,"build destination.name"),platform:k(e.platform,"build destination.platform"),osVersion:U(e.osVersion,"build destination.osVersion"),state:U(e.state,"build destination.state"),...void 0===e.generic?{}:{generic:F(e.generic,"build destination.generic")}}}function G(A,e){if(!Array.isArray(A))throw Error(`${e} must be an array`);return A.map((A,t)=>k(A,`${e}[${t}]`))}function J(A){let e={...m,...S(A??{},"advanced settings")},t=S(e.buildSettingOverrides??{},"advanced settings.buildSettingOverrides"),r={};for(let[A,e]of Object.entries(t)){if(!M.includes(A))throw Error(`Build setting override ${A} is not approved`);r[A]=k(e,`advanced settings.buildSettingOverrides.${A}`)}let n=e.parallelTestingWorkers;if(null!=n&&("number"!=typeof n||!Number.isInteger(n)||n<1||n>128))throw Error("parallelTestingWorkers must be between 1 and 128");let i=e.parallelTesting;if(null!==i&&"boolean"!=typeof i)throw Error("parallelTesting must be a boolean or null");return{packageResolution:R(e.packageResolution,["DEFAULT","RESOLVED_ONLY","SKIP_UPDATES","DISABLE_AUTOMATIC"],"advanced settings.packageResolution"),disablePackageRepositoryCache:F(e.disablePackageRepositoryCache,"advanced settings.disablePackageRepositoryCache"),signingStyle:R(e.signingStyle,["PROJECT_DEFAULT","AUTOMATIC","MANUAL"],"advanced settings.signingStyle"),developmentTeam:U(e.developmentTeam,"advanced settings.developmentTeam"),codeSignIdentity:U(e.codeSignIdentity,"advanced settings.codeSignIdentity"),provisioningProfileSpecifier:U(e.provisioningProfileSpecifier,"advanced settings.provisioningProfileSpecifier"),productBundleIdentifier:U(e.productBundleIdentifier,"advanced settings.productBundleIdentifier"),allowProvisioningUpdates:F(e.allowProvisioningUpdates,"advanced settings.allowProvisioningUpdates"),allowProvisioningDeviceRegistration:F(e.allowProvisioningDeviceRegistration,"advanced settings.allowProvisioningDeviceRegistration"),testPlan:U(e.testPlan,"advanced settings.testPlan"),codeCoverage:F(e.codeCoverage,"advanced settings.codeCoverage"),parseTestResults:F(e.parseTestResults,"advanced settings.parseTestResults"),parallelTesting:i,parallelTestingWorkers:n??null,onlyTesting:G(e.onlyTesting,"advanced settings.onlyTesting"),skipTesting:G(e.skipTesting,"advanced settings.skipTesting"),buildSettingOverrides:r,priorBuildForTestingId:U(e.priorBuildForTestingId,"advanced settings.priorBuildForTestingId"),priorTestProductsPath:null===e.priorTestProductsPath||void 0===e.priorTestProductsPath?null:b(e.priorTestProductsPath,"advanced settings.priorTestProductsPath"),priorXctestrunPath:null===e.priorXctestrunPath||void 0===e.priorXctestrunPath?null:b(e.priorXctestrunPath,"advanced settings.priorXctestrunPath")}}function v(A,e){let t=S(A,`build scripts[${e}]`),r=t.timeoutSeconds,n=t.position;if("number"!=typeof r||!Number.isInteger(r)||r<1||r>3600)throw Error(`build scripts[${e}].timeoutSeconds is invalid`);if("number"!=typeof n||!Number.isInteger(n)||n<0)throw Error(`build scripts[${e}].position is invalid`);return{id:k(t.id,`build scripts[${e}].id`),name:k(t.name,`build scripts[${e}].name`),preBuildScript:U(t.preBuildScript,`build scripts[${e}].preBuildScript`),postBuildScript:U(t.postBuildScript,`build scripts[${e}].postBuildScript`),timeoutSeconds:r,failureBehavior:R(t.failureBehavior,y,`build scripts[${e}].failureBehavior`),position:n}}function x(A,e){let t,r=k(A,e);try{t=new URL(r)}catch{throw Error(`${e} must be a valid HTTP(S) URL`)}if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error(`${e} must be a valid HTTP(S) URL`);return t.toString().replace(/\/$/,"")}function V(A){let e=S(A,"build delete payload"),t=k(e.buildId,"build delete payload.buildId"),r=b(e.artifactDirectory,"build delete payload.artifactDirectory");if(r.split("/").at(-1)!==t)throw Error("Build delete folder must end with the build ID");return{buildId:t,artifactDirectory:r,codebaseId:k(e.codebaseId,"build delete payload.codebaseId")}}function P(A){let e=S(A,"export settings"),t=S(e.provisioningProfiles??{},"export settings.provisioningProfiles");return{method:R(e.method,["DEBUGGING","RELEASE_TESTING","ENTERPRISE","APP_STORE_CONNECT"],"export settings.method"),signingStyle:R(e.signingStyle,["AUTOMATIC","MANUAL"],"export settings.signingStyle"),teamId:U(e.teamId,"export settings.teamId"),signingCertificate:U(e.signingCertificate,"export settings.signingCertificate"),provisioningProfiles:Object.fromEntries(Object.entries(t).map(([A,e])=>[k(A,"export settings provisioning profile bundle id"),k(e,`export settings.provisioningProfiles.${A}`)])),uploadSymbols:F(e.uploadSymbols,"export settings.uploadSymbols"),manageAppVersionAndBuildNumber:F(e.manageAppVersionAndBuildNumber,"export settings.manageAppVersionAndBuildNumber"),testFlightInternalTestingOnly:F(e.testFlightInternalTestingOnly,"export settings.testFlightInternalTestingOnly"),stripSwiftSymbols:void 0===e.stripSwiftSymbols||F(e.stripSwiftSymbols,"export settings.stripSwiftSymbols"),thinning:U(e.thinning??null,"export settings.thinning"),iCloudContainerEnvironment:null===e.iCloudContainerEnvironment||void 0===e.iCloudContainerEnvironment?null:R(e.iCloudContainerEnvironment,["Development","Production"],"export settings.iCloudContainerEnvironment"),distributionBundleIdentifier:U(e.distributionBundleIdentifier??null,"export settings.distributionBundleIdentifier")}}A.s(["BUILD_ACTIONS",0,w,"BUILD_CONFIGURATION_ICON_KEYS",0,["apple","app-window","archive","beaker","box","bug","code","gauge","hammer","layers","package","play","rocket","shield","smartphone","sparkles","terminal","test-tube","wrench"],"BUILD_DESTINATION_TYPES",0,f,"BUILD_SCRIPT_FAILURE_BEHAVIORS",0,y,"DEFAULT_BUILD_ADVANCED_SETTINGS",0,m,"GENERIC_BUILD_DESTINATION_ACTIONS",0,u,"IOS_ARTIFACT_DOWNLOAD_JOB_KIND",0,I,"IOS_BUILD_DELETE_JOB_KIND",0,l,"IOS_BUILD_JOB_KIND",0,Q,"IOS_BUILD_JOB_KINDS",0,D,"IOS_COVERAGE_REPORT_JOB_KIND",0,h,"IOS_DEPLOY_JOB_KIND",0,d,"IOS_DESTINATIONS_JOB_KIND",0,g,"IOS_EXPORT_JOB_KIND",0,E,"IOS_RUN_DESTINATIONS_JOB_KIND",0,C,"IOS_SIGNING_INSPECT_JOB_KIND",0,B,"IOS_SOURCE_DISCOVER_JOB_KIND",0,s,"IOS_SOURCE_PARSE_JOB_KIND",0,o,"IOS_TEST_RESULTS_JOB_KIND",0,c,"parseBuildAdvancedSettings",0,J,"parseBuildArtifactDownloadPayload",0,function(A){let e=S(A,"build artifact download payload");return{...V(e),artifactRelativePath:T(e.artifactRelativePath,"build artifact download payload.artifactRelativePath"),uploadId:k(e.uploadId,"build artifact download payload.uploadId")}},"parseBuildArtifactSnapshots",0,function(A){if(!Array.isArray(A))return[];let e=[];for(let t of A)try{let A=S(t,"build artifact");e.push({kind:k(A.kind,"build artifact.kind"),relativePath:T(A.relativePath,"build artifact.relativePath"),sizeBytes:"number"==typeof A.sizeBytes&&Number.isFinite(A.sizeBytes)?A.sizeBytes:null,checksum:U(A.checksum,"build artifact.checksum"),metadata:A.metadata&&"object"==typeof A.metadata&&!Array.isArray(A.metadata)?A.metadata:{}})}catch{continue}return e},"parseBuildDeletePayload",0,V,"parseBuildDeploymentPayload",0,function(A){let e=S(A,"build deployment payload");if(!Array.isArray(e.deployments)||!e.deployments.length)throw Error("build deployment payload.deployments must not be empty");let t=e.deployments.map((A,e)=>{let t=S(A,`deployments[${e}]`);return{id:k(t.id,`deployments[${e}].id`),destination:O(t.destination)}});if(new Set(t.map(({id:A})=>A)).size!==t.length)throw Error("deployment payload IDs must be unique");if(new Set(t.map(({destination:A})=>`${A.type}:${A.id}`)).size!==t.length)throw Error("deployment destinations must be unique");if(new Set(t.map(({destination:A})=>A.type)).size>1)throw Error("deployment destinations must use one destination type");return{...H(e),buildId:k(e.buildId,"build deployment payload.buildId"),artifactDirectory:k(e.artifactDirectory,"build deployment payload.artifactDirectory"),artifactRelativePath:T(e.artifactRelativePath,"build deployment payload.artifactRelativePath"),bundleIdentifier:k(e.bundleIdentifier,"build deployment payload.bundleIdentifier"),deployments:t}},"parseBuildDestination",0,O,"parseBuildDestinationsPayload",0,function(A){let e=S(A,"destinations payload");return{...H(e),source:L(e.source),scheme:k(e.scheme,"destinations payload.scheme"),configuration:k(e.configuration,"destinations payload.configuration"),action:R(e.action,w,"destinations payload.action")}},"parseBuildExportPayload",0,function(A){let e=S(A,"build export payload");return{...H(e),buildId:k(e.buildId,"build export payload.buildId"),exportId:k(e.exportId,"build export payload.exportId"),artifactDirectory:k(e.artifactDirectory,"build export payload.artifactDirectory"),archiveRelativePath:T(e.archiveRelativePath,"build export payload.archiveRelativePath"),settings:P(e.settings)}},"parseBuildExportSettings",0,P,"parseBuildJobPayload",0,function(A){let e=S(A,"build job payload");if(!Array.isArray(e.scripts))throw Error("build job payload.scripts must be an array");let t=e.scripts.map(v);if(new Set(t.map(A=>A.id)).size!==t.length)throw Error("build job payload scripts must be unique");let r=R(e.action,w,"build job payload.action"),n=O(e.destination),i=J(e.advancedSettings);if("ARCHIVE"===r&&("PHYSICAL_DEVICE"!==n.type||!0!==n.generic))throw Error("Archive builds require a generic physical destination");if(n.generic&&!u.includes(r))throw Error("This build action requires a concrete destination");if("TEST_WITHOUT_BUILDING"===r&&(!i.priorBuildForTestingId||!i.priorTestProductsPath&&!i.priorXctestrunPath))throw Error("Test Without Building requires a captured Build for Testing result");return{...H(e),buildId:k(e.buildId,"build job payload.buildId"),artifactDirectory:k(e.artifactDirectory,"build job payload.artifactDirectory"),source:L(e.source),scheme:k(e.scheme,"build job payload.scheme"),configuration:k(e.configuration,"build job payload.configuration"),action:r,destination:n,advancedSettings:i,scripts:t,telemetry:function(A){if(null==A)return;let e=S(A,"build job payload.telemetry");return{localBaseUrl:x(e.localBaseUrl,"build job payload.telemetry.localBaseUrl"),remoteBaseUrl:x(e.remoteBaseUrl,"build job payload.telemetry.remoteBaseUrl"),selectedBaseUrl:x(e.selectedBaseUrl,"build job payload.telemetry.selectedBaseUrl"),consoleLogsUrl:x(e.consoleLogsUrl,"build job payload.telemetry.consoleLogsUrl"),analyticsEventsUrl:x(e.analyticsEventsUrl,"build job payload.telemetry.analyticsEventsUrl"),consoleCollectionEnabled:F(e.consoleCollectionEnabled,"build job payload.telemetry.consoleCollectionEnabled"),analyticsCollectionEnabled:F(e.analyticsCollectionEnabled,"build job payload.telemetry.analyticsCollectionEnabled")}}(e.telemetry),worktreeCoverage:void 0!==e.worktreeCoverage&&F(e.worktreeCoverage,"build job payload.worktreeCoverage")}},"parseBuildReportPayload",0,function(A){let e=S(A,"build report payload");return{...V(e),reportKind:R(e.reportKind,N,"build report payload.reportKind"),source:R(e.source,["MANUAL","WORKTREE"],"build report payload.source")}},"parseBuildRunDestinationsPayload",0,function(A){let e=S(A,"run destinations payload");return{...H(e),destinationType:R(e.destinationType,f,"run destinations payload.destinationType")}},"parseBuildSigningInspectPayload",0,function(A){let e=S(A,"build signing payload");return{buildId:k(e.buildId,"build signing payload.buildId"),codebaseId:k(e.codebaseId,"build signing payload.codebaseId"),artifactDirectory:k(e.artifactDirectory,"build signing payload.artifactDirectory"),archiveRelativePath:T(e.archiveRelativePath,"build signing payload.archiveRelativePath")}},"parseBuildSource",0,L,"parseBuildSourceDiscoverPayload",0,function(A){return H(S(A,"source discovery payload"))},"parseBuildSourceParsePayload",0,function(A){let e=S(A,"source parse payload");return{...H(e),source:L(e.source),scheme:U(e.scheme,"source parse payload.scheme"),configuration:U(e.configuration,"source parse payload.configuration")}}],807055);let Y="buildData.scan",_="buildData.size",K="buildData.delete",q=[Y,_,K],Z=["DEFAULT","ABSOLUTE","RELATIVE"];function W(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function z(A,e){if("string"!=typeof A||0===A.length||A.includes("\0"))throw Error(`${e} must be a non-empty string`);return A}function j(A,e){return null===A?null:z(A,e)}function $(A,e,t){let r=Object.keys(A).find(A=>!e.includes(A));if(r)throw Error(`Unexpected ${t} field: ${r}`)}function X(A){if("string"!=typeof A||!Z.includes(A))throw Error("Derived Data location mode is invalid");return A}function AA(A,e){let t=W(A,`build data worktrees[${e}]`);return $(t,["id","folder"],"build data worktree"),{id:z(t.id,`build data worktrees[${e}].id`),folder:z(t.folder,`build data worktrees[${e}].folder`)}}function Ae(A,e){let t=W(A,`build data targets[${e}]`);return $(t,["path","rootPath"],"build data target"),{path:z(t.path,`build data targets[${e}].path`),rootPath:z(t.rootPath,`build data targets[${e}].rootPath`)}}A.s(["BUILD_DATA_DELETE_JOB_KIND",0,K,"BUILD_DATA_JOB_KINDS",0,q,"BUILD_DATA_SCAN_JOB_KIND",0,Y,"BUILD_DATA_SIZE_JOB_KIND",0,_,"buildDataScanPayload",0,function(A){let e=W(A,"build data scan payload");if($(e,["mode","path","worktrees"],"build data scan payload"),!Array.isArray(e.worktrees))throw Error("build data scan payload.worktrees must be an array");let t=X(e.mode),r=j(e.path,"build data scan payload.path");if("DEFAULT"!==t&&!r)throw Error("Configured Derived Data modes require a path");if("DEFAULT"===t&&null!==r)throw Error("Default Derived Data mode does not accept a path");return{mode:t,path:r,worktrees:e.worktrees.map(AA)}},"buildDataTargetsPayload",0,function(A){let e=W(A,"build data targets payload");if($(e,["targets"],"build data targets payload"),!Array.isArray(e.targets)||e.targets.length>1e4)throw Error("build data targets must be an array of at most 10,000 items");return{targets:e.targets.map(Ae)}},"parseBuildDataDeleteResult",0,function(A){let e=W(A,"build data delete result");if(!Array.isArray(e.deleted))throw Error("build data delete result.deleted must be an array");return{deleted:e.deleted.map((A,e)=>{let t=W(A,`build data deleted[${e}]`);if("boolean"!=typeof t.deleted)throw Error(`build data deleted[${e}].deleted is invalid`);return{path:z(t.path,`build data deleted[${e}].path`),deleted:t.deleted,error:j(t.error,`build data deleted[${e}].error`)}})}},"parseBuildDataScanResult",0,function(A){let e=W(A,"build data scan result");if(!Array.isArray(e.entries)||!Array.isArray(e.warnings))throw Error("build data scan result arrays are invalid");return{entries:e.entries.map((A,e)=>{let t=W(A,`build data entries[${e}]`),r=t.kind;if(!["PROJECT","PENDING","SHARED_CACHE","DEVICE_SUPPORT"].includes(r))throw Error(`build data entries[${e}].kind is invalid`);return{path:z(t.path,`build data entries[${e}].path`),rootPath:z(t.rootPath,`build data entries[${e}].rootPath`),name:z(t.name,`build data entries[${e}].name`),kind:r,workspacePath:j(t.workspacePath,`build data entries[${e}].workspacePath`)}}),warnings:e.warnings.map((A,e)=>z(A,`build data warnings[${e}]`))}},"parseBuildDataSizeResult",0,function(A){let e=W(A,"build data size result");if(!Array.isArray(e.sizes))throw Error("build data size result.sizes must be an array");return{sizes:e.sizes.map((A,e)=>{let t=W(A,`build data sizes[${e}]`);if(null!==t.sizeBytes&&("number"!=typeof t.sizeBytes||!Number.isFinite(t.sizeBytes)||t.sizeBytes<0))throw Error(`build data sizes[${e}].sizeBytes is invalid`);return{path:z(t.path,`build data sizes[${e}].path`),sizeBytes:t.sizeBytes,error:j(t.error,`build data sizes[${e}].error`)}})}},"parseDerivedDataLocationMode",0,X],885418)},184015,119909,A=>{"use strict";let e="codebase.browse",t="codebase.inspect",r="codebase.refresh",n="codebase.fetch",i="codebase.git.inspect",a="codebase.git.operation",s=["SWITCH_BRANCH","DELETE_BRANCH","DELETE_REMOTE_BRANCH","PULL_BRANCH","APPLY_STASH","DELETE_STASH"],o=[e,t,r,n,i,a];function g(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function C(A,e){if("string"!=typeof A||0===A.length)throw Error(`${e} must be a non-empty string`);return A}function Q(A,e){return null===A?null:C(A,e)}function l(A,e){if(null===A)return null;if("number"!=typeof A||!Number.isInteger(A)||A<0)throw Error(`${e} must be a non-negative integer or null`);return A}function I(A,e){if("boolean"!=typeof A)throw Error(`${e} must be a boolean`);return A}function d(A,e){let t=C(A,e);if(!/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/i.test(t))throw Error(`${e} must be a Git object ID`);return t.toLowerCase()}function E(A){return!(!A||A.length>255||"@"===A||A.startsWith("-")||A.startsWith("/")||A.endsWith("/")||A.endsWith(".")||A.includes("//")||A.includes("..")||A.includes("@{")||/[\u0000-\u0020\u007f~^:?*[\\]/.test(A))&&A.split("/").every(A=>A&&!A.startsWith(".")&&!A.endsWith(".lock"))}function c(A,e,t){if("string"!=typeof A||!e.includes(A))throw Error(`${t} is invalid`);return A}A.s(["CODEBASE_BROWSE_JOB_KIND",0,e,"CODEBASE_FETCH_JOB_KIND",0,n,"CODEBASE_GIT_INSPECT_JOB_KIND",0,i,"CODEBASE_GIT_OPERATION_JOB_KIND",0,a,"CODEBASE_INSPECT_JOB_KIND",0,t,"CODEBASE_JOB_KINDS",0,o,"CODEBASE_RECONCILE_EVENT_CAPABILITY",0,"codebase.reconcile.requested","CODEBASE_REFRESH_JOB_KIND",0,r,"DEFAULT_CODEBASE_RECONCILE_INTERVAL_SECONDS",0,30,"MAX_CODEBASE_RECONCILE_INTERVAL_SECONDS",0,3600,"MIN_CODEBASE_RECONCILE_INTERVAL_SECONDS",0,10,"codebaseBrowsePayload",0,function(A){let e=g(A,"codebase browse payload"),t=Object.keys(e).find(A=>"path"!==A);if(t)throw Error(`Unexpected codebase browse field: ${t}`);return{path:Q(e.path,"payload.path")}},"codebaseGitInspectPayload",0,function(A){let e=g(A,"codebase Git inspect payload"),t=new Set(["action","codebaseId","folder","expectedOrigin","stashOid"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected codebase Git inspect payload field: ${r}`);if("STATE"!==e.action&&"STASH_DIFF"!==e.action)throw Error("codebase Git inspect payload.action is invalid");let n={codebaseId:C(e.codebaseId,"codebase Git inspect payload.codebaseId"),folder:C(e.folder,"codebase Git inspect payload.folder"),expectedOrigin:C(e.expectedOrigin,"codebase Git inspect payload.expectedOrigin")};if("STATE"===e.action){if(void 0!==e.stashOid)throw Error("STATE inspection cannot include stashOid");return{action:e.action,...n}}return{action:e.action,...n,stashOid:d(e.stashOid,"codebase Git inspect payload.stashOid")}},"codebaseGitOperationPayload",0,function(A){let e=g(A,"codebase Git operation payload"),t=new Set(["codebaseId","folder","expectedOrigin","defaultBranch","operation","branch","stashOid","stashChanges"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected codebase Git operation payload field: ${r}`);let n=c(e.operation,s,"codebase Git operation payload.operation"),i={codebaseId:C(e.codebaseId,"codebase Git operation payload.codebaseId"),folder:C(e.folder,"codebase Git operation payload.folder"),expectedOrigin:C(e.expectedOrigin,"codebase Git operation payload.expectedOrigin"),defaultBranch:void 0===e.defaultBranch||null===e.defaultBranch?null:C(e.defaultBranch,"codebase Git operation payload.defaultBranch"),operation:n};if(["SWITCH_BRANCH","DELETE_BRANCH","DELETE_REMOTE_BRANCH","PULL_BRANCH"].includes(n)){let A=C(e.branch,"codebase Git operation payload.branch");if(!E(A))throw Error("Invalid Git branch name");if(void 0!==e.stashOid)throw Error(`${n} cannot include stashOid`);if("SWITCH_BRANCH"!==n&&void 0!==e.stashChanges)throw Error(`${n} cannot include stashChanges`);if(void 0!==e.stashChanges&&"boolean"!=typeof e.stashChanges)throw Error("stashChanges must be a boolean");return{...i,branch:A,..."SWITCH_BRANCH"===n?{stashChanges:!!e.stashChanges}:{}}}if(void 0!==e.branch||void 0!==e.stashChanges)throw Error(`${n} cannot include branch or stashChanges`);return{...i,stashOid:d(e.stashOid,"codebase Git operation payload.stashOid")}},"codebaseJobPayload",0,function(A){let e=g(A,"codebase job payload"),t=new Set(["folder","codebaseId","expectedOrigin","baseBranch","keepBaseBranchUpToDate"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected codebase payload field: ${r}`);return{folder:C(e.folder,"payload.folder"),...void 0===e.codebaseId?{}:{codebaseId:C(e.codebaseId,"payload.codebaseId")},...void 0===e.expectedOrigin?{}:{expectedOrigin:C(e.expectedOrigin,"payload.expectedOrigin")},...void 0===e.baseBranch?{}:{baseBranch:C(e.baseBranch,"payload.baseBranch")},...void 0===e.keepBaseBranchUpToDate?{}:{keepBaseBranchUpToDate:I(e.keepBaseBranchUpToDate,"payload.keepBaseBranchUpToDate")}}},"parseCodebaseDirectoryListing",0,function(A){let e=g(A,"directory listing");if(!Array.isArray(e.entries))throw Error("directory listing.entries must be an array");if("boolean"!=typeof e.truncated)throw Error("directory listing.truncated must be a boolean");return{path:C(e.path,"directory listing.path"),parentPath:Q(e.parentPath,"directory listing.parentPath"),homePath:C(e.homePath,"directory listing.homePath"),entries:e.entries.map((A,e)=>{let t=g(A,`directory listing.entries[${e}]`);if("boolean"!=typeof t.hidden)throw Error(`directory listing.entries[${e}].hidden is invalid`);return{name:C(t.name,`directory listing.entries[${e}].name`),path:C(t.path,`directory listing.entries[${e}].path`),hidden:t.hidden}}),truncated:e.truncated}},"parseCodebaseGitState",0,function(A){let e=g(A,"codebase Git state");if(!Array.isArray(e.branches))throw Error("codebase Git state.branches must be an array");if(!Array.isArray(e.stashes))throw Error("codebase Git state.stashes must be an array");if(e.branches.length>1e3||e.stashes.length>200)throw Error("codebase Git state exceeds its result limits");return{dirty:I(e.dirty,"codebase Git state.dirty"),branches:e.branches.map((A,e)=>{let t=g(A,`codebase Git state.branches[${e}]`),r=C(t.name,`codebase Git state.branches[${e}].name`);if(!E(r))throw Error(`codebase Git state.branches[${e}].name is invalid`);return{name:r,local:I(t.local,`codebase Git state.branches[${e}].local`),remote:I(t.remote,`codebase Git state.branches[${e}].remote`),current:I(t.current,`codebase Git state.branches[${e}].current`),checkedOutPath:null===t.checkedOutPath?null:C(t.checkedOutPath,`codebase Git state.branches[${e}].checkedOutPath`)}}),branchesTruncated:I(e.branchesTruncated,"codebase Git state.branchesTruncated"),stashes:e.stashes.map((A,e)=>{let t=g(A,`codebase Git state.stashes[${e}]`);return{oid:d(t.oid,`codebase Git state.stashes[${e}].oid`),selector:C(t.selector,`codebase Git state.stashes[${e}].selector`),message:"string"==typeof t.message?t.message:(()=>{throw Error(`codebase Git state.stashes[${e}].message must be a string`)})(),createdAt:function(A,e){let t=C(A,e);if(Number.isNaN(new Date(t).valueOf()))throw Error(`${e} must be an ISO date`);return t}(t.createdAt,`codebase Git state.stashes[${e}].createdAt`)}}),stashesTruncated:I(e.stashesTruncated,"codebase Git state.stashesTruncated")}},"parseCodebaseSnapshot",0,function(A){let e=g(A,"codebase snapshot"),t=C(e.checkedAt,"snapshot.checkedAt");if(Number.isNaN(new Date(t).valueOf()))throw Error("snapshot.checkedAt must be an ISO date");let r=Q(e.fetchedAt,"snapshot.fetchedAt");if(r&&Number.isNaN(new Date(r).valueOf()))throw Error("snapshot.fetchedAt must be an ISO date or null");if("boolean"!=typeof e.linkedWorktree)throw Error("snapshot.linkedWorktree must be a boolean");return{folder:C(e.folder,"snapshot.folder"),observedOrigin:Q(e.observedOrigin,"snapshot.observedOrigin"),canonicalOrigin:Q(e.canonicalOrigin,"snapshot.canonicalOrigin"),displayOrigin:Q(e.displayOrigin,"snapshot.displayOrigin"),branch:Q(e.branch,"snapshot.branch"),headSha:Q(e.headSha,"snapshot.headSha"),upstream:Q(e.upstream,"snapshot.upstream"),ahead:l(e.ahead,"snapshot.ahead"),behind:l(e.behind,"snapshot.behind"),syncState:c(e.syncState,["IN_SYNC","AHEAD","BEHIND","DIVERGED","NO_UPSTREAM","DETACHED","UNKNOWN"],"snapshot.syncState"),availability:c(e.availability,["AVAILABLE","MISSING","NOT_REPOSITORY","ORIGIN_MISMATCH","ERROR"],"snapshot.availability"),error:Q(e.error,"snapshot.error"),checkedAt:t,fetchedAt:r,linkedWorktree:e.linkedWorktree}},"parseCodebaseStashDiff",0,function(A){let e=g(A,"codebase stash diff");if("string"!=typeof e.patch)throw Error("codebase stash diff.patch must be a string");if(new TextEncoder().encode(e.patch).byteLength>262144)throw Error("codebase stash diff.patch exceeds its result limit");return{oid:d(e.oid,"codebase stash diff.oid"),patch:e.patch,truncated:I(e.truncated,"codebase stash diff.truncated")}}],184015);let h="worktree.inspect",B="worktree.operation",D="worktree.watch",w="worktree.branch",u="worktree.move.push",p="worktree.move.checkout",f="worktree.delete",y="worktree.diff.inspect",M="worktree.diff.asset",m=[h,B,D,w,u,p,f,y,M],N=String.raw`\b([A-Z][A-Z0-9_]*-\d+)\b`,S=["OPEN_EDITOR","FORCE_PUSH","SYNC","PUSH","RESET","STASH_ALL","STAGE_ALL","UNSTAGE_ALL"],k=["READY","DIRTY","DETACHED","BEHIND","DIVERGED","UNKNOWN"];function U(A){return!(!A||A.length>255||"@"===A||A.startsWith("-")||A.startsWith("/")||A.endsWith("/")||A.endsWith(".")||A.includes("//")||A.includes("..")||A.includes("@{")||/[\u0000-\u0020\u007f~^:?*[\\]/.test(A))&&A.split("/").every(A=>A&&!A.startsWith(".")&&!A.endsWith(".lock"))}let F=["STAGED","UNSTAGED","UNTRACKED","COMMIT","BRANCH"];function R(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function T(A,e){if("string"!=typeof A||0===A.length)throw Error(`${e} must be a non-empty string`);return A}function b(A,e){return null==A?null:T(A,e)}function H(A,e){let t=T(A,e).replaceAll("\\","/");if(t.startsWith("/")||/^[A-Za-z]:\//.test(t)||t.split("/").includes("..")||t.includes("\0"))throw Error(`${e} must stay within the worktree`);return t}function L(A,e){if(null==A)return null;if("number"!=typeof A||!Number.isInteger(A)||A<0)throw Error(`${e} must be a non-negative integer or null`);return A}function O(A,e){if(null!=A){if("boolean"!=typeof A)throw Error(`${e} must be a boolean`);return A}}function G(A,e){if(void 0!==A)return null===A?null:T(A,e)}function J(A,e){if(void 0!==A)return L(A,e)}function v(A,e){if(null!=A){if("string"!=typeof A||!k.includes(A))throw Error(`${e} is invalid`);return A}}function x(A,e){let t=T(A,e);if(Number.isNaN(new Date(t).valueOf()))throw Error(`${e} must be an ISO date`);return t}function V(A,e){let t=b(A,e);if(t&&Number.isNaN(new Date(t).valueOf()))throw Error(`${e} must be an ISO date or null`);return t}function P(A,e){if("string"!=typeof A||!["IN_SYNC","AHEAD","BEHIND","DIVERGED","NO_UPSTREAM","DETACHED","UNKNOWN"].includes(A))throw Error(`${e} is invalid`);return A}function Y(A,e="worktree"){let t=R(A,e);if("boolean"!=typeof t.primary)throw Error(`${e}.primary must be a boolean`);let r=t.availability;if(!["AVAILABLE","MISSING","ERROR"].includes(r))throw Error(`${e}.availability is invalid`);return{gitDirectory:T(t.gitDirectory,`${e}.gitDirectory`),folder:T(t.folder,`${e}.folder`),relativePath:T(t.relativePath,`${e}.relativePath`),primary:t.primary,branch:b(t.branch,`${e}.branch`),headSha:b(t.headSha,`${e}.headSha`),codeStateHash:G(t.codeStateHash,`${e}.codeStateHash`),upstream:b(t.upstream,`${e}.upstream`),ahead:L(t.ahead,`${e}.ahead`),behind:L(t.behind,`${e}.behind`),syncState:P(t.syncState,`${e}.syncState`),baseAhead:L(t.baseAhead,`${e}.baseAhead`),baseBehind:L(t.baseBehind,`${e}.baseBehind`),hasStagedChanges:O(t.hasStagedChanges,`${e}.hasStagedChanges`),hasUnstagedChanges:O(t.hasUnstagedChanges,`${e}.hasUnstagedChanges`),pushStatus:v(t.pushStatus,`${e}.pushStatus`)??"UNKNOWN",availability:r,error:b(t.error,`${e}.error`),checkedAt:x(t.checkedAt,`${e}.checkedAt`)}}A.s(["DEFAULT_JIRA_BRANCH_REGEX",0,N,"DEFAULT_WORKTREE_FETCH_INTERVAL_SECONDS",0,300,"MAX_WORKTREE_FETCH_INTERVAL_SECONDS",0,86400,"MIN_WORKTREE_FETCH_INTERVAL_SECONDS",0,60,"WORKTREE_BRANCH_JOB_KIND",0,w,"WORKTREE_DELETE_JOB_KIND",0,f,"WORKTREE_DIFF_ASSET_JOB_KIND",0,M,"WORKTREE_DIFF_JOB_KIND",0,y,"WORKTREE_INSPECT_JOB_KIND",0,h,"WORKTREE_JOB_KINDS",0,m,"WORKTREE_MOVE_CHECKOUT_JOB_KIND",0,p,"WORKTREE_MOVE_PUSH_JOB_KIND",0,u,"WORKTREE_OPERATIONS",0,S,"WORKTREE_OPERATION_JOB_KIND",0,B,"WORKTREE_WATCH_JOB_KIND",0,D,"parseCodebaseWorktreeReport",0,function(A){let e=R(A,"worktree report"),t=void 0===e.localBranches?[]:e.localBranches;if("boolean"!=typeof e.complete)throw Error("worktree report.complete must be a boolean");if(!Array.isArray(t)||!Array.isArray(e.remoteBranches)||!Array.isArray(e.worktrees))throw Error("worktree report arrays are invalid");return{codebaseId:T(e.codebaseId,"worktree report.codebaseId"),complete:e.complete,defaultBranch:b(e.defaultBranch,"worktree report.defaultBranch"),localBranches:t.map((A,e)=>T(A,`worktree report.localBranches[${e}]`)),remoteBranches:e.remoteBranches.map((A,e)=>T(A,`worktree report.remoteBranches[${e}]`)),fetchedAt:V(e.fetchedAt,"worktree report.fetchedAt"),fetchAttemptedAt:V(e.fetchAttemptedAt,"worktree report.fetchAttemptedAt"),fetchError:b(e.fetchError,"worktree report.fetchError"),worktrees:e.worktrees.map((A,e)=>Y(A,`worktree report.worktrees[${e}]`))}},"parseWorktreeActivityReport",0,function(A){let e=R(A,"worktree activity report"),t=new Set(["codebaseId","gitDirectory","branch","headSha","codeStateHash","upstream","ahead","behind","syncState","baseAhead","baseBehind","hasStagedChanges","hasUnstagedChanges","pushStatus","observedAt"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree activity field: ${r}`);return{codebaseId:T(e.codebaseId,"worktree activity report.codebaseId"),gitDirectory:T(e.gitDirectory,"worktree activity report.gitDirectory"),branch:G(e.branch,"worktree activity report.branch"),headSha:G(e.headSha,"worktree activity report.headSha"),codeStateHash:G(e.codeStateHash,"worktree activity report.codeStateHash"),upstream:G(e.upstream,"worktree activity report.upstream"),ahead:J(e.ahead,"worktree activity report.ahead"),behind:J(e.behind,"worktree activity report.behind"),syncState:function(A,e){if(void 0!==A)return P(A,e)}(e.syncState,"worktree activity report.syncState"),baseAhead:J(e.baseAhead,"worktree activity report.baseAhead"),baseBehind:J(e.baseBehind,"worktree activity report.baseBehind"),hasStagedChanges:O(e.hasStagedChanges,"worktree activity report.hasStagedChanges"),hasUnstagedChanges:O(e.hasUnstagedChanges,"worktree activity report.hasUnstagedChanges"),pushStatus:v(e.pushStatus,"worktree activity report.pushStatus"),observedAt:x(e.observedAt,"worktree activity report.observedAt")}},"parseWorktreeInventoryItem",0,Y,"validGitBranchName",0,U,"worktreeBranchJobPayload",0,function(A){let e=R(A,"worktree branch payload"),t=new Set(["codebaseId","rootFolder","folder","gitDirectory","expectedOrigin","baseBranch","action","mode","candidates","stashOnFailure"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree branch payload field: ${r}`);if("CREATE"!==e.action&&"CHANGE"!==e.action)throw Error("worktree branch payload.action is invalid");if("NEW"!==e.mode&&"EXISTING"!==e.mode)throw Error("worktree branch payload.mode is invalid");if(!Array.isArray(e.candidates)||e.candidates.length<1||e.candidates.length>100)throw Error("worktree branch payload.candidates is invalid");let n=e.candidates.map((A,e)=>{let t=T(A,`worktree branch payload.candidates[${e}]`);if(!U(t))throw Error(`Invalid Git branch name: ${t}`);return t});if(new Set(n).size!==n.length)throw Error("worktree branch candidates must be unique");let i=b(e.folder,"worktree branch payload.folder"),a=b(e.gitDirectory,"worktree branch payload.gitDirectory");if("CHANGE"===e.action&&(!i||!a))throw Error("Changing a branch requires a worktree folder and Git directory");if("boolean"!=typeof e.stashOnFailure)throw Error("worktree branch payload.stashOnFailure must be a boolean");return{codebaseId:T(e.codebaseId,"worktree branch payload.codebaseId"),rootFolder:T(e.rootFolder,"worktree branch payload.rootFolder"),folder:i,gitDirectory:a,expectedOrigin:T(e.expectedOrigin,"worktree branch payload.expectedOrigin"),baseBranch:T(e.baseBranch,"worktree branch payload.baseBranch"),action:e.action,mode:e.mode,candidates:n,stashOnFailure:e.stashOnFailure}},"worktreeDeleteJobPayload",0,function(A){let e=R(A,"worktree delete payload"),t=new Set(["moveId","codebaseId","rootFolder","folder","gitDirectory","expectedOrigin","branch","defaultBranch","deleteRemoteBranch","requireClean","expectedHeadSha"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree delete payload field: ${r}`);if("boolean"!=typeof e.deleteRemoteBranch||"boolean"!=typeof e.requireClean)throw Error("worktree delete payload flags must be booleans");let n=b(e.branch,"worktree delete payload.branch");if(n&&!U(n))throw Error("Invalid Git branch name");let i=b(e.expectedHeadSha,"worktree delete payload.expectedHeadSha");if(e.requireClean&&!i)throw Error("Clean worktree deletion requires an expected HEAD");return{moveId:b(e.moveId,"worktree delete payload.moveId"),codebaseId:T(e.codebaseId,"worktree delete payload.codebaseId"),rootFolder:T(e.rootFolder,"worktree delete payload.rootFolder"),folder:T(e.folder,"worktree delete payload.folder"),gitDirectory:T(e.gitDirectory,"worktree delete payload.gitDirectory"),expectedOrigin:T(e.expectedOrigin,"worktree delete payload.expectedOrigin"),branch:n,defaultBranch:b(e.defaultBranch,"worktree delete payload.defaultBranch"),deleteRemoteBranch:e.deleteRemoteBranch,requireClean:e.requireClean,expectedHeadSha:i}},"worktreeDiffPayload",0,function(A){let e=R(A,"worktree diff payload"),t=new Set(["codebaseId","folder","gitDirectory","expectedOrigin","baseBranch","scope","path","previousPath","commitSha","uploadId","side"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree diff payload field: ${r}`);if(!F.includes(e.scope))throw Error("worktree diff payload.scope is invalid");if(null!==e.side&&void 0!==e.side&&"BEFORE"!==e.side&&"AFTER"!==e.side)throw Error("worktree diff payload.side is invalid");let n=null===e.path||void 0===e.path?null:H(e.path,"worktree diff payload.path"),i=null===e.previousPath||void 0===e.previousPath?null:H(e.previousPath,"worktree diff payload.previousPath"),a=e.scope,s=b(e.commitSha,"worktree diff payload.commitSha");if("COMMIT"===a&&!s)throw Error("Commit diffs require a commit SHA");return{codebaseId:T(e.codebaseId,"worktree diff payload.codebaseId"),folder:T(e.folder,"worktree diff payload.folder"),gitDirectory:T(e.gitDirectory,"worktree diff payload.gitDirectory"),expectedOrigin:T(e.expectedOrigin,"worktree diff payload.expectedOrigin"),baseBranch:T(e.baseBranch,"worktree diff payload.baseBranch"),scope:a,path:n,previousPath:i,commitSha:s,uploadId:b(e.uploadId,"worktree diff payload.uploadId"),side:e.side??null}},"worktreeJobPayload",0,function(A){let e=R(A,"worktree payload"),t=new Set(["codebaseId","folder","gitDirectory","expectedOrigin","baseBranch","operation","editorVariant"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree payload field: ${r}`);let n=e.operation;if(void 0!==n&&("string"!=typeof n||!S.includes(n)))throw Error("worktree payload.operation is invalid");let i=e.editorVariant;if(void 0!==i&&!["CODE","CODE_INSIDERS","NONE"].includes(String(i)))throw Error("worktree payload.editorVariant is invalid");return{codebaseId:T(e.codebaseId,"worktree payload.codebaseId"),folder:T(e.folder,"worktree payload.folder"),gitDirectory:T(e.gitDirectory,"worktree payload.gitDirectory"),expectedOrigin:T(e.expectedOrigin,"worktree payload.expectedOrigin"),baseBranch:b(e.baseBranch,"worktree payload.baseBranch"),...void 0===n?{}:{operation:n},...void 0===i?{}:{editorVariant:i}}},"worktreeMoveCheckoutJobPayload",0,function(A){let e=R(A,"worktree move checkout payload"),t=new Set(["moveId","codebaseId","rootFolder","folder","gitDirectory","expectedOrigin","branch","expectedHeadSha","baseBranch","mode","stashOnFailure"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree move checkout payload field: ${r}`);if("NEW"!==e.mode&&"EXISTING"!==e.mode)throw Error("worktree move checkout payload.mode is invalid");if("boolean"!=typeof e.stashOnFailure)throw Error("worktree move checkout payload.stashOnFailure must be a boolean");let n=b(e.folder,"worktree move checkout payload.folder"),i=b(e.gitDirectory,"worktree move checkout payload.gitDirectory");if("EXISTING"===e.mode&&(!n||!i))throw Error("An existing destination worktree is required");let a=T(e.branch,"worktree move checkout payload.branch");if(!U(a))throw Error("Invalid Git branch name");return{moveId:T(e.moveId,"worktree move checkout payload.moveId"),codebaseId:T(e.codebaseId,"worktree move checkout payload.codebaseId"),rootFolder:T(e.rootFolder,"worktree move checkout payload.rootFolder"),folder:n,gitDirectory:i,expectedOrigin:T(e.expectedOrigin,"worktree move checkout payload.expectedOrigin"),branch:a,expectedHeadSha:T(e.expectedHeadSha,"worktree move checkout payload.expectedHeadSha"),baseBranch:T(e.baseBranch,"worktree move checkout payload.baseBranch"),mode:e.mode,stashOnFailure:e.stashOnFailure}},"worktreeMovePushJobPayload",0,function(A){let e=R(A,"worktree move push payload"),t=new Set(["moveId","codebaseId","folder","gitDirectory","expectedOrigin","branch","expectedHeadSha"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree move push payload field: ${r}`);let n=T(e.branch,"worktree move push payload.branch");if(!U(n))throw Error("Invalid Git branch name");return{moveId:T(e.moveId,"worktree move push payload.moveId"),codebaseId:T(e.codebaseId,"worktree move push payload.codebaseId"),folder:T(e.folder,"worktree move push payload.folder"),gitDirectory:T(e.gitDirectory,"worktree move push payload.gitDirectory"),expectedOrigin:T(e.expectedOrigin,"worktree move push payload.expectedOrigin"),branch:n,expectedHeadSha:T(e.expectedHeadSha,"worktree move push payload.expectedHeadSha")}},"worktreeWatchJobPayload",0,function(A){let e=R(A,"worktree watch payload"),t=new Set(["codebaseId","folder","gitDirectory","expectedOrigin","baseBranch","action","watchId"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree watch payload field: ${r}`);if(!["START","STOP"].includes(e.action))throw Error("worktree watch payload.action is invalid");return{codebaseId:T(e.codebaseId,"worktree watch payload.codebaseId"),folder:T(e.folder,"worktree watch payload.folder"),gitDirectory:T(e.gitDirectory,"worktree watch payload.gitDirectory"),expectedOrigin:T(e.expectedOrigin,"worktree watch payload.expectedOrigin"),baseBranch:b(e.baseBranch,"worktree watch payload.baseBranch"),action:e.action,watchId:T(e.watchId,"worktree watch payload.watchId")}}],119909)},320058,692680,A=>{"use strict";var e=A.i(666680);let t="skills.scan",r="skills.read",n="skills.apply",i=[t,r,n],a=["CURSOR","GITHUB_COPILOT","CODEX","CLAUDE","OPENCODE"],s=["CURSOR","GITHUB_COPILOT","AGENTS","CLAUDE","CODEX_LEGACY","OPENCODE"],o=RegExp("^[a-z0-9]+(?:-[a-z0-9]+)*$");function g(A){let t=(0,e.createHash)("sha256");for(let e of[...A].sort((A,e)=>A.path.localeCompare(e.path)))t.update(e.path),t.update("\0"),t.update(e.executable?"1":"0"),t.update("\0"),t.update(Buffer.from(e.contentsBase64,"base64")),t.update("\0");return t.digest("hex")}function C(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function Q(A,e){if("string"!=typeof A||0===A.length)throw Error(`${e} must be a non-empty string`);return A}function l(A,e,t){let r=Q(A,t);if(!e.includes(r))throw Error(`${t} is invalid`);return r}function I(A,e){let t=Q(A,e);if(t.includes("\0")||t.length>4096)throw Error(`${e} is invalid`);return t}function d(A,e){let t=l(A.scope,["GLOBAL","PROJECT"],`${e}.scope`),r=null===A.folder?null:I(A.folder,`${e}.folder`);if("GLOBAL"===t!=(null===r))throw Error(`${e}.folder must be null only for global skills`);return{scope:t,rootKind:l(A.rootKind,s,`${e}.rootKind`),folder:r}}function E(A,e="skill name"){let t=Q(A,e);if(t.length>64||!o.test(t))throw Error(`${e} must use 1-64 lowercase letters, numbers, and single hyphens`);return t}function c(A,e="skill package"){let t=C(A,e),r=E(t.name,`${e}.name`),n=Q(t.description,`${e}.description`).trim();if(n.length>1024)throw Error(`${e}.description must be 1-1024 characters`);if(!Array.isArray(t.files)||0===t.files.length||t.files.length>500)throw Error(`${e}.files must contain 1-500 files`);let i=0,a=new Set,s=t.files.map((A,t)=>{let r=C(A,`${e}.files[${t}]`),n=function(A,e="file path"){let t=Q(A,e).replaceAll("\\","/");if(t.length>512||t.startsWith("/")||t.endsWith("/")||t.split("/").some(A=>!A||"."===A||".."===A||A.includes("\0")))throw Error(`${e} must stay within the skill directory`);return t}(r.path,`${e}.files[${t}].path`);if(a.has(n))throw Error(`${e} contains duplicate path ${n}`);a.add(n);let s=Q(r.contentsBase64,`${e}.files[${t}].contentsBase64`),o=Buffer.from(s,"base64").byteLength;if(o>0xa00000)throw Error(`${n} exceeds the per-file limit`);return i+=o,{path:n,contentsBase64:s,executable:!0===r.executable}});if(!a.has("SKILL.md"))throw Error(`${e} must contain SKILL.md`);if(i>0x1400000)throw Error(`${e} exceeds the package size limit`);let o=function(A){let e=A.replaceAll("\r\n","\n");if(!e.startsWith("---\n"))throw Error("SKILL.md must begin with YAML frontmatter");let t=e.indexOf("\n---",4);if(t<0)throw Error("SKILL.md frontmatter is not closed");let r=e.slice(4,t).split("\n"),n=new Map;for(let A=0;A<r.length;A+=1){let e=/^([A-Za-z][A-Za-z0-9_-]*):(?:\s*(.*))?$/.exec(r[A]??"");if(!e)continue;let t=e[1],i=e[2]??"";if("|"===i||">"===i){let e=[];for(;A+1<r.length&&/^(?:\s+|$)/.test(r[A+1]??"");)e.push((r[A+=1]??"").replace(/^\s+/,""));n.set(t,">"===i?e.join(" ").trim():e.join("\n").trim())}else n.set(t,function(A){let e=A.trim();if(e.startsWith('"')&&e.endsWith('"'))try{return JSON.parse(e)}catch{return e.slice(1,-1)}return e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1).replaceAll("''","'"):e}(i))}let i=E(n.get("name"),"SKILL.md name"),a=(n.get("description")??"").trim();if(!a||a.length>1024)throw Error("SKILL.md description must be 1-1024 characters");return{name:i,description:a}}(Buffer.from(s.find(A=>"SKILL.md"===A.path).contentsBase64,"base64").toString("utf8"));if(o.name!==r||o.description!==n)throw Error(`${e} metadata must match SKILL.md frontmatter`);let l=Q(t.packageHash,`${e}.packageHash`);if(g(s)!==l)throw Error(`${e}.packageHash does not match its files`);return{name:r,description:n,packageHash:l,files:s}}function h(A){let e=C(A,"skills.scan payload");if(!Array.isArray(e.tools)||!Array.isArray(e.targets))throw Error("skills.scan requires tools and targets arrays");return{tools:[...new Set(e.tools.map((A,e)=>l(A,a,`tools[${e}]`)))],targets:e.targets.slice(0,2e3).map((A,e)=>{var t,r;let n=C(A,`targets[${e}]`);return{codebaseId:Q(n.codebaseId,`targets[${e}].codebaseId`),worktreeId:(t=n.worktreeId,r=`targets[${e}].worktreeId`,null===t?null:Q(t,r)),folder:I(n.folder,`targets[${e}].folder`)}})}}A.s(["AI_TOOLS",0,a,"SKILL_APPLY_JOB_KIND",0,n,"SKILL_JOB_KINDS",0,i,"SKILL_READ_JOB_KIND",0,r,"SKILL_SCAN_JOB_KIND",0,t,"hashSkillFiles",0,g,"parseSkillApplyPayload",0,function(A){let e=C(A,"skills.apply payload");if(!Array.isArray(e.operations))throw Error("skills.apply requires operations");return{operations:e.operations.slice(0,500).map((A,e)=>{let t=C(A,`operations[${e}]`),r=d(t,`operations[${e}]`);if("WRITE"===t.kind)return{kind:"WRITE",...r,package:c(t.package,`operations[${e}].package`),manageGitExclude:!0===t.manageGitExclude};if("DELETE"===t.kind)return{kind:"DELETE",...r,skillName:E(t.skillName,`operations[${e}].skillName`),manageGitExclude:!0===t.manageGitExclude};throw Error(`operations[${e}].kind is invalid`)})}},"parseSkillPackage",0,c,"parseSkillReadPayload",0,function(A){let e=C(A,"skills.read payload"),t=h(e);if(!Array.isArray(e.requests))throw Error("skills.read requires requests");return{...t,requests:e.requests.slice(0,200).map((A,e)=>{let t=C(A,`requests[${e}]`);return{...d(t,`requests[${e}]`),skillName:E(t.skillName,`requests[${e}].skillName`)}})}},"parseSkillScanPayload",0,h],320058);let B="ios.signing.assets.scan",D="ios.signing.profile.read",w="ios.signing.profile.install",u="ios.signing.profile.delete",p="ios.signing.identity.import",f="ios.signing.identity.delete",y=[B,D,w,u,p,f];function M(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function m(A,e){if("string"!=typeof A||!A.trim()||A.includes("\0"))throw Error(`${e} must be a non-empty string`);return A}function N(A,e){return null===A?null:m(A,e)}function S(A,e){if(!Array.isArray(A))throw Error(`${e} must be an array`);return A.map((A,t)=>m(A,`${e}[${t}]`))}function k(A,e){if("boolean"!=typeof A)throw Error(`${e} must be a boolean`);return A}function U(A,e){let t=N(A,e);if(null!==t&&!Number.isFinite(Date.parse(t)))throw Error(`${e} must be an ISO-8601 date`);return t}function F(A,e,t){let r=Object.keys(A).find(A=>!e.includes(A));if(r)throw Error(`Unexpected ${t} field: ${r}`)}A.s(["SIGNING_ASSETS_SCAN_JOB_KIND",0,B,"SIGNING_ASSET_JOB_KINDS",0,y,"SIGNING_IDENTITY_DELETE_JOB_KIND",0,f,"SIGNING_IDENTITY_IMPORT_JOB_KIND",0,p,"SIGNING_PROFILE_DELETE_JOB_KIND",0,u,"SIGNING_PROFILE_INSTALL_JOB_KIND",0,w,"SIGNING_PROFILE_READ_JOB_KIND",0,D,"parseSigningAssetsScanResult",0,function(A){let e=M(A,"signing assets result");if(!Array.isArray(e.profiles)||!Array.isArray(e.certificates)||!Array.isArray(e.warnings))throw Error("Signing assets result arrays are invalid");return{profiles:e.profiles.map((A,e)=>{let t=M(A,`signing profiles[${e}]`),r=m(t.profileType,`signing profiles[${e}].profileType`);if(!["DEVELOPMENT","AD_HOC","ENTERPRISE","APP_STORE"].includes(r))throw Error(`signing profiles[${e}].profileType is invalid`);let n=t.deviceCount;if("number"!=typeof n||!Number.isInteger(n)||n<0)throw Error(`signing profiles[${e}].deviceCount is invalid`);return{uuid:m(t.uuid,`signing profiles[${e}].uuid`),contentHash:m(t.contentHash,`signing profiles[${e}].contentHash`),name:m(t.name,`signing profiles[${e}].name`),profileType:r,bundleId:m(t.bundleId,`signing profiles[${e}].bundleId`),teamId:N(t.teamId,`signing profiles[${e}].teamId`),teamName:N(t.teamName,`signing profiles[${e}].teamName`),platforms:S(t.platforms,`signing profiles[${e}].platforms`),deviceCount:n,deviceUdids:void 0===t.deviceUdids?[]:S(t.deviceUdids,`signing profiles[${e}].deviceUdids`),certificateSha1s:S(t.certificateSha1s,`signing profiles[${e}].certificateSha1s`),createdAt:U(t.createdAt,`signing profiles[${e}].createdAt`),expiresAt:U(t.expiresAt,`signing profiles[${e}].expiresAt`),expired:k(t.expired,`signing profiles[${e}].expired`),xcodeManaged:k(t.xcodeManaged,`signing profiles[${e}].xcodeManaged`)}}),certificates:e.certificates.map((A,e)=>{let t=M(A,`signing certificates[${e}]`);return{sha1:m(t.sha1,`signing certificates[${e}].sha1`),sha256:N(t.sha256,`signing certificates[${e}].sha256`),name:m(t.name,`signing certificates[${e}].name`),teamId:N(t.teamId,`signing certificates[${e}].teamId`),certificateType:N(t.certificateType,`signing certificates[${e}].certificateType`),notBefore:U(t.notBefore,`signing certificates[${e}].notBefore`),expiresAt:U(t.expiresAt,`signing certificates[${e}].expiresAt`),expired:k(t.expired,`signing certificates[${e}].expired`),hasPrivateKey:k(t.hasPrivateKey,`signing certificates[${e}].hasPrivateKey`)}}),warnings:S(e.warnings,"signing warnings")}},"signingIdentityDeletePayload",0,function(A){let e=M(A,"signing identity delete payload");F(e,["sha1"],"signing identity delete payload");let t=m(e.sha1,"signing identity SHA-1");if(!/^[A-Fa-f0-9]{40}$/.test(t))throw Error("Signing identity SHA-1 is invalid");return{sha1:t.toUpperCase()}},"signingIdentityImportPayload",0,function(A){let e=M(A,"signing identity import payload");F(e,["transferId","sha256"],"signing identity import payload");let t=m(e.sha256,"signing identity import sha256");if(!/^[A-Fa-f0-9]{64}$/.test(t))throw Error("Signing identity import SHA-256 is invalid");return{transferId:m(e.transferId,"signing identity transfer ID"),sha256:t.toUpperCase()}},"signingProfileInstallPayload",0,function(A){let e=M(A,"signing profile install payload");F(e,["contentBase64"],"signing profile install payload");let t=m(e.contentBase64,"signing profile install payload.contentBase64");if(t.length>2097152)throw Error("Provisioning profile payload is too large");return{contentBase64:t}},"signingProfileKeyPayload",0,function(A){let e=M(A,"signing profile payload");return F(e,["uuid"],"signing profile payload"),{uuid:m(e.uuid,"signing profile payload.uuid")}},"signingScanPayload",0,function(A){return F(M(A,"signing scan payload"),[],"signing scan payload"),{}}],692680)},805422,694355,A=>{"use strict";var e=A.i(666680),t=A.i(750227),r=A.i(986847),n=A.i(807055),i=A.i(885418),a=A.i(184015),s=A.i(119909),o=A.i(320058),g=A.i(692680),C=A.i(243783),Q=A.i(661983);let l=["QUEUED","RUNNING"],I=new Set(["SUCCEEDED","FAILED","CANCELLED","TIMED_OUT"]);function d(A){return(0,e.createHash)("sha256").update(A).digest("hex")}function E(A){Q.agentEventBus.publish(Q.AGENT_CHANGED_TOPIC,{agentChanged:A})}function c(A){Q.agentEventBus.publish((0,Q.agentJobChangedTopic)(A.id),{agentJobChanged:A}),A.ccusageCollectionId&&Q.agentEventBus.publish((0,Q.ccusageCollectionChangedTopic)(A.ccusageCollectionId),{ccusageCollectionChanged:{id:A.ccusageCollectionId}}),A.buildDataCollectionId&&Q.agentEventBus.publish((0,Q.buildDataCollectionChangedTopic)(A.buildDataCollectionId),{buildDataCollectionChanged:{id:A.buildDataCollectionId}})}[r.CCUSAGE_REPORT_JOB_KIND,...i.BUILD_DATA_JOB_KINDS,...a.CODEBASE_JOB_KINDS,...s.WORKTREE_JOB_KINDS,...o.SKILL_JOB_KINDS,...n.IOS_BUILD_JOB_KINDS,...g.SIGNING_ASSET_JOB_KINDS];class h{completionHandlers=new Map;connectionHandlers=new Set;signingSecretTransfers=new Map;createSigningSecretTransfer(A,t,r=3e5){if(!t.p12Base64||t.p12Base64.length>0x2000000)throw Error("Signing identity transfer is empty or too large");let n=(0,e.randomUUID)(),i=Date.now()+Math.max(3e4,Math.min(r,9e5));return this.signingSecretTransfers.set(n,{agentId:A,...t,expiresAt:i}),setTimeout(()=>{let A=this.signingSecretTransfers.get(n);A?.expiresAt===i&&this.signingSecretTransfers.delete(n)},i-Date.now()).unref(),n}claimSigningSecretTransfer(A,e){let t=this.signingSecretTransfers.get(e);if(this.signingSecretTransfers.delete(e),!t||t.expiresAt<=Date.now())throw Error("Signing secret transfer is missing or expired");if(t.agentId!==A)throw Error("Signing secret transfer belongs to another agent");return{p12Base64:t.p12Base64,passphrase:t.passphrase}}revokeSigningSecretTransfer(A){this.signingSecretTransfers.delete(A)}registerCompletionHandler(A,e){this.completionHandlers.set(A,e)}registerConnectionHandler(A){this.connectionHandlers.add(A)}async notifyConnected(A){await Promise.allSettled([...this.connectionHandlers].map(e=>e(A)))}async requestCodebaseReconcile(A){let e=[...new Set(A.filter(Boolean))];if(!e.length)return 0;let t=await (0,C.getPrismaClient)(),r=(await t.agent.findMany({where:{id:{in:e}},select:{id:!0,capabilitiesJson:!0}})).filter(A=>(function(A){try{let e=JSON.parse(A);return Array.isArray(e)?e.filter(A=>"string"==typeof A):[]}catch{return[]}})(A.capabilitiesJson).includes(a.CODEBASE_RECONCILE_EVENT_CAPABILITY));for(let A of r)Q.agentEventBus.publish((0,Q.agentEventsTopic)(A.id),{agentEvents:{type:"CODEBASE_RECONCILE_REQUESTED",job:null}});return r.length}async projectCompletion(A){await this.completionHandlers.get(A.kind)?.(A)}async authenticate(A){if(!A)return null;let e=await (0,C.getPrismaClient)(),t=await e.agent.findUnique({where:{secretHash:d(A)},select:{id:!0}});return t?.id??null}async createEnrollmentToken(A=15){let t=Math.max(1,Math.min(A,1440)),r=`enroll_${(0,e.randomBytes)(32).toString("base64url")}`,n=new Date(Date.now()+6e4*t),i=await (0,C.getPrismaClient)();return await i.agentEnrollmentToken.create({data:{id:(0,e.randomUUID)(),tokenHash:d(r),expiresAt:n}}),{token:r,expiresAt:n}}async enroll(A){let t=await (0,C.getPrismaClient)(),r=`agent_${(0,e.randomBytes)(32).toString("base64url")}`,n=new Date,i=await t.$transaction(async t=>{if(1!==(await t.agentEnrollmentToken.updateMany({where:{tokenHash:d(A.enrollmentToken),usedAt:null,expiresAt:{gt:n}},data:{usedAt:n}})).count)throw Error("Enrollment token is invalid, expired, or already used");let i=await t.agent.create({data:{id:(0,e.randomUUID)(),name:A.name.trim()||A.hostname,hostname:A.hostname,version:A.version,osVersion:A.osVersion,architecture:A.architecture,cpuModel:A.cpuModel,memoryTotalBytes:A.memoryTotalBytes,memoryFreeBytes:A.memoryFreeBytes,diskTotalBytes:A.diskTotalBytes,diskFreeBytes:A.diskFreeBytes,capabilitiesJson:JSON.stringify(A.capabilities),defaultBuildsDirectory:A.defaultBuildsDirectory??null,secretHash:d(r),ipAddress:A.ipAddress,lastSeenAt:n}});return await t.agentAuditEvent.create({data:{id:(0,e.randomUUID)(),agentId:i.id,action:"agent.enrolled",ipAddress:A.ipAddress}}),i});return E(i),await this.notifyConnected(i.id),{agent:i,credential:r}}async heartbeat(A,e){let t=await (0,C.getPrismaClient)(),r=await t.agent.findUnique({where:{id:A},select:{lastSeenAt:!0,disconnectedAt:!0}}),n=new Date,i=!r?.lastSeenAt||null!==r.disconnectedAt||n.getTime()-r.lastSeenAt.getTime()>45e3,a=await t.agent.update({where:{id:A},data:{version:e.version,osVersion:e.osVersion,architecture:e.architecture,cpuModel:e.cpuModel??void 0,memoryTotalBytes:e.memoryTotalBytes??void 0,memoryFreeBytes:e.memoryFreeBytes??void 0,diskTotalBytes:e.diskTotalBytes??void 0,diskFreeBytes:e.diskFreeBytes??void 0,capabilitiesJson:JSON.stringify(e.capabilities),defaultBuildsDirectory:e.defaultBuildsDirectory??void 0,ipAddress:e.ipAddress??void 0,lastSeenAt:n,disconnectedAt:null}});return E(a),i&&await this.notifyConnected(a.id),a}async listAgents(){return(await (0,C.getPrismaClient)()).agent.findMany({orderBy:{createdAt:"desc"}})}async getAgent(A){return(await (0,C.getPrismaClient)()).agent.findUnique({where:{id:A}})}async deleteAgent(A){let e=await (0,C.getPrismaClient)();return!!await e.agent.findUnique({where:{id:A}})&&(await e.agent.delete({where:{id:A}}),!0)}async updateBaseRepoDirectory(A,e){if(null!==e&&(!e||e.length>4096||e.includes("\0")||!t.posix.isAbsolute(e)&&!t.win32.isAbsolute(e)))throw Error("Base repository directory must be an absolute path");let r=await (0,C.getPrismaClient)(),n=await r.agent.update({where:{id:A},data:{baseRepoDirectory:e}});return E(n),n}async updateBuildsDirectory(A,e){if(null!==e&&(!e||e.length>4096||e.includes("\0")||!t.posix.isAbsolute(e)&&!t.win32.isAbsolute(e)))throw Error("Builds directory must be an absolute path");let r=await (0,C.getPrismaClient)(),n=await r.agent.update({where:{id:A},data:{buildsDirectory:e}});return E(n),n}async updateDerivedDataSettings(A,e,r){let n=(0,i.parseDerivedDataLocationMode)(e),a=r?.trim()||null;if(a?.includes("\0")||(a?.length??0)>4096)throw Error("Derived Data path is invalid");if("DEFAULT"===n&&null!==a)throw Error("Default Derived Data mode does not accept a path");if("ABSOLUTE"===n&&(!a||!t.posix.isAbsolute(a)&&!t.win32.isAbsolute(a)))throw Error("Custom Derived Data directory must be an absolute path");if("RELATIVE"===n){let A=a?.replaceAll("\\","/")??"";if(!A||t.posix.isAbsolute(A)||t.win32.isAbsolute(A)||"."===A||A.split("/").some(A=>!A||"."===A||".."===A))throw Error("Relative Derived Data path must stay within each worktree")}let s=await (0,C.getPrismaClient)(),o=await s.agent.update({where:{id:A},data:{derivedDataLocationMode:n,derivedDataPath:a}});return E(o),o}async listJobs(A,e=50,t=!1){return(await (0,C.getPrismaClient)()).agentJob.findMany({where:{agentId:A,...t?{}:{visibility:"USER"}},orderBy:{createdAt:"desc"},take:Math.max(1,Math.min(e,200))})}async getJob(A){return(await (0,C.getPrismaClient)()).agentJob.findUnique({where:{id:A}})}async createJob(A){let t;if(!function(A,e){let t=function(A){if(!A||"object"!=typeof A||Array.isArray(A))throw Error("Job payload must be an object");return A}(e);if(A===i.BUILD_DATA_SCAN_JOB_KIND)return(0,i.buildDataScanPayload)(t);if(A===i.BUILD_DATA_SIZE_JOB_KIND||A===i.BUILD_DATA_DELETE_JOB_KIND)return(0,i.buildDataTargetsPayload)(t);if(A===a.CODEBASE_BROWSE_JOB_KIND)return(0,a.codebaseBrowsePayload)(t);if(A===a.CODEBASE_INSPECT_JOB_KIND||A===a.CODEBASE_REFRESH_JOB_KIND||A===a.CODEBASE_FETCH_JOB_KIND)return(0,a.codebaseJobPayload)(t);if(A===a.CODEBASE_GIT_INSPECT_JOB_KIND)return(0,a.codebaseGitInspectPayload)(t);if(A===a.CODEBASE_GIT_OPERATION_JOB_KIND)return(0,a.codebaseGitOperationPayload)(t);if(A===s.WORKTREE_BRANCH_JOB_KIND)return(0,s.worktreeBranchJobPayload)(t);if(A===s.WORKTREE_MOVE_PUSH_JOB_KIND)return(0,s.worktreeMovePushJobPayload)(t);if(A===s.WORKTREE_MOVE_CHECKOUT_JOB_KIND)return(0,s.worktreeMoveCheckoutJobPayload)(t);if(A===s.WORKTREE_DELETE_JOB_KIND)return(0,s.worktreeDeleteJobPayload)(t);if(A===s.WORKTREE_DIFF_JOB_KIND||A===s.WORKTREE_DIFF_ASSET_JOB_KIND)return(0,s.worktreeDiffPayload)(t);if(A===s.WORKTREE_INSPECT_JOB_KIND||A===s.WORKTREE_OPERATION_JOB_KIND)return(0,s.worktreeJobPayload)(t);if(A===s.WORKTREE_WATCH_JOB_KIND)return(0,s.worktreeWatchJobPayload)(t);if(A===o.SKILL_SCAN_JOB_KIND)return(0,o.parseSkillScanPayload)(e);if(A===o.SKILL_READ_JOB_KIND)return(0,o.parseSkillReadPayload)(e);if(A===o.SKILL_APPLY_JOB_KIND)return(0,o.parseSkillApplyPayload)(e);if(A===g.SIGNING_ASSETS_SCAN_JOB_KIND)return(0,g.signingScanPayload)(e);if(A===g.SIGNING_PROFILE_READ_JOB_KIND||A===g.SIGNING_PROFILE_DELETE_JOB_KIND)return(0,g.signingProfileKeyPayload)(e);if(A===g.SIGNING_PROFILE_INSTALL_JOB_KIND)return(0,g.signingProfileInstallPayload)(e);if(A===g.SIGNING_IDENTITY_IMPORT_JOB_KIND)return(0,g.signingIdentityImportPayload)(e);if(A===g.SIGNING_IDENTITY_DELETE_JOB_KIND)return(0,g.signingIdentityDeletePayload)(e);if(A===n.IOS_SOURCE_DISCOVER_JOB_KIND)return(0,n.parseBuildSourceDiscoverPayload)(e);if(A===n.IOS_SOURCE_PARSE_JOB_KIND)return(0,n.parseBuildSourceParsePayload)(e);if(A===n.IOS_DESTINATIONS_JOB_KIND)return(0,n.parseBuildDestinationsPayload)(e);if(A===n.IOS_RUN_DESTINATIONS_JOB_KIND)return(0,n.parseBuildRunDestinationsPayload)(e);if(A===n.IOS_BUILD_JOB_KIND)return(0,n.parseBuildJobPayload)(e);if(A===n.IOS_BUILD_DELETE_JOB_KIND)return(0,n.parseBuildDeletePayload)(e);if(A===n.IOS_ARTIFACT_DOWNLOAD_JOB_KIND)return(0,n.parseBuildArtifactDownloadPayload)(e);if(A===n.IOS_DEPLOY_JOB_KIND)return(0,n.parseBuildDeploymentPayload)(e);if(A===n.IOS_EXPORT_JOB_KIND)return(0,n.parseBuildExportPayload)(e);if(A===n.IOS_SIGNING_INSPECT_JOB_KIND)return(0,n.parseBuildSigningInspectPayload)(e);if(A===n.IOS_TEST_RESULTS_JOB_KIND||A===n.IOS_COVERAGE_REPORT_JOB_KIND)return(0,n.parseBuildReportPayload)(e);if(A===r.CCUSAGE_REPORT_JOB_KIND){let A=Object.keys(t);if(A.length>0)throw Error(`Unexpected ccusage.report payload field: ${A[0]}`);return}if("cloudflared.runTunnel"!==A)throw Error(`Unsupported agent job kind: ${A}`);if("string"!=typeof t.tunnelName||!r.TUNNEL_NAME_REGEX.test(t.tunnelName))throw Error("cloudflared.runTunnel requires a tunnelName containing only letters, numbers, underscores, or hyphens");let C=Object.keys(t).filter(A=>"tunnelName"!==A);if(C.length>0)throw Error(`Unexpected cloudflared payload field: ${C[0]}`)}(A.kind,A.payload),!A.idempotencyKey.trim())throw Error("idempotencyKey is required");let l=Math.max(10,Math.min(A.timeoutSeconds??86400,604800)),I=await (0,C.getPrismaClient)(),d=await I.agentJob.findUnique({where:{agentId_idempotencyKey:{agentId:A.agentId,idempotencyKey:A.idempotencyKey}}});if(d){if(A.ccusageCollectionId&&d.ccusageCollectionId!==A.ccusageCollectionId){let e=await I.agentJob.update({where:{id:d.id},data:{ccusageCollectionId:A.ccusageCollectionId}});return c(e),e}return d}try{t=await I.agentJob.create({data:{id:(0,e.randomUUID)(),agentId:A.agentId,kind:A.kind,payloadJson:JSON.stringify(A.payload),status:"QUEUED",idempotencyKey:A.idempotencyKey,timeoutSeconds:l,ccusageCollectionId:A.ccusageCollectionId??null,buildDataCollectionId:A.buildDataCollectionId??null,codebaseId:A.codebaseId??null,worktreeId:A.worktreeId??null,visibility:A.visibility??"USER"}})}catch(t){let e=await I.agentJob.findUnique({where:{agentId_idempotencyKey:{agentId:A.agentId,idempotencyKey:A.idempotencyKey}}});if(!e)throw t;if(A.ccusageCollectionId&&e.ccusageCollectionId!==A.ccusageCollectionId)return I.agentJob.update({where:{id:e.id},data:{ccusageCollectionId:A.ccusageCollectionId}});return e}return await I.agentAuditEvent.create({data:{id:(0,e.randomUUID)(),agentId:A.agentId,action:"job.created",details:JSON.stringify({jobId:t.id,kind:t.kind})}}),c(t),Q.agentEventBus.publish((0,Q.agentEventsTopic)(A.agentId),{agentEvents:{type:"JOB_AVAILABLE",job:t}}),t}async claimJob(A,e){let t=await (0,C.getPrismaClient)(),r=await t.agentJob.updateMany({where:{id:e,agentId:A,status:"QUEUED"},data:{status:"RUNNING",startedAt:new Date}}),n=await t.agentJob.findUnique({where:{id:e}});if(!n||n.agentId!==A)throw Error("Job not found for this agent");if(1!==r.count&&"RUNNING"!==n.status)throw Error(`Job cannot be claimed from status ${n.status}`);return c(n),n}async appendLogs(A,t,r){let n=await (0,C.getPrismaClient)(),i=await n.agentJob.findUnique({where:{id:t}});if(!i||i.agentId!==A)throw Error("Job not found for this agent");let a=r.slice(0,200).map(A=>({id:(0,e.randomUUID)(),jobId:t,sequence:A.sequence,stream:A.stream,message:A.message.slice(0,64e3),createdAt:new Date(A.createdAt)}));if(a.some(A=>Number.isNaN(A.createdAt.valueOf())))throw Error("Log createdAt must be an ISO date");await Promise.all(a.map(A=>n.agentJobLog.upsert({where:{jobId_sequence:{jobId:t,sequence:A.sequence}},create:A,update:{}})));let s=await n.agentJobLog.findMany({where:{jobId:t,sequence:{in:a.map(A=>A.sequence)}},orderBy:{sequence:"asc"}});for(let A of s)Q.agentEventBus.publish((0,Q.agentJobLogTopic)(t),{agentJobLogAdded:A});return s}async completeJob(A,e,t,r,n){if(!I.has(t))throw Error("A final job status is required");let i=await (0,C.getPrismaClient)(),a=await i.agentJob.findUnique({where:{id:e}});if(!a||a.agentId!==A)throw Error("Job not found for this agent");if(I.has(a.status))return await this.projectCompletion(a),a;let s=await i.agentJob.updateMany({where:{id:e,agentId:A,status:{in:l}},data:{status:t,resultJson:null==r?null:JSON.stringify(r),error:n,finishedAt:new Date}}),o=await i.agentJob.findUnique({where:{id:e}});if(!o||o.agentId!==A)throw Error("Job not found for this agent");if(1!==s.count){if(I.has(o.status))return await this.projectCompletion(o),o;throw Error(`Job cannot be completed from status ${o.status}`)}return await this.projectCompletion(o),c(o),o}async cancelJob(A){let e=await (0,C.getPrismaClient)(),t=await e.agentJob.findUnique({where:{id:A}});if(!t)throw Error("Job not found");if(!l.includes(t.status))return t;let r=await e.agentJob.update({where:{id:A},data:{status:"CANCELLED",finishedAt:new Date}});return c(r),Q.agentEventBus.publish((0,Q.agentEventsTopic)(t.agentId),{agentEvents:{type:"JOB_CANCEL_REQUESTED",job:r}}),r}async timeoutCollectionJobs(A){let e=await (0,C.getPrismaClient)(),t=await e.agentJob.findMany({where:{ccusageCollectionId:A,status:{in:l}}}),r=[];for(let A of t){if(1!==(await e.agentJob.updateMany({where:{id:A.id,status:{in:l}},data:{status:"TIMED_OUT",finishedAt:new Date}})).count)continue;let t=await e.agentJob.findUnique({where:{id:A.id}});t&&(r.push(t),c(t),Q.agentEventBus.publish((0,Q.agentEventsTopic)(t.agentId),{agentEvents:{type:"JOB_CANCEL_REQUESTED",job:t}}))}return r}async timeoutBuildDataCollectionJobs(A){let e=await (0,C.getPrismaClient)(),t=await e.agentJob.findMany({where:{buildDataCollectionId:A,kind:i.BUILD_DATA_SCAN_JOB_KIND,status:{in:l}}}),r=[];for(let A of t){if(1!==(await e.agentJob.updateMany({where:{id:A.id,status:{in:l}},data:{status:"TIMED_OUT",finishedAt:new Date}})).count)continue;let t=await e.agentJob.findUnique({where:{id:A.id}});t&&(r.push(t),c(t),Q.agentEventBus.publish((0,Q.agentEventsTopic)(t.agentId),{agentEvents:{type:"JOB_CANCEL_REQUESTED",job:t}}))}return r}async listLogs(A,e=-1){return(await (0,C.getPrismaClient)()).agentJobLog.findMany({where:{jobId:A,sequence:{gt:e}},orderBy:{sequence:"asc"},take:5e3})}}A.s(["AGENT_ONLINE_WINDOW_MS",0,45e3,"AgentControlService",0,h],694355),A.s([],805422)},127438,486618,A=>{"use strict";var e;let t=Object.freeze({status:"aborted"}),r=Symbol("zod_brand");(e=globalThis).__zod_globalConfig??(e.__zod_globalConfig={});let n=globalThis.__zod_globalConfig;function i(A){return{get value(){{let e=A();return Object.defineProperty(this,"value",{value:e}),e}}}}A.s(["$ZodAsyncError",0,class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},"$ZodEncodeError",0,class extends Error{constructor(A){super(`Encountered unidirectional transform during encode: ${A}`),this.name="ZodEncodeError"}},"$brand",0,r,"$constructor",0,function(A,e,t){function r(t,r){if(t._zod||Object.defineProperty(t,"_zod",{value:{def:r,constr:a,traits:new Set},enumerable:!1}),t._zod.traits.has(A))return;t._zod.traits.add(A),e(t,r);let n=a.prototype,i=Object.keys(n);for(let A=0;A<i.length;A++){let e=i[A];e in t||(t[e]=n[e].bind(t))}}let n=t?.Parent??Object;class i extends n{}function a(A){var e;let n=t?.Parent?new i:this;for(let t of(r(n,A),(e=n._zod).deferred??(e.deferred=[]),n._zod.deferred))t();return n}return Object.defineProperty(i,"name",{value:A}),Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:e=>!!t?.Parent&&e instanceof t.Parent||e?._zod?.traits?.has(A)}),Object.defineProperty(a,"name",{value:A}),a},"NEVER",0,t,"config",0,function(A){return A&&Object.assign(n,A),n},"globalConfig",0,n],127438);let a=Symbol("evaluating");function s(A,e,t){Object.defineProperty(A,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function o(...A){let e={};for(let t of A)Object.assign(e,Object.getOwnPropertyDescriptors(t));return Object.defineProperties({},e)}let g="captureStackTrace"in Error?Error.captureStackTrace:(...A)=>{};function C(A){return"object"==typeof A&&null!==A&&!Array.isArray(A)}let Q=i(()=>{if(n.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(A){return!1}});function l(A){if(!1===C(A))return!1;let e=A.constructor;if(void 0===e||"function"!=typeof e)return!0;let t=e.prototype;return!1!==C(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}let I=new Set(["string","number","symbol"]),d=new Set(["string","number","bigint","boolean","symbol","undefined"]);function E(A,e,t){let r=new A._zod.constr(e??A._zod.def);return(!e||t?.parent)&&(r._zod.parent=A),r}function c(A){return"bigint"==typeof A?A.toString()+"n":"string"==typeof A?`"${A}"`:`${A}`}let h={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},B={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function D(A){return"string"==typeof A?A:A?.message}function w(A){let e=atob(A),t=new Uint8Array(e.length);for(let A=0;A<e.length;A++)t[A]=e.charCodeAt(A);return t}function u(A){let e="";for(let t=0;t<A.length;t++)e+=String.fromCharCode(A[t]);return btoa(e)}A.s(["BIGINT_FORMAT_RANGES",0,B,"Class",0,class{constructor(...A){}},"NUMBER_FORMAT_RANGES",0,h,"aborted",0,function(A,e=0){if(!0===A.aborted)return!0;for(let t=e;t<A.issues.length;t++)if(A.issues[t]?.continue!==!0)return!0;return!1},"allowsEval",0,Q,"assert",0,function(A){},"assertEqual",0,function(A){return A},"assertIs",0,function(A){},"assertNever",0,function(A){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(A){return A},"assignProp",0,s,"base64ToUint8Array",0,w,"base64urlToUint8Array",0,function(A){let e=A.replace(/-/g,"+").replace(/_/g,"/"),t="=".repeat((4-e.length%4)%4);return w(e+t)},"cached",0,i,"captureStackTrace",0,g,"cleanEnum",0,function(A){return Object.entries(A).filter(([A,e])=>Number.isNaN(Number.parseInt(A,10))).map(A=>A[1])},"cleanRegex",0,function(A){let e=+!!A.startsWith("^"),t=A.endsWith("$")?A.length-1:A.length;return A.slice(e,t)},"clone",0,E,"cloneDef",0,function(A){return o(A._zod.def)},"createTransparentProxy",0,function(A){let e;return new Proxy({},{get:(t,r,n)=>(e??(e=A()),Reflect.get(e,r,n)),set:(t,r,n,i)=>(e??(e=A()),Reflect.set(e,r,n,i)),has:(t,r)=>(e??(e=A()),Reflect.has(e,r)),deleteProperty:(t,r)=>(e??(e=A()),Reflect.deleteProperty(e,r)),ownKeys:t=>(e??(e=A()),Reflect.ownKeys(e)),getOwnPropertyDescriptor:(t,r)=>(e??(e=A()),Reflect.getOwnPropertyDescriptor(e,r)),defineProperty:(t,r,n)=>(e??(e=A()),Reflect.defineProperty(e,r,n))})},"defineLazy",0,function(A,e,t){let r;Object.defineProperty(A,e,{get(){if(r!==a)return void 0===r&&(r=a,r=t()),r},set(t){Object.defineProperty(A,e,{value:t})},configurable:!0})},"esc",0,function(A){return JSON.stringify(A)},"escapeRegex",0,function(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},"explicitlyAborted",0,function(A,e=0){if(!0===A.aborted)return!0;for(let t=e;t<A.issues.length;t++)if(A.issues[t]?.continue===!1)return!0;return!1},"extend",0,function(A,e){if(!l(e))throw Error("Invalid input to extend: expected a plain object");let t=A._zod.def.checks;if(t&&t.length>0){let t=A._zod.def.shape;for(let A in e)if(void 0!==Object.getOwnPropertyDescriptor(t,A))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=o(A._zod.def,{get shape(){let t={...A._zod.def.shape,...e};return s(this,"shape",t),t}});return E(A,r)},"finalizeIssue",0,function(A,e,t){let r=A.message?A.message:D(A.inst?._zod.def?.error?.(A))??D(e?.error?.(A))??D(t.customError?.(A))??D(t.localeError?.(A))??"Invalid input",{inst:n,continue:i,input:a,...s}=A;return s.path??(s.path=[]),s.message=r,e?.reportInput&&(s.input=a),s},"floatSafeRemainder",0,function(A,e){let t=A/e,r=Math.round(t),n=Number.EPSILON*Math.max(Math.abs(t),1);return Math.abs(t-r)<n?0:t-r},"getElementAtPath",0,function(A,e){return e?e.reduce((A,e)=>A?.[e],A):A},"getEnumValues",0,function(A){let e=Object.values(A).filter(A=>"number"==typeof A);return Object.entries(A).filter(([A,t])=>-1===e.indexOf(+A)).map(([A,e])=>e)},"getLengthableOrigin",0,function(A){return Array.isArray(A)?"array":"string"==typeof A?"string":"unknown"},"getParsedType",0,A=>{let e=typeof A;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(A)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(A))return"array";if(null===A)return"null";if(A.then&&"function"==typeof A.then&&A.catch&&"function"==typeof A.catch)return"promise";if("u">typeof Map&&A instanceof Map)return"map";if("u">typeof Set&&A instanceof Set)return"set";if("u">typeof Date&&A instanceof Date)return"date";if("u">typeof File&&A instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${e}`)}},"getSizableOrigin",0,function(A){return A instanceof Set?"set":A instanceof Map?"map":A instanceof File?"file":"unknown"},"hexToUint8Array",0,function(A){let e=A.replace(/^0x/,"");if(e.length%2!=0)throw Error("Invalid hex string length");let t=new Uint8Array(e.length/2);for(let A=0;A<e.length;A+=2)t[A/2]=Number.parseInt(e.slice(A,A+2),16);return t},"isObject",0,C,"isPlainObject",0,l,"issue",0,function(...A){let[e,t,r]=A;return"string"==typeof e?{message:e,code:"custom",input:t,inst:r}:{...e}},"joinValues",0,function(A,e="|"){return A.map(A=>c(A)).join(e)},"jsonStringifyReplacer",0,function(A,e){return"bigint"==typeof e?e.toString():e},"merge",0,function(A,e){if(A._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let t=o(A._zod.def,{get shape(){let t={...A._zod.def.shape,...e._zod.def.shape};return s(this,"shape",t),t},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return E(A,t)},"mergeDefs",0,o,"normalizeParams",0,function(A){if(!A)return{};if("string"==typeof A)return{error:()=>A};if(A?.message!==void 0){if(A?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");A.error=A.message}return(delete A.message,"string"==typeof A.error)?{...A,error:()=>A.error}:A},"nullish",0,function(A){return null==A},"numKeys",0,function(A){let e=0;for(let t in A)Object.prototype.hasOwnProperty.call(A,t)&&e++;return e},"objectClone",0,function(A){return Object.create(Object.getPrototypeOf(A),Object.getOwnPropertyDescriptors(A))},"omit",0,function(A,e){let t=A._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let n=o(A._zod.def,{get shape(){let r={...A._zod.def.shape};for(let A in e){if(!(A in t.shape))throw Error(`Unrecognized key: "${A}"`);e[A]&&delete r[A]}return s(this,"shape",r),r},checks:[]});return E(A,n)},"optionalKeys",0,function(A){return Object.keys(A).filter(e=>"optional"===A[e]._zod.optin&&"optional"===A[e]._zod.optout)},"parsedType",0,function(A){let e=typeof A;switch(e){case"number":return Number.isNaN(A)?"nan":"number";case"object":if(null===A)return"null";if(Array.isArray(A))return"array";if(A&&Object.getPrototypeOf(A)!==Object.prototype&&"constructor"in A&&A.constructor)return A.constructor.name}return e},"partial",0,function(A,e,t){let r=e._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let n=o(e._zod.def,{get shape(){let r=e._zod.def.shape,n={...r};if(t)for(let e in t){if(!(e in r))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=A?new A({type:"optional",innerType:r[e]}):r[e])}else for(let e in r)n[e]=A?new A({type:"optional",innerType:r[e]}):r[e];return s(this,"shape",n),n},checks:[]});return E(e,n)},"pick",0,function(A,e){let t=A._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let n=o(A._zod.def,{get shape(){let A={};for(let r in e){if(!(r in t.shape))throw Error(`Unrecognized key: "${r}"`);e[r]&&(A[r]=t.shape[r])}return s(this,"shape",A),A},checks:[]});return E(A,n)},"prefixIssues",0,function(A,e){return e.map(e=>(e.path??(e.path=[]),e.path.unshift(A),e))},"primitiveTypes",0,d,"promiseAllObject",0,function(A){let e=Object.keys(A);return Promise.all(e.map(e=>A[e])).then(A=>{let t={};for(let r=0;r<e.length;r++)t[e[r]]=A[r];return t})},"propertyKeyTypes",0,I,"randomString",0,function(A=10){let e="abcdefghijklmnopqrstuvwxyz",t="";for(let r=0;r<A;r++)t+=e[Math.floor(Math.random()*e.length)];return t},"required",0,function(A,e,t){let r=o(e._zod.def,{get shape(){let r=e._zod.def.shape,n={...r};if(t)for(let e in t){if(!(e in n))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=new A({type:"nonoptional",innerType:r[e]}))}else for(let e in r)n[e]=new A({type:"nonoptional",innerType:r[e]});return s(this,"shape",n),n}});return E(e,r)},"safeExtend",0,function(A,e){if(!l(e))throw Error("Invalid input to safeExtend: expected a plain object");let t=o(A._zod.def,{get shape(){let t={...A._zod.def.shape,...e};return s(this,"shape",t),t}});return E(A,t)},"shallowClone",0,function(A){return l(A)?{...A}:Array.isArray(A)?[...A]:A instanceof Map?new Map(A):A instanceof Set?new Set(A):A},"slugify",0,function(A){return A.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")},"stringifyPrimitive",0,c,"uint8ArrayToBase64",0,u,"uint8ArrayToBase64url",0,function(A){return u(A).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(A){return Array.from(A).map(A=>A.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,D],486618)},715143,67021,A=>{"use strict";var e=A.i(127438),t=A.i(486618);let r=(A,e)=>{A.name="$ZodError",Object.defineProperty(A,"_zod",{value:A._zod,enumerable:!1}),Object.defineProperty(A,"issues",{value:e,enumerable:!1}),A.message=JSON.stringify(e,t.jsonStringifyReplacer,2),Object.defineProperty(A,"toString",{value:()=>A.message,enumerable:!1})},n=(0,e.$constructor)("$ZodError",r),i=(0,e.$constructor)("$ZodError",r,{Parent:Error});function a(A){let e=[];for(let t of A.map(A=>"object"==typeof A?A.key:A))"number"==typeof t?e.push(`[${t}]`):"symbol"==typeof t?e.push(`[${JSON.stringify(String(t))}]`):/[^\w$]/.test(t)?e.push(`[${JSON.stringify(t)}]`):(e.length&&e.push("."),e.push(t));return e.join("")}A.s(["$ZodError",0,n,"$ZodRealError",0,i,"flattenError",0,function(A,e=A=>A.message){let t={},r=[];for(let n of A.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}},"formatError",0,function(A,e=A=>A.message){let t={_errors:[]},r=(A,n=[])=>{for(let i of A.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(A=>r({issues:A},[...n,...i.path]));else if("invalid_key"===i.code)r({issues:i.issues},[...n,...i.path]);else if("invalid_element"===i.code)r({issues:i.issues},[...n,...i.path]);else{let A=[...n,...i.path];if(0===A.length)t._errors.push(e(i));else{let r=t,n=0;for(;n<A.length;){let t=A[n];n===A.length-1?(r[t]=r[t]||{_errors:[]},r[t]._errors.push(e(i))):r[t]=r[t]||{_errors:[]},r=r[t],n++}}}};return r(A),t},"prettifyError",0,function(A){let e=[];for(let t of[...A.issues].sort((A,e)=>(A.path??[]).length-(e.path??[]).length))e.push(`✖ ${t.message}`),t.path?.length&&e.push(` → at ${a(t.path)}`);return e.join("\n")},"toDotPath",0,a,"treeifyError",0,function(A,e=A=>A.message){let t={errors:[]},r=(A,n=[])=>{var i,a;for(let s of A.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(A=>r({issues:A},[...n,...s.path]));else if("invalid_key"===s.code)r({issues:s.issues},[...n,...s.path]);else if("invalid_element"===s.code)r({issues:s.issues},[...n,...s.path]);else{let A=[...n,...s.path];if(0===A.length){t.errors.push(e(s));continue}let r=t,o=0;for(;o<A.length;){let t=A[o],n=o===A.length-1;"string"==typeof t?(r.properties??(r.properties={}),(i=r.properties)[t]??(i[t]={errors:[]}),r=r.properties[t]):(r.items??(r.items=[]),(a=r.items)[t]??(a[t]={errors:[]}),r=r.items[t]),n&&r.errors.push(e(s)),o++}}};return r(A),t}],67021);let s=A=>(r,n,i,a)=>{let s=i?{...i,async:!1}:{async:!1},o=r._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new e.$ZodAsyncError;if(o.issues.length){let r=new(a?.Err??A)(o.issues.map(A=>t.finalizeIssue(A,s,e.config())));throw t.captureStackTrace(r,a?.callee),r}return o.value},o=s(i),g=A=>async(r,n,i,a)=>{let s=i?{...i,async:!0}:{async:!0},o=r._zod.run({value:n,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){let r=new(a?.Err??A)(o.issues.map(A=>t.finalizeIssue(A,s,e.config())));throw t.captureStackTrace(r,a?.callee),r}return o.value},C=g(i),Q=A=>(r,i,a)=>{let s=a?{...a,async:!1}:{async:!1},o=r._zod.run({value:i,issues:[]},s);if(o instanceof Promise)throw new e.$ZodAsyncError;return o.issues.length?{success:!1,error:new(A??n)(o.issues.map(A=>t.finalizeIssue(A,s,e.config())))}:{success:!0,data:o.value}},l=Q(i),I=A=>async(r,n,i)=>{let a=i?{...i,async:!0}:{async:!0},s=r._zod.run({value:n,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new A(s.issues.map(A=>t.finalizeIssue(A,a,e.config())))}:{success:!0,data:s.value}},d=I(i),E=A=>(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return s(A)(e,t,n)},c=E(i),h=A=>(e,t,r)=>s(A)(e,t,r),B=h(i),D=A=>async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return g(A)(e,t,n)},w=D(i),u=A=>async(e,t,r)=>g(A)(e,t,r),p=u(i),f=A=>(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Q(A)(e,t,n)},y=f(i),M=A=>(e,t,r)=>Q(A)(e,t,r),m=M(i),N=A=>async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return I(A)(e,t,n)},S=N(i),k=A=>async(e,t,r)=>I(A)(e,t,r),U=k(i);A.s(["_decode",0,h,"_decodeAsync",0,u,"_encode",0,E,"_encodeAsync",0,D,"_parse",0,s,"_parseAsync",0,g,"_safeDecode",0,M,"_safeDecodeAsync",0,k,"_safeEncode",0,f,"_safeEncodeAsync",0,N,"_safeParse",0,Q,"_safeParseAsync",0,I,"decode",0,B,"decodeAsync",0,p,"encode",0,c,"encodeAsync",0,w,"parse",0,o,"parseAsync",0,C,"safeDecode",0,m,"safeDecodeAsync",0,U,"safeEncode",0,y,"safeEncodeAsync",0,S,"safeParse",0,l,"safeParseAsync",0,d],715143)},236608,421131,173911,A=>{"use strict";var e=A.i(127438),t=A.i(486618);let r=A=>A?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${A}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,n=r(4),i=r(6),a=r(7),s=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,o="(?:(?:\\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])))",g=RegExp(`^${o}$`);function C(A){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof A.precision?-1===A.precision?`${e}`:0===A.precision?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${A.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}let Q=/^-?\d+$/,l=/^[^A-Z]*$/,I=/^[^a-z]*$/;function d(A,e){return RegExp(`^[A-Za-z0-9+/]{${A}}${e}$`)}function E(A){return RegExp(`^[A-Za-z0-9_-]{${A}}$`)}let c=d(22,"=="),h=E(22),B=d(27,"="),D=E(27),w=d(43,"="),u=E(43),p=d(64,""),f=E(64),y=d(86,"=="),M=E(86);A.s(["base64",0,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,"base64url",0,/^[A-Za-z0-9_-]*$/,"bigint",0,/^-?\d+n?$/,"boolean",0,/^(?:true|false)$/i,"browserEmail",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"cidrv4",0,/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,"cidrv6",0,/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,"cuid",0,/^[cC][0-9a-z]{6,}$/,"cuid2",0,/^[0-9a-z]+$/,"date",0,g,"datetime",0,function(A){let e=C({precision:A.precision}),t=["Z"];A.local&&t.push(""),A.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${e}(?:${t.join("|")})`;return RegExp(`^${o}T(?:${r})$`)},"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,"e164",0,/^\+[1-9]\d{6,14}$/,"email",0,/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,"emoji",0,function(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")},"extendedDuration",0,/^[-+]?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)?)??$/,"guid",0,/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,"hex",0,/^[0-9a-fA-F]*$/,"hostname",0,/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,"html5Email",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"httpProtocol",0,/^https?$/,"idnEmail",0,s,"integer",0,Q,"ipv4",0,/^(?:(?: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])$/,"ipv6",0,/^(([0-9a-fA-F]{1,4}:){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}|:))$/,"ksuid",0,/^[A-Za-z0-9]{27}$/,"lowercase",0,l,"mac",0,A=>{let e=t.escapeRegex(A??":");return RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},"md5_base64",0,c,"md5_base64url",0,h,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,/^[a-zA-Z0-9_-]{21}$/,"null",0,/^null$/i,"number",0,/^-?\d+(?:\.\d+)?$/,"rfc5322Email",0,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,"sha1_base64",0,B,"sha1_base64url",0,D,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,w,"sha256_base64url",0,u,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,p,"sha384_base64url",0,f,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,y,"sha512_base64url",0,M,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,A=>{let e=A?`[\\s\\S]{${A?.minimum??0},${A?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${e}$`)},"time",0,function(A){return RegExp(`^${C(A)}$`)},"ulid",0,/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,"undefined",0,/^undefined$/i,"unicodeEmail",0,s,"uppercase",0,I,"uuid",0,r,"uuid4",0,n,"uuid6",0,i,"uuid7",0,a,"xid",0,/^[0-9a-vA-V]{20}$/],421131);let m=e.$constructor("$ZodCheck",(A,e)=>{var t;A._zod??(A._zod={}),A._zod.def=e,(t=A._zod).onattach??(t.onattach=[])}),N={number:"number",bigint:"bigint",object:"date"},S=e.$constructor("$ZodCheckLessThan",(A,e)=>{m.init(A,e);let t=N[typeof e.value];A._zod.onattach.push(A=>{let t=A._zod.bag,r=(e.inclusive?t.maximum:t.exclusiveMaximum)??1/0;e.value<r&&(e.inclusive?t.maximum=e.value:t.exclusiveMaximum=e.value)}),A._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:"object"==typeof e.value?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:A,continue:!e.abort})}}),k=e.$constructor("$ZodCheckGreaterThan",(A,e)=>{m.init(A,e);let t=N[typeof e.value];A._zod.onattach.push(A=>{let t=A._zod.bag,r=(e.inclusive?t.minimum:t.exclusiveMinimum)??-1/0;e.value>r&&(e.inclusive?t.minimum=e.value:t.exclusiveMinimum=e.value)}),A._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:"object"==typeof e.value?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:A,continue:!e.abort})}}),U=e.$constructor("$ZodCheckMultipleOf",(A,e)=>{m.init(A,e),A._zod.onattach.push(A=>{var t;(t=A._zod.bag).multipleOf??(t.multipleOf=e.value)}),A._zod.check=r=>{if(typeof r.value!=typeof e.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%e.value===BigInt(0):0===t.floatSafeRemainder(r.value,e.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:A,continue:!e.abort})}}),F=e.$constructor("$ZodCheckNumberFormat",(A,e)=>{m.init(A,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,a]=t.NUMBER_FORMAT_RANGES[e.format];A._zod.onattach.push(A=>{let t=A._zod.bag;t.format=e.format,t.minimum=i,t.maximum=a,r&&(t.pattern=Q)}),A._zod.check=t=>{let s=t.value;if(r){if(!Number.isInteger(s))return void t.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:A});if(!Number.isSafeInteger(s))return void(s>0?t.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:A,origin:n,inclusive:!0,continue:!e.abort}):t.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:A,origin:n,inclusive:!0,continue:!e.abort}))}s<i&&t.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:A,continue:!e.abort}),s>a&&t.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:A,continue:!e.abort})}}),R=e.$constructor("$ZodCheckBigIntFormat",(A,e)=>{m.init(A,e);let[r,n]=t.BIGINT_FORMAT_RANGES[e.format];A._zod.onattach.push(A=>{let t=A._zod.bag;t.format=e.format,t.minimum=r,t.maximum=n}),A._zod.check=t=>{let i=t.value;i<r&&t.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:A,continue:!e.abort}),i>n&&t.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:A,continue:!e.abort})}}),T=e.$constructor("$ZodCheckMaxSize",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.size}),A._zod.onattach.push(A=>{let t=A._zod.bag.maximum??1/0;e.maximum<t&&(A._zod.bag.maximum=e.maximum)}),A._zod.check=r=>{let n=r.value;n.size<=e.maximum||r.issues.push({origin:t.getSizableOrigin(n),code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:A,continue:!e.abort})}}),b=e.$constructor("$ZodCheckMinSize",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.size}),A._zod.onattach.push(A=>{let t=A._zod.bag.minimum??-1/0;e.minimum>t&&(A._zod.bag.minimum=e.minimum)}),A._zod.check=r=>{let n=r.value;n.size>=e.minimum||r.issues.push({origin:t.getSizableOrigin(n),code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:A,continue:!e.abort})}}),H=e.$constructor("$ZodCheckSizeEquals",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.size}),A._zod.onattach.push(A=>{let t=A._zod.bag;t.minimum=e.size,t.maximum=e.size,t.size=e.size}),A._zod.check=r=>{let n=r.value,i=n.size;if(i===e.size)return;let a=i>e.size;r.issues.push({origin:t.getSizableOrigin(n),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:r.value,inst:A,continue:!e.abort})}}),L=e.$constructor("$ZodCheckMaxLength",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.length}),A._zod.onattach.push(A=>{let t=A._zod.bag.maximum??1/0;e.maximum<t&&(A._zod.bag.maximum=e.maximum)}),A._zod.check=r=>{let n=r.value;if(n.length<=e.maximum)return;let i=t.getLengthableOrigin(n);r.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:A,continue:!e.abort})}}),O=e.$constructor("$ZodCheckMinLength",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.length}),A._zod.onattach.push(A=>{let t=A._zod.bag.minimum??-1/0;e.minimum>t&&(A._zod.bag.minimum=e.minimum)}),A._zod.check=r=>{let n=r.value;if(n.length>=e.minimum)return;let i=t.getLengthableOrigin(n);r.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:A,continue:!e.abort})}}),G=e.$constructor("$ZodCheckLengthEquals",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.length}),A._zod.onattach.push(A=>{let t=A._zod.bag;t.minimum=e.length,t.maximum=e.length,t.length=e.length}),A._zod.check=r=>{let n=r.value,i=n.length;if(i===e.length)return;let a=t.getLengthableOrigin(n),s=i>e.length;r.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:A,continue:!e.abort})}}),J=e.$constructor("$ZodCheckStringFormat",(A,e)=>{var t,r;m.init(A,e),A._zod.onattach.push(A=>{let t=A._zod.bag;t.format=e.format,e.pattern&&(t.patterns??(t.patterns=new Set),t.patterns.add(e.pattern))}),e.pattern?(t=A._zod).check??(t.check=t=>{e.pattern.lastIndex=0,e.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:e.format,input:t.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:A,continue:!e.abort})}):(r=A._zod).check??(r.check=()=>{})}),v=e.$constructor("$ZodCheckRegex",(A,e)=>{J.init(A,e),A._zod.check=t=>{e.pattern.lastIndex=0,e.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:A,continue:!e.abort})}}),x=e.$constructor("$ZodCheckLowerCase",(A,e)=>{e.pattern??(e.pattern=l),J.init(A,e)}),V=e.$constructor("$ZodCheckUpperCase",(A,e)=>{e.pattern??(e.pattern=I),J.init(A,e)}),P=e.$constructor("$ZodCheckIncludes",(A,e)=>{m.init(A,e);let r=t.escapeRegex(e.includes),n=new RegExp("number"==typeof e.position?`^.{${e.position}}${r}`:r);e.pattern=n,A._zod.onattach.push(A=>{let e=A._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(n)}),A._zod.check=t=>{t.value.includes(e.includes,e.position)||t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:t.value,inst:A,continue:!e.abort})}}),Y=e.$constructor("$ZodCheckStartsWith",(A,e)=>{m.init(A,e);let r=RegExp(`^${t.escapeRegex(e.prefix)}.*`);e.pattern??(e.pattern=r),A._zod.onattach.push(A=>{let e=A._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(r)}),A._zod.check=t=>{t.value.startsWith(e.prefix)||t.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:t.value,inst:A,continue:!e.abort})}}),_=e.$constructor("$ZodCheckEndsWith",(A,e)=>{m.init(A,e);let r=RegExp(`.*${t.escapeRegex(e.suffix)}$`);e.pattern??(e.pattern=r),A._zod.onattach.push(A=>{let e=A._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(r)}),A._zod.check=t=>{t.value.endsWith(e.suffix)||t.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:t.value,inst:A,continue:!e.abort})}});function K(A,e,r){A.issues.length&&e.issues.push(...t.prefixIssues(r,A.issues))}let q=e.$constructor("$ZodCheckProperty",(A,e)=>{m.init(A,e),A._zod.check=A=>{let t=e.schema._zod.run({value:A.value[e.property],issues:[]},{});if(t instanceof Promise)return t.then(t=>K(t,A,e.property));K(t,A,e.property)}}),Z=e.$constructor("$ZodCheckMimeType",(A,e)=>{m.init(A,e);let t=new Set(e.mime);A._zod.onattach.push(A=>{A._zod.bag.mime=e.mime}),A._zod.check=r=>{t.has(r.value.type)||r.issues.push({code:"invalid_value",values:e.mime,input:r.value.type,inst:A,continue:!e.abort})}}),W=e.$constructor("$ZodCheckOverwrite",(A,e)=>{m.init(A,e),A._zod.check=A=>{A.value=e.tx(A.value)}});A.s(["$ZodCheck",0,m,"$ZodCheckBigIntFormat",0,R,"$ZodCheckEndsWith",0,_,"$ZodCheckGreaterThan",0,k,"$ZodCheckIncludes",0,P,"$ZodCheckLengthEquals",0,G,"$ZodCheckLessThan",0,S,"$ZodCheckLowerCase",0,x,"$ZodCheckMaxLength",0,L,"$ZodCheckMaxSize",0,T,"$ZodCheckMimeType",0,Z,"$ZodCheckMinLength",0,O,"$ZodCheckMinSize",0,b,"$ZodCheckMultipleOf",0,U,"$ZodCheckNumberFormat",0,F,"$ZodCheckOverwrite",0,W,"$ZodCheckProperty",0,q,"$ZodCheckRegex",0,v,"$ZodCheckSizeEquals",0,H,"$ZodCheckStartsWith",0,Y,"$ZodCheckStringFormat",0,J,"$ZodCheckUpperCase",0,V],236608),A.s(["Doc",0,class{constructor(A=[]){this.content=[],this.indent=0,this&&(this.args=A)}indented(A){this.indent+=1,A(this),this.indent-=1}write(A){if("function"==typeof A){A(this,{execution:"sync"}),A(this,{execution:"async"});return}let e=A.split("\n").filter(A=>A),t=Math.min(...e.map(A=>A.length-A.trimStart().length));for(let A of e.map(A=>A.slice(t)).map(A=>" ".repeat(2*this.indent)+A))this.content.push(A)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(A=>` ${A}`)].join("\n"))}}],173911)},639510,622824,52637,862061,A=>{"use strict";var e,t=A.i(236608),r=A.i(127438),n=A.i(173911),i=A.i(715143),a=A.i(421131),s=A.i(486618);let o={major:4,minor:4,patch:3};A.s(["version",0,o],622824);let g=r.$constructor("$ZodType",(A,e)=>{var t;A??(A={}),A._zod.def=e,A._zod.bag=A._zod.bag||{},A._zod.version=o;let n=[...A._zod.def.checks??[]];for(let e of(A._zod.traits.has("$ZodCheck")&&n.unshift(A),n))for(let t of e._zod.onattach)t(A);if(0===n.length)(t=A._zod).deferred??(t.deferred=[]),A._zod.deferred?.push(()=>{A._zod.run=A._zod.parse});else{let e=(A,e,t)=>{let n,i=s.aborted(A);for(let a of e){if(a._zod.def.when){if(s.explicitlyAborted(A)||!a._zod.def.when(A))continue}else if(i)continue;let e=A.issues.length,o=a._zod.check(A);if(o instanceof Promise&&t?.async===!1)throw new r.$ZodAsyncError;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,A.issues.length!==e&&(i||(i=s.aborted(A,e)))});else{if(A.issues.length===e)continue;i||(i=s.aborted(A,e))}}return n?n.then(()=>A):A},t=(t,i,a)=>{if(s.aborted(t))return t.aborted=!0,t;let o=e(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new r.$ZodAsyncError;return o.then(e=>A._zod.parse(e,a))}return A._zod.parse(o,a)};A._zod.run=(i,a)=>{if(a.skipChecks)return A._zod.parse(i,a);if("backward"===a.direction){let e=A._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return e instanceof Promise?e.then(A=>t(A,i,a)):t(e,i,a)}let s=A._zod.parse(i,a);if(s instanceof Promise){if(!1===a.async)throw new r.$ZodAsyncError;return s.then(A=>e(A,n,a))}return e(s,n,a)}}s.defineLazy(A,"~standard",()=>({validate:e=>{try{let t=(0,i.safeParse)(A,e);return t.success?{value:t.data}:{issues:t.error?.issues}}catch(t){return(0,i.safeParseAsync)(A,e).then(A=>A.success?{value:A.data}:{issues:A.error?.issues})}},vendor:"zod",version:1}))}),C=r.$constructor("$ZodString",(A,e)=>{g.init(A,e),A._zod.pattern=[...A?._zod.bag?.patterns??[]].pop()??a.string(A._zod.bag),A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=String(t.value)}catch(A){}return"string"==typeof t.value||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:A}),t}}),Q=r.$constructor("$ZodStringFormat",(A,e)=>{t.$ZodCheckStringFormat.init(A,e),C.init(A,e)}),l=r.$constructor("$ZodGUID",(A,e)=>{e.pattern??(e.pattern=a.guid),Q.init(A,e)}),I=r.$constructor("$ZodUUID",(A,e)=>{if(e.version){let A={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(void 0===A)throw Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=a.uuid(A))}else e.pattern??(e.pattern=a.uuid());Q.init(A,e)}),d=r.$constructor("$ZodEmail",(A,e)=>{e.pattern??(e.pattern=a.email),Q.init(A,e)}),E=r.$constructor("$ZodURL",(A,e)=>{Q.init(A,e),A._zod.check=t=>{try{let r=t.value.trim();if(!e.normalize&&e.protocol?.source===a.httpProtocol.source&&!/^https?:\/\//i.test(r))return void t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:A,continue:!e.abort});let n=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:A,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:A,continue:!e.abort})),e.normalize?t.value=n.href:t.value=r;return}catch(r){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:A,continue:!e.abort})}}}),c=r.$constructor("$ZodEmoji",(A,e)=>{e.pattern??(e.pattern=a.emoji()),Q.init(A,e)}),h=r.$constructor("$ZodNanoID",(A,e)=>{e.pattern??(e.pattern=a.nanoid),Q.init(A,e)}),B=r.$constructor("$ZodCUID",(A,e)=>{e.pattern??(e.pattern=a.cuid),Q.init(A,e)}),D=r.$constructor("$ZodCUID2",(A,e)=>{e.pattern??(e.pattern=a.cuid2),Q.init(A,e)}),w=r.$constructor("$ZodULID",(A,e)=>{e.pattern??(e.pattern=a.ulid),Q.init(A,e)}),u=r.$constructor("$ZodXID",(A,e)=>{e.pattern??(e.pattern=a.xid),Q.init(A,e)}),p=r.$constructor("$ZodKSUID",(A,e)=>{e.pattern??(e.pattern=a.ksuid),Q.init(A,e)}),f=r.$constructor("$ZodISODateTime",(A,e)=>{e.pattern??(e.pattern=a.datetime(e)),Q.init(A,e)}),y=r.$constructor("$ZodISODate",(A,e)=>{e.pattern??(e.pattern=a.date),Q.init(A,e)}),M=r.$constructor("$ZodISOTime",(A,e)=>{e.pattern??(e.pattern=a.time(e)),Q.init(A,e)}),m=r.$constructor("$ZodISODuration",(A,e)=>{e.pattern??(e.pattern=a.duration),Q.init(A,e)}),N=r.$constructor("$ZodIPv4",(A,e)=>{e.pattern??(e.pattern=a.ipv4),Q.init(A,e),A._zod.bag.format="ipv4"}),S=r.$constructor("$ZodIPv6",(A,e)=>{e.pattern??(e.pattern=a.ipv6),Q.init(A,e),A._zod.bag.format="ipv6",A._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:A,continue:!e.abort})}}}),k=r.$constructor("$ZodMAC",(A,e)=>{e.pattern??(e.pattern=a.mac(e.delimiter)),Q.init(A,e),A._zod.bag.format="mac"}),U=r.$constructor("$ZodCIDRv4",(A,e)=>{e.pattern??(e.pattern=a.cidrv4),Q.init(A,e)}),F=r.$constructor("$ZodCIDRv6",(A,e)=>{e.pattern??(e.pattern=a.cidrv6),Q.init(A,e),A._zod.check=t=>{let r=t.value.split("/");try{if(2!==r.length)throw Error();let[A,e]=r;if(!e)throw Error();let t=Number(e);if(`${t}`!==e||t<0||t>128)throw Error();new URL(`http://[${A}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:A,continue:!e.abort})}}});function R(A){if(""===A)return!0;if(/\s/.test(A)||A.length%4!=0)return!1;try{return atob(A),!0}catch{return!1}}let T=r.$constructor("$ZodBase64",(A,e)=>{e.pattern??(e.pattern=a.base64),Q.init(A,e),A._zod.bag.contentEncoding="base64",A._zod.check=t=>{R(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:A,continue:!e.abort})}});function b(A){if(!a.base64url.test(A))return!1;let e=A.replace(/[-_]/g,A=>"-"===A?"+":"/");return R(e.padEnd(4*Math.ceil(e.length/4),"="))}let H=r.$constructor("$ZodBase64URL",(A,e)=>{e.pattern??(e.pattern=a.base64url),Q.init(A,e),A._zod.bag.contentEncoding="base64url",A._zod.check=t=>{b(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:A,continue:!e.abort})}}),L=r.$constructor("$ZodE164",(A,e)=>{e.pattern??(e.pattern=a.e164),Q.init(A,e)});function O(A,e=null){try{let t=A.split(".");if(3!==t.length)return!1;let[r]=t;if(!r)return!1;let n=JSON.parse(atob(r));if("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))return!1;return!0}catch{return!1}}let G=r.$constructor("$ZodJWT",(A,e)=>{Q.init(A,e),A._zod.check=t=>{O(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:A,continue:!e.abort})}}),J=r.$constructor("$ZodCustomStringFormat",(A,e)=>{Q.init(A,e),A._zod.check=t=>{e.fn(t.value)||t.issues.push({code:"invalid_format",format:e.format,input:t.value,inst:A,continue:!e.abort})}}),v=r.$constructor("$ZodNumber",(A,e)=>{g.init(A,e),A._zod.pattern=A._zod.bag.pattern??a.number,A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=Number(t.value)}catch(A){}let n=t.value;if("number"==typeof n&&!Number.isNaN(n)&&Number.isFinite(n))return t;let i="number"==typeof n?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:n,inst:A,...i?{received:i}:{}}),t}}),x=r.$constructor("$ZodNumberFormat",(A,e)=>{t.$ZodCheckNumberFormat.init(A,e),v.init(A,e)}),V=r.$constructor("$ZodBoolean",(A,e)=>{g.init(A,e),A._zod.pattern=a.boolean,A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=!!t.value}catch(A){}let n=t.value;return"boolean"==typeof n||t.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:A}),t}}),P=r.$constructor("$ZodBigInt",(A,e)=>{g.init(A,e),A._zod.pattern=a.bigint,A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=BigInt(t.value)}catch(A){}return"bigint"==typeof t.value||t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:A}),t}}),Y=r.$constructor("$ZodBigIntFormat",(A,e)=>{t.$ZodCheckBigIntFormat.init(A,e),P.init(A,e)}),_=r.$constructor("$ZodSymbol",(A,e)=>{g.init(A,e),A._zod.parse=(e,t)=>{let r=e.value;return"symbol"==typeof r||e.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:A}),e}}),K=r.$constructor("$ZodUndefined",(A,e)=>{g.init(A,e),A._zod.pattern=a.undefined,A._zod.values=new Set([void 0]),A._zod.parse=(e,t)=>{let r=e.value;return void 0===r||e.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:A}),e}}),q=r.$constructor("$ZodNull",(A,e)=>{g.init(A,e),A._zod.pattern=a.null,A._zod.values=new Set([null]),A._zod.parse=(e,t)=>{let r=e.value;return null===r||e.issues.push({expected:"null",code:"invalid_type",input:r,inst:A}),e}}),Z=r.$constructor("$ZodAny",(A,e)=>{g.init(A,e),A._zod.parse=A=>A}),W=r.$constructor("$ZodUnknown",(A,e)=>{g.init(A,e),A._zod.parse=A=>A}),z=r.$constructor("$ZodNever",(A,e)=>{g.init(A,e),A._zod.parse=(e,t)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:A}),e)}),j=r.$constructor("$ZodVoid",(A,e)=>{g.init(A,e),A._zod.parse=(e,t)=>{let r=e.value;return void 0===r||e.issues.push({expected:"void",code:"invalid_type",input:r,inst:A}),e}}),$=r.$constructor("$ZodDate",(A,e)=>{g.init(A,e),A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=new Date(t.value)}catch(A){}let n=t.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||t.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:A}),t}});function X(A,e,t){A.issues.length&&e.issues.push(...s.prefixIssues(t,A.issues)),e.value[t]=A.value}let AA=r.$constructor("$ZodArray",(A,e)=>{g.init(A,e),A._zod.parse=(t,r)=>{let n=t.value;if(!Array.isArray(n))return t.issues.push({expected:"array",code:"invalid_type",input:n,inst:A}),t;t.value=Array(n.length);let i=[];for(let A=0;A<n.length;A++){let a=n[A],s=e.element._zod.run({value:a,issues:[]},r);s instanceof Promise?i.push(s.then(e=>X(e,t,A))):X(s,t,A)}return i.length?Promise.all(i).then(()=>t):t}});function Ae(A,e,t,r,n,i){let a=t in r;if(A.issues.length){if(n&&i&&!a)return;e.issues.push(...s.prefixIssues(t,A.issues))}if(!a&&!n){A.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}void 0===A.value?a&&(e.value[t]=void 0):e.value[t]=A.value}function At(A){let e=Object.keys(A.shape);for(let t of e)if(!A.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let t=s.optionalKeys(A.shape);return{...A,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Ar(A,e,t,r,n,i){let a=[],s=n.keySet,o=n.catchall._zod,g=o.def.type,C="optional"===o.optin,Q="optional"===o.optout;for(let n in e){if("__proto__"===n||s.has(n))continue;if("never"===g){a.push(n);continue}let i=o.run({value:e[n],issues:[]},r);i instanceof Promise?A.push(i.then(A=>Ae(A,t,n,e,C,Q))):Ae(i,t,n,e,C,Q)}return(a.length&&t.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),A.length)?Promise.all(A).then(()=>t):t}let An=r.$constructor("$ZodObject",(A,e)=>{let t;g.init(A,e);let r=Object.getOwnPropertyDescriptor(e,"shape");if(!r?.get){let A=e.shape;Object.defineProperty(e,"shape",{get:()=>{let t={...A};return Object.defineProperty(e,"shape",{value:t}),t}})}let n=s.cached(()=>At(e));s.defineLazy(A._zod,"propValues",()=>{let A=e.shape,t={};for(let e in A){let r=A[e]._zod;if(r.values)for(let A of(t[e]??(t[e]=new Set),r.values))t[e].add(A)}return t});let i=s.isObject,a=e.catchall;A._zod.parse=(e,r)=>{t??(t=n.value);let s=e.value;if(!i(s))return e.issues.push({expected:"object",code:"invalid_type",input:s,inst:A}),e;e.value={};let o=[],g=t.shape;for(let A of t.keys){let t=g[A],n="optional"===t._zod.optin,i="optional"===t._zod.optout,a=t._zod.run({value:s[A],issues:[]},r);a instanceof Promise?o.push(a.then(t=>Ae(t,e,A,s,n,i))):Ae(a,e,A,s,n,i)}return a?Ar(o,s,e,r,n.value,A):o.length?Promise.all(o).then(()=>e):e}}),Ai=r.$constructor("$ZodObjectJIT",(A,e)=>{let t,i;An.init(A,e);let a=A._zod.parse,o=s.cached(()=>At(e)),g=s.isObject,C=!r.globalConfig.jitless,Q=s.allowsEval,l=C&&Q.value,I=e.catchall;A._zod.parse=(r,Q)=>{i??(i=o.value);let d=r.value;return g(d)?C&&l&&Q?.async===!1&&!0!==Q.jitless?(t||(t=(A=>{let e=new n.Doc(["shape","payload","ctx"]),t=o.value,r=A=>{let e=s.esc(A);return`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`};e.write("const input = payload.value;");let i=Object.create(null),a=0;for(let A of t.keys)i[A]=`key_${a++}`;for(let n of(e.write("const newResult = {};"),t.keys)){let t=i[n],a=s.esc(n),o=A[n],g=o?._zod?.optin==="optional",C=o?._zod?.optout==="optional";e.write(`const ${t} = ${r(n)};`),g&&C?e.write(`
121
+ ${a}`:i.stack}(A,H):A&&"object"==typeof A&&Error.captureStackTrace(A,e.exports.fetch),A})},e.exports.Headers=A.r(761883).Headers,e.exports.Response=A.r(650801).Response,e.exports.Request=A.r(341716).Request,e.exports.FormData=A.r(740526).FormData;let{setGlobalOrigin:L,getGlobalOrigin:O}=A.r(65616);e.exports.setGlobalOrigin=L,e.exports.getGlobalOrigin=O;let{CacheStorage:G}=A.r(562899),{kConstruct:J}=A.r(35634);e.exports.caches=new G(J);let{deleteCookie:v,getCookies:x,getSetCookies:V,setCookie:P,parseCookie:Y}=A.r(75864);e.exports.deleteCookie=v,e.exports.getCookies=x,e.exports.getSetCookies=V,e.exports.setCookie=P,e.exports.parseCookie=Y;let{parseMIMEType:_,serializeAMimeType:K}=A.r(561743);e.exports.parseMIMEType=_,e.exports.serializeAMimeType=K;let{CloseEvent:q,ErrorEvent:Z,MessageEvent:W}=A.r(124672),{WebSocket:z,ping:j}=A.r(126507);e.exports.WebSocket=z,e.exports.CloseEvent=q,e.exports.ErrorEvent=Z,e.exports.MessageEvent=W,e.exports.ping=j,e.exports.WebSocketStream=A.r(326101).WebSocketStream,e.exports.WebSocketError=A.r(691168).WebSocketError,e.exports.request=T(B.request),e.exports.stream=T(B.stream),e.exports.pipeline=T(B.pipeline),e.exports.connect=T(B.connect),e.exports.upgrade=T(B.upgrade),e.exports.MockClient=w,e.exports.MockCallHistory=u,e.exports.MockCallHistoryLog=p,e.exports.MockPool=y,e.exports.MockAgent=f,e.exports.SnapshotAgent=M,e.exports.mockErrors=m;let{EventSource:$}=A.r(763785);e.exports.EventSource=$,e.exports.install=function(){globalThis.fetch=e.exports.fetch,globalThis.Headers=e.exports.Headers,globalThis.Response=e.exports.Response,globalThis.Request=e.exports.Request,globalThis.FormData=e.exports.FormData,globalThis.WebSocket=e.exports.WebSocket,globalThis.CloseEvent=e.exports.CloseEvent,globalThis.ErrorEvent=e.exports.ErrorEvent,globalThis.MessageEvent=e.exports.MessageEvent,globalThis.EventSource=e.exports.EventSource}},582482,318905,91022,A=>{"use strict";var e=A.i(666680);function t(A){return(0,e.createHash)("sha256").update(A).digest("hex")}function r(A,e){return Buffer.from(JSON.stringify({id:A.id,kind:A.kind,version:e}),"utf8")}function n(A,n,i){let a=(0,e.randomBytes)(12),s=(0,e.createCipheriv)("aes-256-gcm",i,a,{authTagLength:16});return s.setAAD(r(A,1)),{payload:Buffer.concat([s.update(Buffer.from(n)),s.final()]),encryptionVersion:1,nonce:a,authTag:s.getAuthTag(),keyFingerprint:t(i)}}let i="secret",a="ai-development-environment/credentials",s=new Set(["accept","connection","content-length","content-type","expect","host","transfer-encoding","upgrade","x-vault-request"]);function o(A,e){return{code:A,message:e}}function g(A,e){let t=A.replace(/^\/+|\/+$/g,""),r=t.split("/");if(!t||r.some(A=>!A||"."===A||".."===A||A.includes("\\")))throw Error(`${e} must contain non-empty Vault path segments`);return t}function C(A,e){return Object.keys(A).some(A=>A.toLowerCase()===e.toLowerCase())}function Q(A=process.env,e=process.platform){let r,n=A.CREDENTIAL_STORAGE_TYPE?.trim().toLowerCase()||"database";if("database"!==n&&"vault"!==n&&"keychain"!==n)return{requestedStorageType:n,storageType:"unknown",config:null,warnings:[],errors:[o("CREDENTIAL_STORAGE_TYPE_INVALID","CREDENTIAL_STORAGE_TYPE must be database, vault, or keychain")],details:[{label:"Configured value",value:n}]};if("database"===n){let e=A.CREDENTIAL_ENCRYPTION_KEY;if(!e)return{requestedStorageType:n,storageType:"database",config:{storageType:"database",encryptionKey:null,keyFingerprint:null},warnings:[o("DATABASE_UNENCRYPTED","Database credentials are stored as plaintext until CREDENTIAL_ENCRYPTION_KEY is configured")],errors:[],details:[{label:"Location",value:"Application database"},{label:"Encryption key",value:"Not configured"}]};try{let A=function(A){if(!A||A.length%4!=0||!/^[A-Za-z0-9+/]+={0,2}$/.test(A))throw Error("CREDENTIAL_ENCRYPTION_KEY must be strict base64 encoding of exactly 32 bytes");let e=Buffer.from(A,"base64");if(32!==e.length||e.toString("base64")!==A)throw Error("CREDENTIAL_ENCRYPTION_KEY must be strict base64 encoding of exactly 32 bytes");return e}(e);return{requestedStorageType:n,storageType:"database",config:{storageType:"database",encryptionKey:A,keyFingerprint:t(A)},warnings:[],errors:[],details:[{label:"Location",value:"Application database"},{label:"Encryption key",value:"Configured"}]}}catch(A){return{requestedStorageType:n,storageType:"database",config:null,warnings:[],errors:[o("CREDENTIAL_ENCRYPTION_KEY_INVALID",A instanceof Error?A.message:"The encryption key is invalid")],details:[{label:"Location",value:"Application database"},{label:"Encryption key",value:"Invalid"}]}}}if("keychain"===n)return{requestedStorageType:n,storageType:"keychain",config:{storageType:"keychain",platform:e,service:"com.bludesign.ai-development-environment.credentials"},warnings:[],errors:"darwin"===e?[]:[o("KEYCHAIN_UNSUPPORTED_PLATFORM","macOS Keychain storage is only available when the Next.js host runs on macOS")],details:[{label:"Service",value:"com.bludesign.ai-development-environment.credentials"},{label:"Host platform",value:e}]};let l=[],I=[],d={},E=i,c=a,h=!1;try{if(!A.VAULT_ADDR?.trim())throw Error("VAULT_ADDR is required");if(r=new URL(A.VAULT_ADDR),"https:"!==r.protocol&&"http:"!==r.protocol)throw Error("VAULT_ADDR must use http or https");if(r.username||r.password||r.search||r.hash)throw Error("VAULT_ADDR cannot contain credentials, query parameters, or a fragment");if(r.pathname=r.pathname.replace(/\/+$/,""),d=function(A){let e;if(!A?.trim())return{};try{e=JSON.parse(A)}catch{throw Error("CREDENTIAL_VAULT_HEADERS must be a JSON object")}if("object"!=typeof e||null===e||Array.isArray(e))throw Error("CREDENTIAL_VAULT_HEADERS must be a JSON object");let t={};for(let[A,r]of Object.entries(e)){let e=A.trim();if(!e||"string"!=typeof r)throw Error("CREDENTIAL_VAULT_HEADERS must contain only string header values");try{new Headers({[e]:r})}catch{throw Error(`CREDENTIAL_VAULT_HEADERS contains invalid header ${e}`)}if(s.has(e.toLowerCase()))throw Error(`CREDENTIAL_VAULT_HEADERS cannot override the managed ${e} header`);if(Object.keys(t).find(A=>A.toLowerCase()===e.toLowerCase()))throw Error(`CREDENTIAL_VAULT_HEADERS repeats the ${e} header`);t[e]=r}return t}(A.CREDENTIAL_VAULT_HEADERS),E=g(A.CREDENTIAL_VAULT_MOUNT||i,"CREDENTIAL_VAULT_MOUNT"),c=g(A.CREDENTIAL_VAULT_PATH_PREFIX||a,"CREDENTIAL_VAULT_PATH_PREFIX"),h=function(A,e){if(!A||"0"===A||"false"===A.toLowerCase())return!1;if("1"===A||"true"===A.toLowerCase())return!0;throw Error(`${e} must be true, false, 1, or 0`)}(A.VAULT_SKIP_VERIFY,"VAULT_SKIP_VERIFY"),A.VAULT_TOKEN&&C(d,"x-vault-token"))throw Error("VAULT_TOKEN conflicts with X-Vault-Token in CREDENTIAL_VAULT_HEADERS");if(A.VAULT_NAMESPACE&&C(d,"x-vault-namespace"))throw Error("VAULT_NAMESPACE conflicts with X-Vault-Namespace in CREDENTIAL_VAULT_HEADERS")}catch(A){l.push(o("VAULT_CONFIGURATION_INVALID",A instanceof Error?A.message:"Vault configuration is invalid")),r=new URL("https://invalid.local")}"http:"===r.protocol&&I.push(o("VAULT_INSECURE_HTTP","VAULT_ADDR uses plaintext HTTP; Vault credentials and authentication headers are not protected in transit")),h&&I.push(o("VAULT_TLS_VERIFICATION_DISABLED","VAULT_SKIP_VERIFY disables certificate verification for Vault connections"));let B=Object.keys(d).sort((A,e)=>A.localeCompare(e)),D=[{label:"Address",value:l.length?"Invalid":r.toString()},{label:"KV v2 mount",value:E},{label:"Path prefix",value:c},{label:"Namespace",value:A.VAULT_NAMESPACE?"Configured":"Not configured"},{label:"Authentication token",value:A.VAULT_TOKEN||C(d,"x-vault-token")?"Configured":"Not configured"},{label:"Additional headers",value:B.length?B.join(", "):"None"},{label:"Custom CA",value:A.VAULT_CACERT?"Configured":"Not configured"},{label:"TLS server name",value:A.VAULT_TLS_SERVER_NAME?"Configured":"Not configured"}];return{requestedStorageType:n,storageType:"vault",config:0===l.length?{storageType:"vault",address:r,token:A.VAULT_TOKEN||null,namespace:A.VAULT_NAMESPACE||null,mount:E,pathPrefix:c,headers:d,caCertPath:A.VAULT_CACERT||null,tlsServerName:A.VAULT_TLS_SERVER_NAME||null,skipVerify:h}:null,warnings:I,errors:l,details:D}}var l=A.i(243783);class I extends Error{code;constructor(A,e){super(A),this.code=e,this.name="CredentialStoreOperationError"}}function d(A){return new I(A,"CREDENTIAL_DATA_INVALID")}function E(A){return Uint8Array.from(A)}async function c(A){let[e]=await A.$queryRawUnsafe("PRAGMA wal_checkpoint(TRUNCATE);");if(!e||0!==Number(e.busy))throw Error("SQLite WAL could not be truncated after credential encryption")}async function h(A){await c(A),await A.$executeRawUnsafe("VACUUM;"),await c(A)}class B{prisma;config;storageType;constructor(A,e){this.prisma=A,this.config=e,this.storageType="database"}async initialize(){let A=await this.prisma.credential.findMany({where:{storageType:this.storageType,encrypted:!0},select:{id:!0,keyFingerprint:!0,encryptionVersion:!0,nonce:!0,authTag:!0,payload:!0}});if(A.length&&!this.config.encryptionKey)throw new I("Encrypted credentials exist, but CREDENTIAL_ENCRYPTION_KEY is not configured. Restore the original key and restart the server.","CREDENTIAL_ENCRYPTION_KEY_MISSING");if(this.config.encryptionKey){let e=this.config.encryptionKey;if(A.some(A=>A.keyFingerprint!==this.config.keyFingerprint))throw new I("CREDENTIAL_ENCRYPTION_KEY does not match existing credentials. Restore the original key and restart the server.","CREDENTIAL_ENCRYPTION_KEY_MISMATCH");if(A.some(A=>!A.payload||1!==A.encryptionVersion||!A.nonce||!A.authTag))throw d("One or more encrypted credential records have invalid encryption metadata");await this.prisma.$queryRawUnsafe("PRAGMA secure_delete = ON;"),await this.prisma.$transaction(async A=>{let t=await A.credential.findMany({where:{storageType:this.storageType,encrypted:!1},select:{id:!0,kind:!0,payload:!0}});for(let r of t){if(!r.payload)throw d(`Credential metadata for ${r.id} has no database payload`);let t=n({id:r.id,kind:r.kind},r.payload,e);await A.credential.update({where:{id:r.id},data:{payload:E(t.payload),encrypted:!0,encryptionVersion:t.encryptionVersion,nonce:E(t.nonce),authTag:E(t.authTag),keyFingerprint:t.keyFingerprint}})}return t.length})>0&&await h(this.prisma)}}async get(A){let e=await this.prisma.credential.findUnique({where:{id:A.id}});return e?this.getFromRecord(A,e):null}getFromRecord(A,t){if(t.kind!==A.kind)throw d(`Credential ${A.id} has unexpected kind metadata`);if(t.storageType!==this.storageType)throw new I(`Credential ${A.id} was stored in ${t.storageType}; re-enter it for database storage`,"BACKEND_MISMATCH");if(!t.payload)throw d(`Credential ${A.id} has no database payload`);if(!t.encrypted)return Buffer.from(t.payload);if(!this.config.encryptionKey)throw new I("CREDENTIAL_ENCRYPTION_KEY is required to read encrypted credentials","CREDENTIAL_ENCRYPTION_KEY_MISSING");if(t.keyFingerprint!==this.config.keyFingerprint)throw new I("CREDENTIAL_ENCRYPTION_KEY does not match this credential","CREDENTIAL_ENCRYPTION_KEY_MISMATCH");if(!t.encryptionVersion||!t.nonce||!t.authTag)throw d(`Credential ${A.id} has invalid encryption metadata`);return function(A,t,n){if(1!==t.encryptionVersion)throw Error("The credential encryption envelope version is unsupported");if(12!==t.nonce.byteLength||16!==t.authTag.byteLength)throw Error("The credential encryption envelope is invalid");try{let i=(0,e.createDecipheriv)("aes-256-gcm",n,t.nonce,{authTagLength:16});return i.setAAD(r(A,t.encryptionVersion)),i.setAuthTag(Buffer.from(t.authTag)),Buffer.concat([i.update(Buffer.from(t.payload)),i.final()])}catch{throw Error("The credential could not be decrypted; restore the original encryption key or re-enter the credential")}}(A,{payload:t.payload,encryptionVersion:t.encryptionVersion,nonce:t.nonce,authTag:t.authTag},this.config.encryptionKey)}async set(A,e){await this.prisma.$transaction(t=>this.setInTransaction(t,A,e))}async setInTransaction(A,e,t){let r=this.config.encryptionKey?n(e,t,this.config.encryptionKey):null,i={kind:e.kind,ownerId:e.ownerId??null,storageType:this.storageType,payload:E(r?.payload??t),encrypted:!!r,encryptionVersion:r?.encryptionVersion??null,nonce:r?E(r.nonce):null,authTag:r?E(r.authTag):null,keyFingerprint:r?.keyFingerprint??null};await A.credential.upsert({where:{id:e.id},create:{id:e.id,...i},update:i})}async delete(A){await this.prisma.$transaction(e=>this.deleteInTransaction(e,A))}async deleteInTransaction(A,e){await A.credential.deleteMany({where:{id:e.id}})}}let D=()=>A.A(12202);class w{config;moduleLoader;storageType;constructor(A,e=D){this.config=A,this.moduleLoader=e,this.storageType="keychain"}async initialize(){this.assertSupported()}assertSupported(){if("darwin"!==this.config.platform)throw new I("macOS Keychain credential storage is unavailable on this host. Select database or Vault storage and restart the server.","KEYCHAIN_UNSUPPORTED_PLATFORM")}async entry(A){this.assertSupported();let{AsyncEntry:e}=await this.moduleLoader();return new e(this.config.service,A)}async get(A){try{let e=await (await this.entry(A.id)).getSecret();return e?Buffer.from(e):null}catch(e){throw Error(`macOS Keychain could not read ${A.id}: ${e instanceof Error?e.message:"credential operation failed"}`)}}async set(A,e){try{await (await this.entry(A.id)).setSecret(Buffer.from(e))}catch(e){throw Error(`macOS Keychain could not store ${A.id}: ${e instanceof Error?e.message:"credential operation failed"}`)}}async delete(A){try{await (await this.entry(A.id)).deleteCredential()}catch(e){throw Error(`macOS Keychain could not delete ${A.id}: ${e instanceof Error?e.message:"credential operation failed"}`)}}}let u="jira-api-token",p="github-personal-access-token",f="github-app-private-key",y="cache-server-api-key",M="cache-server-headers",m="external-mcp-server-headers",N="ios-profile-signer-private-key",S="app-store-connect-private-key",k="apns-token-private-key",U="apns-certificate-bundle",F="web-push-vapid-private-key";function R(A){return Buffer.from(JSON.stringify({version:1,value:A}),"utf8")}function T(A){let e;try{e=JSON.parse(Buffer.from(A).toString("utf8"))}catch{throw Error("The stored credential envelope is invalid")}if("object"!=typeof e||null===e||1!==e.version||!("value"in e))throw Error("The stored credential envelope version is unsupported");return e.value}function b(A){switch(A){case u:return"Jira";case p:case f:return"GitHub";case y:case M:return"Actions cache";case m:return"External MCP server";case N:case S:return"iOS devices";case k:case U:return"Push notifications";case F:return"Notifications";default:return"Unknown"}}A.s(["CREDENTIALS",0,{jiraApiToken:{id:"jira/default/api-token",kind:u,ownerId:"default"},githubPersonalAccessToken:{id:"github/default/personal-access-token",kind:p,ownerId:"default"},githubAppPrivateKey:{id:"github-app/default/private-key",kind:f,ownerId:"default"},cacheServerApiKey:{id:"cache-server/default/api-key",kind:y,ownerId:"default"},cacheServerHeaders:{id:"cache-server/default/headers",kind:M,ownerId:"default"},iosProfileSignerPrivateKey:{id:"ios-devices/default/profile-signer-private-key",kind:N,ownerId:"default"},appStoreConnectPrivateKey:{id:"ios-devices/default/app-store-connect-private-key",kind:S,ownerId:"default"},apnsTokenPrivateKey:{id:"push-notifications/default/token-private-key",kind:k,ownerId:"default"},webPushVapidPrivateKey:{id:"notifications/default/web-push-vapid-private-key",kind:F,ownerId:"default"}},"apnsCertificateCredential",0,function(A){return{id:`apns-certificate/${A}/bundle`,kind:U,ownerId:A}},"credentialOwnerFeature",0,b,"decodeJsonCredential",0,T,"encodeJsonCredential",0,R,"externalMcpHeadersCredential",0,function(A){return{id:`external-mcp-server/${A}/headers`,kind:m,ownerId:A}}],318905);var H=A.i(912714),L=A.i(936689);function O(A){return A.split("/").map(encodeURIComponent).join("/")}class G{config;requestImplementation;dispatcherFactory;storageType;dispatcherPromise;constructor(A,e=L.request,t=A=>new L.Agent(A)){this.config=A,this.requestImplementation=e,this.dispatcherFactory=t,this.storageType="vault",this.dispatcherPromise=null}async initialize(){await this.dispatcher()}dispatcher(){return this.dispatcherPromise||(this.dispatcherPromise=(async()=>{let A="https:"===this.config.address.protocol&&this.config.caCertPath?await (0,H.readFile)(this.config.caCertPath):void 0;return this.dispatcherFactory({connect:{...A?{ca:A}:{},...this.config.tlsServerName?{servername:this.config.tlsServerName}:{},rejectUnauthorized:!this.config.skipVerify},connectTimeout:1e4,headersTimeout:1e4,bodyTimeout:1e4,maxResponseSize:0x4000000})})()),this.dispatcherPromise}endpoint(A,e){let t=this.config.address.toString().replace(/\/+$/,"");return`${t}/v1/${O(this.config.mount)}/${A}/${O(this.config.pathPrefix)}/${O(e)}`}headers(A){let e={...this.config.headers,accept:"application/json","x-vault-request":"true"};return A&&(e["content-type"]="application/json"),this.config.token&&(e["x-vault-token"]=this.config.token),this.config.namespace&&(e["x-vault-namespace"]=this.config.namespace),e}async call(A,e,t){try{let A=await this.requestImplementation(e,{method:t.method,headers:this.headers(!!t.body),body:t.body,dispatcher:await this.dispatcher(),signal:AbortSignal.timeout(1e4),headersTimeout:1e4,bodyTimeout:1e4});return{statusCode:A.statusCode,body:await A.body.text()}}catch(t){let e="object"==typeof t&&null!==t&&"code"in t&&"string"==typeof t.code?t.code:null;throw Error(`Vault credential ${A} failed${e?` (${e})`:""}`)}}async get(A){let e=await this.call("read",this.endpoint("data",A.id),{method:"GET"});if(404===e.statusCode)return null;if(e.statusCode<200||e.statusCode>=300)throw Error(`Vault credential read failed (HTTP ${e.statusCode})`);try{let t=JSON.parse(e.body),r=t.data?.data?.value;if("string"!=typeof r||t.data?.data?.version!==1||t.data?.data?.kind!==A.kind)throw Error("invalid payload");return Buffer.from(r,"base64")}catch{throw Error("Vault returned an invalid credential payload")}}async set(A,e){let t=await this.call("write",this.endpoint("data",A.id),{method:"POST",body:JSON.stringify({data:{value:Buffer.from(e).toString("base64"),version:1,kind:A.kind}})});if(t.statusCode<200||t.statusCode>=300)throw Error(`Vault credential write failed (HTTP ${t.statusCode})`)}async delete(A){let e=await this.call("delete",this.endpoint("metadata",A.id),{method:"DELETE"});if(404!==e.statusCode&&(e.statusCode<200||e.statusCode>=300))throw Error(`Vault credential delete failed (HTTP ${e.statusCode})`)}}function J(A){return"database"===A||"vault"===A||"keychain"===A?A:"unknown"}let v=new Map;async function x(A,e){let t,r=[...new Set(A)].sort();if(!r.length)return e();let n=r.flatMap(A=>{let e=v.get(A);return e?[e]:[]}),i=new Promise(A=>{t=A});for(let A of r)v.set(A,i);await Promise.all(n);try{return await e()}finally{for(let A of(t(),r))v.get(A)===i&&v.delete(A)}}A.s(["CredentialService",0,class{env;platform;configResult;prismaFactory;prismaPromise=null;driverPromise=null;initializationPromise=null;runtimeIssue=null;keychainModuleLoader;vaultRequest;vaultDispatcherFactory;constructor(A={}){this.env=A.env??process.env,this.platform=A.platform??process.platform,this.configResult=Q(this.env,this.platform),this.prismaFactory=A.prisma?async()=>A.prisma:A.prismaFactory??l.getPrismaClient,this.keychainModuleLoader=A.keychainModuleLoader,this.vaultRequest=A.vaultRequest,this.vaultDispatcherFactory=A.vaultDispatcherFactory}prisma(){return this.prismaPromise??=this.prismaFactory()}configurationError(){let A=this.configResult.errors[0];return A?Error(`Credential storage is not configured: ${A.message}`):null}async createDriver(A){return"database"===A.storageType?new B(await this.prisma(),A):"vault"===A.storageType?new G(A,this.vaultRequest,this.vaultDispatcherFactory):new w(A,this.keychainModuleLoader)}driver(){return this.driverPromise||(this.driverPromise=(async()=>{let A=this.configurationError();if(A)throw A;if(!this.configResult.config)throw Error("Credential storage is not configured");return this.createDriver(this.configResult.config)})()),this.driverPromise}async ensureInitialized(){return this.initializationPromise||(this.initializationPromise=(async()=>{let A=await this.driver();await A.initialize()})().catch(A=>{throw 0===this.configResult.errors.length&&(this.runtimeIssue=this.issueForInitializationError(A)),A})),this.initializationPromise}issueForInitializationError(A){return A instanceof I?{code:A.code,message:A.message}:"vault"===this.configResult.storageType?{code:"VAULT_CONFIGURATION_INVALID",message:"Vault TLS configuration could not be initialized"}:{code:"CREDENTIAL_STORE_UNAVAILABLE",message:A instanceof Error?A.message:"Credential storage could not be initialized"}}async requireCurrentDriver(){return await this.ensureInitialized(),this.driver()}async get(A){let e=await this.requireCurrentDriver(),t=await this.prisma(),r=await t.credential.findUnique({where:{id:A.id}});if(!r)return null;if(r.kind!==A.kind)throw new I(`Credential ${A.id} has unexpected kind metadata`,"CREDENTIAL_DATA_INVALID");if(r.storageType!==e.storageType)throw new I(`Credential ${A.id} was stored in ${r.storageType}; re-enter it for ${e.storageType} storage`,"BACKEND_MISMATCH");let n=e instanceof B?e.getFromRecord(A,r):await e.get(A);if(!n)throw Error(`Credential ${A.id} is missing from ${e.storageType}; re-enter it in its owning settings form`);return n}async getText(A){let e=await this.get(A);return e?e.toString("utf8"):null}async getJson(A){let e=await this.get(A);return e?T(e):null}async isConfigured(A){let e=await (await this.prisma()).credential.findUnique({where:{id:A.id},select:{kind:!0,storageType:!0}});return!!(e&&e.kind===A.kind&&e.storageType===this.configResult.storageType)}async set(A,e,t){await this.setMany([{descriptor:A,value:e}],t)}async setMany(A,e){let t=A.map(A=>A.descriptor.id);if(new Set(t).size!==t.length)throw Error("Credential writes must use unique IDs");let r=await this.requireCurrentDriver(),n=await this.prisma();await x(t,async()=>{if(r instanceof B)return void await n.$transaction(async t=>{for(let e of A)await r.setInTransaction(t,e.descriptor,e.value);await e?.(t)});let t=new Map;for(let e of A)t.set(e.descriptor.id,await r.get(e.descriptor));let i=[];try{for(let e of A)i.push(e),await r.set(e.descriptor,e.value);await n.$transaction(async t=>{for(let{descriptor:e}of A)await t.credential.upsert({where:{id:e.id},create:{id:e.id,kind:e.kind,ownerId:e.ownerId??null,storageType:r.storageType},update:{kind:e.kind,ownerId:e.ownerId??null,storageType:r.storageType,payload:null,encrypted:!1,encryptionVersion:null,nonce:null,authTag:null,keyFingerprint:null}});await e?.(t)})}catch(A){try{for(let A of i.reverse()){let e=t.get(A.descriptor.id);e?await r.set(A.descriptor,e):await r.delete(A.descriptor)}}catch{throw Error(`Credential metadata could not be saved and the ${r.storageType} rollback also failed; re-enter the affected credentials`,{cause:A})}throw A}})}async setText(A,e,t){await this.set(A,Buffer.from(e,"utf8"),t)}async setJson(A,e,t){await this.set(A,R(e),t)}async driverForRecordedStorage(A){if(0===this.configResult.errors.length&&this.configResult.config?.storageType===A){let A=await this.driver();return await A.initialize(),A}let e=Q({...this.env,CREDENTIAL_STORAGE_TYPE:A},this.platform);if(!e.config||e.errors.length)throw Error(`Cannot delete the credential from its recorded ${A} backend: ${e.errors[0]?.message??"backend configuration is unavailable"}`);let t=await this.createDriver(e.config);return await t.initialize(),t}clearRecoverableDatabaseInitializationIssue(){(this.runtimeIssue?.code==="CREDENTIAL_ENCRYPTION_KEY_MISSING"||this.runtimeIssue?.code==="CREDENTIAL_ENCRYPTION_KEY_MISMATCH"||this.runtimeIssue?.code==="CREDENTIAL_DATA_INVALID")&&(this.initializationPromise=null,this.runtimeIssue=null)}async delete(A,e){await this.deleteMany([A],e)}async deleteMany(A,e){let t=A.map(A=>A.id);if(new Set(t).size!==t.length)throw Error("Credential deletes must use unique IDs");let r=await this.prisma();await x(t,async()=>{let n=await r.credential.findMany({where:{id:{in:t}},select:{id:!0,kind:!0,storageType:!0}});if(!n.length){e&&await r.$transaction(e);return}let i=new Map(A.map(A=>[A.id,A])),a=[];for(let A of n){let e=i.get(A.id);if(A.kind!==e.kind)throw new I(`Credential ${e.id} has unexpected kind metadata`,"CREDENTIAL_DATA_INVALID");let t=J(A.storageType);if("unknown"===t)throw new I(`Credential ${e.id} has an unknown backend`,"CREDENTIAL_DATA_INVALID");if("database"===t)continue;let r=await this.driverForRecordedStorage(t);a.push({descriptor:e,driver:r,previous:await r.get(e)})}let s=[];try{for(let A of a)s.push(A),await A.driver.delete(A.descriptor);await r.$transaction(async A=>{await A.credential.deleteMany({where:{id:{in:n.map(A=>A.id)}}}),await e?.(A)})}catch(A){try{for(let A of s.reverse())A.previous&&await A.driver.set(A.descriptor,A.previous)}catch{throw Error("Credential metadata could not be deleted and an external-backend rollback also failed; re-enter the affected credentials",{cause:A})}throw A}n.some(A=>"database"===A.storageType)&&this.clearRecoverableDatabaseInitializationIssue()})}async list(){return(await (await this.prisma()).credential.findMany({select:{id:!0,kind:!0,ownerId:!0,storageType:!0,encrypted:!0,createdAt:!0,updatedAt:!0},orderBy:[{kind:"asc"},{id:"asc"}]})).map(A=>({id:A.id,kind:A.kind,ownerId:A.ownerId,ownerFeature:b(A.kind),storageType:J(A.storageType),protection:"vault"===A.storageType?"VAULT":"keychain"===A.storageType?"KEYCHAIN":A.encrypted?"ENCRYPTED":"PLAINTEXT",createdAt:A.createdAt.toISOString(),updatedAt:A.updatedAt.toISOString()}))}async status(){var A;let e;try{await this.ensureInitialized()}catch{}let t=await (await this.prisma()).credential.findMany({select:{storageType:!0,encrypted:!0}}),r=t.filter(A=>A.storageType!==this.configResult.storageType).length,n=r?[{code:"BACKEND_MISMATCH",message:`${r} credential item${1===r?" was":"s were"} stored with another backend and must be re-entered`}]:[],i=t.some(A=>"database"===A.storageType&&A.encrypted),a=(A=[...this.configResult.warnings.filter(A=>"DATABASE_UNENCRYPTED"!==A.code||!i),...this.configResult.errors,...this.runtimeIssue?[this.runtimeIssue]:[],...n],e=new Set,A.filter(A=>{let t=`${A.code}:${A.message}`;return!e.has(t)&&(e.add(t),!0)})),s=this.configResult.errors.length>0||!!this.runtimeIssue,o=s?"ERROR":"database"===this.configResult.storageType?this.configResult.config?.storageType==="database"&&this.configResult.config.encryptionKey?"ENCRYPTED":"PLAINTEXT":"EXTERNAL";return{storageType:this.configResult.storageType,state:s?"ERROR":a.length?"WARNING":"READY",encryptionState:o,details:this.configResult.details,itemCount:t.length,mismatchCount:r,warnings:a}}}],91022),A.s([],582482)},661983,A=>{"use strict";class e{subscribers=new Map;publish(A,e){for(let t of this.subscribers.get(A)??[])(!t.predicate||t.predicate(e))&&t.push(e)}iterate(A,e){let t=[],r=[],n=!0,i={predicate:e,push(A){let e=r.shift();e?e({value:A,done:!1}):t.push(A)}},a=this.subscribers.get(A)??new Set;a.add(i),this.subscribers.set(A,a);let s=()=>{if(n)for(let e of(n=!1,a.delete(i),0===a.size&&this.subscribers.delete(A),r.splice(0)))e({value:void 0,done:!0})};return{[Symbol.asyncIterator](){return this},next(){if(!n)return Promise.resolve({value:void 0,done:!0});let A=t.shift();return void 0!==A?Promise.resolve({value:A,done:!1}):new Promise(A=>r.push(A))},return:()=>(s(),Promise.resolve({value:void 0,done:!0})),throw:A=>(s(),Promise.reject(A))}}}let t=globalThis,r=t.agentEventBus??(t.agentEventBus=new e);A.s(["AGENT_CHANGED_TOPIC",0,"agent.changed","APP_NOTIFICATIONS_CHANGED_TOPIC",0,"app-notifications.changed","BUILDS_CHANGED_TOPIC",0,"builds.changed","CODEBASE_CHANGED_TOPIC",0,"codebase.changed","IOS_DEVICES_CHANGED_TOPIC",0,"ios-devices.changed","PUSH_NOTIFICATIONS_CHANGED_TOPIC",0,"push-notifications.changed","SIGNING_ASSETS_CHANGED_TOPIC",0,"signing-assets.changed","SKILLS_CHANGED_TOPIC",0,"skills.changed","TELEMETRY_CHANGED_TOPIC",0,"telemetry.changed","TELEMETRY_SETTINGS_CHANGED_TOPIC",0,"telemetry.settings.changed","WORKTREE_CHANGED_TOPIC",0,"worktree.changed","agentEventBus",0,r,"agentEventsTopic",0,A=>`agent.${A}.events`,"agentJobChangedTopic",0,A=>`job.${A}.changed`,"agentJobLogTopic",0,A=>`job.${A}.log`,"buildDataCollectionChangedTopic",0,A=>`build-data.${A}.changed`,"buildLogTopic",0,A=>`build.${A}.log`,"buildTopic",0,A=>`build.${A}.changed`,"ccusageCollectionChangedTopic",0,A=>`ccusage.${A}.changed`,"skillSyncRunTopic",0,A=>`skills.sync.${A}.changed`,"worktreeInspectionTopic",0,A=>`worktree.${A}.inspection`])},397554,827957,A=>{"use strict";let e;function t(A,e,...r){if((r=r.filter(Boolean)).length>2){let e=r.pop();A+=`one of type ${r.join(", ")}, or ${e}.`}else 2===r.length?A+=`one of type ${r[0]} or ${r[1]}.`:A+=`of type ${r[0]}.`;return null==e?A+=` Received ${e}`:"function"==typeof e&&e.name?A+=` Received function ${e.name}`:"object"==typeof e&&null!=e&&e.constructor?.name&&(A+=` Received an instance of ${e.constructor.name}`),A}let r=(A,e,...r)=>t(`Key for the ${A} algorithm must be `,e,...r);function n(A){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(A);let e=atob(A),t=new Uint8Array(e.length);for(let A=0;A<e.length;A++)t[A]=e.charCodeAt(A);return t}class i extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(A,e){super(A,e),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class a extends i{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class s extends i{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class o extends i{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class g extends i{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(A="multiple matching keys found in the JSON Web Key Set",e){super(A,e)}}let C=A=>{if(A?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return A instanceof CryptoKey}catch{return!1}},Q=A=>A?.[Symbol.toStringTag]==="KeyObject",l=A=>C(A)||Q(A),I=(A,e)=>{if(A.byteLength!==e.length)return!1;for(let t=0;t<A.byteLength;t++)if(A[t]!==e[t])return!1;return!0},d=A=>{let e=A.data[A.pos++];if(128&e){let t=127&e,r=0;for(let e=0;e<t;e++)r=r<<8|A.data[A.pos++];return r}return e},E=(A,e,t)=>{if(A.data[A.pos++]!==e)throw Error(t)},c=(A,e)=>{let t=A.data.subarray(A.pos,A.pos+e);return A.pos+=e,t},h=async(A,e,t,r)=>{let n,i,s="spki"===A,o=()=>s?["verify"]:["sign"];switch(t){case"PS256":case"PS384":case"PS512":n={name:"RSA-PSS",hash:`SHA-${t.slice(-3)}`},i=o();break;case"RS256":case"RS384":case"RS512":n={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.slice(-3)}`},i=o();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":n={name:"RSA-OAEP",hash:`SHA-${parseInt(t.slice(-3),10)||1}`},i=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":n={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[t]},i=o();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{let A=r.getNamedCurve(e);n="X25519"===A?{name:"X25519"}:{name:"ECDH",namedCurve:A}}catch(A){throw new a("Invalid or unsupported key format")}i=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":n={name:"Ed25519"},i=o();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":n={name:t},i=o();break;default:throw new a('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(A,e,n,r?.extractable??!!s,i)};async function B(A,e,t){let r,i,a;if("string"!=typeof A||0!==A.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return r=/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,i=n(A.replace(r,"")),a=t,e?.startsWith?.("ECDH-ES")&&((a||={}).getNamedCurve=A=>{let e,t={data:A,pos:0};return E(t,48,"Invalid PKCS#8 structure"),d(t),E(t,2,"Expected version field"),e=d(t),t.pos+=e,E(t,48,"Expected algorithm identifier"),d(t),t.pos,(A=>{let e,t=(E(A,6,"Expected algorithm OID"),e=d(A),c(A,e));if(I(t,[43,101,110]))return"X25519";if(!I(t,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");E(A,6,"Expected curve OID");let r=d(A),n=c(A,r);for(let{name:A,oid:e}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(I(n,e))return A;throw Error("Unsupported named curve")})(t)}),h("pkcs8",i,e,a)}A.s(["importPKCS8",0,B],397554);let D=new TextEncoder,w=new TextDecoder;function u(A){let e=new Uint8Array(A.length);for(let t=0;t<A.length;t++){let r=A.charCodeAt(t);if(r>127)throw TypeError("non-ASCII string encountered in encode()");e[t]=r}return e}function p(A){let e=A;return("string"==typeof e&&(e=D.encode(e)),Uint8Array.prototype.toBase64)?e.toBase64({alphabet:"base64url",omitPadding:!0}):(function(A){if(Uint8Array.prototype.toBase64)return A.toBase64();let e=[];for(let t=0;t<A.length;t+=32768)e.push(String.fromCharCode.apply(null,A.subarray(t,t+32768)));return btoa(e.join(""))})(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}let f=(A,e="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${e} must be ${A}`);function y(A,e){if(parseInt(A.hash.name.slice(4),10)!==e)throw f(`SHA-${e}`,"algorithm.hash")}async function M(A,e,r){if(e instanceof Uint8Array){if(!A.startsWith("HS"))throw TypeError(((A,...e)=>t("Key must be ",A,...e))(e,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",e,{hash:`SHA-${A.slice(-3)}`,name:"HMAC"},!1,[r])}return!function(A,e,t){switch(e){case"HS256":case"HS384":case"HS512":if("HMAC"!==A.algorithm.name)throw f("HMAC");y(A.algorithm,parseInt(e.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==A.algorithm.name)throw f("RSASSA-PKCS1-v1_5");y(A.algorithm,parseInt(e.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==A.algorithm.name)throw f("RSA-PSS");y(A.algorithm,parseInt(e.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==A.algorithm.name)throw f("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let r;if(r=A.algorithm,r.name!==e)throw f(e);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==A.algorithm.name)throw f("ECDSA");let t=function(A){switch(A){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(e);if(A.algorithm.namedCurve!==t)throw f(t,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(t&&!A.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}(e,A,r),e}async function m(A,e,t){let r=await M(A,e,"sign");return!function(A,e){if(A.startsWith("RS")||A.startsWith("PS")){let{modulusLength:t}=e.algorithm;if("number"!=typeof t||t<2048)throw TypeError(`${A} requires key modulusLength to be 2048 bits or larger`)}}(A,r),new Uint8Array(await crypto.subtle.sign(function(A,e){let t=`SHA-${A.slice(-3)}`;switch(A){case"HS256":case"HS384":case"HS512":return{hash:t,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:t,name:"RSA-PSS",saltLength:parseInt(A.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:t,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:t,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:A};default:throw new a(`alg ${A} is not supported either by JOSE or your javascript runtime`)}}(A,r.algorithm),r,t))}function N(A){if("object"!=typeof A||null===A||"[object Object]"!==Object.prototype.toString.call(A))return!1;if(null===Object.getPrototypeOf(A))return!0;let e=A;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(A)===e}let S=A=>N(A)&&"string"==typeof A.kty,k=A=>A?.[Symbol.toStringTag],U=(A,e,t)=>{if(void 0!==e.use){let A;switch(t){case"sign":case"verify":A="sig";break;case"encrypt":case"decrypt":A="enc"}if(e.use!==A)throw TypeError(`Invalid key for this operation, its "use" must be "${A}" when present`)}if(void 0!==e.alg&&e.alg!==A)throw TypeError(`Invalid key for this operation, its "alg" must be "${A}" when present`);if(Array.isArray(e.key_ops)){let r;switch(!0){case"sign"===t||"verify"===t:case"dir"===A:case A.includes("CBC-HS"):r=t;break;case A.startsWith("PBES2"):r="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(A):r=!A.includes("GCM")&&A.endsWith("KW")?"encrypt"===t?"wrapKey":"unwrapKey":t;break;case"encrypt"===t&&A.startsWith("RSA"):r="wrapKey";break;case"decrypt"===t:r=A.startsWith("RSA")?"unwrapKey":"deriveBits"}if(r&&e.key_ops?.includes?.(r)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${r}" when present`)}return!0},F='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function R(A){if(!A.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:e,keyUsages:t}=function(A){let e,t;switch(A.kty){case"AKP":switch(A.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":e={name:A.alg},t=A.priv?["sign"]:["verify"];break;default:throw new a(F)}break;case"RSA":switch(A.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${A.alg.slice(-3)}`},t=A.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${A.alg.slice(-3)}`},t=A.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(A.alg.slice(-3),10)||1}`},t=A.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new a(F)}break;case"EC":switch(A.alg){case"ES256":case"ES384":case"ES512":e={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[A.alg]},t=A.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:A.crv},t=A.d?["deriveBits"]:[];break;default:throw new a(F)}break;case"OKP":switch(A.alg){case"Ed25519":case"EdDSA":e={name:"Ed25519"},t=A.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:A.crv},t=A.d?["deriveBits"]:[];break;default:throw new a(F)}break;default:throw new a('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:t}}(A),r={...A};return"AKP"!==r.kty&&delete r.alg,delete r.use,crypto.subtle.importKey("jwk",r,e,A.ext??(!A.d&&!A.priv),A.key_ops??t)}let T="given KeyObject instance cannot be used for this algorithm",b=async(A,t,r,n=!1)=>{let i=(e||=new WeakMap).get(A);if(i?.[r])return i[r];let a=await R({...t,alg:r});return n&&Object.freeze(A),i?i[r]=a:e.set(A,{[r]:a}),a};async function H(A,t){if(A instanceof Uint8Array||C(A))return A;if(Q(A)){if("secret"===A.type)return A.export();if("toCryptoKey"in A&&"function"==typeof A.toCryptoKey)try{return((A,t)=>{let r,n=(e||=new WeakMap).get(A);if(n?.[t])return n[t];let i="public"===A.type,a=!!i;if("x25519"===A.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(T)}r=A.toCryptoKey(A.asymmetricKeyType,a,i?[]:["deriveBits"])}if("ed25519"===A.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw TypeError(T);r=A.toCryptoKey(A.asymmetricKeyType,a,[i?"verify":"sign"])}switch(A.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==A.asymmetricKeyType.toUpperCase())throw TypeError(T);r=A.toCryptoKey(A.asymmetricKeyType,a,[i?"verify":"sign"])}if("rsa"===A.asymmetricKeyType){let e;switch(t){case"RSA-OAEP":e="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":e="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":e="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":e="SHA-512";break;default:throw TypeError(T)}if(t.startsWith("RSA-OAEP"))return A.toCryptoKey({name:"RSA-OAEP",hash:e},a,i?["encrypt"]:["decrypt"]);r=A.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:e},a,[i?"verify":"sign"])}if("ec"===A.asymmetricKeyType){let e=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(A.asymmetricKeyDetails?.namedCurve);if(!e)throw TypeError(T);let n={ES256:"P-256",ES384:"P-384",ES512:"P-521"};n[t]&&e===n[t]&&(r=A.toCryptoKey({name:"ECDSA",namedCurve:e},a,[i?"verify":"sign"])),t.startsWith("ECDH-ES")&&(r=A.toCryptoKey({name:"ECDH",namedCurve:e},a,i?[]:["deriveBits"]))}if(!r)throw TypeError(T);return n?n[t]=r:e.set(A,{[t]:r}),r})(A,t)}catch(A){if(A instanceof TypeError)throw A}let r=A.export({format:"jwk"});return b(A,r,t)}if(S(A)){if(A.k){var r=A.k;if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof r?r:w.decode(r),{alphabet:"base64url"});let e=r;e instanceof Uint8Array&&(e=w.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/");try{return n(e)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}return b(A,A,t,!0)}throw Error("unreachable")}function L(A,e){if(A)throw TypeError(`${e} can only be called once`)}Symbol();class O{#eq;#eZ;#eW;constructor(A){if(!(A instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#eq=A}setProtectedHeader(A){return L(this.#eZ,"setProtectedHeader"),this.#eZ=A,this}setUnprotectedHeader(A){return L(this.#eW,"setUnprotectedHeader"),this.#eW=A,this}async sign(A,e){let t,n,i,o;if(!this.#eZ&&!this.#eW)throw new s("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!function(...A){let e,t=A.filter(Boolean);if(0===t.length||1===t.length)return!0;for(let A of t){let t=Object.keys(A);if(!e||0===e.size){e=new Set(t);continue}for(let A of t){if(e.has(A))return!1;e.add(A)}}return!0}(this.#eZ,this.#eW))throw new s("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let g={...this.#eZ,...this.#eW},C=function(A,e,t,r,n){let i;if(void 0!==n.crit&&r?.crit===void 0)throw new A('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||void 0===r.crit)return new Set;if(!Array.isArray(r.crit)||0===r.crit.length||r.crit.some(A=>"string"!=typeof A||0===A.length))throw new A('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let s of(i=void 0!==t?new Map([...Object.entries(t),...e.entries()]):e,r.crit)){if(!i.has(s))throw new a(`Extension Header Parameter "${s}" is not recognized`);if(void 0===n[s])throw new A(`Extension Header Parameter "${s}" is missing`);if(i.get(s)&&void 0===r[s])throw new A(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)}(s,new Map([["b64",!0]]),e?.crit,this.#eZ,g),Q=!0;if(C.has("b64")&&"boolean"!=typeof(Q=this.#eZ.b64))throw new s('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:I}=g;if("string"!=typeof I||!I)throw new s('JWS "alg" (Algorithm) Header Parameter missing or invalid');var d="sign";switch(I.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((A,e,t)=>{if(!(e instanceof Uint8Array)){if(S(e)){if("oct"===e.kty&&"string"==typeof e.k&&U(A,e,t))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!l(e))throw TypeError(r(A,e,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==e.type)throw TypeError(`${k(e)} instances for symmetric algorithms must be of type "secret"`)}})(I,A,d);break;default:((A,e,t)=>{if(S(e))switch(t){case"decrypt":case"sign":if("oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d)&&U(A,e,t))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==e.kty&&void 0===e.d&&void 0===e.priv&&U(A,e,t))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!l(e))throw TypeError(r(A,e,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===e.type)throw TypeError(`${k(e)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===e.type)switch(t){case"sign":throw TypeError(`${k(e)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${k(e)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===e.type)switch(t){case"verify":throw TypeError(`${k(e)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${k(e)} instances for asymmetric algorithm encryption must be of type "public"`)}})(I,A,d)}Q?n=u(t=p(this.#eq)):(n=this.#eq,t=""),this.#eZ?o=u(i=p(JSON.stringify(this.#eZ))):(i="",o=new Uint8Array);let E=function(...A){let e=new Uint8Array(A.reduce((A,{length:e})=>A+e,0)),t=0;for(let r of A)e.set(r,t),t+=r.length;return e}(o,u("."),n),c=await H(A,I),h={signature:p(await m(I,c,E)),payload:t};return this.#eW&&(h.header=this.#eW),this.#eZ&&(h.protected=i),h}}class G{#ez;constructor(A){this.#ez=new O(A)}setProtectedHeader(A){return this.#ez.setProtectedHeader(A),this}async sign(A,e){let t=await this.#ez.sign(A,e);if(void 0===t.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${t.protected}.${t.payload}.${t.signature}`}}let J=A=>Math.floor(A.getTime()/1e3),v=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function x(A){let e,t=v.exec(A);if(!t||t[4]&&t[1])throw TypeError("Invalid time period format");let r=parseFloat(t[2]);switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":e=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":e=Math.round(60*r);break;case"hour":case"hours":case"hr":case"hrs":case"h":e=Math.round(3600*r);break;case"day":case"days":case"d":e=Math.round(86400*r);break;case"week":case"weeks":case"w":e=Math.round(604800*r);break;default:e=Math.round(0x1e187e0*r)}return"-"===t[1]||"ago"===t[4]?-e:e}function V(A,e){if(!Number.isFinite(e))throw TypeError(`Invalid ${A} input`);return e}class P{#eq;constructor(A){if(!N(A))throw TypeError("JWT Claims Set MUST be an object");this.#eq=structuredClone(A)}data(){return D.encode(JSON.stringify(this.#eq))}get iss(){return this.#eq.iss}set iss(A){this.#eq.iss=A}get sub(){return this.#eq.sub}set sub(A){this.#eq.sub=A}get aud(){return this.#eq.aud}set aud(A){this.#eq.aud=A}set jti(A){this.#eq.jti=A}set nbf(A){"number"==typeof A?this.#eq.nbf=V("setNotBefore",A):A instanceof Date?this.#eq.nbf=V("setNotBefore",J(A)):this.#eq.nbf=J(new Date)+x(A)}set exp(A){"number"==typeof A?this.#eq.exp=V("setExpirationTime",A):A instanceof Date?this.#eq.exp=V("setExpirationTime",J(A)):this.#eq.exp=J(new Date)+x(A)}set iat(A){void 0===A?this.#eq.iat=J(new Date):A instanceof Date?this.#eq.iat=V("setIssuedAt",J(A)):"string"==typeof A?this.#eq.iat=V("setIssuedAt",J(new Date)+x(A)):this.#eq.iat=V("setIssuedAt",A)}}A.s(["SignJWT",0,class{#eZ;#ej;constructor(A={}){this.#ej=new P(A)}setIssuer(A){return this.#ej.iss=A,this}setSubject(A){return this.#ej.sub=A,this}setAudience(A){return this.#ej.aud=A,this}setJti(A){return this.#ej.jti=A,this}setNotBefore(A){return this.#ej.nbf=A,this}setExpirationTime(A){return this.#ej.exp=A,this}setIssuedAt(A){return this.#ej.iat=A,this}setProtectedHeader(A){return this.#eZ=A,this}async sign(A,e){let t=new G(this.#ej.data());if(t.setProtectedHeader(this.#eZ),Array.isArray(this.#eZ?.crit)&&this.#eZ.crit.includes("b64")&&!1===this.#eZ.b64)throw new o("JWTs MUST NOT use unencoded payload");return t.sign(A,e)}}],827957)},986847,807055,885418,A=>{"use strict";let e=RegExp("^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$");function t(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function r(A,e){if("number"!=typeof A||!Number.isFinite(A)||A<0)throw Error(`${e} must be a non-negative finite number`);return A}function n(A,e){if("string"!=typeof A||0===A.length)throw Error(`${e} must be a non-empty string`);return A}function i(A,e){if(!Array.isArray(A))throw Error(`${e} must be an array`);return A.map((A,t)=>n(A,`${e}[${t}]`))}function a(A,e){return{inputTokens:r(A.inputTokens,`${e}.inputTokens`),outputTokens:r(A.outputTokens,`${e}.outputTokens`),cacheCreationTokens:r(A.cacheCreationTokens,`${e}.cacheCreationTokens`),cacheReadTokens:r(A.cacheReadTokens,`${e}.cacheReadTokens`),totalTokens:r(A.totalTokens,`${e}.totalTokens`),totalCost:r(A.totalCost,`${e}.totalCost`)}}A.s(["CCUSAGE_REPORT_JOB_KIND",0,"ccusage.report","TUNNEL_NAME_REGEX",0,e,"parseCcusageJobResult",0,function(A){let e=t(A,"ccusage job result");if(null!==e.exitCode&&("number"!=typeof e.exitCode||!Number.isInteger(e.exitCode)))throw Error("ccusage job result.exitCode must be an integer or null");if(null!==e.signal&&"string"!=typeof e.signal)throw Error("ccusage job result.signal must be a string or null");if("boolean"!=typeof e.timedOut)throw Error("ccusage job result.timedOut must be a boolean");if("boolean"!=typeof e.cancelled)throw Error("ccusage job result.cancelled must be a boolean");return{exitCode:e.exitCode,signal:e.signal,timedOut:e.timedOut,cancelled:e.cancelled,report:function(A){let e=t(A,"ccusage report");if(!Array.isArray(e.daily))throw Error("ccusage.daily must be an array");return{daily:e.daily.map((A,e)=>(function(A,e){let s=`ccusage.daily[${e}]`,o=t(A,s),g=t(o.metadata,`${s}.metadata`);if(!Array.isArray(o.modelBreakdowns))throw Error(`${s}.modelBreakdowns must be an array`);let C=n(o.period,`${s}.period`);if(!/^\d{4}-\d{2}-\d{2}$/.test(C))throw Error(`${s}.period must use YYYY-MM-DD`);return{...a(o,s),agent:n(o.agent,`${s}.agent`),period:C,metadata:{agents:i(g.agents,`${s}.metadata.agents`)},modelBreakdowns:o.modelBreakdowns.map((A,e)=>{var i;let a;return{modelName:n((a=t(A,i=`${s}.modelBreakdowns[${e}]`)).modelName,`${i}.modelName`),inputTokens:r(a.inputTokens,`${i}.inputTokens`),outputTokens:r(a.outputTokens,`${i}.outputTokens`),cacheCreationTokens:r(a.cacheCreationTokens,`${i}.cacheCreationTokens`),cacheReadTokens:r(a.cacheReadTokens,`${i}.cacheReadTokens`),cost:r(a.cost,`${i}.cost`)}}),modelsUsed:i(o.modelsUsed,`${s}.modelsUsed`)}})(A,e)),totals:a(t(e.totals,"ccusage.totals"),"ccusage.totals")}}(e.report)}}],986847);let s="ios.source.discover",o="ios.source.parse",g="ios.destinations.inspect",C="ios.runDestinations.inspect",Q="ios.build.run",l="ios.build.delete",I="ios.artifact.download",d="ios.build.deploy",E="ios.archive.export",c="ios.test-results.parse",h="ios.coverage.generate",B="ios.signing.inspect",D=[s,o,g,C,Q,l,I,d,E,c,h,B],w=["BUILD","TEST","ANALYZE","ARCHIVE","BUILD_FOR_TESTING","TEST_WITHOUT_BUILDING"],u=["BUILD","ANALYZE","ARCHIVE","BUILD_FOR_TESTING"],p=["PROJECT","WORKSPACE","PACKAGE"],f=["SIMULATOR","PHYSICAL_DEVICE"],y=["FAIL_BUILD","CONTINUE"],M=["ONLY_ACTIVE_ARCH","SWIFT_ACTIVE_COMPILATION_CONDITIONS","SWIFT_OPTIMIZATION_LEVEL","GCC_PREPROCESSOR_DEFINITIONS","OTHER_SWIFT_FLAGS","ENABLE_TESTABILITY","DEBUG_INFORMATION_FORMAT","VALIDATE_PRODUCT","MARKETING_VERSION","CURRENT_PROJECT_VERSION"],m={packageResolution:"DEFAULT",disablePackageRepositoryCache:!1,signingStyle:"PROJECT_DEFAULT",developmentTeam:null,codeSignIdentity:null,provisioningProfileSpecifier:null,productBundleIdentifier:null,allowProvisioningUpdates:!1,allowProvisioningDeviceRegistration:!1,testPlan:null,codeCoverage:!1,parseTestResults:!0,parallelTesting:null,parallelTestingWorkers:null,onlyTesting:[],skipTesting:[],buildSettingOverrides:{},priorBuildForTestingId:null,priorTestProductsPath:null,priorXctestrunPath:null},N=["TEST_RESULTS","CODE_COVERAGE"];function S(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function k(A,e){if("string"!=typeof A||!A.trim())throw Error(`${e} must be a non-empty string`);return A}function U(A,e){return null==A?null:k(A,e)}function F(A,e){if("boolean"!=typeof A)throw Error(`${e} must be a boolean`);return A}function R(A,e,t){if("string"!=typeof A||!e.includes(A))throw Error(`${t} is invalid`);return A}function T(A,e){let t=k(A,e);if(t.startsWith("/")||/^[A-Za-z]:[\\/]/.test(t)||t.split(/[\\/]/).includes("..")||t.includes("\0"))throw Error(`${e} must stay within the worktree`);return t.replaceAll("\\","/")}function b(A,e){let t=k(A,e);if(!t.startsWith("/")||t.split("/").includes("..")||t.includes("\0"))throw Error(`${e} must be an absolute normalized path`);return t}function H(A){return{codebaseId:k(A.codebaseId,"build payload.codebaseId"),worktreeId:k(A.worktreeId,"build payload.worktreeId"),branch:U(A.branch,"build payload.branch"),folder:k(A.folder,"build payload.folder"),gitDirectory:k(A.gitDirectory,"build payload.gitDirectory"),expectedOrigin:k(A.expectedOrigin,"build payload.expectedOrigin"),headSha:U(A.headSha,"build payload.headSha"),baseBranch:U(A.baseBranch,"build payload.baseBranch")}}function L(A){let e=S(A,"build source"),t=R(e.kind,p,"build source.kind"),r=T(e.relativePath,"build source.relativePath");if("PROJECT"===t&&!r.endsWith(".xcodeproj"))throw Error("Project sources must end in .xcodeproj");if("WORKSPACE"===t&&!r.endsWith(".xcworkspace"))throw Error("Workspace sources must end in .xcworkspace");if("PACKAGE"===t&&"Package.swift"!==r)throw Error("Package.swift must be at the worktree root");return{kind:t,relativePath:r}}function O(A){let e=S(A,"build destination");return{type:R(e.type,f,"build destination.type"),id:k(e.id,"build destination.id"),name:k(e.name,"build destination.name"),platform:k(e.platform,"build destination.platform"),osVersion:U(e.osVersion,"build destination.osVersion"),state:U(e.state,"build destination.state"),...void 0===e.generic?{}:{generic:F(e.generic,"build destination.generic")}}}function G(A,e){if(!Array.isArray(A))throw Error(`${e} must be an array`);return A.map((A,t)=>k(A,`${e}[${t}]`))}function J(A){let e={...m,...S(A??{},"advanced settings")},t=S(e.buildSettingOverrides??{},"advanced settings.buildSettingOverrides"),r={};for(let[A,e]of Object.entries(t)){if(!M.includes(A))throw Error(`Build setting override ${A} is not approved`);r[A]=k(e,`advanced settings.buildSettingOverrides.${A}`)}let n=e.parallelTestingWorkers;if(null!=n&&("number"!=typeof n||!Number.isInteger(n)||n<1||n>128))throw Error("parallelTestingWorkers must be between 1 and 128");let i=e.parallelTesting;if(null!==i&&"boolean"!=typeof i)throw Error("parallelTesting must be a boolean or null");return{packageResolution:R(e.packageResolution,["DEFAULT","RESOLVED_ONLY","SKIP_UPDATES","DISABLE_AUTOMATIC"],"advanced settings.packageResolution"),disablePackageRepositoryCache:F(e.disablePackageRepositoryCache,"advanced settings.disablePackageRepositoryCache"),signingStyle:R(e.signingStyle,["PROJECT_DEFAULT","AUTOMATIC","MANUAL"],"advanced settings.signingStyle"),developmentTeam:U(e.developmentTeam,"advanced settings.developmentTeam"),codeSignIdentity:U(e.codeSignIdentity,"advanced settings.codeSignIdentity"),provisioningProfileSpecifier:U(e.provisioningProfileSpecifier,"advanced settings.provisioningProfileSpecifier"),productBundleIdentifier:U(e.productBundleIdentifier,"advanced settings.productBundleIdentifier"),allowProvisioningUpdates:F(e.allowProvisioningUpdates,"advanced settings.allowProvisioningUpdates"),allowProvisioningDeviceRegistration:F(e.allowProvisioningDeviceRegistration,"advanced settings.allowProvisioningDeviceRegistration"),testPlan:U(e.testPlan,"advanced settings.testPlan"),codeCoverage:F(e.codeCoverage,"advanced settings.codeCoverage"),parseTestResults:F(e.parseTestResults,"advanced settings.parseTestResults"),parallelTesting:i,parallelTestingWorkers:n??null,onlyTesting:G(e.onlyTesting,"advanced settings.onlyTesting"),skipTesting:G(e.skipTesting,"advanced settings.skipTesting"),buildSettingOverrides:r,priorBuildForTestingId:U(e.priorBuildForTestingId,"advanced settings.priorBuildForTestingId"),priorTestProductsPath:null===e.priorTestProductsPath||void 0===e.priorTestProductsPath?null:b(e.priorTestProductsPath,"advanced settings.priorTestProductsPath"),priorXctestrunPath:null===e.priorXctestrunPath||void 0===e.priorXctestrunPath?null:b(e.priorXctestrunPath,"advanced settings.priorXctestrunPath")}}function v(A,e){let t=S(A,`build scripts[${e}]`),r=t.timeoutSeconds,n=t.position;if("number"!=typeof r||!Number.isInteger(r)||r<1||r>3600)throw Error(`build scripts[${e}].timeoutSeconds is invalid`);if("number"!=typeof n||!Number.isInteger(n)||n<0)throw Error(`build scripts[${e}].position is invalid`);return{id:k(t.id,`build scripts[${e}].id`),name:k(t.name,`build scripts[${e}].name`),preBuildScript:U(t.preBuildScript,`build scripts[${e}].preBuildScript`),postBuildScript:U(t.postBuildScript,`build scripts[${e}].postBuildScript`),timeoutSeconds:r,failureBehavior:R(t.failureBehavior,y,`build scripts[${e}].failureBehavior`),position:n}}function x(A,e){let t,r=k(A,e);try{t=new URL(r)}catch{throw Error(`${e} must be a valid HTTP(S) URL`)}if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error(`${e} must be a valid HTTP(S) URL`);return t.toString().replace(/\/$/,"")}function V(A){let e=S(A,"build delete payload"),t=k(e.buildId,"build delete payload.buildId"),r=b(e.artifactDirectory,"build delete payload.artifactDirectory");if(r.split("/").at(-1)!==t)throw Error("Build delete folder must end with the build ID");return{buildId:t,artifactDirectory:r,codebaseId:k(e.codebaseId,"build delete payload.codebaseId")}}function P(A){let e=S(A,"export settings"),t=S(e.provisioningProfiles??{},"export settings.provisioningProfiles");return{method:R(e.method,["DEBUGGING","RELEASE_TESTING","ENTERPRISE","APP_STORE_CONNECT"],"export settings.method"),signingStyle:R(e.signingStyle,["AUTOMATIC","MANUAL"],"export settings.signingStyle"),teamId:U(e.teamId,"export settings.teamId"),signingCertificate:U(e.signingCertificate,"export settings.signingCertificate"),provisioningProfiles:Object.fromEntries(Object.entries(t).map(([A,e])=>[k(A,"export settings provisioning profile bundle id"),k(e,`export settings.provisioningProfiles.${A}`)])),uploadSymbols:F(e.uploadSymbols,"export settings.uploadSymbols"),manageAppVersionAndBuildNumber:F(e.manageAppVersionAndBuildNumber,"export settings.manageAppVersionAndBuildNumber"),testFlightInternalTestingOnly:F(e.testFlightInternalTestingOnly,"export settings.testFlightInternalTestingOnly"),stripSwiftSymbols:void 0===e.stripSwiftSymbols||F(e.stripSwiftSymbols,"export settings.stripSwiftSymbols"),thinning:U(e.thinning??null,"export settings.thinning"),iCloudContainerEnvironment:null===e.iCloudContainerEnvironment||void 0===e.iCloudContainerEnvironment?null:R(e.iCloudContainerEnvironment,["Development","Production"],"export settings.iCloudContainerEnvironment"),distributionBundleIdentifier:U(e.distributionBundleIdentifier??null,"export settings.distributionBundleIdentifier")}}A.s(["BUILD_ACTIONS",0,w,"BUILD_CONFIGURATION_ICON_KEYS",0,["apple","app-window","archive","beaker","box","bug","code","gauge","hammer","layers","package","play","rocket","shield","smartphone","sparkles","terminal","test-tube","wrench"],"BUILD_DESTINATION_TYPES",0,f,"BUILD_SCRIPT_FAILURE_BEHAVIORS",0,y,"DEFAULT_BUILD_ADVANCED_SETTINGS",0,m,"GENERIC_BUILD_DESTINATION_ACTIONS",0,u,"IOS_ARTIFACT_DOWNLOAD_JOB_KIND",0,I,"IOS_BUILD_DELETE_JOB_KIND",0,l,"IOS_BUILD_JOB_KIND",0,Q,"IOS_BUILD_JOB_KINDS",0,D,"IOS_COVERAGE_REPORT_JOB_KIND",0,h,"IOS_DEPLOY_JOB_KIND",0,d,"IOS_DESTINATIONS_JOB_KIND",0,g,"IOS_EXPORT_JOB_KIND",0,E,"IOS_RUN_DESTINATIONS_JOB_KIND",0,C,"IOS_SIGNING_INSPECT_JOB_KIND",0,B,"IOS_SOURCE_DISCOVER_JOB_KIND",0,s,"IOS_SOURCE_PARSE_JOB_KIND",0,o,"IOS_TEST_RESULTS_JOB_KIND",0,c,"parseBuildAdvancedSettings",0,J,"parseBuildArtifactDownloadPayload",0,function(A){let e=S(A,"build artifact download payload");return{...V(e),artifactRelativePath:T(e.artifactRelativePath,"build artifact download payload.artifactRelativePath"),uploadId:k(e.uploadId,"build artifact download payload.uploadId")}},"parseBuildArtifactSnapshots",0,function(A){if(!Array.isArray(A))return[];let e=[];for(let t of A)try{let A=S(t,"build artifact");e.push({kind:k(A.kind,"build artifact.kind"),relativePath:T(A.relativePath,"build artifact.relativePath"),sizeBytes:"number"==typeof A.sizeBytes&&Number.isFinite(A.sizeBytes)?A.sizeBytes:null,checksum:U(A.checksum,"build artifact.checksum"),metadata:A.metadata&&"object"==typeof A.metadata&&!Array.isArray(A.metadata)?A.metadata:{}})}catch{continue}return e},"parseBuildDeletePayload",0,V,"parseBuildDeploymentPayload",0,function(A){let e=S(A,"build deployment payload");if(!Array.isArray(e.deployments)||!e.deployments.length)throw Error("build deployment payload.deployments must not be empty");let t=e.deployments.map((A,e)=>{let t=S(A,`deployments[${e}]`);return{id:k(t.id,`deployments[${e}].id`),destination:O(t.destination)}});if(new Set(t.map(({id:A})=>A)).size!==t.length)throw Error("deployment payload IDs must be unique");if(new Set(t.map(({destination:A})=>`${A.type}:${A.id}`)).size!==t.length)throw Error("deployment destinations must be unique");if(new Set(t.map(({destination:A})=>A.type)).size>1)throw Error("deployment destinations must use one destination type");return{...H(e),buildId:k(e.buildId,"build deployment payload.buildId"),artifactDirectory:k(e.artifactDirectory,"build deployment payload.artifactDirectory"),artifactRelativePath:T(e.artifactRelativePath,"build deployment payload.artifactRelativePath"),bundleIdentifier:k(e.bundleIdentifier,"build deployment payload.bundleIdentifier"),deployments:t}},"parseBuildDestination",0,O,"parseBuildDestinationsPayload",0,function(A){let e=S(A,"destinations payload");return{...H(e),source:L(e.source),scheme:k(e.scheme,"destinations payload.scheme"),configuration:k(e.configuration,"destinations payload.configuration"),action:R(e.action,w,"destinations payload.action")}},"parseBuildExportPayload",0,function(A){let e=S(A,"build export payload");return{...H(e),buildId:k(e.buildId,"build export payload.buildId"),exportId:k(e.exportId,"build export payload.exportId"),artifactDirectory:k(e.artifactDirectory,"build export payload.artifactDirectory"),archiveRelativePath:T(e.archiveRelativePath,"build export payload.archiveRelativePath"),settings:P(e.settings)}},"parseBuildExportSettings",0,P,"parseBuildJobPayload",0,function(A){let e=S(A,"build job payload");if(!Array.isArray(e.scripts))throw Error("build job payload.scripts must be an array");let t=e.scripts.map(v);if(new Set(t.map(A=>A.id)).size!==t.length)throw Error("build job payload scripts must be unique");let r=R(e.action,w,"build job payload.action"),n=O(e.destination),i=J(e.advancedSettings);if("ARCHIVE"===r&&("PHYSICAL_DEVICE"!==n.type||!0!==n.generic))throw Error("Archive builds require a generic physical destination");if(n.generic&&!u.includes(r))throw Error("This build action requires a concrete destination");if("TEST_WITHOUT_BUILDING"===r&&(!i.priorBuildForTestingId||!i.priorTestProductsPath&&!i.priorXctestrunPath))throw Error("Test Without Building requires a captured Build for Testing result");return{...H(e),buildId:k(e.buildId,"build job payload.buildId"),artifactDirectory:k(e.artifactDirectory,"build job payload.artifactDirectory"),source:L(e.source),scheme:k(e.scheme,"build job payload.scheme"),configuration:k(e.configuration,"build job payload.configuration"),action:r,destination:n,advancedSettings:i,scripts:t,telemetry:function(A){if(null==A)return;let e=S(A,"build job payload.telemetry");return{localBaseUrl:x(e.localBaseUrl,"build job payload.telemetry.localBaseUrl"),remoteBaseUrl:x(e.remoteBaseUrl,"build job payload.telemetry.remoteBaseUrl"),selectedBaseUrl:x(e.selectedBaseUrl,"build job payload.telemetry.selectedBaseUrl"),consoleLogsUrl:x(e.consoleLogsUrl,"build job payload.telemetry.consoleLogsUrl"),analyticsEventsUrl:x(e.analyticsEventsUrl,"build job payload.telemetry.analyticsEventsUrl"),consoleCollectionEnabled:F(e.consoleCollectionEnabled,"build job payload.telemetry.consoleCollectionEnabled"),analyticsCollectionEnabled:F(e.analyticsCollectionEnabled,"build job payload.telemetry.analyticsCollectionEnabled")}}(e.telemetry),worktreeCoverage:void 0!==e.worktreeCoverage&&F(e.worktreeCoverage,"build job payload.worktreeCoverage")}},"parseBuildReportPayload",0,function(A){let e=S(A,"build report payload");return{...V(e),reportKind:R(e.reportKind,N,"build report payload.reportKind"),source:R(e.source,["MANUAL","WORKTREE"],"build report payload.source")}},"parseBuildRunDestinationsPayload",0,function(A){let e=S(A,"run destinations payload");return{...H(e),destinationType:R(e.destinationType,f,"run destinations payload.destinationType")}},"parseBuildSigningInspectPayload",0,function(A){let e=S(A,"build signing payload");return{buildId:k(e.buildId,"build signing payload.buildId"),codebaseId:k(e.codebaseId,"build signing payload.codebaseId"),artifactDirectory:k(e.artifactDirectory,"build signing payload.artifactDirectory"),archiveRelativePath:T(e.archiveRelativePath,"build signing payload.archiveRelativePath")}},"parseBuildSource",0,L,"parseBuildSourceDiscoverPayload",0,function(A){return H(S(A,"source discovery payload"))},"parseBuildSourceParsePayload",0,function(A){let e=S(A,"source parse payload");return{...H(e),source:L(e.source),scheme:U(e.scheme,"source parse payload.scheme"),configuration:U(e.configuration,"source parse payload.configuration")}}],807055);let Y="buildData.scan",_="buildData.size",K="buildData.delete",q=[Y,_,K],Z=["DEFAULT","ABSOLUTE","RELATIVE"];function W(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function z(A,e){if("string"!=typeof A||0===A.length||A.includes("\0"))throw Error(`${e} must be a non-empty string`);return A}function j(A,e){return null===A?null:z(A,e)}function $(A,e,t){let r=Object.keys(A).find(A=>!e.includes(A));if(r)throw Error(`Unexpected ${t} field: ${r}`)}function X(A){if("string"!=typeof A||!Z.includes(A))throw Error("Derived Data location mode is invalid");return A}function AA(A,e){let t=W(A,`build data worktrees[${e}]`);return $(t,["id","folder"],"build data worktree"),{id:z(t.id,`build data worktrees[${e}].id`),folder:z(t.folder,`build data worktrees[${e}].folder`)}}function Ae(A,e){let t=W(A,`build data targets[${e}]`);return $(t,["path","rootPath"],"build data target"),{path:z(t.path,`build data targets[${e}].path`),rootPath:z(t.rootPath,`build data targets[${e}].rootPath`)}}A.s(["BUILD_DATA_DELETE_JOB_KIND",0,K,"BUILD_DATA_JOB_KINDS",0,q,"BUILD_DATA_SCAN_JOB_KIND",0,Y,"BUILD_DATA_SIZE_JOB_KIND",0,_,"buildDataScanPayload",0,function(A){let e=W(A,"build data scan payload");if($(e,["mode","path","worktrees"],"build data scan payload"),!Array.isArray(e.worktrees))throw Error("build data scan payload.worktrees must be an array");let t=X(e.mode),r=j(e.path,"build data scan payload.path");if("DEFAULT"!==t&&!r)throw Error("Configured Derived Data modes require a path");if("DEFAULT"===t&&null!==r)throw Error("Default Derived Data mode does not accept a path");return{mode:t,path:r,worktrees:e.worktrees.map(AA)}},"buildDataTargetsPayload",0,function(A){let e=W(A,"build data targets payload");if($(e,["targets"],"build data targets payload"),!Array.isArray(e.targets)||e.targets.length>1e4)throw Error("build data targets must be an array of at most 10,000 items");return{targets:e.targets.map(Ae)}},"parseBuildDataDeleteResult",0,function(A){let e=W(A,"build data delete result");if(!Array.isArray(e.deleted))throw Error("build data delete result.deleted must be an array");return{deleted:e.deleted.map((A,e)=>{let t=W(A,`build data deleted[${e}]`);if("boolean"!=typeof t.deleted)throw Error(`build data deleted[${e}].deleted is invalid`);return{path:z(t.path,`build data deleted[${e}].path`),deleted:t.deleted,error:j(t.error,`build data deleted[${e}].error`)}})}},"parseBuildDataScanResult",0,function(A){let e=W(A,"build data scan result");if(!Array.isArray(e.entries)||!Array.isArray(e.warnings))throw Error("build data scan result arrays are invalid");return{entries:e.entries.map((A,e)=>{let t=W(A,`build data entries[${e}]`),r=t.kind;if(!["PROJECT","PENDING","SHARED_CACHE","DEVICE_SUPPORT"].includes(r))throw Error(`build data entries[${e}].kind is invalid`);return{path:z(t.path,`build data entries[${e}].path`),rootPath:z(t.rootPath,`build data entries[${e}].rootPath`),name:z(t.name,`build data entries[${e}].name`),kind:r,workspacePath:j(t.workspacePath,`build data entries[${e}].workspacePath`)}}),warnings:e.warnings.map((A,e)=>z(A,`build data warnings[${e}]`))}},"parseBuildDataSizeResult",0,function(A){let e=W(A,"build data size result");if(!Array.isArray(e.sizes))throw Error("build data size result.sizes must be an array");return{sizes:e.sizes.map((A,e)=>{let t=W(A,`build data sizes[${e}]`);if(null!==t.sizeBytes&&("number"!=typeof t.sizeBytes||!Number.isFinite(t.sizeBytes)||t.sizeBytes<0))throw Error(`build data sizes[${e}].sizeBytes is invalid`);return{path:z(t.path,`build data sizes[${e}].path`),sizeBytes:t.sizeBytes,error:j(t.error,`build data sizes[${e}].error`)}})}},"parseDerivedDataLocationMode",0,X],885418)},184015,119909,A=>{"use strict";let e="codebase.browse",t="codebase.inspect",r="codebase.refresh",n="codebase.fetch",i="codebase.git.inspect",a="codebase.git.operation",s=["SWITCH_BRANCH","DELETE_BRANCH","DELETE_REMOTE_BRANCH","PULL_BRANCH","APPLY_STASH","DELETE_STASH"],o=[e,t,r,n,i,a];function g(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function C(A,e){if("string"!=typeof A||0===A.length)throw Error(`${e} must be a non-empty string`);return A}function Q(A,e){return null===A?null:C(A,e)}function l(A,e){if(null===A)return null;if("number"!=typeof A||!Number.isInteger(A)||A<0)throw Error(`${e} must be a non-negative integer or null`);return A}function I(A,e){if("boolean"!=typeof A)throw Error(`${e} must be a boolean`);return A}function d(A,e){let t=C(A,e);if(!/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/i.test(t))throw Error(`${e} must be a Git object ID`);return t.toLowerCase()}function E(A,e){let t=C(A,e);if(Number.isNaN(new Date(t).valueOf()))throw Error(`${e} must be an ISO date`);return t}function c(A){return!(!A||A.length>255||"@"===A||A.startsWith("-")||A.startsWith("/")||A.endsWith("/")||A.endsWith(".")||A.includes("//")||A.includes("..")||A.includes("@{")||/[\u0000-\u0020\u007f~^:?*[\\]/.test(A))&&A.split("/").every(A=>A&&!A.startsWith(".")&&!A.endsWith(".lock"))}function h(A,e,t){if("string"!=typeof A||!e.includes(A))throw Error(`${t} is invalid`);return A}A.s(["CODEBASE_BROWSE_JOB_KIND",0,e,"CODEBASE_FETCH_JOB_KIND",0,n,"CODEBASE_GIT_INSPECT_JOB_KIND",0,i,"CODEBASE_GIT_OPERATION_JOB_KIND",0,a,"CODEBASE_INSPECT_JOB_KIND",0,t,"CODEBASE_JOB_KINDS",0,o,"CODEBASE_RECONCILE_EVENT_CAPABILITY",0,"codebase.reconcile.requested","CODEBASE_REFRESH_JOB_KIND",0,r,"DEFAULT_CODEBASE_RECONCILE_INTERVAL_SECONDS",0,30,"MAX_CODEBASE_RECONCILE_INTERVAL_SECONDS",0,3600,"MIN_CODEBASE_RECONCILE_INTERVAL_SECONDS",0,10,"codebaseBrowsePayload",0,function(A){let e=g(A,"codebase browse payload"),t=Object.keys(e).find(A=>"path"!==A);if(t)throw Error(`Unexpected codebase browse field: ${t}`);return{path:Q(e.path,"payload.path")}},"codebaseGitInspectPayload",0,function(A){let e=g(A,"codebase Git inspect payload"),t=new Set(["action","codebaseId","folder","expectedOrigin","stashOid"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected codebase Git inspect payload field: ${r}`);if("STATE"!==e.action&&"STASH_DIFF"!==e.action)throw Error("codebase Git inspect payload.action is invalid");let n={codebaseId:C(e.codebaseId,"codebase Git inspect payload.codebaseId"),folder:C(e.folder,"codebase Git inspect payload.folder"),expectedOrigin:C(e.expectedOrigin,"codebase Git inspect payload.expectedOrigin")};if("STATE"===e.action){if(void 0!==e.stashOid)throw Error("STATE inspection cannot include stashOid");return{action:e.action,...n}}return{action:e.action,...n,stashOid:d(e.stashOid,"codebase Git inspect payload.stashOid")}},"codebaseGitOperationPayload",0,function(A){let e=g(A,"codebase Git operation payload"),t=new Set(["codebaseId","folder","expectedOrigin","defaultBranch","operation","branch","stashOid","stashChanges"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected codebase Git operation payload field: ${r}`);let n=h(e.operation,s,"codebase Git operation payload.operation"),i={codebaseId:C(e.codebaseId,"codebase Git operation payload.codebaseId"),folder:C(e.folder,"codebase Git operation payload.folder"),expectedOrigin:C(e.expectedOrigin,"codebase Git operation payload.expectedOrigin"),defaultBranch:void 0===e.defaultBranch||null===e.defaultBranch?null:C(e.defaultBranch,"codebase Git operation payload.defaultBranch"),operation:n};if(["SWITCH_BRANCH","DELETE_BRANCH","DELETE_REMOTE_BRANCH","PULL_BRANCH"].includes(n)){let A=C(e.branch,"codebase Git operation payload.branch");if(!c(A))throw Error("Invalid Git branch name");if(void 0!==e.stashOid)throw Error(`${n} cannot include stashOid`);if("SWITCH_BRANCH"!==n&&void 0!==e.stashChanges)throw Error(`${n} cannot include stashChanges`);if(void 0!==e.stashChanges&&"boolean"!=typeof e.stashChanges)throw Error("stashChanges must be a boolean");return{...i,branch:A,..."SWITCH_BRANCH"===n?{stashChanges:!!e.stashChanges}:{}}}if(void 0!==e.branch||void 0!==e.stashChanges)throw Error(`${n} cannot include branch or stashChanges`);return{...i,stashOid:d(e.stashOid,"codebase Git operation payload.stashOid")}},"codebaseJobPayload",0,function(A){let e=g(A,"codebase job payload"),t=new Set(["folder","codebaseId","expectedOrigin","baseBranch","keepBaseBranchUpToDate"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected codebase payload field: ${r}`);return{folder:C(e.folder,"payload.folder"),...void 0===e.codebaseId?{}:{codebaseId:C(e.codebaseId,"payload.codebaseId")},...void 0===e.expectedOrigin?{}:{expectedOrigin:C(e.expectedOrigin,"payload.expectedOrigin")},...void 0===e.baseBranch?{}:{baseBranch:C(e.baseBranch,"payload.baseBranch")},...void 0===e.keepBaseBranchUpToDate?{}:{keepBaseBranchUpToDate:I(e.keepBaseBranchUpToDate,"payload.keepBaseBranchUpToDate")}}},"parseCodebaseDirectoryListing",0,function(A){let e=g(A,"directory listing");if(!Array.isArray(e.entries))throw Error("directory listing.entries must be an array");if("boolean"!=typeof e.truncated)throw Error("directory listing.truncated must be a boolean");return{path:C(e.path,"directory listing.path"),parentPath:Q(e.parentPath,"directory listing.parentPath"),homePath:C(e.homePath,"directory listing.homePath"),entries:e.entries.map((A,e)=>{let t=g(A,`directory listing.entries[${e}]`);if("boolean"!=typeof t.hidden)throw Error(`directory listing.entries[${e}].hidden is invalid`);return{name:C(t.name,`directory listing.entries[${e}].name`),path:C(t.path,`directory listing.entries[${e}].path`),hidden:t.hidden}}),truncated:e.truncated}},"parseCodebaseGitState",0,function(A){let e=g(A,"codebase Git state");if(!Array.isArray(e.branches))throw Error("codebase Git state.branches must be an array");if(!Array.isArray(e.stashes))throw Error("codebase Git state.stashes must be an array");if(e.branches.length>1e3||e.stashes.length>200)throw Error("codebase Git state exceeds its result limits");return{dirty:I(e.dirty,"codebase Git state.dirty"),branches:e.branches.map((A,e)=>{let t=g(A,`codebase Git state.branches[${e}]`),r=C(t.name,`codebase Git state.branches[${e}].name`);if(!c(r))throw Error(`codebase Git state.branches[${e}].name is invalid`);return{name:r,local:I(t.local,`codebase Git state.branches[${e}].local`),remote:I(t.remote,`codebase Git state.branches[${e}].remote`),current:I(t.current,`codebase Git state.branches[${e}].current`),checkedOutPath:null===t.checkedOutPath?null:C(t.checkedOutPath,`codebase Git state.branches[${e}].checkedOutPath`),lastCommitMessage:null==t.lastCommitMessage?null:C(t.lastCommitMessage,`codebase Git state.branches[${e}].lastCommitMessage`),lastCommitAt:null==t.lastCommitAt?null:E(t.lastCommitAt,`codebase Git state.branches[${e}].lastCommitAt`)}}),branchesTruncated:I(e.branchesTruncated,"codebase Git state.branchesTruncated"),stashes:e.stashes.map((A,e)=>{let t=g(A,`codebase Git state.stashes[${e}]`);return{oid:d(t.oid,`codebase Git state.stashes[${e}].oid`),selector:C(t.selector,`codebase Git state.stashes[${e}].selector`),message:"string"==typeof t.message?t.message:(()=>{throw Error(`codebase Git state.stashes[${e}].message must be a string`)})(),createdAt:E(t.createdAt,`codebase Git state.stashes[${e}].createdAt`)}}),stashesTruncated:I(e.stashesTruncated,"codebase Git state.stashesTruncated")}},"parseCodebaseSnapshot",0,function(A){let e=g(A,"codebase snapshot"),t=C(e.checkedAt,"snapshot.checkedAt");if(Number.isNaN(new Date(t).valueOf()))throw Error("snapshot.checkedAt must be an ISO date");let r=Q(e.fetchedAt,"snapshot.fetchedAt");if(r&&Number.isNaN(new Date(r).valueOf()))throw Error("snapshot.fetchedAt must be an ISO date or null");if("boolean"!=typeof e.linkedWorktree)throw Error("snapshot.linkedWorktree must be a boolean");return{folder:C(e.folder,"snapshot.folder"),observedOrigin:Q(e.observedOrigin,"snapshot.observedOrigin"),canonicalOrigin:Q(e.canonicalOrigin,"snapshot.canonicalOrigin"),displayOrigin:Q(e.displayOrigin,"snapshot.displayOrigin"),branch:Q(e.branch,"snapshot.branch"),headSha:Q(e.headSha,"snapshot.headSha"),upstream:Q(e.upstream,"snapshot.upstream"),ahead:l(e.ahead,"snapshot.ahead"),behind:l(e.behind,"snapshot.behind"),syncState:h(e.syncState,["IN_SYNC","AHEAD","BEHIND","DIVERGED","NO_UPSTREAM","DETACHED","UNKNOWN"],"snapshot.syncState"),availability:h(e.availability,["AVAILABLE","MISSING","NOT_REPOSITORY","ORIGIN_MISMATCH","ERROR"],"snapshot.availability"),error:Q(e.error,"snapshot.error"),checkedAt:t,fetchedAt:r,linkedWorktree:e.linkedWorktree}},"parseCodebaseStashDiff",0,function(A){let e=g(A,"codebase stash diff");if("string"!=typeof e.patch)throw Error("codebase stash diff.patch must be a string");if(new TextEncoder().encode(e.patch).byteLength>262144)throw Error("codebase stash diff.patch exceeds its result limit");return{oid:d(e.oid,"codebase stash diff.oid"),patch:e.patch,truncated:I(e.truncated,"codebase stash diff.truncated")}}],184015);let B="worktree.inspect",D="worktree.operation",w="worktree.watch",u="worktree.branch",p="worktree.move.push",f="worktree.move.checkout",y="worktree.delete",M="worktree.diff.inspect",m="worktree.diff.asset",N=[B,D,w,u,p,f,y,M,m],S=String.raw`\b([A-Z][A-Z0-9_]*-\d+)\b`,k=["OPEN_EDITOR","FORCE_PUSH","SYNC","PUSH","RESET","STASH_ALL","STAGE_ALL","UNSTAGE_ALL"],U=["READY","DIRTY","DETACHED","BEHIND","DIVERGED","UNKNOWN"];function F(A){return!(!A||A.length>255||"@"===A||A.startsWith("-")||A.startsWith("/")||A.endsWith("/")||A.endsWith(".")||A.includes("//")||A.includes("..")||A.includes("@{")||/[\u0000-\u0020\u007f~^:?*[\\]/.test(A))&&A.split("/").every(A=>A&&!A.startsWith(".")&&!A.endsWith(".lock"))}let R=["STAGED","UNSTAGED","UNTRACKED","COMMIT","BRANCH"];function T(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function b(A,e){if("string"!=typeof A||0===A.length)throw Error(`${e} must be a non-empty string`);return A}function H(A,e){return null==A?null:b(A,e)}function L(A,e){let t=b(A,e).replaceAll("\\","/");if(t.startsWith("/")||/^[A-Za-z]:\//.test(t)||t.split("/").includes("..")||t.includes("\0"))throw Error(`${e} must stay within the worktree`);return t}function O(A,e){if(null==A)return null;if("number"!=typeof A||!Number.isInteger(A)||A<0)throw Error(`${e} must be a non-negative integer or null`);return A}function G(A,e){if(null!=A){if("boolean"!=typeof A)throw Error(`${e} must be a boolean`);return A}}function J(A,e){if(void 0!==A)return null===A?null:b(A,e)}function v(A,e){if(void 0!==A)return O(A,e)}function x(A,e){if(null!=A){if("string"!=typeof A||!U.includes(A))throw Error(`${e} is invalid`);return A}}function V(A,e){let t=b(A,e);if(Number.isNaN(new Date(t).valueOf()))throw Error(`${e} must be an ISO date`);return t}function P(A,e){let t=H(A,e);if(t&&Number.isNaN(new Date(t).valueOf()))throw Error(`${e} must be an ISO date or null`);return t}function Y(A,e){if("string"!=typeof A||!["IN_SYNC","AHEAD","BEHIND","DIVERGED","NO_UPSTREAM","DETACHED","UNKNOWN"].includes(A))throw Error(`${e} is invalid`);return A}function _(A,e="worktree"){let t=T(A,e);if("boolean"!=typeof t.primary)throw Error(`${e}.primary must be a boolean`);let r=t.availability;if(!["AVAILABLE","MISSING","ERROR"].includes(r))throw Error(`${e}.availability is invalid`);return{gitDirectory:b(t.gitDirectory,`${e}.gitDirectory`),folder:b(t.folder,`${e}.folder`),relativePath:b(t.relativePath,`${e}.relativePath`),primary:t.primary,branch:H(t.branch,`${e}.branch`),headSha:H(t.headSha,`${e}.headSha`),codeStateHash:J(t.codeStateHash,`${e}.codeStateHash`),upstream:H(t.upstream,`${e}.upstream`),ahead:O(t.ahead,`${e}.ahead`),behind:O(t.behind,`${e}.behind`),syncState:Y(t.syncState,`${e}.syncState`),baseAhead:O(t.baseAhead,`${e}.baseAhead`),baseBehind:O(t.baseBehind,`${e}.baseBehind`),hasStagedChanges:G(t.hasStagedChanges,`${e}.hasStagedChanges`),hasUnstagedChanges:G(t.hasUnstagedChanges,`${e}.hasUnstagedChanges`),pushStatus:x(t.pushStatus,`${e}.pushStatus`)??"UNKNOWN",availability:r,error:H(t.error,`${e}.error`),checkedAt:V(t.checkedAt,`${e}.checkedAt`)}}A.s(["DEFAULT_JIRA_BRANCH_REGEX",0,S,"DEFAULT_WORKTREE_FETCH_INTERVAL_SECONDS",0,300,"MAX_WORKTREE_FETCH_INTERVAL_SECONDS",0,86400,"MIN_WORKTREE_FETCH_INTERVAL_SECONDS",0,60,"WORKTREE_BRANCH_JOB_KIND",0,u,"WORKTREE_DELETE_JOB_KIND",0,y,"WORKTREE_DIFF_ASSET_JOB_KIND",0,m,"WORKTREE_DIFF_JOB_KIND",0,M,"WORKTREE_INSPECT_JOB_KIND",0,B,"WORKTREE_JOB_KINDS",0,N,"WORKTREE_MOVE_CHECKOUT_JOB_KIND",0,f,"WORKTREE_MOVE_PUSH_JOB_KIND",0,p,"WORKTREE_OPERATIONS",0,k,"WORKTREE_OPERATION_JOB_KIND",0,D,"WORKTREE_WATCH_JOB_KIND",0,w,"parseCodebaseWorktreeReport",0,function(A){let e=T(A,"worktree report"),t=void 0===e.localBranches?[]:e.localBranches;if("boolean"!=typeof e.complete)throw Error("worktree report.complete must be a boolean");if(!Array.isArray(t)||!Array.isArray(e.remoteBranches)||!Array.isArray(e.worktrees))throw Error("worktree report arrays are invalid");return{codebaseId:b(e.codebaseId,"worktree report.codebaseId"),complete:e.complete,defaultBranch:H(e.defaultBranch,"worktree report.defaultBranch"),localBranches:t.map((A,e)=>b(A,`worktree report.localBranches[${e}]`)),remoteBranches:e.remoteBranches.map((A,e)=>b(A,`worktree report.remoteBranches[${e}]`)),fetchedAt:P(e.fetchedAt,"worktree report.fetchedAt"),fetchAttemptedAt:P(e.fetchAttemptedAt,"worktree report.fetchAttemptedAt"),fetchError:H(e.fetchError,"worktree report.fetchError"),worktrees:e.worktrees.map((A,e)=>_(A,`worktree report.worktrees[${e}]`))}},"parseWorktreeActivityReport",0,function(A){let e=T(A,"worktree activity report"),t=new Set(["codebaseId","gitDirectory","branch","headSha","codeStateHash","upstream","ahead","behind","syncState","baseAhead","baseBehind","hasStagedChanges","hasUnstagedChanges","pushStatus","observedAt"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree activity field: ${r}`);return{codebaseId:b(e.codebaseId,"worktree activity report.codebaseId"),gitDirectory:b(e.gitDirectory,"worktree activity report.gitDirectory"),branch:J(e.branch,"worktree activity report.branch"),headSha:J(e.headSha,"worktree activity report.headSha"),codeStateHash:J(e.codeStateHash,"worktree activity report.codeStateHash"),upstream:J(e.upstream,"worktree activity report.upstream"),ahead:v(e.ahead,"worktree activity report.ahead"),behind:v(e.behind,"worktree activity report.behind"),syncState:function(A,e){if(void 0!==A)return Y(A,e)}(e.syncState,"worktree activity report.syncState"),baseAhead:v(e.baseAhead,"worktree activity report.baseAhead"),baseBehind:v(e.baseBehind,"worktree activity report.baseBehind"),hasStagedChanges:G(e.hasStagedChanges,"worktree activity report.hasStagedChanges"),hasUnstagedChanges:G(e.hasUnstagedChanges,"worktree activity report.hasUnstagedChanges"),pushStatus:x(e.pushStatus,"worktree activity report.pushStatus"),observedAt:V(e.observedAt,"worktree activity report.observedAt")}},"parseWorktreeInventoryItem",0,_,"validGitBranchName",0,F,"worktreeBranchJobPayload",0,function(A){let e=T(A,"worktree branch payload"),t=new Set(["codebaseId","rootFolder","folder","gitDirectory","expectedOrigin","baseBranch","action","mode","candidates","stashOnFailure"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree branch payload field: ${r}`);if("CREATE"!==e.action&&"CHANGE"!==e.action)throw Error("worktree branch payload.action is invalid");if("NEW"!==e.mode&&"EXISTING"!==e.mode)throw Error("worktree branch payload.mode is invalid");if(!Array.isArray(e.candidates)||e.candidates.length<1||e.candidates.length>100)throw Error("worktree branch payload.candidates is invalid");let n=e.candidates.map((A,e)=>{let t=b(A,`worktree branch payload.candidates[${e}]`);if(!F(t))throw Error(`Invalid Git branch name: ${t}`);return t});if(new Set(n).size!==n.length)throw Error("worktree branch candidates must be unique");let i=H(e.folder,"worktree branch payload.folder"),a=H(e.gitDirectory,"worktree branch payload.gitDirectory");if("CHANGE"===e.action&&(!i||!a))throw Error("Changing a branch requires a worktree folder and Git directory");if("boolean"!=typeof e.stashOnFailure)throw Error("worktree branch payload.stashOnFailure must be a boolean");return{codebaseId:b(e.codebaseId,"worktree branch payload.codebaseId"),rootFolder:b(e.rootFolder,"worktree branch payload.rootFolder"),folder:i,gitDirectory:a,expectedOrigin:b(e.expectedOrigin,"worktree branch payload.expectedOrigin"),baseBranch:b(e.baseBranch,"worktree branch payload.baseBranch"),action:e.action,mode:e.mode,candidates:n,stashOnFailure:e.stashOnFailure}},"worktreeDeleteJobPayload",0,function(A){let e=T(A,"worktree delete payload"),t=new Set(["moveId","codebaseId","rootFolder","folder","gitDirectory","expectedOrigin","branch","defaultBranch","deleteRemoteBranch","requireClean","expectedHeadSha"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree delete payload field: ${r}`);if("boolean"!=typeof e.deleteRemoteBranch||"boolean"!=typeof e.requireClean)throw Error("worktree delete payload flags must be booleans");let n=H(e.branch,"worktree delete payload.branch");if(n&&!F(n))throw Error("Invalid Git branch name");let i=H(e.expectedHeadSha,"worktree delete payload.expectedHeadSha");if(e.requireClean&&!i)throw Error("Clean worktree deletion requires an expected HEAD");return{moveId:H(e.moveId,"worktree delete payload.moveId"),codebaseId:b(e.codebaseId,"worktree delete payload.codebaseId"),rootFolder:b(e.rootFolder,"worktree delete payload.rootFolder"),folder:b(e.folder,"worktree delete payload.folder"),gitDirectory:b(e.gitDirectory,"worktree delete payload.gitDirectory"),expectedOrigin:b(e.expectedOrigin,"worktree delete payload.expectedOrigin"),branch:n,defaultBranch:H(e.defaultBranch,"worktree delete payload.defaultBranch"),deleteRemoteBranch:e.deleteRemoteBranch,requireClean:e.requireClean,expectedHeadSha:i}},"worktreeDiffPayload",0,function(A){let e=T(A,"worktree diff payload"),t=new Set(["codebaseId","folder","gitDirectory","expectedOrigin","baseBranch","scope","path","previousPath","commitSha","uploadId","side"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree diff payload field: ${r}`);if(!R.includes(e.scope))throw Error("worktree diff payload.scope is invalid");if(null!==e.side&&void 0!==e.side&&"BEFORE"!==e.side&&"AFTER"!==e.side)throw Error("worktree diff payload.side is invalid");let n=null===e.path||void 0===e.path?null:L(e.path,"worktree diff payload.path"),i=null===e.previousPath||void 0===e.previousPath?null:L(e.previousPath,"worktree diff payload.previousPath"),a=e.scope,s=H(e.commitSha,"worktree diff payload.commitSha");if("COMMIT"===a&&!s)throw Error("Commit diffs require a commit SHA");return{codebaseId:b(e.codebaseId,"worktree diff payload.codebaseId"),folder:b(e.folder,"worktree diff payload.folder"),gitDirectory:b(e.gitDirectory,"worktree diff payload.gitDirectory"),expectedOrigin:b(e.expectedOrigin,"worktree diff payload.expectedOrigin"),baseBranch:b(e.baseBranch,"worktree diff payload.baseBranch"),scope:a,path:n,previousPath:i,commitSha:s,uploadId:H(e.uploadId,"worktree diff payload.uploadId"),side:e.side??null}},"worktreeJobPayload",0,function(A){let e=T(A,"worktree payload"),t=new Set(["codebaseId","folder","gitDirectory","expectedOrigin","baseBranch","operation","editorVariant"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree payload field: ${r}`);let n=e.operation;if(void 0!==n&&("string"!=typeof n||!k.includes(n)))throw Error("worktree payload.operation is invalid");let i=e.editorVariant;if(void 0!==i&&!["CODE","CODE_INSIDERS","NONE"].includes(String(i)))throw Error("worktree payload.editorVariant is invalid");return{codebaseId:b(e.codebaseId,"worktree payload.codebaseId"),folder:b(e.folder,"worktree payload.folder"),gitDirectory:b(e.gitDirectory,"worktree payload.gitDirectory"),expectedOrigin:b(e.expectedOrigin,"worktree payload.expectedOrigin"),baseBranch:H(e.baseBranch,"worktree payload.baseBranch"),...void 0===n?{}:{operation:n},...void 0===i?{}:{editorVariant:i}}},"worktreeMoveCheckoutJobPayload",0,function(A){let e=T(A,"worktree move checkout payload"),t=new Set(["moveId","codebaseId","rootFolder","folder","gitDirectory","expectedOrigin","branch","expectedHeadSha","baseBranch","mode","stashOnFailure"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree move checkout payload field: ${r}`);if("NEW"!==e.mode&&"EXISTING"!==e.mode)throw Error("worktree move checkout payload.mode is invalid");if("boolean"!=typeof e.stashOnFailure)throw Error("worktree move checkout payload.stashOnFailure must be a boolean");let n=H(e.folder,"worktree move checkout payload.folder"),i=H(e.gitDirectory,"worktree move checkout payload.gitDirectory");if("EXISTING"===e.mode&&(!n||!i))throw Error("An existing destination worktree is required");let a=b(e.branch,"worktree move checkout payload.branch");if(!F(a))throw Error("Invalid Git branch name");return{moveId:b(e.moveId,"worktree move checkout payload.moveId"),codebaseId:b(e.codebaseId,"worktree move checkout payload.codebaseId"),rootFolder:b(e.rootFolder,"worktree move checkout payload.rootFolder"),folder:n,gitDirectory:i,expectedOrigin:b(e.expectedOrigin,"worktree move checkout payload.expectedOrigin"),branch:a,expectedHeadSha:b(e.expectedHeadSha,"worktree move checkout payload.expectedHeadSha"),baseBranch:b(e.baseBranch,"worktree move checkout payload.baseBranch"),mode:e.mode,stashOnFailure:e.stashOnFailure}},"worktreeMovePushJobPayload",0,function(A){let e=T(A,"worktree move push payload"),t=new Set(["moveId","codebaseId","folder","gitDirectory","expectedOrigin","branch","expectedHeadSha"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree move push payload field: ${r}`);let n=b(e.branch,"worktree move push payload.branch");if(!F(n))throw Error("Invalid Git branch name");return{moveId:b(e.moveId,"worktree move push payload.moveId"),codebaseId:b(e.codebaseId,"worktree move push payload.codebaseId"),folder:b(e.folder,"worktree move push payload.folder"),gitDirectory:b(e.gitDirectory,"worktree move push payload.gitDirectory"),expectedOrigin:b(e.expectedOrigin,"worktree move push payload.expectedOrigin"),branch:n,expectedHeadSha:b(e.expectedHeadSha,"worktree move push payload.expectedHeadSha")}},"worktreeWatchJobPayload",0,function(A){let e=T(A,"worktree watch payload"),t=new Set(["codebaseId","folder","gitDirectory","expectedOrigin","baseBranch","action","watchId"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected worktree watch payload field: ${r}`);if(!["START","STOP"].includes(e.action))throw Error("worktree watch payload.action is invalid");return{codebaseId:b(e.codebaseId,"worktree watch payload.codebaseId"),folder:b(e.folder,"worktree watch payload.folder"),gitDirectory:b(e.gitDirectory,"worktree watch payload.gitDirectory"),expectedOrigin:b(e.expectedOrigin,"worktree watch payload.expectedOrigin"),baseBranch:H(e.baseBranch,"worktree watch payload.baseBranch"),action:e.action,watchId:b(e.watchId,"worktree watch payload.watchId")}}],119909)},320058,692680,A=>{"use strict";var e=A.i(666680);let t="skills.scan",r="skills.read",n="skills.apply",i=[t,r,n],a=["CURSOR","GITHUB_COPILOT","CODEX","CLAUDE","OPENCODE"],s=["CURSOR","GITHUB_COPILOT","AGENTS","CLAUDE","CODEX_LEGACY","OPENCODE"],o=RegExp("^[a-z0-9]+(?:-[a-z0-9]+)*$");function g(A){let t=(0,e.createHash)("sha256");for(let e of[...A].sort((A,e)=>A.path.localeCompare(e.path)))t.update(e.path),t.update("\0"),t.update(e.executable?"1":"0"),t.update("\0"),t.update(Buffer.from(e.contentsBase64,"base64")),t.update("\0");return t.digest("hex")}function C(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function Q(A,e){if("string"!=typeof A||0===A.length)throw Error(`${e} must be a non-empty string`);return A}function l(A,e,t){let r=Q(A,t);if(!e.includes(r))throw Error(`${t} is invalid`);return r}function I(A,e){let t=Q(A,e);if(t.includes("\0")||t.length>4096)throw Error(`${e} is invalid`);return t}function d(A,e){let t=l(A.scope,["GLOBAL","PROJECT"],`${e}.scope`),r=null===A.folder?null:I(A.folder,`${e}.folder`);if("GLOBAL"===t!=(null===r))throw Error(`${e}.folder must be null only for global skills`);return{scope:t,rootKind:l(A.rootKind,s,`${e}.rootKind`),folder:r}}function E(A,e="skill name"){let t=Q(A,e);if(t.length>64||!o.test(t))throw Error(`${e} must use 1-64 lowercase letters, numbers, and single hyphens`);return t}function c(A,e="skill package"){let t=C(A,e),r=E(t.name,`${e}.name`),n=Q(t.description,`${e}.description`).trim();if(n.length>1024)throw Error(`${e}.description must be 1-1024 characters`);if(!Array.isArray(t.files)||0===t.files.length||t.files.length>500)throw Error(`${e}.files must contain 1-500 files`);let i=0,a=new Set,s=t.files.map((A,t)=>{let r=C(A,`${e}.files[${t}]`),n=function(A,e="file path"){let t=Q(A,e).replaceAll("\\","/");if(t.length>512||t.startsWith("/")||t.endsWith("/")||t.split("/").some(A=>!A||"."===A||".."===A||A.includes("\0")))throw Error(`${e} must stay within the skill directory`);return t}(r.path,`${e}.files[${t}].path`);if(a.has(n))throw Error(`${e} contains duplicate path ${n}`);a.add(n);let s=Q(r.contentsBase64,`${e}.files[${t}].contentsBase64`),o=Buffer.from(s,"base64").byteLength;if(o>0xa00000)throw Error(`${n} exceeds the per-file limit`);return i+=o,{path:n,contentsBase64:s,executable:!0===r.executable}});if(!a.has("SKILL.md"))throw Error(`${e} must contain SKILL.md`);if(i>0x1400000)throw Error(`${e} exceeds the package size limit`);let o=function(A){let e=A.replaceAll("\r\n","\n");if(!e.startsWith("---\n"))throw Error("SKILL.md must begin with YAML frontmatter");let t=e.indexOf("\n---",4);if(t<0)throw Error("SKILL.md frontmatter is not closed");let r=e.slice(4,t).split("\n"),n=new Map;for(let A=0;A<r.length;A+=1){let e=/^([A-Za-z][A-Za-z0-9_-]*):(?:\s*(.*))?$/.exec(r[A]??"");if(!e)continue;let t=e[1],i=e[2]??"";if("|"===i||">"===i){let e=[];for(;A+1<r.length&&/^(?:\s+|$)/.test(r[A+1]??"");)e.push((r[A+=1]??"").replace(/^\s+/,""));n.set(t,">"===i?e.join(" ").trim():e.join("\n").trim())}else n.set(t,function(A){let e=A.trim();if(e.startsWith('"')&&e.endsWith('"'))try{return JSON.parse(e)}catch{return e.slice(1,-1)}return e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1).replaceAll("''","'"):e}(i))}let i=E(n.get("name"),"SKILL.md name"),a=(n.get("description")??"").trim();if(!a||a.length>1024)throw Error("SKILL.md description must be 1-1024 characters");return{name:i,description:a}}(Buffer.from(s.find(A=>"SKILL.md"===A.path).contentsBase64,"base64").toString("utf8"));if(o.name!==r||o.description!==n)throw Error(`${e} metadata must match SKILL.md frontmatter`);let l=Q(t.packageHash,`${e}.packageHash`);if(g(s)!==l)throw Error(`${e}.packageHash does not match its files`);return{name:r,description:n,packageHash:l,files:s}}function h(A){let e=C(A,"skills.scan payload");if(!Array.isArray(e.tools)||!Array.isArray(e.targets))throw Error("skills.scan requires tools and targets arrays");return{tools:[...new Set(e.tools.map((A,e)=>l(A,a,`tools[${e}]`)))],targets:e.targets.slice(0,2e3).map((A,e)=>{var t,r;let n=C(A,`targets[${e}]`);return{codebaseId:Q(n.codebaseId,`targets[${e}].codebaseId`),worktreeId:(t=n.worktreeId,r=`targets[${e}].worktreeId`,null===t?null:Q(t,r)),folder:I(n.folder,`targets[${e}].folder`)}})}}A.s(["AI_TOOLS",0,a,"SKILL_APPLY_JOB_KIND",0,n,"SKILL_JOB_KINDS",0,i,"SKILL_READ_JOB_KIND",0,r,"SKILL_SCAN_JOB_KIND",0,t,"hashSkillFiles",0,g,"parseSkillApplyPayload",0,function(A){let e=C(A,"skills.apply payload");if(!Array.isArray(e.operations))throw Error("skills.apply requires operations");return{operations:e.operations.slice(0,500).map((A,e)=>{let t=C(A,`operations[${e}]`),r=d(t,`operations[${e}]`);if("WRITE"===t.kind)return{kind:"WRITE",...r,package:c(t.package,`operations[${e}].package`),manageGitExclude:!0===t.manageGitExclude};if("DELETE"===t.kind)return{kind:"DELETE",...r,skillName:E(t.skillName,`operations[${e}].skillName`),manageGitExclude:!0===t.manageGitExclude};throw Error(`operations[${e}].kind is invalid`)})}},"parseSkillPackage",0,c,"parseSkillReadPayload",0,function(A){let e=C(A,"skills.read payload"),t=h(e);if(!Array.isArray(e.requests))throw Error("skills.read requires requests");return{...t,requests:e.requests.slice(0,200).map((A,e)=>{let t=C(A,`requests[${e}]`);return{...d(t,`requests[${e}]`),skillName:E(t.skillName,`requests[${e}].skillName`)}})}},"parseSkillScanPayload",0,h],320058);let B="ios.signing.assets.scan",D="ios.signing.profile.read",w="ios.signing.profile.install",u="ios.signing.profile.delete",p="ios.signing.identity.import",f="ios.signing.identity.delete",y=[B,D,w,u,p,f];function M(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function m(A,e){if("string"!=typeof A||!A.trim()||A.includes("\0"))throw Error(`${e} must be a non-empty string`);return A}function N(A,e){return null===A?null:m(A,e)}function S(A,e){if(!Array.isArray(A))throw Error(`${e} must be an array`);return A.map((A,t)=>m(A,`${e}[${t}]`))}function k(A,e){if("boolean"!=typeof A)throw Error(`${e} must be a boolean`);return A}function U(A,e){let t=N(A,e);if(null!==t&&!Number.isFinite(Date.parse(t)))throw Error(`${e} must be an ISO-8601 date`);return t}function F(A,e,t){let r=Object.keys(A).find(A=>!e.includes(A));if(r)throw Error(`Unexpected ${t} field: ${r}`)}A.s(["SIGNING_ASSETS_SCAN_JOB_KIND",0,B,"SIGNING_ASSET_JOB_KINDS",0,y,"SIGNING_IDENTITY_DELETE_JOB_KIND",0,f,"SIGNING_IDENTITY_IMPORT_JOB_KIND",0,p,"SIGNING_PROFILE_DELETE_JOB_KIND",0,u,"SIGNING_PROFILE_INSTALL_JOB_KIND",0,w,"SIGNING_PROFILE_READ_JOB_KIND",0,D,"parseSigningAssetsScanResult",0,function(A){let e=M(A,"signing assets result");if(!Array.isArray(e.profiles)||!Array.isArray(e.certificates)||!Array.isArray(e.warnings))throw Error("Signing assets result arrays are invalid");return{profiles:e.profiles.map((A,e)=>{let t=M(A,`signing profiles[${e}]`),r=m(t.profileType,`signing profiles[${e}].profileType`);if(!["DEVELOPMENT","AD_HOC","ENTERPRISE","APP_STORE"].includes(r))throw Error(`signing profiles[${e}].profileType is invalid`);let n=t.deviceCount;if("number"!=typeof n||!Number.isInteger(n)||n<0)throw Error(`signing profiles[${e}].deviceCount is invalid`);return{uuid:m(t.uuid,`signing profiles[${e}].uuid`),contentHash:m(t.contentHash,`signing profiles[${e}].contentHash`),name:m(t.name,`signing profiles[${e}].name`),profileType:r,bundleId:m(t.bundleId,`signing profiles[${e}].bundleId`),teamId:N(t.teamId,`signing profiles[${e}].teamId`),teamName:N(t.teamName,`signing profiles[${e}].teamName`),platforms:S(t.platforms,`signing profiles[${e}].platforms`),deviceCount:n,deviceUdids:void 0===t.deviceUdids?[]:S(t.deviceUdids,`signing profiles[${e}].deviceUdids`),certificateSha1s:S(t.certificateSha1s,`signing profiles[${e}].certificateSha1s`),createdAt:U(t.createdAt,`signing profiles[${e}].createdAt`),expiresAt:U(t.expiresAt,`signing profiles[${e}].expiresAt`),expired:k(t.expired,`signing profiles[${e}].expired`),xcodeManaged:k(t.xcodeManaged,`signing profiles[${e}].xcodeManaged`)}}),certificates:e.certificates.map((A,e)=>{let t=M(A,`signing certificates[${e}]`);return{sha1:m(t.sha1,`signing certificates[${e}].sha1`),sha256:N(t.sha256,`signing certificates[${e}].sha256`),name:m(t.name,`signing certificates[${e}].name`),teamId:N(t.teamId,`signing certificates[${e}].teamId`),certificateType:N(t.certificateType,`signing certificates[${e}].certificateType`),notBefore:U(t.notBefore,`signing certificates[${e}].notBefore`),expiresAt:U(t.expiresAt,`signing certificates[${e}].expiresAt`),expired:k(t.expired,`signing certificates[${e}].expired`),hasPrivateKey:k(t.hasPrivateKey,`signing certificates[${e}].hasPrivateKey`)}}),warnings:S(e.warnings,"signing warnings")}},"signingIdentityDeletePayload",0,function(A){let e=M(A,"signing identity delete payload");F(e,["sha1"],"signing identity delete payload");let t=m(e.sha1,"signing identity SHA-1");if(!/^[A-Fa-f0-9]{40}$/.test(t))throw Error("Signing identity SHA-1 is invalid");return{sha1:t.toUpperCase()}},"signingIdentityImportPayload",0,function(A){let e=M(A,"signing identity import payload");F(e,["transferId","sha256"],"signing identity import payload");let t=m(e.sha256,"signing identity import sha256");if(!/^[A-Fa-f0-9]{64}$/.test(t))throw Error("Signing identity import SHA-256 is invalid");return{transferId:m(e.transferId,"signing identity transfer ID"),sha256:t.toUpperCase()}},"signingProfileInstallPayload",0,function(A){let e=M(A,"signing profile install payload");F(e,["contentBase64"],"signing profile install payload");let t=m(e.contentBase64,"signing profile install payload.contentBase64");if(t.length>2097152)throw Error("Provisioning profile payload is too large");return{contentBase64:t}},"signingProfileKeyPayload",0,function(A){let e=M(A,"signing profile payload");return F(e,["uuid"],"signing profile payload"),{uuid:m(e.uuid,"signing profile payload.uuid")}},"signingScanPayload",0,function(A){return F(M(A,"signing scan payload"),[],"signing scan payload"),{}}],692680)},805422,694355,A=>{"use strict";var e=A.i(666680),t=A.i(750227),r=A.i(986847),n=A.i(807055),i=A.i(885418),a=A.i(184015),s=A.i(119909),o=A.i(320058),g=A.i(692680),C=A.i(243783),Q=A.i(661983);let l=["QUEUED","RUNNING"],I=new Set(["SUCCEEDED","FAILED","CANCELLED","TIMED_OUT"]);function d(A){return(0,e.createHash)("sha256").update(A).digest("hex")}function E(A){Q.agentEventBus.publish(Q.AGENT_CHANGED_TOPIC,{agentChanged:A})}function c(A){Q.agentEventBus.publish((0,Q.agentJobChangedTopic)(A.id),{agentJobChanged:A}),A.ccusageCollectionId&&Q.agentEventBus.publish((0,Q.ccusageCollectionChangedTopic)(A.ccusageCollectionId),{ccusageCollectionChanged:{id:A.ccusageCollectionId}}),A.buildDataCollectionId&&Q.agentEventBus.publish((0,Q.buildDataCollectionChangedTopic)(A.buildDataCollectionId),{buildDataCollectionChanged:{id:A.buildDataCollectionId}})}[r.CCUSAGE_REPORT_JOB_KIND,...i.BUILD_DATA_JOB_KINDS,...a.CODEBASE_JOB_KINDS,...s.WORKTREE_JOB_KINDS,...o.SKILL_JOB_KINDS,...n.IOS_BUILD_JOB_KINDS,...g.SIGNING_ASSET_JOB_KINDS];class h{completionHandlers=new Map;connectionHandlers=new Set;signingSecretTransfers=new Map;createSigningSecretTransfer(A,t,r=3e5){if(!t.p12Base64||t.p12Base64.length>0x2000000)throw Error("Signing identity transfer is empty or too large");let n=(0,e.randomUUID)(),i=Date.now()+Math.max(3e4,Math.min(r,9e5));return this.signingSecretTransfers.set(n,{agentId:A,...t,expiresAt:i}),setTimeout(()=>{let A=this.signingSecretTransfers.get(n);A?.expiresAt===i&&this.signingSecretTransfers.delete(n)},i-Date.now()).unref(),n}claimSigningSecretTransfer(A,e){let t=this.signingSecretTransfers.get(e);if(this.signingSecretTransfers.delete(e),!t||t.expiresAt<=Date.now())throw Error("Signing secret transfer is missing or expired");if(t.agentId!==A)throw Error("Signing secret transfer belongs to another agent");return{p12Base64:t.p12Base64,passphrase:t.passphrase}}revokeSigningSecretTransfer(A){this.signingSecretTransfers.delete(A)}registerCompletionHandler(A,e){this.completionHandlers.set(A,e)}registerConnectionHandler(A){this.connectionHandlers.add(A)}async notifyConnected(A){await Promise.allSettled([...this.connectionHandlers].map(e=>e(A)))}async requestCodebaseReconcile(A){let e=[...new Set(A.filter(Boolean))];if(!e.length)return 0;let t=await (0,C.getPrismaClient)(),r=(await t.agent.findMany({where:{id:{in:e}},select:{id:!0,capabilitiesJson:!0}})).filter(A=>(function(A){try{let e=JSON.parse(A);return Array.isArray(e)?e.filter(A=>"string"==typeof A):[]}catch{return[]}})(A.capabilitiesJson).includes(a.CODEBASE_RECONCILE_EVENT_CAPABILITY));for(let A of r)Q.agentEventBus.publish((0,Q.agentEventsTopic)(A.id),{agentEvents:{type:"CODEBASE_RECONCILE_REQUESTED",job:null}});return r.length}async projectCompletion(A){await this.completionHandlers.get(A.kind)?.(A)}async authenticate(A){if(!A)return null;let e=await (0,C.getPrismaClient)(),t=await e.agent.findUnique({where:{secretHash:d(A)},select:{id:!0}});return t?.id??null}async createEnrollmentToken(A=15){let t=Math.max(1,Math.min(A,1440)),r=`enroll_${(0,e.randomBytes)(32).toString("base64url")}`,n=new Date(Date.now()+6e4*t),i=await (0,C.getPrismaClient)();return await i.agentEnrollmentToken.create({data:{id:(0,e.randomUUID)(),tokenHash:d(r),expiresAt:n}}),{token:r,expiresAt:n}}async enroll(A){let t=await (0,C.getPrismaClient)(),r=`agent_${(0,e.randomBytes)(32).toString("base64url")}`,n=new Date,i=await t.$transaction(async t=>{if(1!==(await t.agentEnrollmentToken.updateMany({where:{tokenHash:d(A.enrollmentToken),usedAt:null,expiresAt:{gt:n}},data:{usedAt:n}})).count)throw Error("Enrollment token is invalid, expired, or already used");let i=await t.agent.create({data:{id:(0,e.randomUUID)(),name:A.name.trim()||A.hostname,hostname:A.hostname,version:A.version,osVersion:A.osVersion,architecture:A.architecture,cpuModel:A.cpuModel,memoryTotalBytes:A.memoryTotalBytes,memoryFreeBytes:A.memoryFreeBytes,diskTotalBytes:A.diskTotalBytes,diskFreeBytes:A.diskFreeBytes,capabilitiesJson:JSON.stringify(A.capabilities),defaultBuildsDirectory:A.defaultBuildsDirectory??null,secretHash:d(r),ipAddress:A.ipAddress,lastSeenAt:n}});return await t.agentAuditEvent.create({data:{id:(0,e.randomUUID)(),agentId:i.id,action:"agent.enrolled",ipAddress:A.ipAddress}}),i});return E(i),await this.notifyConnected(i.id),{agent:i,credential:r}}async heartbeat(A,e){let t=await (0,C.getPrismaClient)(),r=await t.agent.findUnique({where:{id:A},select:{lastSeenAt:!0,disconnectedAt:!0}}),n=new Date,i=!r?.lastSeenAt||null!==r.disconnectedAt||n.getTime()-r.lastSeenAt.getTime()>45e3,a=await t.agent.update({where:{id:A},data:{version:e.version,osVersion:e.osVersion,architecture:e.architecture,cpuModel:e.cpuModel??void 0,memoryTotalBytes:e.memoryTotalBytes??void 0,memoryFreeBytes:e.memoryFreeBytes??void 0,diskTotalBytes:e.diskTotalBytes??void 0,diskFreeBytes:e.diskFreeBytes??void 0,capabilitiesJson:JSON.stringify(e.capabilities),defaultBuildsDirectory:e.defaultBuildsDirectory??void 0,ipAddress:e.ipAddress??void 0,lastSeenAt:n,disconnectedAt:null}});return E(a),i&&await this.notifyConnected(a.id),a}async listAgents(){return(await (0,C.getPrismaClient)()).agent.findMany({orderBy:{createdAt:"desc"}})}async getAgent(A){return(await (0,C.getPrismaClient)()).agent.findUnique({where:{id:A}})}async deleteAgent(A){let e=await (0,C.getPrismaClient)();return!!await e.agent.findUnique({where:{id:A}})&&(await e.agent.delete({where:{id:A}}),!0)}async updateBaseRepoDirectory(A,e){if(null!==e&&(!e||e.length>4096||e.includes("\0")||!t.posix.isAbsolute(e)&&!t.win32.isAbsolute(e)))throw Error("Base repository directory must be an absolute path");let r=await (0,C.getPrismaClient)(),n=await r.agent.update({where:{id:A},data:{baseRepoDirectory:e}});return E(n),n}async updateBuildsDirectory(A,e){if(null!==e&&(!e||e.length>4096||e.includes("\0")||!t.posix.isAbsolute(e)&&!t.win32.isAbsolute(e)))throw Error("Builds directory must be an absolute path");let r=await (0,C.getPrismaClient)(),n=await r.agent.update({where:{id:A},data:{buildsDirectory:e}});return E(n),n}async updateDerivedDataSettings(A,e,r){let n=(0,i.parseDerivedDataLocationMode)(e),a=r?.trim()||null;if(a?.includes("\0")||(a?.length??0)>4096)throw Error("Derived Data path is invalid");if("DEFAULT"===n&&null!==a)throw Error("Default Derived Data mode does not accept a path");if("ABSOLUTE"===n&&(!a||!t.posix.isAbsolute(a)&&!t.win32.isAbsolute(a)))throw Error("Custom Derived Data directory must be an absolute path");if("RELATIVE"===n){let A=a?.replaceAll("\\","/")??"";if(!A||t.posix.isAbsolute(A)||t.win32.isAbsolute(A)||"."===A||A.split("/").some(A=>!A||"."===A||".."===A))throw Error("Relative Derived Data path must stay within each worktree")}let s=await (0,C.getPrismaClient)(),o=await s.agent.update({where:{id:A},data:{derivedDataLocationMode:n,derivedDataPath:a}});return E(o),o}async listJobs(A,e=50,t=!1){return(await (0,C.getPrismaClient)()).agentJob.findMany({where:{agentId:A,...t?{}:{visibility:"USER"}},orderBy:{createdAt:"desc"},take:Math.max(1,Math.min(e,200))})}async getJob(A){return(await (0,C.getPrismaClient)()).agentJob.findUnique({where:{id:A}})}async createJob(A){let t;if(!function(A,e){let t=function(A){if(!A||"object"!=typeof A||Array.isArray(A))throw Error("Job payload must be an object");return A}(e);if(A===i.BUILD_DATA_SCAN_JOB_KIND)return(0,i.buildDataScanPayload)(t);if(A===i.BUILD_DATA_SIZE_JOB_KIND||A===i.BUILD_DATA_DELETE_JOB_KIND)return(0,i.buildDataTargetsPayload)(t);if(A===a.CODEBASE_BROWSE_JOB_KIND)return(0,a.codebaseBrowsePayload)(t);if(A===a.CODEBASE_INSPECT_JOB_KIND||A===a.CODEBASE_REFRESH_JOB_KIND||A===a.CODEBASE_FETCH_JOB_KIND)return(0,a.codebaseJobPayload)(t);if(A===a.CODEBASE_GIT_INSPECT_JOB_KIND)return(0,a.codebaseGitInspectPayload)(t);if(A===a.CODEBASE_GIT_OPERATION_JOB_KIND)return(0,a.codebaseGitOperationPayload)(t);if(A===s.WORKTREE_BRANCH_JOB_KIND)return(0,s.worktreeBranchJobPayload)(t);if(A===s.WORKTREE_MOVE_PUSH_JOB_KIND)return(0,s.worktreeMovePushJobPayload)(t);if(A===s.WORKTREE_MOVE_CHECKOUT_JOB_KIND)return(0,s.worktreeMoveCheckoutJobPayload)(t);if(A===s.WORKTREE_DELETE_JOB_KIND)return(0,s.worktreeDeleteJobPayload)(t);if(A===s.WORKTREE_DIFF_JOB_KIND||A===s.WORKTREE_DIFF_ASSET_JOB_KIND)return(0,s.worktreeDiffPayload)(t);if(A===s.WORKTREE_INSPECT_JOB_KIND||A===s.WORKTREE_OPERATION_JOB_KIND)return(0,s.worktreeJobPayload)(t);if(A===s.WORKTREE_WATCH_JOB_KIND)return(0,s.worktreeWatchJobPayload)(t);if(A===o.SKILL_SCAN_JOB_KIND)return(0,o.parseSkillScanPayload)(e);if(A===o.SKILL_READ_JOB_KIND)return(0,o.parseSkillReadPayload)(e);if(A===o.SKILL_APPLY_JOB_KIND)return(0,o.parseSkillApplyPayload)(e);if(A===g.SIGNING_ASSETS_SCAN_JOB_KIND)return(0,g.signingScanPayload)(e);if(A===g.SIGNING_PROFILE_READ_JOB_KIND||A===g.SIGNING_PROFILE_DELETE_JOB_KIND)return(0,g.signingProfileKeyPayload)(e);if(A===g.SIGNING_PROFILE_INSTALL_JOB_KIND)return(0,g.signingProfileInstallPayload)(e);if(A===g.SIGNING_IDENTITY_IMPORT_JOB_KIND)return(0,g.signingIdentityImportPayload)(e);if(A===g.SIGNING_IDENTITY_DELETE_JOB_KIND)return(0,g.signingIdentityDeletePayload)(e);if(A===n.IOS_SOURCE_DISCOVER_JOB_KIND)return(0,n.parseBuildSourceDiscoverPayload)(e);if(A===n.IOS_SOURCE_PARSE_JOB_KIND)return(0,n.parseBuildSourceParsePayload)(e);if(A===n.IOS_DESTINATIONS_JOB_KIND)return(0,n.parseBuildDestinationsPayload)(e);if(A===n.IOS_RUN_DESTINATIONS_JOB_KIND)return(0,n.parseBuildRunDestinationsPayload)(e);if(A===n.IOS_BUILD_JOB_KIND)return(0,n.parseBuildJobPayload)(e);if(A===n.IOS_BUILD_DELETE_JOB_KIND)return(0,n.parseBuildDeletePayload)(e);if(A===n.IOS_ARTIFACT_DOWNLOAD_JOB_KIND)return(0,n.parseBuildArtifactDownloadPayload)(e);if(A===n.IOS_DEPLOY_JOB_KIND)return(0,n.parseBuildDeploymentPayload)(e);if(A===n.IOS_EXPORT_JOB_KIND)return(0,n.parseBuildExportPayload)(e);if(A===n.IOS_SIGNING_INSPECT_JOB_KIND)return(0,n.parseBuildSigningInspectPayload)(e);if(A===n.IOS_TEST_RESULTS_JOB_KIND||A===n.IOS_COVERAGE_REPORT_JOB_KIND)return(0,n.parseBuildReportPayload)(e);if(A===r.CCUSAGE_REPORT_JOB_KIND){let A=Object.keys(t);if(A.length>0)throw Error(`Unexpected ccusage.report payload field: ${A[0]}`);return}if("cloudflared.runTunnel"!==A)throw Error(`Unsupported agent job kind: ${A}`);if("string"!=typeof t.tunnelName||!r.TUNNEL_NAME_REGEX.test(t.tunnelName))throw Error("cloudflared.runTunnel requires a tunnelName containing only letters, numbers, underscores, or hyphens");let C=Object.keys(t).filter(A=>"tunnelName"!==A);if(C.length>0)throw Error(`Unexpected cloudflared payload field: ${C[0]}`)}(A.kind,A.payload),!A.idempotencyKey.trim())throw Error("idempotencyKey is required");let l=Math.max(10,Math.min(A.timeoutSeconds??86400,604800)),I=await (0,C.getPrismaClient)(),d=await I.agentJob.findUnique({where:{agentId_idempotencyKey:{agentId:A.agentId,idempotencyKey:A.idempotencyKey}}});if(d){if(A.ccusageCollectionId&&d.ccusageCollectionId!==A.ccusageCollectionId){let e=await I.agentJob.update({where:{id:d.id},data:{ccusageCollectionId:A.ccusageCollectionId}});return c(e),e}return d}try{t=await I.agentJob.create({data:{id:(0,e.randomUUID)(),agentId:A.agentId,kind:A.kind,payloadJson:JSON.stringify(A.payload),status:"QUEUED",idempotencyKey:A.idempotencyKey,timeoutSeconds:l,ccusageCollectionId:A.ccusageCollectionId??null,buildDataCollectionId:A.buildDataCollectionId??null,codebaseId:A.codebaseId??null,worktreeId:A.worktreeId??null,visibility:A.visibility??"USER"}})}catch(t){let e=await I.agentJob.findUnique({where:{agentId_idempotencyKey:{agentId:A.agentId,idempotencyKey:A.idempotencyKey}}});if(!e)throw t;if(A.ccusageCollectionId&&e.ccusageCollectionId!==A.ccusageCollectionId)return I.agentJob.update({where:{id:e.id},data:{ccusageCollectionId:A.ccusageCollectionId}});return e}return await I.agentAuditEvent.create({data:{id:(0,e.randomUUID)(),agentId:A.agentId,action:"job.created",details:JSON.stringify({jobId:t.id,kind:t.kind})}}),c(t),Q.agentEventBus.publish((0,Q.agentEventsTopic)(A.agentId),{agentEvents:{type:"JOB_AVAILABLE",job:t}}),t}async claimJob(A,e){let t=await (0,C.getPrismaClient)(),r=await t.agentJob.updateMany({where:{id:e,agentId:A,status:"QUEUED"},data:{status:"RUNNING",startedAt:new Date}}),n=await t.agentJob.findUnique({where:{id:e}});if(!n||n.agentId!==A)throw Error("Job not found for this agent");if(1!==r.count&&"RUNNING"!==n.status)throw Error(`Job cannot be claimed from status ${n.status}`);return c(n),n}async appendLogs(A,t,r){let n=await (0,C.getPrismaClient)(),i=await n.agentJob.findUnique({where:{id:t}});if(!i||i.agentId!==A)throw Error("Job not found for this agent");let a=r.slice(0,200).map(A=>({id:(0,e.randomUUID)(),jobId:t,sequence:A.sequence,stream:A.stream,message:A.message.slice(0,64e3),createdAt:new Date(A.createdAt)}));if(a.some(A=>Number.isNaN(A.createdAt.valueOf())))throw Error("Log createdAt must be an ISO date");await Promise.all(a.map(A=>n.agentJobLog.upsert({where:{jobId_sequence:{jobId:t,sequence:A.sequence}},create:A,update:{}})));let s=await n.agentJobLog.findMany({where:{jobId:t,sequence:{in:a.map(A=>A.sequence)}},orderBy:{sequence:"asc"}});for(let A of s)Q.agentEventBus.publish((0,Q.agentJobLogTopic)(t),{agentJobLogAdded:A});return s}async completeJob(A,e,t,r,n){if(!I.has(t))throw Error("A final job status is required");let i=await (0,C.getPrismaClient)(),a=await i.agentJob.findUnique({where:{id:e}});if(!a||a.agentId!==A)throw Error("Job not found for this agent");if(I.has(a.status))return await this.projectCompletion(a),a;let s=await i.agentJob.updateMany({where:{id:e,agentId:A,status:{in:l}},data:{status:t,resultJson:null==r?null:JSON.stringify(r),error:n,finishedAt:new Date}}),o=await i.agentJob.findUnique({where:{id:e}});if(!o||o.agentId!==A)throw Error("Job not found for this agent");if(1!==s.count){if(I.has(o.status))return await this.projectCompletion(o),o;throw Error(`Job cannot be completed from status ${o.status}`)}return await this.projectCompletion(o),c(o),o}async cancelJob(A){let e=await (0,C.getPrismaClient)(),t=await e.agentJob.findUnique({where:{id:A}});if(!t)throw Error("Job not found");if(!l.includes(t.status))return t;let r=await e.agentJob.update({where:{id:A},data:{status:"CANCELLED",finishedAt:new Date}});return c(r),Q.agentEventBus.publish((0,Q.agentEventsTopic)(t.agentId),{agentEvents:{type:"JOB_CANCEL_REQUESTED",job:r}}),r}async timeoutCollectionJobs(A){let e=await (0,C.getPrismaClient)(),t=await e.agentJob.findMany({where:{ccusageCollectionId:A,status:{in:l}}}),r=[];for(let A of t){if(1!==(await e.agentJob.updateMany({where:{id:A.id,status:{in:l}},data:{status:"TIMED_OUT",finishedAt:new Date}})).count)continue;let t=await e.agentJob.findUnique({where:{id:A.id}});t&&(r.push(t),c(t),Q.agentEventBus.publish((0,Q.agentEventsTopic)(t.agentId),{agentEvents:{type:"JOB_CANCEL_REQUESTED",job:t}}))}return r}async timeoutBuildDataCollectionJobs(A){let e=await (0,C.getPrismaClient)(),t=await e.agentJob.findMany({where:{buildDataCollectionId:A,kind:i.BUILD_DATA_SCAN_JOB_KIND,status:{in:l}}}),r=[];for(let A of t){if(1!==(await e.agentJob.updateMany({where:{id:A.id,status:{in:l}},data:{status:"TIMED_OUT",finishedAt:new Date}})).count)continue;let t=await e.agentJob.findUnique({where:{id:A.id}});t&&(r.push(t),c(t),Q.agentEventBus.publish((0,Q.agentEventsTopic)(t.agentId),{agentEvents:{type:"JOB_CANCEL_REQUESTED",job:t}}))}return r}async listLogs(A,e=-1){return(await (0,C.getPrismaClient)()).agentJobLog.findMany({where:{jobId:A,sequence:{gt:e}},orderBy:{sequence:"asc"},take:5e3})}}A.s(["AGENT_ONLINE_WINDOW_MS",0,45e3,"AgentControlService",0,h],694355),A.s([],805422)},127438,486618,A=>{"use strict";var e;let t=Object.freeze({status:"aborted"}),r=Symbol("zod_brand");(e=globalThis).__zod_globalConfig??(e.__zod_globalConfig={});let n=globalThis.__zod_globalConfig;function i(A){return{get value(){{let e=A();return Object.defineProperty(this,"value",{value:e}),e}}}}A.s(["$ZodAsyncError",0,class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},"$ZodEncodeError",0,class extends Error{constructor(A){super(`Encountered unidirectional transform during encode: ${A}`),this.name="ZodEncodeError"}},"$brand",0,r,"$constructor",0,function(A,e,t){function r(t,r){if(t._zod||Object.defineProperty(t,"_zod",{value:{def:r,constr:a,traits:new Set},enumerable:!1}),t._zod.traits.has(A))return;t._zod.traits.add(A),e(t,r);let n=a.prototype,i=Object.keys(n);for(let A=0;A<i.length;A++){let e=i[A];e in t||(t[e]=n[e].bind(t))}}let n=t?.Parent??Object;class i extends n{}function a(A){var e;let n=t?.Parent?new i:this;for(let t of(r(n,A),(e=n._zod).deferred??(e.deferred=[]),n._zod.deferred))t();return n}return Object.defineProperty(i,"name",{value:A}),Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:e=>!!t?.Parent&&e instanceof t.Parent||e?._zod?.traits?.has(A)}),Object.defineProperty(a,"name",{value:A}),a},"NEVER",0,t,"config",0,function(A){return A&&Object.assign(n,A),n},"globalConfig",0,n],127438);let a=Symbol("evaluating");function s(A,e,t){Object.defineProperty(A,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function o(...A){let e={};for(let t of A)Object.assign(e,Object.getOwnPropertyDescriptors(t));return Object.defineProperties({},e)}let g="captureStackTrace"in Error?Error.captureStackTrace:(...A)=>{};function C(A){return"object"==typeof A&&null!==A&&!Array.isArray(A)}let Q=i(()=>{if(n.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(A){return!1}});function l(A){if(!1===C(A))return!1;let e=A.constructor;if(void 0===e||"function"!=typeof e)return!0;let t=e.prototype;return!1!==C(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}let I=new Set(["string","number","symbol"]),d=new Set(["string","number","bigint","boolean","symbol","undefined"]);function E(A,e,t){let r=new A._zod.constr(e??A._zod.def);return(!e||t?.parent)&&(r._zod.parent=A),r}function c(A){return"bigint"==typeof A?A.toString()+"n":"string"==typeof A?`"${A}"`:`${A}`}let h={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},B={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function D(A){return"string"==typeof A?A:A?.message}function w(A){let e=atob(A),t=new Uint8Array(e.length);for(let A=0;A<e.length;A++)t[A]=e.charCodeAt(A);return t}function u(A){let e="";for(let t=0;t<A.length;t++)e+=String.fromCharCode(A[t]);return btoa(e)}A.s(["BIGINT_FORMAT_RANGES",0,B,"Class",0,class{constructor(...A){}},"NUMBER_FORMAT_RANGES",0,h,"aborted",0,function(A,e=0){if(!0===A.aborted)return!0;for(let t=e;t<A.issues.length;t++)if(A.issues[t]?.continue!==!0)return!0;return!1},"allowsEval",0,Q,"assert",0,function(A){},"assertEqual",0,function(A){return A},"assertIs",0,function(A){},"assertNever",0,function(A){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(A){return A},"assignProp",0,s,"base64ToUint8Array",0,w,"base64urlToUint8Array",0,function(A){let e=A.replace(/-/g,"+").replace(/_/g,"/"),t="=".repeat((4-e.length%4)%4);return w(e+t)},"cached",0,i,"captureStackTrace",0,g,"cleanEnum",0,function(A){return Object.entries(A).filter(([A,e])=>Number.isNaN(Number.parseInt(A,10))).map(A=>A[1])},"cleanRegex",0,function(A){let e=+!!A.startsWith("^"),t=A.endsWith("$")?A.length-1:A.length;return A.slice(e,t)},"clone",0,E,"cloneDef",0,function(A){return o(A._zod.def)},"createTransparentProxy",0,function(A){let e;return new Proxy({},{get:(t,r,n)=>(e??(e=A()),Reflect.get(e,r,n)),set:(t,r,n,i)=>(e??(e=A()),Reflect.set(e,r,n,i)),has:(t,r)=>(e??(e=A()),Reflect.has(e,r)),deleteProperty:(t,r)=>(e??(e=A()),Reflect.deleteProperty(e,r)),ownKeys:t=>(e??(e=A()),Reflect.ownKeys(e)),getOwnPropertyDescriptor:(t,r)=>(e??(e=A()),Reflect.getOwnPropertyDescriptor(e,r)),defineProperty:(t,r,n)=>(e??(e=A()),Reflect.defineProperty(e,r,n))})},"defineLazy",0,function(A,e,t){let r;Object.defineProperty(A,e,{get(){if(r!==a)return void 0===r&&(r=a,r=t()),r},set(t){Object.defineProperty(A,e,{value:t})},configurable:!0})},"esc",0,function(A){return JSON.stringify(A)},"escapeRegex",0,function(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},"explicitlyAborted",0,function(A,e=0){if(!0===A.aborted)return!0;for(let t=e;t<A.issues.length;t++)if(A.issues[t]?.continue===!1)return!0;return!1},"extend",0,function(A,e){if(!l(e))throw Error("Invalid input to extend: expected a plain object");let t=A._zod.def.checks;if(t&&t.length>0){let t=A._zod.def.shape;for(let A in e)if(void 0!==Object.getOwnPropertyDescriptor(t,A))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=o(A._zod.def,{get shape(){let t={...A._zod.def.shape,...e};return s(this,"shape",t),t}});return E(A,r)},"finalizeIssue",0,function(A,e,t){let r=A.message?A.message:D(A.inst?._zod.def?.error?.(A))??D(e?.error?.(A))??D(t.customError?.(A))??D(t.localeError?.(A))??"Invalid input",{inst:n,continue:i,input:a,...s}=A;return s.path??(s.path=[]),s.message=r,e?.reportInput&&(s.input=a),s},"floatSafeRemainder",0,function(A,e){let t=A/e,r=Math.round(t),n=Number.EPSILON*Math.max(Math.abs(t),1);return Math.abs(t-r)<n?0:t-r},"getElementAtPath",0,function(A,e){return e?e.reduce((A,e)=>A?.[e],A):A},"getEnumValues",0,function(A){let e=Object.values(A).filter(A=>"number"==typeof A);return Object.entries(A).filter(([A,t])=>-1===e.indexOf(+A)).map(([A,e])=>e)},"getLengthableOrigin",0,function(A){return Array.isArray(A)?"array":"string"==typeof A?"string":"unknown"},"getParsedType",0,A=>{let e=typeof A;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(A)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(A))return"array";if(null===A)return"null";if(A.then&&"function"==typeof A.then&&A.catch&&"function"==typeof A.catch)return"promise";if("u">typeof Map&&A instanceof Map)return"map";if("u">typeof Set&&A instanceof Set)return"set";if("u">typeof Date&&A instanceof Date)return"date";if("u">typeof File&&A instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${e}`)}},"getSizableOrigin",0,function(A){return A instanceof Set?"set":A instanceof Map?"map":A instanceof File?"file":"unknown"},"hexToUint8Array",0,function(A){let e=A.replace(/^0x/,"");if(e.length%2!=0)throw Error("Invalid hex string length");let t=new Uint8Array(e.length/2);for(let A=0;A<e.length;A+=2)t[A/2]=Number.parseInt(e.slice(A,A+2),16);return t},"isObject",0,C,"isPlainObject",0,l,"issue",0,function(...A){let[e,t,r]=A;return"string"==typeof e?{message:e,code:"custom",input:t,inst:r}:{...e}},"joinValues",0,function(A,e="|"){return A.map(A=>c(A)).join(e)},"jsonStringifyReplacer",0,function(A,e){return"bigint"==typeof e?e.toString():e},"merge",0,function(A,e){if(A._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let t=o(A._zod.def,{get shape(){let t={...A._zod.def.shape,...e._zod.def.shape};return s(this,"shape",t),t},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return E(A,t)},"mergeDefs",0,o,"normalizeParams",0,function(A){if(!A)return{};if("string"==typeof A)return{error:()=>A};if(A?.message!==void 0){if(A?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");A.error=A.message}return(delete A.message,"string"==typeof A.error)?{...A,error:()=>A.error}:A},"nullish",0,function(A){return null==A},"numKeys",0,function(A){let e=0;for(let t in A)Object.prototype.hasOwnProperty.call(A,t)&&e++;return e},"objectClone",0,function(A){return Object.create(Object.getPrototypeOf(A),Object.getOwnPropertyDescriptors(A))},"omit",0,function(A,e){let t=A._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let n=o(A._zod.def,{get shape(){let r={...A._zod.def.shape};for(let A in e){if(!(A in t.shape))throw Error(`Unrecognized key: "${A}"`);e[A]&&delete r[A]}return s(this,"shape",r),r},checks:[]});return E(A,n)},"optionalKeys",0,function(A){return Object.keys(A).filter(e=>"optional"===A[e]._zod.optin&&"optional"===A[e]._zod.optout)},"parsedType",0,function(A){let e=typeof A;switch(e){case"number":return Number.isNaN(A)?"nan":"number";case"object":if(null===A)return"null";if(Array.isArray(A))return"array";if(A&&Object.getPrototypeOf(A)!==Object.prototype&&"constructor"in A&&A.constructor)return A.constructor.name}return e},"partial",0,function(A,e,t){let r=e._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let n=o(e._zod.def,{get shape(){let r=e._zod.def.shape,n={...r};if(t)for(let e in t){if(!(e in r))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=A?new A({type:"optional",innerType:r[e]}):r[e])}else for(let e in r)n[e]=A?new A({type:"optional",innerType:r[e]}):r[e];return s(this,"shape",n),n},checks:[]});return E(e,n)},"pick",0,function(A,e){let t=A._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let n=o(A._zod.def,{get shape(){let A={};for(let r in e){if(!(r in t.shape))throw Error(`Unrecognized key: "${r}"`);e[r]&&(A[r]=t.shape[r])}return s(this,"shape",A),A},checks:[]});return E(A,n)},"prefixIssues",0,function(A,e){return e.map(e=>(e.path??(e.path=[]),e.path.unshift(A),e))},"primitiveTypes",0,d,"promiseAllObject",0,function(A){let e=Object.keys(A);return Promise.all(e.map(e=>A[e])).then(A=>{let t={};for(let r=0;r<e.length;r++)t[e[r]]=A[r];return t})},"propertyKeyTypes",0,I,"randomString",0,function(A=10){let e="abcdefghijklmnopqrstuvwxyz",t="";for(let r=0;r<A;r++)t+=e[Math.floor(Math.random()*e.length)];return t},"required",0,function(A,e,t){let r=o(e._zod.def,{get shape(){let r=e._zod.def.shape,n={...r};if(t)for(let e in t){if(!(e in n))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=new A({type:"nonoptional",innerType:r[e]}))}else for(let e in r)n[e]=new A({type:"nonoptional",innerType:r[e]});return s(this,"shape",n),n}});return E(e,r)},"safeExtend",0,function(A,e){if(!l(e))throw Error("Invalid input to safeExtend: expected a plain object");let t=o(A._zod.def,{get shape(){let t={...A._zod.def.shape,...e};return s(this,"shape",t),t}});return E(A,t)},"shallowClone",0,function(A){return l(A)?{...A}:Array.isArray(A)?[...A]:A instanceof Map?new Map(A):A instanceof Set?new Set(A):A},"slugify",0,function(A){return A.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")},"stringifyPrimitive",0,c,"uint8ArrayToBase64",0,u,"uint8ArrayToBase64url",0,function(A){return u(A).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(A){return Array.from(A).map(A=>A.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,D],486618)},715143,67021,A=>{"use strict";var e=A.i(127438),t=A.i(486618);let r=(A,e)=>{A.name="$ZodError",Object.defineProperty(A,"_zod",{value:A._zod,enumerable:!1}),Object.defineProperty(A,"issues",{value:e,enumerable:!1}),A.message=JSON.stringify(e,t.jsonStringifyReplacer,2),Object.defineProperty(A,"toString",{value:()=>A.message,enumerable:!1})},n=(0,e.$constructor)("$ZodError",r),i=(0,e.$constructor)("$ZodError",r,{Parent:Error});function a(A){let e=[];for(let t of A.map(A=>"object"==typeof A?A.key:A))"number"==typeof t?e.push(`[${t}]`):"symbol"==typeof t?e.push(`[${JSON.stringify(String(t))}]`):/[^\w$]/.test(t)?e.push(`[${JSON.stringify(t)}]`):(e.length&&e.push("."),e.push(t));return e.join("")}A.s(["$ZodError",0,n,"$ZodRealError",0,i,"flattenError",0,function(A,e=A=>A.message){let t={},r=[];for(let n of A.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}},"formatError",0,function(A,e=A=>A.message){let t={_errors:[]},r=(A,n=[])=>{for(let i of A.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(A=>r({issues:A},[...n,...i.path]));else if("invalid_key"===i.code)r({issues:i.issues},[...n,...i.path]);else if("invalid_element"===i.code)r({issues:i.issues},[...n,...i.path]);else{let A=[...n,...i.path];if(0===A.length)t._errors.push(e(i));else{let r=t,n=0;for(;n<A.length;){let t=A[n];n===A.length-1?(r[t]=r[t]||{_errors:[]},r[t]._errors.push(e(i))):r[t]=r[t]||{_errors:[]},r=r[t],n++}}}};return r(A),t},"prettifyError",0,function(A){let e=[];for(let t of[...A.issues].sort((A,e)=>(A.path??[]).length-(e.path??[]).length))e.push(`✖ ${t.message}`),t.path?.length&&e.push(` → at ${a(t.path)}`);return e.join("\n")},"toDotPath",0,a,"treeifyError",0,function(A,e=A=>A.message){let t={errors:[]},r=(A,n=[])=>{var i,a;for(let s of A.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(A=>r({issues:A},[...n,...s.path]));else if("invalid_key"===s.code)r({issues:s.issues},[...n,...s.path]);else if("invalid_element"===s.code)r({issues:s.issues},[...n,...s.path]);else{let A=[...n,...s.path];if(0===A.length){t.errors.push(e(s));continue}let r=t,o=0;for(;o<A.length;){let t=A[o],n=o===A.length-1;"string"==typeof t?(r.properties??(r.properties={}),(i=r.properties)[t]??(i[t]={errors:[]}),r=r.properties[t]):(r.items??(r.items=[]),(a=r.items)[t]??(a[t]={errors:[]}),r=r.items[t]),n&&r.errors.push(e(s)),o++}}};return r(A),t}],67021);let s=A=>(r,n,i,a)=>{let s=i?{...i,async:!1}:{async:!1},o=r._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new e.$ZodAsyncError;if(o.issues.length){let r=new(a?.Err??A)(o.issues.map(A=>t.finalizeIssue(A,s,e.config())));throw t.captureStackTrace(r,a?.callee),r}return o.value},o=s(i),g=A=>async(r,n,i,a)=>{let s=i?{...i,async:!0}:{async:!0},o=r._zod.run({value:n,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){let r=new(a?.Err??A)(o.issues.map(A=>t.finalizeIssue(A,s,e.config())));throw t.captureStackTrace(r,a?.callee),r}return o.value},C=g(i),Q=A=>(r,i,a)=>{let s=a?{...a,async:!1}:{async:!1},o=r._zod.run({value:i,issues:[]},s);if(o instanceof Promise)throw new e.$ZodAsyncError;return o.issues.length?{success:!1,error:new(A??n)(o.issues.map(A=>t.finalizeIssue(A,s,e.config())))}:{success:!0,data:o.value}},l=Q(i),I=A=>async(r,n,i)=>{let a=i?{...i,async:!0}:{async:!0},s=r._zod.run({value:n,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new A(s.issues.map(A=>t.finalizeIssue(A,a,e.config())))}:{success:!0,data:s.value}},d=I(i),E=A=>(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return s(A)(e,t,n)},c=E(i),h=A=>(e,t,r)=>s(A)(e,t,r),B=h(i),D=A=>async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return g(A)(e,t,n)},w=D(i),u=A=>async(e,t,r)=>g(A)(e,t,r),p=u(i),f=A=>(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Q(A)(e,t,n)},y=f(i),M=A=>(e,t,r)=>Q(A)(e,t,r),m=M(i),N=A=>async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return I(A)(e,t,n)},S=N(i),k=A=>async(e,t,r)=>I(A)(e,t,r),U=k(i);A.s(["_decode",0,h,"_decodeAsync",0,u,"_encode",0,E,"_encodeAsync",0,D,"_parse",0,s,"_parseAsync",0,g,"_safeDecode",0,M,"_safeDecodeAsync",0,k,"_safeEncode",0,f,"_safeEncodeAsync",0,N,"_safeParse",0,Q,"_safeParseAsync",0,I,"decode",0,B,"decodeAsync",0,p,"encode",0,c,"encodeAsync",0,w,"parse",0,o,"parseAsync",0,C,"safeDecode",0,m,"safeDecodeAsync",0,U,"safeEncode",0,y,"safeEncodeAsync",0,S,"safeParse",0,l,"safeParseAsync",0,d],715143)},236608,421131,173911,A=>{"use strict";var e=A.i(127438),t=A.i(486618);let r=A=>A?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${A}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,n=r(4),i=r(6),a=r(7),s=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,o="(?:(?:\\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])))",g=RegExp(`^${o}$`);function C(A){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof A.precision?-1===A.precision?`${e}`:0===A.precision?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${A.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}let Q=/^-?\d+$/,l=/^[^A-Z]*$/,I=/^[^a-z]*$/;function d(A,e){return RegExp(`^[A-Za-z0-9+/]{${A}}${e}$`)}function E(A){return RegExp(`^[A-Za-z0-9_-]{${A}}$`)}let c=d(22,"=="),h=E(22),B=d(27,"="),D=E(27),w=d(43,"="),u=E(43),p=d(64,""),f=E(64),y=d(86,"=="),M=E(86);A.s(["base64",0,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,"base64url",0,/^[A-Za-z0-9_-]*$/,"bigint",0,/^-?\d+n?$/,"boolean",0,/^(?:true|false)$/i,"browserEmail",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"cidrv4",0,/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,"cidrv6",0,/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,"cuid",0,/^[cC][0-9a-z]{6,}$/,"cuid2",0,/^[0-9a-z]+$/,"date",0,g,"datetime",0,function(A){let e=C({precision:A.precision}),t=["Z"];A.local&&t.push(""),A.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${e}(?:${t.join("|")})`;return RegExp(`^${o}T(?:${r})$`)},"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,"e164",0,/^\+[1-9]\d{6,14}$/,"email",0,/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,"emoji",0,function(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")},"extendedDuration",0,/^[-+]?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)?)??$/,"guid",0,/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,"hex",0,/^[0-9a-fA-F]*$/,"hostname",0,/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,"html5Email",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"httpProtocol",0,/^https?$/,"idnEmail",0,s,"integer",0,Q,"ipv4",0,/^(?:(?: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])$/,"ipv6",0,/^(([0-9a-fA-F]{1,4}:){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}|:))$/,"ksuid",0,/^[A-Za-z0-9]{27}$/,"lowercase",0,l,"mac",0,A=>{let e=t.escapeRegex(A??":");return RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},"md5_base64",0,c,"md5_base64url",0,h,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,/^[a-zA-Z0-9_-]{21}$/,"null",0,/^null$/i,"number",0,/^-?\d+(?:\.\d+)?$/,"rfc5322Email",0,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,"sha1_base64",0,B,"sha1_base64url",0,D,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,w,"sha256_base64url",0,u,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,p,"sha384_base64url",0,f,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,y,"sha512_base64url",0,M,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,A=>{let e=A?`[\\s\\S]{${A?.minimum??0},${A?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${e}$`)},"time",0,function(A){return RegExp(`^${C(A)}$`)},"ulid",0,/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,"undefined",0,/^undefined$/i,"unicodeEmail",0,s,"uppercase",0,I,"uuid",0,r,"uuid4",0,n,"uuid6",0,i,"uuid7",0,a,"xid",0,/^[0-9a-vA-V]{20}$/],421131);let m=e.$constructor("$ZodCheck",(A,e)=>{var t;A._zod??(A._zod={}),A._zod.def=e,(t=A._zod).onattach??(t.onattach=[])}),N={number:"number",bigint:"bigint",object:"date"},S=e.$constructor("$ZodCheckLessThan",(A,e)=>{m.init(A,e);let t=N[typeof e.value];A._zod.onattach.push(A=>{let t=A._zod.bag,r=(e.inclusive?t.maximum:t.exclusiveMaximum)??1/0;e.value<r&&(e.inclusive?t.maximum=e.value:t.exclusiveMaximum=e.value)}),A._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:"object"==typeof e.value?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:A,continue:!e.abort})}}),k=e.$constructor("$ZodCheckGreaterThan",(A,e)=>{m.init(A,e);let t=N[typeof e.value];A._zod.onattach.push(A=>{let t=A._zod.bag,r=(e.inclusive?t.minimum:t.exclusiveMinimum)??-1/0;e.value>r&&(e.inclusive?t.minimum=e.value:t.exclusiveMinimum=e.value)}),A._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:"object"==typeof e.value?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:A,continue:!e.abort})}}),U=e.$constructor("$ZodCheckMultipleOf",(A,e)=>{m.init(A,e),A._zod.onattach.push(A=>{var t;(t=A._zod.bag).multipleOf??(t.multipleOf=e.value)}),A._zod.check=r=>{if(typeof r.value!=typeof e.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%e.value===BigInt(0):0===t.floatSafeRemainder(r.value,e.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:A,continue:!e.abort})}}),F=e.$constructor("$ZodCheckNumberFormat",(A,e)=>{m.init(A,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,a]=t.NUMBER_FORMAT_RANGES[e.format];A._zod.onattach.push(A=>{let t=A._zod.bag;t.format=e.format,t.minimum=i,t.maximum=a,r&&(t.pattern=Q)}),A._zod.check=t=>{let s=t.value;if(r){if(!Number.isInteger(s))return void t.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:A});if(!Number.isSafeInteger(s))return void(s>0?t.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:A,origin:n,inclusive:!0,continue:!e.abort}):t.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:A,origin:n,inclusive:!0,continue:!e.abort}))}s<i&&t.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:A,continue:!e.abort}),s>a&&t.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:A,continue:!e.abort})}}),R=e.$constructor("$ZodCheckBigIntFormat",(A,e)=>{m.init(A,e);let[r,n]=t.BIGINT_FORMAT_RANGES[e.format];A._zod.onattach.push(A=>{let t=A._zod.bag;t.format=e.format,t.minimum=r,t.maximum=n}),A._zod.check=t=>{let i=t.value;i<r&&t.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:A,continue:!e.abort}),i>n&&t.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:A,continue:!e.abort})}}),T=e.$constructor("$ZodCheckMaxSize",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.size}),A._zod.onattach.push(A=>{let t=A._zod.bag.maximum??1/0;e.maximum<t&&(A._zod.bag.maximum=e.maximum)}),A._zod.check=r=>{let n=r.value;n.size<=e.maximum||r.issues.push({origin:t.getSizableOrigin(n),code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:A,continue:!e.abort})}}),b=e.$constructor("$ZodCheckMinSize",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.size}),A._zod.onattach.push(A=>{let t=A._zod.bag.minimum??-1/0;e.minimum>t&&(A._zod.bag.minimum=e.minimum)}),A._zod.check=r=>{let n=r.value;n.size>=e.minimum||r.issues.push({origin:t.getSizableOrigin(n),code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:A,continue:!e.abort})}}),H=e.$constructor("$ZodCheckSizeEquals",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.size}),A._zod.onattach.push(A=>{let t=A._zod.bag;t.minimum=e.size,t.maximum=e.size,t.size=e.size}),A._zod.check=r=>{let n=r.value,i=n.size;if(i===e.size)return;let a=i>e.size;r.issues.push({origin:t.getSizableOrigin(n),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:r.value,inst:A,continue:!e.abort})}}),L=e.$constructor("$ZodCheckMaxLength",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.length}),A._zod.onattach.push(A=>{let t=A._zod.bag.maximum??1/0;e.maximum<t&&(A._zod.bag.maximum=e.maximum)}),A._zod.check=r=>{let n=r.value;if(n.length<=e.maximum)return;let i=t.getLengthableOrigin(n);r.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:A,continue:!e.abort})}}),O=e.$constructor("$ZodCheckMinLength",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.length}),A._zod.onattach.push(A=>{let t=A._zod.bag.minimum??-1/0;e.minimum>t&&(A._zod.bag.minimum=e.minimum)}),A._zod.check=r=>{let n=r.value;if(n.length>=e.minimum)return;let i=t.getLengthableOrigin(n);r.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:A,continue:!e.abort})}}),G=e.$constructor("$ZodCheckLengthEquals",(A,e)=>{var r;m.init(A,e),(r=A._zod.def).when??(r.when=A=>{let e=A.value;return!t.nullish(e)&&void 0!==e.length}),A._zod.onattach.push(A=>{let t=A._zod.bag;t.minimum=e.length,t.maximum=e.length,t.length=e.length}),A._zod.check=r=>{let n=r.value,i=n.length;if(i===e.length)return;let a=t.getLengthableOrigin(n),s=i>e.length;r.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:A,continue:!e.abort})}}),J=e.$constructor("$ZodCheckStringFormat",(A,e)=>{var t,r;m.init(A,e),A._zod.onattach.push(A=>{let t=A._zod.bag;t.format=e.format,e.pattern&&(t.patterns??(t.patterns=new Set),t.patterns.add(e.pattern))}),e.pattern?(t=A._zod).check??(t.check=t=>{e.pattern.lastIndex=0,e.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:e.format,input:t.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:A,continue:!e.abort})}):(r=A._zod).check??(r.check=()=>{})}),v=e.$constructor("$ZodCheckRegex",(A,e)=>{J.init(A,e),A._zod.check=t=>{e.pattern.lastIndex=0,e.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:A,continue:!e.abort})}}),x=e.$constructor("$ZodCheckLowerCase",(A,e)=>{e.pattern??(e.pattern=l),J.init(A,e)}),V=e.$constructor("$ZodCheckUpperCase",(A,e)=>{e.pattern??(e.pattern=I),J.init(A,e)}),P=e.$constructor("$ZodCheckIncludes",(A,e)=>{m.init(A,e);let r=t.escapeRegex(e.includes),n=new RegExp("number"==typeof e.position?`^.{${e.position}}${r}`:r);e.pattern=n,A._zod.onattach.push(A=>{let e=A._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(n)}),A._zod.check=t=>{t.value.includes(e.includes,e.position)||t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:t.value,inst:A,continue:!e.abort})}}),Y=e.$constructor("$ZodCheckStartsWith",(A,e)=>{m.init(A,e);let r=RegExp(`^${t.escapeRegex(e.prefix)}.*`);e.pattern??(e.pattern=r),A._zod.onattach.push(A=>{let e=A._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(r)}),A._zod.check=t=>{t.value.startsWith(e.prefix)||t.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:t.value,inst:A,continue:!e.abort})}}),_=e.$constructor("$ZodCheckEndsWith",(A,e)=>{m.init(A,e);let r=RegExp(`.*${t.escapeRegex(e.suffix)}$`);e.pattern??(e.pattern=r),A._zod.onattach.push(A=>{let e=A._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(r)}),A._zod.check=t=>{t.value.endsWith(e.suffix)||t.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:t.value,inst:A,continue:!e.abort})}});function K(A,e,r){A.issues.length&&e.issues.push(...t.prefixIssues(r,A.issues))}let q=e.$constructor("$ZodCheckProperty",(A,e)=>{m.init(A,e),A._zod.check=A=>{let t=e.schema._zod.run({value:A.value[e.property],issues:[]},{});if(t instanceof Promise)return t.then(t=>K(t,A,e.property));K(t,A,e.property)}}),Z=e.$constructor("$ZodCheckMimeType",(A,e)=>{m.init(A,e);let t=new Set(e.mime);A._zod.onattach.push(A=>{A._zod.bag.mime=e.mime}),A._zod.check=r=>{t.has(r.value.type)||r.issues.push({code:"invalid_value",values:e.mime,input:r.value.type,inst:A,continue:!e.abort})}}),W=e.$constructor("$ZodCheckOverwrite",(A,e)=>{m.init(A,e),A._zod.check=A=>{A.value=e.tx(A.value)}});A.s(["$ZodCheck",0,m,"$ZodCheckBigIntFormat",0,R,"$ZodCheckEndsWith",0,_,"$ZodCheckGreaterThan",0,k,"$ZodCheckIncludes",0,P,"$ZodCheckLengthEquals",0,G,"$ZodCheckLessThan",0,S,"$ZodCheckLowerCase",0,x,"$ZodCheckMaxLength",0,L,"$ZodCheckMaxSize",0,T,"$ZodCheckMimeType",0,Z,"$ZodCheckMinLength",0,O,"$ZodCheckMinSize",0,b,"$ZodCheckMultipleOf",0,U,"$ZodCheckNumberFormat",0,F,"$ZodCheckOverwrite",0,W,"$ZodCheckProperty",0,q,"$ZodCheckRegex",0,v,"$ZodCheckSizeEquals",0,H,"$ZodCheckStartsWith",0,Y,"$ZodCheckStringFormat",0,J,"$ZodCheckUpperCase",0,V],236608),A.s(["Doc",0,class{constructor(A=[]){this.content=[],this.indent=0,this&&(this.args=A)}indented(A){this.indent+=1,A(this),this.indent-=1}write(A){if("function"==typeof A){A(this,{execution:"sync"}),A(this,{execution:"async"});return}let e=A.split("\n").filter(A=>A),t=Math.min(...e.map(A=>A.length-A.trimStart().length));for(let A of e.map(A=>A.slice(t)).map(A=>" ".repeat(2*this.indent)+A))this.content.push(A)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(A=>` ${A}`)].join("\n"))}}],173911)},639510,622824,52637,862061,A=>{"use strict";var e,t=A.i(236608),r=A.i(127438),n=A.i(173911),i=A.i(715143),a=A.i(421131),s=A.i(486618);let o={major:4,minor:4,patch:3};A.s(["version",0,o],622824);let g=r.$constructor("$ZodType",(A,e)=>{var t;A??(A={}),A._zod.def=e,A._zod.bag=A._zod.bag||{},A._zod.version=o;let n=[...A._zod.def.checks??[]];for(let e of(A._zod.traits.has("$ZodCheck")&&n.unshift(A),n))for(let t of e._zod.onattach)t(A);if(0===n.length)(t=A._zod).deferred??(t.deferred=[]),A._zod.deferred?.push(()=>{A._zod.run=A._zod.parse});else{let e=(A,e,t)=>{let n,i=s.aborted(A);for(let a of e){if(a._zod.def.when){if(s.explicitlyAborted(A)||!a._zod.def.when(A))continue}else if(i)continue;let e=A.issues.length,o=a._zod.check(A);if(o instanceof Promise&&t?.async===!1)throw new r.$ZodAsyncError;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,A.issues.length!==e&&(i||(i=s.aborted(A,e)))});else{if(A.issues.length===e)continue;i||(i=s.aborted(A,e))}}return n?n.then(()=>A):A},t=(t,i,a)=>{if(s.aborted(t))return t.aborted=!0,t;let o=e(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new r.$ZodAsyncError;return o.then(e=>A._zod.parse(e,a))}return A._zod.parse(o,a)};A._zod.run=(i,a)=>{if(a.skipChecks)return A._zod.parse(i,a);if("backward"===a.direction){let e=A._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return e instanceof Promise?e.then(A=>t(A,i,a)):t(e,i,a)}let s=A._zod.parse(i,a);if(s instanceof Promise){if(!1===a.async)throw new r.$ZodAsyncError;return s.then(A=>e(A,n,a))}return e(s,n,a)}}s.defineLazy(A,"~standard",()=>({validate:e=>{try{let t=(0,i.safeParse)(A,e);return t.success?{value:t.data}:{issues:t.error?.issues}}catch(t){return(0,i.safeParseAsync)(A,e).then(A=>A.success?{value:A.data}:{issues:A.error?.issues})}},vendor:"zod",version:1}))}),C=r.$constructor("$ZodString",(A,e)=>{g.init(A,e),A._zod.pattern=[...A?._zod.bag?.patterns??[]].pop()??a.string(A._zod.bag),A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=String(t.value)}catch(A){}return"string"==typeof t.value||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:A}),t}}),Q=r.$constructor("$ZodStringFormat",(A,e)=>{t.$ZodCheckStringFormat.init(A,e),C.init(A,e)}),l=r.$constructor("$ZodGUID",(A,e)=>{e.pattern??(e.pattern=a.guid),Q.init(A,e)}),I=r.$constructor("$ZodUUID",(A,e)=>{if(e.version){let A={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(void 0===A)throw Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=a.uuid(A))}else e.pattern??(e.pattern=a.uuid());Q.init(A,e)}),d=r.$constructor("$ZodEmail",(A,e)=>{e.pattern??(e.pattern=a.email),Q.init(A,e)}),E=r.$constructor("$ZodURL",(A,e)=>{Q.init(A,e),A._zod.check=t=>{try{let r=t.value.trim();if(!e.normalize&&e.protocol?.source===a.httpProtocol.source&&!/^https?:\/\//i.test(r))return void t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:A,continue:!e.abort});let n=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:A,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:A,continue:!e.abort})),e.normalize?t.value=n.href:t.value=r;return}catch(r){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:A,continue:!e.abort})}}}),c=r.$constructor("$ZodEmoji",(A,e)=>{e.pattern??(e.pattern=a.emoji()),Q.init(A,e)}),h=r.$constructor("$ZodNanoID",(A,e)=>{e.pattern??(e.pattern=a.nanoid),Q.init(A,e)}),B=r.$constructor("$ZodCUID",(A,e)=>{e.pattern??(e.pattern=a.cuid),Q.init(A,e)}),D=r.$constructor("$ZodCUID2",(A,e)=>{e.pattern??(e.pattern=a.cuid2),Q.init(A,e)}),w=r.$constructor("$ZodULID",(A,e)=>{e.pattern??(e.pattern=a.ulid),Q.init(A,e)}),u=r.$constructor("$ZodXID",(A,e)=>{e.pattern??(e.pattern=a.xid),Q.init(A,e)}),p=r.$constructor("$ZodKSUID",(A,e)=>{e.pattern??(e.pattern=a.ksuid),Q.init(A,e)}),f=r.$constructor("$ZodISODateTime",(A,e)=>{e.pattern??(e.pattern=a.datetime(e)),Q.init(A,e)}),y=r.$constructor("$ZodISODate",(A,e)=>{e.pattern??(e.pattern=a.date),Q.init(A,e)}),M=r.$constructor("$ZodISOTime",(A,e)=>{e.pattern??(e.pattern=a.time(e)),Q.init(A,e)}),m=r.$constructor("$ZodISODuration",(A,e)=>{e.pattern??(e.pattern=a.duration),Q.init(A,e)}),N=r.$constructor("$ZodIPv4",(A,e)=>{e.pattern??(e.pattern=a.ipv4),Q.init(A,e),A._zod.bag.format="ipv4"}),S=r.$constructor("$ZodIPv6",(A,e)=>{e.pattern??(e.pattern=a.ipv6),Q.init(A,e),A._zod.bag.format="ipv6",A._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:A,continue:!e.abort})}}}),k=r.$constructor("$ZodMAC",(A,e)=>{e.pattern??(e.pattern=a.mac(e.delimiter)),Q.init(A,e),A._zod.bag.format="mac"}),U=r.$constructor("$ZodCIDRv4",(A,e)=>{e.pattern??(e.pattern=a.cidrv4),Q.init(A,e)}),F=r.$constructor("$ZodCIDRv6",(A,e)=>{e.pattern??(e.pattern=a.cidrv6),Q.init(A,e),A._zod.check=t=>{let r=t.value.split("/");try{if(2!==r.length)throw Error();let[A,e]=r;if(!e)throw Error();let t=Number(e);if(`${t}`!==e||t<0||t>128)throw Error();new URL(`http://[${A}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:A,continue:!e.abort})}}});function R(A){if(""===A)return!0;if(/\s/.test(A)||A.length%4!=0)return!1;try{return atob(A),!0}catch{return!1}}let T=r.$constructor("$ZodBase64",(A,e)=>{e.pattern??(e.pattern=a.base64),Q.init(A,e),A._zod.bag.contentEncoding="base64",A._zod.check=t=>{R(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:A,continue:!e.abort})}});function b(A){if(!a.base64url.test(A))return!1;let e=A.replace(/[-_]/g,A=>"-"===A?"+":"/");return R(e.padEnd(4*Math.ceil(e.length/4),"="))}let H=r.$constructor("$ZodBase64URL",(A,e)=>{e.pattern??(e.pattern=a.base64url),Q.init(A,e),A._zod.bag.contentEncoding="base64url",A._zod.check=t=>{b(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:A,continue:!e.abort})}}),L=r.$constructor("$ZodE164",(A,e)=>{e.pattern??(e.pattern=a.e164),Q.init(A,e)});function O(A,e=null){try{let t=A.split(".");if(3!==t.length)return!1;let[r]=t;if(!r)return!1;let n=JSON.parse(atob(r));if("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))return!1;return!0}catch{return!1}}let G=r.$constructor("$ZodJWT",(A,e)=>{Q.init(A,e),A._zod.check=t=>{O(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:A,continue:!e.abort})}}),J=r.$constructor("$ZodCustomStringFormat",(A,e)=>{Q.init(A,e),A._zod.check=t=>{e.fn(t.value)||t.issues.push({code:"invalid_format",format:e.format,input:t.value,inst:A,continue:!e.abort})}}),v=r.$constructor("$ZodNumber",(A,e)=>{g.init(A,e),A._zod.pattern=A._zod.bag.pattern??a.number,A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=Number(t.value)}catch(A){}let n=t.value;if("number"==typeof n&&!Number.isNaN(n)&&Number.isFinite(n))return t;let i="number"==typeof n?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:n,inst:A,...i?{received:i}:{}}),t}}),x=r.$constructor("$ZodNumberFormat",(A,e)=>{t.$ZodCheckNumberFormat.init(A,e),v.init(A,e)}),V=r.$constructor("$ZodBoolean",(A,e)=>{g.init(A,e),A._zod.pattern=a.boolean,A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=!!t.value}catch(A){}let n=t.value;return"boolean"==typeof n||t.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:A}),t}}),P=r.$constructor("$ZodBigInt",(A,e)=>{g.init(A,e),A._zod.pattern=a.bigint,A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=BigInt(t.value)}catch(A){}return"bigint"==typeof t.value||t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:A}),t}}),Y=r.$constructor("$ZodBigIntFormat",(A,e)=>{t.$ZodCheckBigIntFormat.init(A,e),P.init(A,e)}),_=r.$constructor("$ZodSymbol",(A,e)=>{g.init(A,e),A._zod.parse=(e,t)=>{let r=e.value;return"symbol"==typeof r||e.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:A}),e}}),K=r.$constructor("$ZodUndefined",(A,e)=>{g.init(A,e),A._zod.pattern=a.undefined,A._zod.values=new Set([void 0]),A._zod.parse=(e,t)=>{let r=e.value;return void 0===r||e.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:A}),e}}),q=r.$constructor("$ZodNull",(A,e)=>{g.init(A,e),A._zod.pattern=a.null,A._zod.values=new Set([null]),A._zod.parse=(e,t)=>{let r=e.value;return null===r||e.issues.push({expected:"null",code:"invalid_type",input:r,inst:A}),e}}),Z=r.$constructor("$ZodAny",(A,e)=>{g.init(A,e),A._zod.parse=A=>A}),W=r.$constructor("$ZodUnknown",(A,e)=>{g.init(A,e),A._zod.parse=A=>A}),z=r.$constructor("$ZodNever",(A,e)=>{g.init(A,e),A._zod.parse=(e,t)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:A}),e)}),j=r.$constructor("$ZodVoid",(A,e)=>{g.init(A,e),A._zod.parse=(e,t)=>{let r=e.value;return void 0===r||e.issues.push({expected:"void",code:"invalid_type",input:r,inst:A}),e}}),$=r.$constructor("$ZodDate",(A,e)=>{g.init(A,e),A._zod.parse=(t,r)=>{if(e.coerce)try{t.value=new Date(t.value)}catch(A){}let n=t.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||t.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:A}),t}});function X(A,e,t){A.issues.length&&e.issues.push(...s.prefixIssues(t,A.issues)),e.value[t]=A.value}let AA=r.$constructor("$ZodArray",(A,e)=>{g.init(A,e),A._zod.parse=(t,r)=>{let n=t.value;if(!Array.isArray(n))return t.issues.push({expected:"array",code:"invalid_type",input:n,inst:A}),t;t.value=Array(n.length);let i=[];for(let A=0;A<n.length;A++){let a=n[A],s=e.element._zod.run({value:a,issues:[]},r);s instanceof Promise?i.push(s.then(e=>X(e,t,A))):X(s,t,A)}return i.length?Promise.all(i).then(()=>t):t}});function Ae(A,e,t,r,n,i){let a=t in r;if(A.issues.length){if(n&&i&&!a)return;e.issues.push(...s.prefixIssues(t,A.issues))}if(!a&&!n){A.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}void 0===A.value?a&&(e.value[t]=void 0):e.value[t]=A.value}function At(A){let e=Object.keys(A.shape);for(let t of e)if(!A.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let t=s.optionalKeys(A.shape);return{...A,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Ar(A,e,t,r,n,i){let a=[],s=n.keySet,o=n.catchall._zod,g=o.def.type,C="optional"===o.optin,Q="optional"===o.optout;for(let n in e){if("__proto__"===n||s.has(n))continue;if("never"===g){a.push(n);continue}let i=o.run({value:e[n],issues:[]},r);i instanceof Promise?A.push(i.then(A=>Ae(A,t,n,e,C,Q))):Ae(i,t,n,e,C,Q)}return(a.length&&t.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),A.length)?Promise.all(A).then(()=>t):t}let An=r.$constructor("$ZodObject",(A,e)=>{let t;g.init(A,e);let r=Object.getOwnPropertyDescriptor(e,"shape");if(!r?.get){let A=e.shape;Object.defineProperty(e,"shape",{get:()=>{let t={...A};return Object.defineProperty(e,"shape",{value:t}),t}})}let n=s.cached(()=>At(e));s.defineLazy(A._zod,"propValues",()=>{let A=e.shape,t={};for(let e in A){let r=A[e]._zod;if(r.values)for(let A of(t[e]??(t[e]=new Set),r.values))t[e].add(A)}return t});let i=s.isObject,a=e.catchall;A._zod.parse=(e,r)=>{t??(t=n.value);let s=e.value;if(!i(s))return e.issues.push({expected:"object",code:"invalid_type",input:s,inst:A}),e;e.value={};let o=[],g=t.shape;for(let A of t.keys){let t=g[A],n="optional"===t._zod.optin,i="optional"===t._zod.optout,a=t._zod.run({value:s[A],issues:[]},r);a instanceof Promise?o.push(a.then(t=>Ae(t,e,A,s,n,i))):Ae(a,e,A,s,n,i)}return a?Ar(o,s,e,r,n.value,A):o.length?Promise.all(o).then(()=>e):e}}),Ai=r.$constructor("$ZodObjectJIT",(A,e)=>{let t,i;An.init(A,e);let a=A._zod.parse,o=s.cached(()=>At(e)),g=s.isObject,C=!r.globalConfig.jitless,Q=s.allowsEval,l=C&&Q.value,I=e.catchall;A._zod.parse=(r,Q)=>{i??(i=o.value);let d=r.value;return g(d)?C&&l&&Q?.async===!1&&!0!==Q.jitless?(t||(t=(A=>{let e=new n.Doc(["shape","payload","ctx"]),t=o.value,r=A=>{let e=s.esc(A);return`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`};e.write("const input = payload.value;");let i=Object.create(null),a=0;for(let A of t.keys)i[A]=`key_${a++}`;for(let n of(e.write("const newResult = {};"),t.keys)){let t=i[n],a=s.esc(n),o=A[n],g=o?._zod?.optin==="optional",C=o?._zod?.optout==="optional";e.write(`const ${t} = ${r(n)};`),g&&C?e.write(`
122
122
  if (${t}.issues.length) {
123
123
  if (${a} in input) {
124
124
  payload.issues = payload.issues.concat(${t}.issues.map(iss => ({
@@ -179,8 +179,8 @@ ${a}`:i.stack}(A,H):A&&"object"==typeof A&&Error.captureStackTrace(A,e.exports.f
179
179
 
180
180
  `)}e.write("payload.value = newResult;"),e.write("return payload;");let g=e.compile();return(e,t)=>g(A,e,t)})(e.shape)),r=t(r,Q),I)?Ar([],d,r,Q,i,A):r:a(r,Q):(r.issues.push({expected:"object",code:"invalid_type",input:d,inst:A}),r)}});function Aa(A,e,t,n){for(let t of A)if(0===t.issues.length)return e.value=t.value,e;let i=A.filter(A=>!s.aborted(A));return 1===i.length?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:A.map(A=>A.issues.map(A=>s.finalizeIssue(A,n,r.config())))}),e)}let As=r.$constructor("$ZodUnion",(A,e)=>{g.init(A,e),s.defineLazy(A._zod,"optin",()=>e.options.some(A=>"optional"===A._zod.optin)?"optional":void 0),s.defineLazy(A._zod,"optout",()=>e.options.some(A=>"optional"===A._zod.optout)?"optional":void 0),s.defineLazy(A._zod,"values",()=>{if(e.options.every(A=>A._zod.values))return new Set(e.options.flatMap(A=>Array.from(A._zod.values)))}),s.defineLazy(A._zod,"pattern",()=>{if(e.options.every(A=>A._zod.pattern)){let A=e.options.map(A=>A._zod.pattern);return RegExp(`^(${A.map(A=>s.cleanRegex(A.source)).join("|")})$`)}});let t=1===e.options.length?e.options[0]._zod.run:null;A._zod.parse=(r,n)=>{if(t)return t(r,n);let i=!1,a=[];for(let A of e.options){let e=A._zod.run({value:r.value,issues:[]},n);if(e instanceof Promise)a.push(e),i=!0;else{if(0===e.issues.length)return e;a.push(e)}}return i?Promise.all(a).then(e=>Aa(e,r,A,n)):Aa(a,r,A,n)}});function Ao(A,e,t,n){let i=A.filter(A=>0===A.issues.length);return 1===i.length?e.value=i[0].value:0===i.length?e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:A.map(A=>A.issues.map(A=>s.finalizeIssue(A,n,r.config())))}):e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:[],inclusive:!1}),e}let Ag=r.$constructor("$ZodXor",(A,e)=>{As.init(A,e),e.inclusive=!1;let t=1===e.options.length?e.options[0]._zod.run:null;A._zod.parse=(r,n)=>{if(t)return t(r,n);let i=!1,a=[];for(let A of e.options){let e=A._zod.run({value:r.value,issues:[]},n);e instanceof Promise?(a.push(e),i=!0):a.push(e)}return i?Promise.all(a).then(e=>Ao(e,r,A,n)):Ao(a,r,A,n)}}),AC=r.$constructor("$ZodDiscriminatedUnion",(A,e)=>{e.inclusive=!1,As.init(A,e);let t=A._zod.parse;s.defineLazy(A._zod,"propValues",()=>{let A={};for(let t of e.options){let r=t._zod.propValues;if(!r||0===Object.keys(r).length)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(t)}"`);for(let[e,t]of Object.entries(r))for(let r of(A[e]||(A[e]=new Set),t))A[e].add(r)}return A});let r=s.cached(()=>{let A=e.options,t=new Map;for(let r of A){let A=r._zod.propValues?.[e.discriminator];if(!A||0===A.size)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let e of A){if(t.has(e))throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,r)}}return t});A._zod.parse=(n,i)=>{let a=n.value;if(!s.isObject(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:A}),n;let o=r.value.get(a?.[e.discriminator]);return o?o._zod.run(n,i):e.unionFallback||"backward"===i.direction?t(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(r.value.keys()),input:a,path:[e.discriminator],inst:A}),n)}}),AQ=r.$constructor("$ZodIntersection",(A,e)=>{g.init(A,e),A._zod.parse=(A,t)=>{let r=A.value,n=e.left._zod.run({value:r,issues:[]},t),i=e.right._zod.run({value:r,issues:[]},t);return n instanceof Promise||i instanceof Promise?Promise.all([n,i]).then(([e,t])=>Al(A,e,t)):Al(A,n,i)}});function Al(A,e,t){let r,n=new Map;for(let t of e.issues)if("unrecognized_keys"===t.code)for(let A of(r??(r=t),t.keys))n.has(A)||n.set(A,{}),n.get(A).l=!0;else A.issues.push(t);for(let e of t.issues)if("unrecognized_keys"===e.code)for(let A of e.keys)n.has(A)||n.set(A,{}),n.get(A).r=!0;else A.issues.push(e);let i=[...n].filter(([,A])=>A.l&&A.r).map(([A])=>A);if(i.length&&r&&A.issues.push({...r,keys:i}),s.aborted(A))return A;let a=function A(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(s.isPlainObject(e)&&s.isPlainObject(t)){let r=Object.keys(t),n=Object.keys(e).filter(A=>-1!==r.indexOf(A)),i={...e,...t};for(let r of n){let n=A(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};i[r]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=A(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}(e.value,t.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return A.value=a.data,A}let AI=r.$constructor("$ZodTuple",(A,e)=>{g.init(A,e);let t=e.items;A._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({input:i,inst:A,expected:"tuple",code:"invalid_type"}),r;r.value=[];let a=[],s=Ad(t,"optin"),o=Ad(t,"optout");if(!e.rest){if(i.length<s)return r.issues.push({code:"too_small",minimum:s,inclusive:!0,input:i,inst:A,origin:"array"}),r;i.length>t.length&&r.issues.push({code:"too_big",maximum:t.length,inclusive:!0,input:i,inst:A,origin:"array"})}let g=Array(t.length);for(let A=0;A<t.length;A++){let e=t[A]._zod.run({value:i[A],issues:[]},n);e instanceof Promise?a.push(e.then(e=>{g[A]=e})):g[A]=e}if(e.rest){let A=t.length-1;for(let s of i.slice(t.length)){A++;let t=e.rest._zod.run({value:s,issues:[]},n);t instanceof Promise?a.push(t.then(e=>AE(e,r,A))):AE(t,r,A)}}return a.length?Promise.all(a).then(()=>Ac(g,r,t,i,o)):Ac(g,r,t,i,o)}});function Ad(A,e){for(let t=A.length-1;t>=0;t--)if("optional"!==A[t]._zod[e])return t+1;return 0}function AE(A,e,t){A.issues.length&&e.issues.push(...s.prefixIssues(t,A.issues)),e.value[t]=A.value}function Ac(A,e,t,r,n){for(let i=0;i<t.length;i++){let t=A[i],a=i<r.length;if(t.issues.length){if(!a&&i>=n){e.value.length=i;break}e.issues.push(...s.prefixIssues(i,t.issues))}e.value[i]=t.value}for(let A=e.value.length-1;A>=r.length;A--)if("optional"===t[A]._zod.optout&&void 0===e.value[A])e.value.length=A;else break;return e}let Ah=r.$constructor("$ZodRecord",(A,e)=>{g.init(A,e),A._zod.parse=(t,n)=>{let i=t.value;if(!s.isPlainObject(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:A}),t;let o=[],g=e.keyType._zod.values;if(g){let a;t.value={};let C=new Set;for(let a of g)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){C.add("number"==typeof a?a.toString():a);let g=e.keyType._zod.run({value:a,issues:[]},n);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length){t.issues.push({code:"invalid_key",origin:"record",issues:g.issues.map(A=>s.finalizeIssue(A,n,r.config())),input:a,path:[a],inst:A});continue}let Q=g.value,l=e.valueType._zod.run({value:i[a],issues:[]},n);l instanceof Promise?o.push(l.then(A=>{A.issues.length&&t.issues.push(...s.prefixIssues(a,A.issues)),t.value[Q]=A.value})):(l.issues.length&&t.issues.push(...s.prefixIssues(a,l.issues)),t.value[Q]=l.value)}for(let A in i)C.has(A)||(a=a??[]).push(A);a&&a.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:A,keys:a})}else for(let g of(t.value={},Reflect.ownKeys(i))){if("__proto__"===g||!Object.prototype.propertyIsEnumerable.call(i,g))continue;let C=e.keyType._zod.run({value:g,issues:[]},n);if(C instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof g&&a.number.test(g)&&C.issues.length){let A=e.keyType._zod.run({value:Number(g),issues:[]},n);if(A instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===A.issues.length&&(C=A)}if(C.issues.length){"loose"===e.mode?t.value[g]=i[g]:t.issues.push({code:"invalid_key",origin:"record",issues:C.issues.map(A=>s.finalizeIssue(A,n,r.config())),input:g,path:[g],inst:A});continue}let Q=e.valueType._zod.run({value:i[g],issues:[]},n);Q instanceof Promise?o.push(Q.then(A=>{A.issues.length&&t.issues.push(...s.prefixIssues(g,A.issues)),t.value[C.value]=A.value})):(Q.issues.length&&t.issues.push(...s.prefixIssues(g,Q.issues)),t.value[C.value]=Q.value)}return o.length?Promise.all(o).then(()=>t):t}}),AB=r.$constructor("$ZodMap",(A,e)=>{g.init(A,e),A._zod.parse=(t,r)=>{let n=t.value;if(!(n instanceof Map))return t.issues.push({expected:"map",code:"invalid_type",input:n,inst:A}),t;let i=[];for(let[a,s]of(t.value=new Map,n)){let o=e.keyType._zod.run({value:a,issues:[]},r),g=e.valueType._zod.run({value:s,issues:[]},r);o instanceof Promise||g instanceof Promise?i.push(Promise.all([o,g]).then(([e,i])=>{AD(e,i,t,a,n,A,r)})):AD(o,g,t,a,n,A,r)}return i.length?Promise.all(i).then(()=>t):t}});function AD(A,e,t,n,i,a,o){A.issues.length&&(s.propertyKeyTypes.has(typeof n)?t.issues.push(...s.prefixIssues(n,A.issues)):t.issues.push({code:"invalid_key",origin:"map",input:i,inst:a,issues:A.issues.map(A=>s.finalizeIssue(A,o,r.config()))})),e.issues.length&&(s.propertyKeyTypes.has(typeof n)?t.issues.push(...s.prefixIssues(n,e.issues)):t.issues.push({origin:"map",code:"invalid_element",input:i,inst:a,key:n,issues:e.issues.map(A=>s.finalizeIssue(A,o,r.config()))})),t.value.set(A.value,e.value)}let Aw=r.$constructor("$ZodSet",(A,e)=>{g.init(A,e),A._zod.parse=(t,r)=>{let n=t.value;if(!(n instanceof Set))return t.issues.push({input:n,inst:A,expected:"set",code:"invalid_type"}),t;let i=[];for(let A of(t.value=new Set,n)){let n=e.valueType._zod.run({value:A,issues:[]},r);n instanceof Promise?i.push(n.then(A=>Au(A,t))):Au(n,t)}return i.length?Promise.all(i).then(()=>t):t}});function Au(A,e){A.issues.length&&e.issues.push(...A.issues),e.value.add(A.value)}let Ap=r.$constructor("$ZodEnum",(A,e)=>{g.init(A,e);let t=s.getEnumValues(e.entries),r=new Set(t);A._zod.values=r,A._zod.pattern=RegExp(`^(${t.filter(A=>s.propertyKeyTypes.has(typeof A)).map(A=>"string"==typeof A?s.escapeRegex(A):A.toString()).join("|")})$`),A._zod.parse=(e,n)=>{let i=e.value;return r.has(i)||e.issues.push({code:"invalid_value",values:t,input:i,inst:A}),e}}),Af=r.$constructor("$ZodLiteral",(A,e)=>{if(g.init(A,e),0===e.values.length)throw Error("Cannot create literal schema with no valid values");let t=new Set(e.values);A._zod.values=t,A._zod.pattern=RegExp(`^(${e.values.map(A=>"string"==typeof A?s.escapeRegex(A):A?s.escapeRegex(A.toString()):String(A)).join("|")})$`),A._zod.parse=(r,n)=>{let i=r.value;return t.has(i)||r.issues.push({code:"invalid_value",values:e.values,input:i,inst:A}),r}}),Ay=r.$constructor("$ZodFile",(A,e)=>{g.init(A,e),A._zod.parse=(e,t)=>{let r=e.value;return r instanceof File||e.issues.push({expected:"file",code:"invalid_type",input:r,inst:A}),e}}),AM=r.$constructor("$ZodTransform",(A,e)=>{g.init(A,e),A._zod.optin="optional",A._zod.parse=(t,n)=>{if("backward"===n.direction)throw new r.$ZodEncodeError(A.constructor.name);let i=e.transform(t.value,t);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(A=>(t.value=A,t.fallback=!0,t));if(i instanceof Promise)throw new r.$ZodAsyncError;return t.value=i,t.fallback=!0,t}});function Am(A,e){return void 0===e&&(A.issues.length||A.fallback)?{issues:[],value:void 0}:A}let AN=r.$constructor("$ZodOptional",(A,e)=>{g.init(A,e),A._zod.optin="optional",A._zod.optout="optional",s.defineLazy(A._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),s.defineLazy(A._zod,"pattern",()=>{let A=e.innerType._zod.pattern;return A?RegExp(`^(${s.cleanRegex(A.source)})?$`):void 0}),A._zod.parse=(A,t)=>{if("optional"===e.innerType._zod.optin){let r=A.value,n=e.innerType._zod.run(A,t);return n instanceof Promise?n.then(A=>Am(A,r)):Am(n,r)}return void 0===A.value?A:e.innerType._zod.run(A,t)}}),AS=r.$constructor("$ZodExactOptional",(A,e)=>{AN.init(A,e),s.defineLazy(A._zod,"values",()=>e.innerType._zod.values),s.defineLazy(A._zod,"pattern",()=>e.innerType._zod.pattern),A._zod.parse=(A,t)=>e.innerType._zod.run(A,t)}),Ak=r.$constructor("$ZodNullable",(A,e)=>{g.init(A,e),s.defineLazy(A._zod,"optin",()=>e.innerType._zod.optin),s.defineLazy(A._zod,"optout",()=>e.innerType._zod.optout),s.defineLazy(A._zod,"pattern",()=>{let A=e.innerType._zod.pattern;return A?RegExp(`^(${s.cleanRegex(A.source)}|null)$`):void 0}),s.defineLazy(A._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),A._zod.parse=(A,t)=>null===A.value?A:e.innerType._zod.run(A,t)}),AU=r.$constructor("$ZodDefault",(A,e)=>{g.init(A,e),A._zod.optin="optional",s.defineLazy(A._zod,"values",()=>e.innerType._zod.values),A._zod.parse=(A,t)=>{if("backward"===t.direction)return e.innerType._zod.run(A,t);if(void 0===A.value)return A.value=e.defaultValue,A;let r=e.innerType._zod.run(A,t);return r instanceof Promise?r.then(A=>AF(A,e)):AF(r,e)}});function AF(A,e){return void 0===A.value&&(A.value=e.defaultValue),A}let AR=r.$constructor("$ZodPrefault",(A,e)=>{g.init(A,e),A._zod.optin="optional",s.defineLazy(A._zod,"values",()=>e.innerType._zod.values),A._zod.parse=(A,t)=>("backward"===t.direction||void 0===A.value&&(A.value=e.defaultValue),e.innerType._zod.run(A,t))}),AT=r.$constructor("$ZodNonOptional",(A,e)=>{g.init(A,e),s.defineLazy(A._zod,"values",()=>{let A=e.innerType._zod.values;return A?new Set([...A].filter(A=>void 0!==A)):void 0}),A._zod.parse=(t,r)=>{let n=e.innerType._zod.run(t,r);return n instanceof Promise?n.then(e=>Ab(e,A)):Ab(n,A)}});function Ab(A,e){return A.issues.length||void 0!==A.value||A.issues.push({code:"invalid_type",expected:"nonoptional",input:A.value,inst:e}),A}let AH=r.$constructor("$ZodSuccess",(A,e)=>{g.init(A,e),A._zod.parse=(A,t)=>{if("backward"===t.direction)throw new r.$ZodEncodeError("ZodSuccess");let n=e.innerType._zod.run(A,t);return n instanceof Promise?n.then(e=>(A.value=0===e.issues.length,A)):(A.value=0===n.issues.length,A)}}),AL=r.$constructor("$ZodCatch",(A,e)=>{g.init(A,e),A._zod.optin="optional",s.defineLazy(A._zod,"optout",()=>e.innerType._zod.optout),s.defineLazy(A._zod,"values",()=>e.innerType._zod.values),A._zod.parse=(A,t)=>{if("backward"===t.direction)return e.innerType._zod.run(A,t);let n=e.innerType._zod.run(A,t);return n instanceof Promise?n.then(n=>(A.value=n.value,n.issues.length&&(A.value=e.catchValue({...A,error:{issues:n.issues.map(A=>s.finalizeIssue(A,t,r.config()))},input:A.value}),A.issues=[],A.fallback=!0),A)):(A.value=n.value,n.issues.length&&(A.value=e.catchValue({...A,error:{issues:n.issues.map(A=>s.finalizeIssue(A,t,r.config()))},input:A.value}),A.issues=[],A.fallback=!0),A)}}),AO=r.$constructor("$ZodNaN",(A,e)=>{g.init(A,e),A._zod.parse=(e,t)=>("number"==typeof e.value&&Number.isNaN(e.value)||e.issues.push({input:e.value,inst:A,expected:"nan",code:"invalid_type"}),e)}),AG=r.$constructor("$ZodPipe",(A,e)=>{g.init(A,e),s.defineLazy(A._zod,"values",()=>e.in._zod.values),s.defineLazy(A._zod,"optin",()=>e.in._zod.optin),s.defineLazy(A._zod,"optout",()=>e.out._zod.optout),s.defineLazy(A._zod,"propValues",()=>e.in._zod.propValues),A._zod.parse=(A,t)=>{if("backward"===t.direction){let r=e.out._zod.run(A,t);return r instanceof Promise?r.then(A=>AJ(A,e.in,t)):AJ(r,e.in,t)}let r=e.in._zod.run(A,t);return r instanceof Promise?r.then(A=>AJ(A,e.out,t)):AJ(r,e.out,t)}});function AJ(A,e,t){return A.issues.length?(A.aborted=!0,A):e._zod.run({value:A.value,issues:A.issues,fallback:A.fallback},t)}let Av=r.$constructor("$ZodCodec",(A,e)=>{g.init(A,e),s.defineLazy(A._zod,"values",()=>e.in._zod.values),s.defineLazy(A._zod,"optin",()=>e.in._zod.optin),s.defineLazy(A._zod,"optout",()=>e.out._zod.optout),s.defineLazy(A._zod,"propValues",()=>e.in._zod.propValues),A._zod.parse=(A,t)=>{if("forward"===(t.direction||"forward")){let r=e.in._zod.run(A,t);return r instanceof Promise?r.then(A=>Ax(A,e,t)):Ax(r,e,t)}{let r=e.out._zod.run(A,t);return r instanceof Promise?r.then(A=>Ax(A,e,t)):Ax(r,e,t)}}});function Ax(A,e,t){if(A.issues.length)return A.aborted=!0,A;if("forward"===(t.direction||"forward")){let r=e.transform(A.value,A);return r instanceof Promise?r.then(r=>AV(A,r,e.out,t)):AV(A,r,e.out,t)}{let r=e.reverseTransform(A.value,A);return r instanceof Promise?r.then(r=>AV(A,r,e.in,t)):AV(A,r,e.in,t)}}function AV(A,e,t,r){return A.issues.length?(A.aborted=!0,A):t._zod.run({value:e,issues:A.issues},r)}let AP=r.$constructor("$ZodPreprocess",(A,e)=>{AG.init(A,e)}),AY=r.$constructor("$ZodReadonly",(A,e)=>{g.init(A,e),s.defineLazy(A._zod,"propValues",()=>e.innerType._zod.propValues),s.defineLazy(A._zod,"values",()=>e.innerType._zod.values),s.defineLazy(A._zod,"optin",()=>e.innerType?._zod?.optin),s.defineLazy(A._zod,"optout",()=>e.innerType?._zod?.optout),A._zod.parse=(A,t)=>{if("backward"===t.direction)return e.innerType._zod.run(A,t);let r=e.innerType._zod.run(A,t);return r instanceof Promise?r.then(A_):A_(r)}});function A_(A){return A.value=Object.freeze(A.value),A}let AK=r.$constructor("$ZodTemplateLiteral",(A,e)=>{g.init(A,e);let t=[];for(let A of e.parts)if("object"==typeof A&&null!==A){if(!A._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...A._zod.traits].shift()}`);let e=A._zod.pattern instanceof RegExp?A._zod.pattern.source:A._zod.pattern;if(!e)throw Error(`Invalid template literal part: ${A._zod.traits}`);let r=+!!e.startsWith("^"),n=e.endsWith("$")?e.length-1:e.length;t.push(e.slice(r,n))}else if(null===A||s.primitiveTypes.has(typeof A))t.push(s.escapeRegex(`${A}`));else throw Error(`Invalid template literal part: ${A}`);A._zod.pattern=RegExp(`^${t.join("")}$`),A._zod.parse=(t,r)=>("string"!=typeof t.value?t.issues.push({input:t.value,inst:A,expected:"string",code:"invalid_type"}):(A._zod.pattern.lastIndex=0,A._zod.pattern.test(t.value)||t.issues.push({input:t.value,inst:A,code:"invalid_format",format:e.format??"template_literal",pattern:A._zod.pattern.source})),t)}),Aq=r.$constructor("$ZodFunction",(A,e)=>(g.init(A,e),A._def=e,A._zod.def=e,A.implement=e=>{if("function"!=typeof e)throw Error("implement() must be called with a function");return function(...t){let r=Reflect.apply(e,this,A._def.input?(0,i.parse)(A._def.input,t):t);return A._def.output?(0,i.parse)(A._def.output,r):r}},A.implementAsync=e=>{if("function"!=typeof e)throw Error("implementAsync() must be called with a function");return async function(...t){let r=A._def.input?await (0,i.parseAsync)(A._def.input,t):t,n=await Reflect.apply(e,this,r);return A._def.output?await (0,i.parseAsync)(A._def.output,n):n}},A._zod.parse=(e,t)=>("function"!=typeof e.value?e.issues.push({code:"invalid_type",expected:"function",input:e.value,inst:A}):A._def.output&&"promise"===A._def.output._zod.def.type?e.value=A.implementAsync(e.value):e.value=A.implement(e.value),e),A.input=(...e)=>{let t=A.constructor;return new t(Array.isArray(e[0])?{type:"function",input:new AI({type:"tuple",items:e[0],rest:e[1]}),output:A._def.output}:{type:"function",input:e[0],output:A._def.output})},A.output=e=>new A.constructor({type:"function",input:A._def.input,output:e}),A)),AZ=r.$constructor("$ZodPromise",(A,e)=>{g.init(A,e),A._zod.parse=(A,t)=>Promise.resolve(A.value).then(A=>e.innerType._zod.run({value:A,issues:[]},t))}),AW=r.$constructor("$ZodLazy",(A,e)=>{g.init(A,e),s.defineLazy(A._zod,"innerType",()=>(e._cachedInner||(e._cachedInner=e.getter()),e._cachedInner)),s.defineLazy(A._zod,"pattern",()=>A._zod.innerType?._zod?.pattern),s.defineLazy(A._zod,"propValues",()=>A._zod.innerType?._zod?.propValues),s.defineLazy(A._zod,"optin",()=>A._zod.innerType?._zod?.optin??void 0),s.defineLazy(A._zod,"optout",()=>A._zod.innerType?._zod?.optout??void 0),A._zod.parse=(e,t)=>A._zod.innerType._zod.run(e,t)}),Az=r.$constructor("$ZodCustom",(A,e)=>{t.$ZodCheck.init(A,e),g.init(A,e),A._zod.parse=(A,e)=>A,A._zod.check=t=>{let r=t.value,n=e.fn(r);if(n instanceof Promise)return n.then(e=>Aj(e,t,r,A));Aj(n,t,r,A)}});function Aj(A,e,t,r){if(!A){let A={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(A.params=r._zod.def.params),e.issues.push(s.issue(A))}}A.s(["$ZodAny",0,Z,"$ZodArray",0,AA,"$ZodBase64",0,T,"$ZodBase64URL",0,H,"$ZodBigInt",0,P,"$ZodBigIntFormat",0,Y,"$ZodBoolean",0,V,"$ZodCIDRv4",0,U,"$ZodCIDRv6",0,F,"$ZodCUID",0,B,"$ZodCUID2",0,D,"$ZodCatch",0,AL,"$ZodCodec",0,Av,"$ZodCustom",0,Az,"$ZodCustomStringFormat",0,J,"$ZodDate",0,$,"$ZodDefault",0,AU,"$ZodDiscriminatedUnion",0,AC,"$ZodE164",0,L,"$ZodEmail",0,d,"$ZodEmoji",0,c,"$ZodEnum",0,Ap,"$ZodExactOptional",0,AS,"$ZodFile",0,Ay,"$ZodFunction",0,Aq,"$ZodGUID",0,l,"$ZodIPv4",0,N,"$ZodIPv6",0,S,"$ZodISODate",0,y,"$ZodISODateTime",0,f,"$ZodISODuration",0,m,"$ZodISOTime",0,M,"$ZodIntersection",0,AQ,"$ZodJWT",0,G,"$ZodKSUID",0,p,"$ZodLazy",0,AW,"$ZodLiteral",0,Af,"$ZodMAC",0,k,"$ZodMap",0,AB,"$ZodNaN",0,AO,"$ZodNanoID",0,h,"$ZodNever",0,z,"$ZodNonOptional",0,AT,"$ZodNull",0,q,"$ZodNullable",0,Ak,"$ZodNumber",0,v,"$ZodNumberFormat",0,x,"$ZodObject",0,An,"$ZodObjectJIT",0,Ai,"$ZodOptional",0,AN,"$ZodPipe",0,AG,"$ZodPrefault",0,AR,"$ZodPreprocess",0,AP,"$ZodPromise",0,AZ,"$ZodReadonly",0,AY,"$ZodRecord",0,Ah,"$ZodSet",0,Aw,"$ZodString",0,C,"$ZodStringFormat",0,Q,"$ZodSuccess",0,AH,"$ZodSymbol",0,_,"$ZodTemplateLiteral",0,AK,"$ZodTransform",0,AM,"$ZodTuple",0,AI,"$ZodType",0,g,"$ZodULID",0,w,"$ZodURL",0,E,"$ZodUUID",0,I,"$ZodUndefined",0,K,"$ZodUnion",0,As,"$ZodUnknown",0,W,"$ZodVoid",0,j,"$ZodXID",0,u,"$ZodXor",0,Ag,"isValidBase64",0,R,"isValidBase64URL",0,b,"isValidJWT",0,O],639510);let A$=Symbol("ZodOutput"),AX=Symbol("ZodInput");class A0{constructor(){this._map=new WeakMap,this._idmap=new Map}add(A,...e){let t=e[0];return this._map.set(A,t),t&&"object"==typeof t&&"id"in t&&this._idmap.set(t.id,A),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(A){let e=this._map.get(A);return e&&"object"==typeof e&&"id"in e&&this._idmap.delete(e.id),this._map.delete(A),this}get(A){let e=A._zod.parent;if(e){let t={...this.get(e)??{}};delete t.id;let r={...t,...this._map.get(A)};return Object.keys(r).length?r:void 0}return this._map.get(A)}has(A){return this._map.has(A)}}function A4(){return new A0}(e=globalThis).__zod_globalRegistry??(e.__zod_globalRegistry=A4());let A2=globalThis.__zod_globalRegistry;function A8(A,e){return new t.$ZodCheckLessThan({check:"less_than",...s.normalizeParams(e),value:A,inclusive:!1})}function A1(A,e){return new t.$ZodCheckLessThan({check:"less_than",...s.normalizeParams(e),value:A,inclusive:!0})}function A3(A,e){return new t.$ZodCheckGreaterThan({check:"greater_than",...s.normalizeParams(e),value:A,inclusive:!1})}function A5(A,e){return new t.$ZodCheckGreaterThan({check:"greater_than",...s.normalizeParams(e),value:A,inclusive:!0})}function A9(A){return new t.$ZodCheckOverwrite({check:"overwrite",tx:A})}function A6(A,e){let r=new t.$ZodCheck({check:"custom",...s.normalizeParams(e)});return r._zod.check=A,r}A.s(["$ZodRegistry",0,A0,"$input",0,AX,"$output",0,A$,"globalRegistry",0,A2,"registry",0,A4],52637),A.s(["TimePrecision",0,{Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6},"_any",0,function(A){return new A({type:"any"})},"_array",0,function(A,e,t){return new A({type:"array",element:e,...s.normalizeParams(t)})},"_base64",0,function(A,e){return new A({type:"string",format:"base64",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_base64url",0,function(A,e){return new A({type:"string",format:"base64url",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_bigint",0,function(A,e){return new A({type:"bigint",...s.normalizeParams(e)})},"_boolean",0,function(A,e){return new A({type:"boolean",...s.normalizeParams(e)})},"_catch",0,function(A,e,t){return new A({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})},"_check",0,A6,"_cidrv4",0,function(A,e){return new A({type:"string",format:"cidrv4",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_cidrv6",0,function(A,e){return new A({type:"string",format:"cidrv6",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_coercedBigint",0,function(A,e){return new A({type:"bigint",coerce:!0,...s.normalizeParams(e)})},"_coercedBoolean",0,function(A,e){return new A({type:"boolean",coerce:!0,...s.normalizeParams(e)})},"_coercedDate",0,function(A,e){return new A({type:"date",coerce:!0,...s.normalizeParams(e)})},"_coercedNumber",0,function(A,e){return new A({type:"number",coerce:!0,checks:[],...s.normalizeParams(e)})},"_coercedString",0,function(A,e){return new A({type:"string",coerce:!0,...s.normalizeParams(e)})},"_cuid",0,function(A,e){return new A({type:"string",format:"cuid",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_cuid2",0,function(A,e){return new A({type:"string",format:"cuid2",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_custom",0,function(A,e,t){let r=s.normalizeParams(t);return r.abort??(r.abort=!0),new A({type:"custom",check:"custom",fn:e,...r})},"_date",0,function(A,e){return new A({type:"date",...s.normalizeParams(e)})},"_default",0,function(A,e,t){return new A({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():s.shallowClone(t)}})},"_discriminatedUnion",0,function(A,e,t,r){return new A({type:"union",options:t,discriminator:e,...s.normalizeParams(r)})},"_e164",0,function(A,e){return new A({type:"string",format:"e164",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_email",0,function(A,e){return new A({type:"string",format:"email",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_emoji",0,function(A,e){return new A({type:"string",format:"emoji",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_endsWith",0,function(A,e){return new t.$ZodCheckEndsWith({check:"string_format",format:"ends_with",...s.normalizeParams(e),suffix:A})},"_enum",0,function(A,e,t){return new A({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(A=>[A,A])):e,...s.normalizeParams(t)})},"_file",0,function(A,e){return new A({type:"file",...s.normalizeParams(e)})},"_float32",0,function(A,e){return new A({type:"number",check:"number_format",abort:!1,format:"float32",...s.normalizeParams(e)})},"_float64",0,function(A,e){return new A({type:"number",check:"number_format",abort:!1,format:"float64",...s.normalizeParams(e)})},"_gt",0,A3,"_gte",0,A5,"_guid",0,function(A,e){return new A({type:"string",format:"guid",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_includes",0,function(A,e){return new t.$ZodCheckIncludes({check:"string_format",format:"includes",...s.normalizeParams(e),includes:A})},"_int",0,function(A,e){return new A({type:"number",check:"number_format",abort:!1,format:"safeint",...s.normalizeParams(e)})},"_int32",0,function(A,e){return new A({type:"number",check:"number_format",abort:!1,format:"int32",...s.normalizeParams(e)})},"_int64",0,function(A,e){return new A({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...s.normalizeParams(e)})},"_intersection",0,function(A,e,t){return new A({type:"intersection",left:e,right:t})},"_ipv4",0,function(A,e){return new A({type:"string",format:"ipv4",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_ipv6",0,function(A,e){return new A({type:"string",format:"ipv6",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_isoDate",0,function(A,e){return new A({type:"string",format:"date",check:"string_format",...s.normalizeParams(e)})},"_isoDateTime",0,function(A,e){return new A({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...s.normalizeParams(e)})},"_isoDuration",0,function(A,e){return new A({type:"string",format:"duration",check:"string_format",...s.normalizeParams(e)})},"_isoTime",0,function(A,e){return new A({type:"string",format:"time",check:"string_format",precision:null,...s.normalizeParams(e)})},"_jwt",0,function(A,e){return new A({type:"string",format:"jwt",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_ksuid",0,function(A,e){return new A({type:"string",format:"ksuid",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_lazy",0,function(A,e){return new A({type:"lazy",getter:e})},"_length",0,function(A,e){return new t.$ZodCheckLengthEquals({check:"length_equals",...s.normalizeParams(e),length:A})},"_literal",0,function(A,e,t){return new A({type:"literal",values:Array.isArray(e)?e:[e],...s.normalizeParams(t)})},"_lowercase",0,function(A){return new t.$ZodCheckLowerCase({check:"string_format",format:"lowercase",...s.normalizeParams(A)})},"_lt",0,A8,"_lte",0,A1,"_mac",0,function(A,e){return new A({type:"string",format:"mac",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_map",0,function(A,e,t,r){return new A({type:"map",keyType:e,valueType:t,...s.normalizeParams(r)})},"_max",0,A1,"_maxLength",0,function(A,e){return new t.$ZodCheckMaxLength({check:"max_length",...s.normalizeParams(e),maximum:A})},"_maxSize",0,function(A,e){return new t.$ZodCheckMaxSize({check:"max_size",...s.normalizeParams(e),maximum:A})},"_mime",0,function(A,e){return new t.$ZodCheckMimeType({check:"mime_type",mime:A,...s.normalizeParams(e)})},"_min",0,A5,"_minLength",0,function(A,e){return new t.$ZodCheckMinLength({check:"min_length",...s.normalizeParams(e),minimum:A})},"_minSize",0,function(A,e){return new t.$ZodCheckMinSize({check:"min_size",...s.normalizeParams(e),minimum:A})},"_multipleOf",0,function(A,e){return new t.$ZodCheckMultipleOf({check:"multiple_of",...s.normalizeParams(e),value:A})},"_nan",0,function(A,e){return new A({type:"nan",...s.normalizeParams(e)})},"_nanoid",0,function(A,e){return new A({type:"string",format:"nanoid",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_nativeEnum",0,function(A,e,t){return new A({type:"enum",entries:e,...s.normalizeParams(t)})},"_negative",0,function(A){return A8(0,A)},"_never",0,function(A,e){return new A({type:"never",...s.normalizeParams(e)})},"_nonnegative",0,function(A){return A5(0,A)},"_nonoptional",0,function(A,e,t){return new A({type:"nonoptional",innerType:e,...s.normalizeParams(t)})},"_nonpositive",0,function(A){return A1(0,A)},"_normalize",0,function(A){return A9(e=>e.normalize(A))},"_null",0,function(A,e){return new A({type:"null",...s.normalizeParams(e)})},"_nullable",0,function(A,e){return new A({type:"nullable",innerType:e})},"_number",0,function(A,e){return new A({type:"number",checks:[],...s.normalizeParams(e)})},"_optional",0,function(A,e){return new A({type:"optional",innerType:e})},"_overwrite",0,A9,"_pipe",0,function(A,e,t){return new A({type:"pipe",in:e,out:t})},"_positive",0,function(A){return A3(0,A)},"_promise",0,function(A,e){return new A({type:"promise",innerType:e})},"_property",0,function(A,e,r){return new t.$ZodCheckProperty({check:"property",property:A,schema:e,...s.normalizeParams(r)})},"_readonly",0,function(A,e){return new A({type:"readonly",innerType:e})},"_record",0,function(A,e,t,r){return new A({type:"record",keyType:e,valueType:t,...s.normalizeParams(r)})},"_refine",0,function(A,e,t){return new A({type:"custom",check:"custom",fn:e,...s.normalizeParams(t)})},"_regex",0,function(A,e){return new t.$ZodCheckRegex({check:"string_format",format:"regex",...s.normalizeParams(e),pattern:A})},"_set",0,function(A,e,t){return new A({type:"set",valueType:e,...s.normalizeParams(t)})},"_size",0,function(A,e){return new t.$ZodCheckSizeEquals({check:"size_equals",...s.normalizeParams(e),size:A})},"_slugify",0,function(){return A9(A=>s.slugify(A))},"_startsWith",0,function(A,e){return new t.$ZodCheckStartsWith({check:"string_format",format:"starts_with",...s.normalizeParams(e),prefix:A})},"_string",0,function(A,e){return new A({type:"string",...s.normalizeParams(e)})},"_stringFormat",0,function(A,e,t,r={}){let n=s.normalizeParams(r),i={...s.normalizeParams(r),check:"string_format",type:"string",format:e,fn:"function"==typeof t?t:A=>t.test(A),...n};return t instanceof RegExp&&(i.pattern=t),new A(i)},"_stringbool",0,function(A,e){let t=s.normalizeParams(e),r=t.truthy??["true","1","yes","on","y","enabled"],n=t.falsy??["false","0","no","off","n","disabled"];"sensitive"!==t.case&&(r=r.map(A=>"string"==typeof A?A.toLowerCase():A),n=n.map(A=>"string"==typeof A?A.toLowerCase():A));let i=new Set(r),a=new Set(n),o=A.Codec??Av,g=A.Boolean??V,Q=new o({type:"pipe",in:new(A.String??C)({type:"string",error:t.error}),out:new g({type:"boolean",error:t.error}),transform:(A,e)=>{let r=A;return"sensitive"!==t.case&&(r=r.toLowerCase()),!!i.has(r)||!a.has(r)&&(e.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:e.value,inst:Q,continue:!1}),{})},reverseTransform:(A,e)=>!0===A?r[0]||"true":n[0]||"false",error:t.error});return Q},"_success",0,function(A,e){return new A({type:"success",innerType:e})},"_superRefine",0,function(A,e){let t=A6(e=>(e.addIssue=A=>{"string"==typeof A?e.issues.push(s.issue(A,e.value,t._zod.def)):(A.fatal&&(A.continue=!1),A.code??(A.code="custom"),A.input??(A.input=e.value),A.inst??(A.inst=t),A.continue??(A.continue=!t._zod.def.abort),e.issues.push(s.issue(A)))},A(e.value,e)),e);return t},"_symbol",0,function(A,e){return new A({type:"symbol",...s.normalizeParams(e)})},"_templateLiteral",0,function(A,e,t){return new A({type:"template_literal",parts:e,...s.normalizeParams(t)})},"_toLowerCase",0,function(){return A9(A=>A.toLowerCase())},"_toUpperCase",0,function(){return A9(A=>A.toUpperCase())},"_transform",0,function(A,e){return new A({type:"transform",transform:e})},"_trim",0,function(){return A9(A=>A.trim())},"_tuple",0,function(A,e,t,r){let n=t instanceof g,i=n?r:t;return new A({type:"tuple",items:e,rest:n?t:null,...s.normalizeParams(i)})},"_uint32",0,function(A,e){return new A({type:"number",check:"number_format",abort:!1,format:"uint32",...s.normalizeParams(e)})},"_uint64",0,function(A,e){return new A({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...s.normalizeParams(e)})},"_ulid",0,function(A,e){return new A({type:"string",format:"ulid",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_undefined",0,function(A,e){return new A({type:"undefined",...s.normalizeParams(e)})},"_union",0,function(A,e,t){return new A({type:"union",options:e,...s.normalizeParams(t)})},"_unknown",0,function(A){return new A({type:"unknown"})},"_uppercase",0,function(A){return new t.$ZodCheckUpperCase({check:"string_format",format:"uppercase",...s.normalizeParams(A)})},"_url",0,function(A,e){return new A({type:"string",format:"url",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_uuid",0,function(A,e){return new A({type:"string",format:"uuid",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_uuidv4",0,function(A,e){return new A({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...s.normalizeParams(e)})},"_uuidv6",0,function(A,e){return new A({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...s.normalizeParams(e)})},"_uuidv7",0,function(A,e){return new A({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...s.normalizeParams(e)})},"_void",0,function(A,e){return new A({type:"void",...s.normalizeParams(e)})},"_xid",0,function(A,e){return new A({type:"string",format:"xid",check:"string_format",abort:!1,...s.normalizeParams(e)})},"_xor",0,function(A,e,t){return new A({type:"union",options:e,inclusive:!1,...s.normalizeParams(t)})},"describe",0,function(A){let e=new t.$ZodCheck({check:"describe"});return e._zod.onattach=[e=>{let t=A2.get(e)??{};A2.add(e,{...t,description:A})}],e._zod.check=()=>{},e},"meta",0,function(A){let e=new t.$ZodCheck({check:"meta"});return e._zod.onattach=[e=>{let t=A2.get(e)??{};A2.add(e,{...t,...A})}],e._zod.check=()=>{},e}],862061)},865889,207159,A=>{"use strict";var e=A.i(52637);function t(A){let t=A?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:A.processors??{},metadataRegistry:A?.metadata??e.globalRegistry,target:t,unrepresentable:A?.unrepresentable??"throw",override:A?.override??(()=>{}),io:A?.io??"output",counter:0,seen:new Map,cycles:A?.cycles??"ref",reused:A?.reused??"inline",external:A?.external??void 0}}function r(A,e,t={path:[],schemaPath:[]}){var n;let i=A._zod.def,a=e.seen.get(A);if(a)return a.count++,t.schemaPath.includes(A)&&(a.cycle=t.path),a.schema;let s={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(A,s);let o=A._zod.toJSONSchema?.();if(o)s.schema=o;else{let n={...t,schemaPath:[...t.schemaPath,A],path:t.path};if(A._zod.processJSONSchema)A._zod.processJSONSchema(e,s.schema,n);else{let t=s.schema,r=e.processors[i.type];if(!r)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);r(A,e,t,n)}let a=A._zod.parent;a&&(s.ref||(s.ref=a),r(a,e,n),e.seen.get(a).isParent=!0)}let g=e.metadataRegistry.get(A);return g&&Object.assign(s.schema,g),"input"===e.io&&function A(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return A(n.element,r);if("set"===n.type)return A(n.valueType,r);if("lazy"===n.type)return A(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return A(n.innerType,r);if("intersection"===n.type)return A(n.left,r)||A(n.right,r);if("record"===n.type||"map"===n.type)return A(n.keyType,r)||A(n.valueType,r);if("pipe"===n.type)return!!e._zod.traits.has("$ZodCodec")||A(n.in,r)||A(n.out,r);if("object"===n.type){for(let e in n.shape)if(A(n.shape[e],r))return!0;return!1}if("union"===n.type){for(let e of n.options)if(A(e,r))return!0;return!1}if("tuple"===n.type){for(let e of n.items)if(A(e,r))return!0;if(n.rest&&A(n.rest,r))return!0}return!1}(A)&&(delete s.schema.examples,delete s.schema.default),"input"===e.io&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,e.seen.get(A).schema}function n(A,e){let t=A.seen.get(e);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let e of A.seen.entries()){let t=A.metadataRegistry.get(e[0])?.id;if(t){let A=r.get(t);if(A&&A!==e[0])throw Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,e[0])}}let n=e=>{if(e[1].schema.$ref)return;let r=e[1],{ref:n,defId:i}=(e=>{let r="draft-2020-12"===A.target?"$defs":"definitions";if(A.external){let t=A.external.registry.get(e[0])?.id,n=A.external.uri??(A=>A);if(t)return{ref:n(t)};let i=e[1].defId??e[1].schema.id??`schema${A.counter++}`;return e[1].defId=i,{defId:i,ref:`${n("__shared")}#/${r}/${i}`}}if(e[1]===t)return{ref:"#"};let n=`#/${r}/`,i=e[1].schema.id??`__schema${A.counter++}`;return{defId:i,ref:n+i}})(e);r.def={...r.schema},i&&(r.defId=i);let a=r.schema;for(let A in a)delete a[A];a.$ref=n};if("throw"===A.cycles)for(let e of A.seen.entries()){let A=e[1];if(A.cycle)throw Error(`Cycle detected: #/${A.cycle?.join("/")}/<root>
181
181
 
182
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let t of A.seen.entries()){let r=t[1];if(e===t[0]){n(t);continue}if(A.external){let r=A.external.registry.get(t[0])?.id;if(e!==t[0]&&r){n(t);continue}}if(A.metadataRegistry.get(t[0])?.id||r.cycle||r.count>1&&"ref"===A.reused){n(t);continue}}}function i(A,e){let t=A.seen.get(e);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");let r=e=>{let t=A.seen.get(e);if(null===t.ref)return;let n=t.def??t.schema,i={...n},a=t.ref;if(t.ref=null,a){r(a);let t=A.seen.get(a),s=t.schema;if(s.$ref&&("draft-07"===A.target||"draft-04"===A.target||"openapi-3.0"===A.target)?(n.allOf=n.allOf??[],n.allOf.push(s)):Object.assign(n,s),Object.assign(n,i),e._zod.parent===a)for(let A in n)"$ref"!==A&&"allOf"!==A&&(A in i||delete n[A]);if(s.$ref&&t.def)for(let A in n)"$ref"!==A&&"allOf"!==A&&A in t.def&&JSON.stringify(n[A])===JSON.stringify(t.def[A])&&delete n[A]}let s=e._zod.parent;if(s&&s!==a){r(s);let e=A.seen.get(s);if(e?.schema.$ref&&(n.$ref=e.schema.$ref,e.def))for(let A in n)"$ref"!==A&&"allOf"!==A&&A in e.def&&JSON.stringify(n[A])===JSON.stringify(e.def[A])&&delete n[A]}A.override({zodSchema:e,jsonSchema:n,path:t.path??[]})};for(let e of[...A.seen.entries()].reverse())r(e[0]);let n={};if("draft-2020-12"===A.target?n.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===A.target?n.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===A.target?n.$schema="http://json-schema.org/draft-04/schema#":A.target,A.external?.uri){let t=A.external.registry.get(e)?.id;if(!t)throw Error("Schema is missing an `id` property");n.$id=A.external.uri(t)}Object.assign(n,t.def??t.schema);let i=A.metadataRegistry.get(e)?.id;void 0!==i&&n.id===i&&delete n.id;let s=A.external?.defs??{};for(let e of A.seen.entries()){let A=e[1];A.def&&A.defId&&(A.def.id===A.defId&&delete A.def.id,s[A.defId]=A.def)}A.external||Object.keys(s).length>0&&("draft-2020-12"===A.target?n.$defs=s:n.definitions=s);try{let t=JSON.parse(JSON.stringify(n));return Object.defineProperty(t,"~standard",{value:{...e["~standard"],jsonSchema:{input:a(e,"input",A.processors),output:a(e,"output",A.processors)}},enumerable:!1,writable:!1}),t}catch(A){throw Error("Error converting schema to JSON.")}}let a=(A,e,a={})=>s=>{let{libraryOptions:o,target:g}=s??{},C=t({...o??{},target:g,io:e,processors:a});return r(A,C),n(C,A),i(C,A)};A.s(["createStandardJSONSchemaMethod",0,a,"createToJSONSchemaMethod",0,(A,e={})=>a=>{let s=t({...a,processors:e});return r(A,s),n(s,A),i(s,A)},"extractDefs",0,n,"finalize",0,i,"initializeContext",0,t,"process",0,r],207159);var s=A.i(486618);let o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},g=(A,e,t,r)=>{t.type="string";let{minimum:n,maximum:i,format:a,patterns:s,contentEncoding:g}=A._zod.bag;if("number"==typeof n&&(t.minLength=n),"number"==typeof i&&(t.maxLength=i),a&&(t.format=o[a]??a,""===t.format&&delete t.format,"time"===a&&delete t.format),g&&(t.contentEncoding=g),s&&s.size>0){let A=[...s];1===A.length?t.pattern=A[0].source:A.length>1&&(t.allOf=[...A.map(A=>({..."draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target?{type:"string"}:{},pattern:A.source}))])}},C=(A,e,t,r)=>{let{minimum:n,maximum:i,format:a,multipleOf:s,exclusiveMaximum:o,exclusiveMinimum:g}=A._zod.bag;"string"==typeof a&&a.includes("int")?t.type="integer":t.type="number";let C="number"==typeof g&&g>=(n??-1/0),Q="number"==typeof o&&o<=(i??1/0),l="draft-04"===e.target||"openapi-3.0"===e.target;C?l?(t.minimum=g,t.exclusiveMinimum=!0):t.exclusiveMinimum=g:"number"==typeof n&&(t.minimum=n),Q?l?(t.maximum=o,t.exclusiveMaximum=!0):t.exclusiveMaximum=o:"number"==typeof i&&(t.maximum=i),"number"==typeof s&&(t.multipleOf=s)},Q=(A,e,t,r)=>{t.type="boolean"},l=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},I=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},d=(A,e,t,r)=>{"openapi-3.0"===e.target?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"},E=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},c=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},h=(A,e,t,r)=>{t.not={}},B=(A,e,t,r)=>{},D=(A,e,t,r)=>{},w=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},u=(A,e,t,r)=>{let n=A._zod.def,i=(0,s.getEnumValues)(n.entries);i.every(A=>"number"==typeof A)&&(t.type="number"),i.every(A=>"string"==typeof A)&&(t.type="string"),t.enum=i},p=(A,e,t,r)=>{let n=A._zod.def,i=[];for(let A of n.values)if(void 0===A){if("throw"===e.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof A)if("throw"===e.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(A));else i.push(A);if(0===i.length);else if(1===i.length){let A=i[0];t.type=null===A?"null":typeof A,"draft-04"===e.target||"openapi-3.0"===e.target?t.enum=[A]:t.const=A}else i.every(A=>"number"==typeof A)&&(t.type="number"),i.every(A=>"string"==typeof A)&&(t.type="string"),i.every(A=>"boolean"==typeof A)&&(t.type="boolean"),i.every(A=>null===A)&&(t.type="null"),t.enum=i},f=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},y=(A,e,t,r)=>{let n=A._zod.pattern;if(!n)throw Error("Pattern not found in template literal");t.type="string",t.pattern=n.source},M=(A,e,t,r)=>{let n={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:s}=A._zod.bag;void 0!==i&&(n.minLength=i),void 0!==a&&(n.maxLength=a),s?1===s.length?(n.contentMediaType=s[0],Object.assign(t,n)):(Object.assign(t,n),t.anyOf=s.map(A=>({contentMediaType:A}))):Object.assign(t,n)},m=(A,e,t,r)=>{t.type="boolean"},N=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},S=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},k=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},U=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},F=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},R=(A,e,t,n)=>{let i=A._zod.def,{minimum:a,maximum:s}=A._zod.bag;"number"==typeof a&&(t.minItems=a),"number"==typeof s&&(t.maxItems=s),t.type="array",t.items=r(i.element,e,{...n,path:[...n.path,"items"]})},T=(A,e,t,n)=>{let i=A._zod.def;t.type="object",t.properties={};let a=i.shape;for(let A in a)t.properties[A]=r(a[A],e,{...n,path:[...n.path,"properties",A]});let s=new Set([...new Set(Object.keys(a))].filter(A=>{let t=i.shape[A]._zod;return"input"===e.io?void 0===t.optin:void 0===t.optout}));s.size>0&&(t.required=Array.from(s)),i.catchall?._zod.def.type==="never"?t.additionalProperties=!1:i.catchall?i.catchall&&(t.additionalProperties=r(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):"output"===e.io&&(t.additionalProperties=!1)},b=(A,e,t,n)=>{let i=A._zod.def,a=!1===i.inclusive,s=i.options.map((A,t)=>r(A,e,{...n,path:[...n.path,a?"oneOf":"anyOf",t]}));a?t.oneOf=s:t.anyOf=s},H=(A,e,t,n)=>{let i=A._zod.def,a=r(i.left,e,{...n,path:[...n.path,"allOf",0]}),s=r(i.right,e,{...n,path:[...n.path,"allOf",1]}),o=A=>"allOf"in A&&1===Object.keys(A).length;t.allOf=[...o(a)?a.allOf:[a],...o(s)?s.allOf:[s]]},L=(A,e,t,n)=>{let i=A._zod.def;t.type="array";let a="draft-2020-12"===e.target?"prefixItems":"items",s="draft-2020-12"===e.target||"openapi-3.0"===e.target?"items":"additionalItems",o=i.items.map((A,t)=>r(A,e,{...n,path:[...n.path,a,t]})),g=i.rest?r(i.rest,e,{...n,path:[...n.path,s,..."openapi-3.0"===e.target?[i.items.length]:[]]}):null;"draft-2020-12"===e.target?(t.prefixItems=o,g&&(t.items=g)):"openapi-3.0"===e.target?(t.items={anyOf:o},g&&t.items.anyOf.push(g),t.minItems=o.length,g||(t.maxItems=o.length)):(t.items=o,g&&(t.additionalItems=g));let{minimum:C,maximum:Q}=A._zod.bag;"number"==typeof C&&(t.minItems=C),"number"==typeof Q&&(t.maxItems=Q)},O=(A,e,t,n)=>{let i=A._zod.def;t.type="object";let a=i.keyType,s=a._zod.bag,o=s?.patterns;if("loose"===i.mode&&o&&o.size>0){let A=r(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});for(let e of(t.patternProperties={},o))t.patternProperties[e.source]=A}else("draft-07"===e.target||"draft-2020-12"===e.target)&&(t.propertyNames=r(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),t.additionalProperties=r(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let g=a._zod.values;if(g){let A=[...g].filter(A=>"string"==typeof A||"number"==typeof A);A.length>0&&(t.required=A)}},G=(A,e,t,n)=>{let i=A._zod.def,a=r(i.innerType,e,n),s=e.seen.get(A);"openapi-3.0"===e.target?(s.ref=i.innerType,t.nullable=!0):t.anyOf=[a,{type:"null"}]},J=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType},v=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},x=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType,"input"===e.io&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},V=(A,e,t,n)=>{let i,a=A._zod.def;r(a.innerType,e,n),e.seen.get(A).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}t.default=i},P=(A,e,t,n)=>{let i=A._zod.def,a=i.in._zod.traits.has("$ZodTransform"),s="input"===e.io?a?i.out:i.in:i.out;r(s,e,n),e.seen.get(A).ref=s},Y=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType,t.readOnly=!0},_=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType},K=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType},q=(A,e,t,n)=>{let i=A._zod.innerType;r(i,e,n),e.seen.get(A).ref=i},Z={string:g,number:C,boolean:Q,bigint:l,symbol:I,null:d,undefined:E,void:c,never:h,any:B,unknown:D,date:w,enum:u,literal:p,nan:f,template_literal:y,file:M,success:m,custom:N,function:S,transform:k,map:U,set:F,array:R,object:T,union:b,intersection:H,tuple:L,record:O,nullable:G,nonoptional:J,default:v,prefault:x,catch:V,pipe:P,readonly:Y,promise:_,optional:K,lazy:q};A.s(["allProcessors",0,Z,"anyProcessor",0,B,"arrayProcessor",0,R,"bigintProcessor",0,l,"booleanProcessor",0,Q,"catchProcessor",0,V,"customProcessor",0,N,"dateProcessor",0,w,"defaultProcessor",0,v,"enumProcessor",0,u,"fileProcessor",0,M,"functionProcessor",0,S,"intersectionProcessor",0,H,"lazyProcessor",0,q,"literalProcessor",0,p,"mapProcessor",0,U,"nanProcessor",0,f,"neverProcessor",0,h,"nonoptionalProcessor",0,J,"nullProcessor",0,d,"nullableProcessor",0,G,"numberProcessor",0,C,"objectProcessor",0,T,"optionalProcessor",0,K,"pipeProcessor",0,P,"prefaultProcessor",0,x,"promiseProcessor",0,_,"readonlyProcessor",0,Y,"recordProcessor",0,O,"setProcessor",0,F,"stringProcessor",0,g,"successProcessor",0,m,"symbolProcessor",0,I,"templateLiteralProcessor",0,y,"toJSONSchema",0,function(A,e){if("_idmap"in A){let a=t({...e,processors:Z}),s={};for(let e of A._idmap.entries()){let[A,t]=e;r(t,a)}let o={};for(let t of(a.external={registry:A,uri:e?.uri,defs:s},A._idmap.entries())){let[A,e]=t;n(a,e),o[A]=i(a,e)}return Object.keys(s).length>0&&(o.__shared={["draft-2020-12"===a.target?"$defs":"definitions"]:s}),{schemas:o}}let a=t({...e,processors:Z});return r(A,a),n(a,A),i(a,A)},"transformProcessor",0,k,"tupleProcessor",0,L,"undefinedProcessor",0,E,"unionProcessor",0,b,"unknownProcessor",0,D,"voidProcessor",0,c],865889)},467662,628343,A=>{"use strict";var e=A.i(421131);A.s(["regexes",0,e],467662);var t=A.i(486618);A.s(["util",0,t],628343)},907855,551047,915874,248804,A=>{"use strict";A.s(["ZodAny",()=>A3,"ZodArray",()=>ei,"ZodBase64",()=>AM,"ZodBase64URL",()=>AN,"ZodBigInt",()=>AZ,"ZodBigIntFormat",()=>Az,"ZodBoolean",()=>AK,"ZodCIDRv4",()=>Au,"ZodCIDRv6",()=>Af,"ZodCUID",()=>Ai,"ZodCUID2",()=>As,"ZodCatch",()=>e0,"ZodCodec",()=>e5,"ZodCustom",()=>tC,"ZodCustomStringFormat",()=>AT,"ZodDate",()=>er,"ZodDefault",()=>eK,"ZodDiscriminatedUnion",()=>ec,"ZodE164",()=>Ak,"ZodEmail",()=>P,"ZodEmoji",()=>Ae,"ZodEnum",()=>eU,"ZodExactOptional",()=>ex,"ZodFile",()=>eH,"ZodFunction",()=>to,"ZodGUID",()=>_,"ZodIPv4",()=>AE,"ZodIPv6",()=>AD,"ZodIntersection",()=>eB,"ZodJWT",()=>AF,"ZodKSUID",()=>AI,"ZodLazy",()=>tn,"ZodLiteral",()=>eT,"ZodMAC",()=>Ah,"ZodMap",()=>em,"ZodNaN",()=>e2,"ZodNanoID",()=>Ar,"ZodNever",()=>A7,"ZodNonOptional",()=>ez,"ZodNull",()=>A8,"ZodNullable",()=>eP,"ZodNumber",()=>AG,"ZodNumberFormat",()=>Av,"ZodObject",()=>eo,"ZodOptional",()=>eJ,"ZodPipe",()=>e1,"ZodPrefault",()=>eZ,"ZodPreprocess",()=>e7,"ZodPromise",()=>ta,"ZodReadonly",()=>tA,"ZodRecord",()=>ep,"ZodSet",()=>eS,"ZodString",()=>v,"ZodStringFormat",()=>V,"ZodSuccess",()=>e$,"ZodSymbol",()=>AX,"ZodTemplateLiteral",()=>tt,"ZodTransform",()=>eO,"ZodTuple",()=>ew,"ZodType",()=>G,"ZodULID",()=>Ag,"ZodURL",()=>$,"ZodUUID",()=>q,"ZodUndefined",()=>A4,"ZodUnion",()=>el,"ZodUnknown",()=>A9,"ZodVoid",()=>ee,"ZodXID",()=>AQ,"ZodXor",()=>ed,"_ZodString",()=>J,"_default",()=>eq,"_function",()=>tg,"any",()=>A5,"array",()=>ea,"base64",()=>Am,"base64url",()=>AS,"bigint",()=>AW,"boolean",()=>Aq,"catch",()=>e4,"check",()=>tQ,"cidrv4",()=>Ap,"cidrv6",()=>Ay,"codec",()=>e9,"cuid",()=>Aa,"cuid2",()=>Ao,"custom",()=>tl,"date",()=>en,"describe",()=>tE,"discriminatedUnion",()=>eh,"e164",()=>AU,"email",()=>Y,"emoji",()=>At,"enum",()=>eF,"exactOptional",()=>eV,"file",()=>eL,"float32",()=>AV,"float64",()=>AP,"function",()=>tg,"guid",()=>K,"hash",()=>AO,"hex",()=>AL,"hostname",()=>AH,"httpUrl",()=>AA,"instanceof",()=>th,"int",()=>Ax,"int32",()=>AY,"int64",()=>Aj,"intersection",()=>eD,"invertCodec",()=>e6,"ipv4",()=>Ac,"ipv6",()=>Aw,"json",()=>tD,"jwt",()=>AR,"keyof",()=>es,"ksuid",()=>Ad,"lazy",()=>ti,"literal",()=>eb,"looseObject",()=>eQ,"looseRecord",()=>eM,"mac",()=>AB,"map",()=>eN,"meta",()=>tc,"nan",()=>e8,"nanoid",()=>An,"nativeEnum",()=>eR,"never",()=>eA,"nonoptional",()=>ej,"null",()=>A1,"nullable",()=>eY,"nullish",()=>e_,"number",()=>AJ,"object",()=>eg,"optional",()=>ev,"partialRecord",()=>ey,"pipe",()=>e3,"prefault",()=>eW,"preprocess",()=>tw,"promise",()=>ts,"readonly",()=>te,"record",()=>ef,"refine",()=>tI,"set",()=>ek,"strictObject",()=>eC,"string",()=>x,"stringFormat",()=>Ab,"stringbool",()=>tB,"success",()=>eX,"superRefine",()=>td,"symbol",()=>A0,"templateLiteral",()=>tr,"transform",()=>eG,"tuple",()=>eu,"uint32",()=>A_,"uint64",()=>A$,"ulid",()=>AC,"undefined",()=>A2,"union",()=>eI,"unknown",()=>A6,"url",()=>X,"uuid",()=>Z,"uuidv4",()=>W,"uuidv6",()=>z,"uuidv7",()=>j,"void",()=>et,"xid",()=>Al,"xor",()=>eE],907855);var e=A.i(127438),t=A.i(639510),r=A.i(486618),n=A.i(52637),i=A.i(862061),a=A.i(467662),s=A.i(236608),o=A.i(628343),g=A.i(865889),C=A.i(207159);A.s(["ZodISODate",()=>I,"ZodISODateTime",()=>Q,"ZodISODuration",()=>h,"ZodISOTime",()=>E,"date",()=>d,"datetime",()=>l,"duration",()=>B,"time",()=>c],551047);let Q=e.$constructor("ZodISODateTime",(A,e)=>{t.$ZodISODateTime.init(A,e),V.init(A,e)});function l(A){return i._isoDateTime(Q,A)}let I=e.$constructor("ZodISODate",(A,e)=>{t.$ZodISODate.init(A,e),V.init(A,e)});function d(A){return i._isoDate(I,A)}let E=e.$constructor("ZodISOTime",(A,e)=>{t.$ZodISOTime.init(A,e),V.init(A,e)});function c(A){return i._isoTime(E,A)}let h=e.$constructor("ZodISODuration",(A,e)=>{t.$ZodISODuration.init(A,e),V.init(A,e)});function B(A){return i._isoDuration(h,A)}var D=A.i(715143),w=A.i(67021);let u=(A,e)=>{w.$ZodError.init(A,e),A.name="ZodError",Object.defineProperties(A,{format:{value:e=>w.formatError(A,e)},flatten:{value:e=>w.flattenError(A,e)},addIssue:{value:e=>{A.issues.push(e),A.message=JSON.stringify(A.issues,r.jsonStringifyReplacer,2)}},addIssues:{value:e=>{A.issues.push(...e),A.message=JSON.stringify(A.issues,r.jsonStringifyReplacer,2)}},isEmpty:{get:()=>0===A.issues.length}})},p=e.$constructor("ZodError",u),f=e.$constructor("ZodError",u,{Parent:Error});A.s(["ZodError",0,p,"ZodRealError",0,f],915874);let y=D._parse(f),M=D._parseAsync(f),m=D._safeParse(f),N=D._safeParseAsync(f),S=D._encode(f),k=D._decode(f),U=D._encodeAsync(f),F=D._decodeAsync(f),R=D._safeEncode(f),T=D._safeDecode(f),b=D._safeEncodeAsync(f),H=D._safeDecodeAsync(f);A.s(["decode",0,k,"decodeAsync",0,F,"encode",0,S,"encodeAsync",0,U,"parse",0,y,"parseAsync",0,M,"safeDecode",0,T,"safeDecodeAsync",0,H,"safeEncode",0,R,"safeEncodeAsync",0,b,"safeParse",0,m,"safeParseAsync",0,N],248804);let L=new WeakMap;function O(A,e,t){let r=Object.getPrototypeOf(A),n=L.get(r);if(n||(n=new Set,L.set(r,n)),!n.has(e))for(let A in n.add(e),t){let e=t[A];Object.defineProperty(r,A,{configurable:!0,enumerable:!1,get(){let t=e.bind(this);return Object.defineProperty(this,A,{configurable:!0,writable:!0,enumerable:!0,value:t}),t},set(e){Object.defineProperty(this,A,{configurable:!0,writable:!0,enumerable:!0,value:e})}})}}let G=e.$constructor("ZodType",(A,e)=>(t.$ZodType.init(A,e),Object.assign(A["~standard"],{jsonSchema:{input:(0,C.createStandardJSONSchemaMethod)(A,"input"),output:(0,C.createStandardJSONSchemaMethod)(A,"output")}}),A.toJSONSchema=(0,C.createToJSONSchemaMethod)(A,{}),A.def=e,A.type=e.type,Object.defineProperty(A,"_def",{value:e}),A.parse=(e,t)=>y(A,e,t,{callee:A.parse}),A.safeParse=(e,t)=>m(A,e,t),A.parseAsync=async(e,t)=>M(A,e,t,{callee:A.parseAsync}),A.safeParseAsync=async(e,t)=>N(A,e,t),A.spa=A.safeParseAsync,A.encode=(e,t)=>S(A,e,t),A.decode=(e,t)=>k(A,e,t),A.encodeAsync=async(e,t)=>U(A,e,t),A.decodeAsync=async(e,t)=>F(A,e,t),A.safeEncode=(e,t)=>R(A,e,t),A.safeDecode=(e,t)=>T(A,e,t),A.safeEncodeAsync=async(e,t)=>b(A,e,t),A.safeDecodeAsync=async(e,t)=>H(A,e,t),O(A,"ZodType",{check(...A){let e=this.def;return this.clone(o.util.mergeDefs(e,{checks:[...e.checks??[],...A.map(A=>"function"==typeof A?{_zod:{check:A,def:{check:"custom"},onattach:[]}}:A)]}),{parent:!0})},with(...A){return this.check(...A)},clone(A,e){return r.clone(this,A,e)},brand(){return this},register(A,e){return A.add(this,e),this},refine(A,e){return this.check(tI(A,e))},superRefine(A,e){return this.check(td(A,e))},overwrite(A){return this.check(i._overwrite(A))},optional(){return ev(this)},exactOptional(){return eV(this)},nullable(){return eY(this)},nullish(){return ev(eY(this))},nonoptional(A){return ej(this,A)},array(){return ea(this)},or(A){return eI([this,A])},and(A){return eD(this,A)},transform(A){return e3(this,eG(A))},default(A){return eq(this,A)},prefault(A){return eW(this,A)},catch(A){return e4(this,A)},pipe(A){return e3(this,A)},readonly(){return te(this)},describe(A){let e=this.clone();return n.globalRegistry.add(e,{description:A}),e},meta(...A){if(0===A.length)return n.globalRegistry.get(this);let e=this.clone();return n.globalRegistry.add(e,A[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(A){return A(this)}}),Object.defineProperty(A,"description",{get:()=>n.globalRegistry.get(A)?.description,configurable:!0}),A)),J=e.$constructor("_ZodString",(A,e)=>{t.$ZodString.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.stringProcessor(A,e,t,r);let r=A._zod.bag;A.format=r.format??null,A.minLength=r.minimum??null,A.maxLength=r.maximum??null,O(A,"_ZodString",{regex(...A){return this.check(i._regex(...A))},includes(...A){return this.check(i._includes(...A))},startsWith(...A){return this.check(i._startsWith(...A))},endsWith(...A){return this.check(i._endsWith(...A))},min(...A){return this.check(i._minLength(...A))},max(...A){return this.check(i._maxLength(...A))},length(...A){return this.check(i._length(...A))},nonempty(...A){return this.check(i._minLength(1,...A))},lowercase(A){return this.check(i._lowercase(A))},uppercase(A){return this.check(i._uppercase(A))},trim(){return this.check(i._trim())},normalize(...A){return this.check(i._normalize(...A))},toLowerCase(){return this.check(i._toLowerCase())},toUpperCase(){return this.check(i._toUpperCase())},slugify(){return this.check(i._slugify())}})}),v=e.$constructor("ZodString",(A,e)=>{t.$ZodString.init(A,e),J.init(A,e),A.email=e=>A.check(i._email(P,e)),A.url=e=>A.check(i._url($,e)),A.jwt=e=>A.check(i._jwt(AF,e)),A.emoji=e=>A.check(i._emoji(Ae,e)),A.guid=e=>A.check(i._guid(_,e)),A.uuid=e=>A.check(i._uuid(q,e)),A.uuidv4=e=>A.check(i._uuidv4(q,e)),A.uuidv6=e=>A.check(i._uuidv6(q,e)),A.uuidv7=e=>A.check(i._uuidv7(q,e)),A.nanoid=e=>A.check(i._nanoid(Ar,e)),A.guid=e=>A.check(i._guid(_,e)),A.cuid=e=>A.check(i._cuid(Ai,e)),A.cuid2=e=>A.check(i._cuid2(As,e)),A.ulid=e=>A.check(i._ulid(Ag,e)),A.base64=e=>A.check(i._base64(AM,e)),A.base64url=e=>A.check(i._base64url(AN,e)),A.xid=e=>A.check(i._xid(AQ,e)),A.ksuid=e=>A.check(i._ksuid(AI,e)),A.ipv4=e=>A.check(i._ipv4(AE,e)),A.ipv6=e=>A.check(i._ipv6(AD,e)),A.cidrv4=e=>A.check(i._cidrv4(Au,e)),A.cidrv6=e=>A.check(i._cidrv6(Af,e)),A.e164=e=>A.check(i._e164(Ak,e)),A.datetime=e=>A.check(l(e)),A.date=e=>A.check(d(e)),A.time=e=>A.check(c(e)),A.duration=e=>A.check(B(e))});function x(A){return i._string(v,A)}let V=e.$constructor("ZodStringFormat",(A,e)=>{t.$ZodStringFormat.init(A,e),J.init(A,e)}),P=e.$constructor("ZodEmail",(A,e)=>{t.$ZodEmail.init(A,e),V.init(A,e)});function Y(A){return i._email(P,A)}let _=e.$constructor("ZodGUID",(A,e)=>{t.$ZodGUID.init(A,e),V.init(A,e)});function K(A){return i._guid(_,A)}let q=e.$constructor("ZodUUID",(A,e)=>{t.$ZodUUID.init(A,e),V.init(A,e)});function Z(A){return i._uuid(q,A)}function W(A){return i._uuidv4(q,A)}function z(A){return i._uuidv6(q,A)}function j(A){return i._uuidv7(q,A)}let $=e.$constructor("ZodURL",(A,e)=>{t.$ZodURL.init(A,e),V.init(A,e)});function X(A){return i._url($,A)}function AA(A){return i._url($,{protocol:a.regexes.httpProtocol,hostname:a.regexes.domain,...o.util.normalizeParams(A)})}let Ae=e.$constructor("ZodEmoji",(A,e)=>{t.$ZodEmoji.init(A,e),V.init(A,e)});function At(A){return i._emoji(Ae,A)}let Ar=e.$constructor("ZodNanoID",(A,e)=>{t.$ZodNanoID.init(A,e),V.init(A,e)});function An(A){return i._nanoid(Ar,A)}let Ai=e.$constructor("ZodCUID",(A,e)=>{t.$ZodCUID.init(A,e),V.init(A,e)});function Aa(A){return i._cuid(Ai,A)}let As=e.$constructor("ZodCUID2",(A,e)=>{t.$ZodCUID2.init(A,e),V.init(A,e)});function Ao(A){return i._cuid2(As,A)}let Ag=e.$constructor("ZodULID",(A,e)=>{t.$ZodULID.init(A,e),V.init(A,e)});function AC(A){return i._ulid(Ag,A)}let AQ=e.$constructor("ZodXID",(A,e)=>{t.$ZodXID.init(A,e),V.init(A,e)});function Al(A){return i._xid(AQ,A)}let AI=e.$constructor("ZodKSUID",(A,e)=>{t.$ZodKSUID.init(A,e),V.init(A,e)});function Ad(A){return i._ksuid(AI,A)}let AE=e.$constructor("ZodIPv4",(A,e)=>{t.$ZodIPv4.init(A,e),V.init(A,e)});function Ac(A){return i._ipv4(AE,A)}let Ah=e.$constructor("ZodMAC",(A,e)=>{t.$ZodMAC.init(A,e),V.init(A,e)});function AB(A){return i._mac(Ah,A)}let AD=e.$constructor("ZodIPv6",(A,e)=>{t.$ZodIPv6.init(A,e),V.init(A,e)});function Aw(A){return i._ipv6(AD,A)}let Au=e.$constructor("ZodCIDRv4",(A,e)=>{t.$ZodCIDRv4.init(A,e),V.init(A,e)});function Ap(A){return i._cidrv4(Au,A)}let Af=e.$constructor("ZodCIDRv6",(A,e)=>{t.$ZodCIDRv6.init(A,e),V.init(A,e)});function Ay(A){return i._cidrv6(Af,A)}let AM=e.$constructor("ZodBase64",(A,e)=>{t.$ZodBase64.init(A,e),V.init(A,e)});function Am(A){return i._base64(AM,A)}let AN=e.$constructor("ZodBase64URL",(A,e)=>{t.$ZodBase64URL.init(A,e),V.init(A,e)});function AS(A){return i._base64url(AN,A)}let Ak=e.$constructor("ZodE164",(A,e)=>{t.$ZodE164.init(A,e),V.init(A,e)});function AU(A){return i._e164(Ak,A)}let AF=e.$constructor("ZodJWT",(A,e)=>{t.$ZodJWT.init(A,e),V.init(A,e)});function AR(A){return i._jwt(AF,A)}let AT=e.$constructor("ZodCustomStringFormat",(A,e)=>{t.$ZodCustomStringFormat.init(A,e),V.init(A,e)});function Ab(A,e,t={}){return i._stringFormat(AT,A,e,t)}function AH(A){return i._stringFormat(AT,"hostname",a.regexes.hostname,A)}function AL(A){return i._stringFormat(AT,"hex",a.regexes.hex,A)}function AO(A,e){let t=e?.enc??"hex",r=`${A}_${t}`,n=a.regexes[r];if(!n)throw Error(`Unrecognized hash format: ${r}`);return i._stringFormat(AT,r,n,e)}let AG=e.$constructor("ZodNumber",(A,e)=>{t.$ZodNumber.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.numberProcessor(A,e,t,r),O(A,"ZodNumber",{gt(A,e){return this.check(i._gt(A,e))},gte(A,e){return this.check(i._gte(A,e))},min(A,e){return this.check(i._gte(A,e))},lt(A,e){return this.check(i._lt(A,e))},lte(A,e){return this.check(i._lte(A,e))},max(A,e){return this.check(i._lte(A,e))},int(A){return this.check(Ax(A))},safe(A){return this.check(Ax(A))},positive(A){return this.check(i._gt(0,A))},nonnegative(A){return this.check(i._gte(0,A))},negative(A){return this.check(i._lt(0,A))},nonpositive(A){return this.check(i._lte(0,A))},multipleOf(A,e){return this.check(i._multipleOf(A,e))},step(A,e){return this.check(i._multipleOf(A,e))},finite(){return this}});let r=A._zod.bag;A.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,A.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,A.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),A.isFinite=!0,A.format=r.format??null});function AJ(A){return i._number(AG,A)}let Av=e.$constructor("ZodNumberFormat",(A,e)=>{t.$ZodNumberFormat.init(A,e),AG.init(A,e)});function Ax(A){return i._int(Av,A)}function AV(A){return i._float32(Av,A)}function AP(A){return i._float64(Av,A)}function AY(A){return i._int32(Av,A)}function A_(A){return i._uint32(Av,A)}let AK=e.$constructor("ZodBoolean",(A,e)=>{t.$ZodBoolean.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.booleanProcessor(A,e,t,r)});function Aq(A){return i._boolean(AK,A)}let AZ=e.$constructor("ZodBigInt",(A,e)=>{t.$ZodBigInt.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.bigintProcessor(A,e,t,r),A.gte=(e,t)=>A.check(i._gte(e,t)),A.min=(e,t)=>A.check(i._gte(e,t)),A.gt=(e,t)=>A.check(i._gt(e,t)),A.gte=(e,t)=>A.check(i._gte(e,t)),A.min=(e,t)=>A.check(i._gte(e,t)),A.lt=(e,t)=>A.check(i._lt(e,t)),A.lte=(e,t)=>A.check(i._lte(e,t)),A.max=(e,t)=>A.check(i._lte(e,t)),A.positive=e=>A.check(i._gt(BigInt(0),e)),A.negative=e=>A.check(i._lt(BigInt(0),e)),A.nonpositive=e=>A.check(i._lte(BigInt(0),e)),A.nonnegative=e=>A.check(i._gte(BigInt(0),e)),A.multipleOf=(e,t)=>A.check(i._multipleOf(e,t));let r=A._zod.bag;A.minValue=r.minimum??null,A.maxValue=r.maximum??null,A.format=r.format??null});function AW(A){return i._bigint(AZ,A)}let Az=e.$constructor("ZodBigIntFormat",(A,e)=>{t.$ZodBigIntFormat.init(A,e),AZ.init(A,e)});function Aj(A){return i._int64(Az,A)}function A$(A){return i._uint64(Az,A)}let AX=e.$constructor("ZodSymbol",(A,e)=>{t.$ZodSymbol.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.symbolProcessor(A,e,t,r)});function A0(A){return i._symbol(AX,A)}let A4=e.$constructor("ZodUndefined",(A,e)=>{t.$ZodUndefined.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.undefinedProcessor(A,e,t,r)});function A2(A){return i._undefined(A4,A)}let A8=e.$constructor("ZodNull",(A,e)=>{t.$ZodNull.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.nullProcessor(A,e,t,r)});function A1(A){return i._null(A8,A)}let A3=e.$constructor("ZodAny",(A,e)=>{t.$ZodAny.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.anyProcessor(A,e,t,r)});function A5(){return i._any(A3)}let A9=e.$constructor("ZodUnknown",(A,e)=>{t.$ZodUnknown.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.unknownProcessor(A,e,t,r)});function A6(){return i._unknown(A9)}let A7=e.$constructor("ZodNever",(A,e)=>{t.$ZodNever.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.neverProcessor(A,e,t,r)});function eA(A){return i._never(A7,A)}let ee=e.$constructor("ZodVoid",(A,e)=>{t.$ZodVoid.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.voidProcessor(A,e,t,r)});function et(A){return i._void(ee,A)}let er=e.$constructor("ZodDate",(A,e)=>{t.$ZodDate.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.dateProcessor(A,e,t,r),A.min=(e,t)=>A.check(i._gte(e,t)),A.max=(e,t)=>A.check(i._lte(e,t));let r=A._zod.bag;A.minDate=r.minimum?new Date(r.minimum):null,A.maxDate=r.maximum?new Date(r.maximum):null});function en(A){return i._date(er,A)}let ei=e.$constructor("ZodArray",(A,e)=>{t.$ZodArray.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.arrayProcessor(A,e,t,r),A.element=e.element,O(A,"ZodArray",{min(A,e){return this.check(i._minLength(A,e))},nonempty(A){return this.check(i._minLength(1,A))},max(A,e){return this.check(i._maxLength(A,e))},length(A,e){return this.check(i._length(A,e))},unwrap(){return this.element}})});function ea(A,e){return i._array(ei,A,e)}function es(A){return eF(Object.keys(A._zod.def.shape))}let eo=e.$constructor("ZodObject",(A,e)=>{t.$ZodObjectJIT.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.objectProcessor(A,e,t,r),o.util.defineLazy(A,"shape",()=>e.shape),O(A,"ZodObject",{keyof(){return eF(Object.keys(this._zod.def.shape))},catchall(A){return this.clone({...this._zod.def,catchall:A})},passthrough(){return this.clone({...this._zod.def,catchall:A6()})},loose(){return this.clone({...this._zod.def,catchall:A6()})},strict(){return this.clone({...this._zod.def,catchall:eA()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(A){return o.util.extend(this,A)},safeExtend(A){return o.util.safeExtend(this,A)},merge(A){return o.util.merge(this,A)},pick(A){return o.util.pick(this,A)},omit(A){return o.util.omit(this,A)},partial(...A){return o.util.partial(eJ,this,A[0])},required(...A){return o.util.required(ez,this,A[0])}})});function eg(A,e){return new eo({type:"object",shape:A??{},...o.util.normalizeParams(e)})}function eC(A,e){return new eo({type:"object",shape:A,catchall:eA(),...o.util.normalizeParams(e)})}function eQ(A,e){return new eo({type:"object",shape:A,catchall:A6(),...o.util.normalizeParams(e)})}let el=e.$constructor("ZodUnion",(A,e)=>{t.$ZodUnion.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.unionProcessor(A,e,t,r),A.options=e.options});function eI(A,e){return new el({type:"union",options:A,...o.util.normalizeParams(e)})}let ed=e.$constructor("ZodXor",(A,e)=>{el.init(A,e),t.$ZodXor.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.unionProcessor(A,e,t,r),A.options=e.options});function eE(A,e){return new ed({type:"union",options:A,inclusive:!1,...o.util.normalizeParams(e)})}let ec=e.$constructor("ZodDiscriminatedUnion",(A,e)=>{el.init(A,e),t.$ZodDiscriminatedUnion.init(A,e)});function eh(A,e,t){return new ec({type:"union",options:e,discriminator:A,...o.util.normalizeParams(t)})}let eB=e.$constructor("ZodIntersection",(A,e)=>{t.$ZodIntersection.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.intersectionProcessor(A,e,t,r)});function eD(A,e){return new eB({type:"intersection",left:A,right:e})}let ew=e.$constructor("ZodTuple",(A,e)=>{t.$ZodTuple.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.tupleProcessor(A,e,t,r),A.rest=e=>A.clone({...A._zod.def,rest:e})});function eu(A,e,r){let n=e instanceof t.$ZodType,i=n?r:e;return new ew({type:"tuple",items:A,rest:n?e:null,...o.util.normalizeParams(i)})}let ep=e.$constructor("ZodRecord",(A,e)=>{t.$ZodRecord.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.recordProcessor(A,e,t,r),A.keyType=e.keyType,A.valueType=e.valueType});function ef(A,e,t){return new ep(e&&e._zod?{type:"record",keyType:A,valueType:e,...o.util.normalizeParams(t)}:{type:"record",keyType:x(),valueType:A,...o.util.normalizeParams(e)})}function ey(A,e,t){let n=r.clone(A);return n._zod.values=void 0,new ep({type:"record",keyType:n,valueType:e,...o.util.normalizeParams(t)})}function eM(A,e,t){return new ep({type:"record",keyType:A,valueType:e,mode:"loose",...o.util.normalizeParams(t)})}let em=e.$constructor("ZodMap",(A,e)=>{t.$ZodMap.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.mapProcessor(A,e,t,r),A.keyType=e.keyType,A.valueType=e.valueType,A.min=(...e)=>A.check(i._minSize(...e)),A.nonempty=e=>A.check(i._minSize(1,e)),A.max=(...e)=>A.check(i._maxSize(...e)),A.size=(...e)=>A.check(i._size(...e))});function eN(A,e,t){return new em({type:"map",keyType:A,valueType:e,...o.util.normalizeParams(t)})}let eS=e.$constructor("ZodSet",(A,e)=>{t.$ZodSet.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.setProcessor(A,e,t,r),A.min=(...e)=>A.check(i._minSize(...e)),A.nonempty=e=>A.check(i._minSize(1,e)),A.max=(...e)=>A.check(i._maxSize(...e)),A.size=(...e)=>A.check(i._size(...e))});function ek(A,e){return new eS({type:"set",valueType:A,...o.util.normalizeParams(e)})}let eU=e.$constructor("ZodEnum",(A,e)=>{t.$ZodEnum.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.enumProcessor(A,e,t,r),A.enum=e.entries,A.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));A.extract=(A,t)=>{let n={};for(let t of A)if(r.has(t))n[t]=e.entries[t];else throw Error(`Key ${t} not found in enum`);return new eU({...e,checks:[],...o.util.normalizeParams(t),entries:n})},A.exclude=(A,t)=>{let n={...e.entries};for(let e of A)if(r.has(e))delete n[e];else throw Error(`Key ${e} not found in enum`);return new eU({...e,checks:[],...o.util.normalizeParams(t),entries:n})}});function eF(A,e){return new eU({type:"enum",entries:Array.isArray(A)?Object.fromEntries(A.map(A=>[A,A])):A,...o.util.normalizeParams(e)})}function eR(A,e){return new eU({type:"enum",entries:A,...o.util.normalizeParams(e)})}let eT=e.$constructor("ZodLiteral",(A,e)=>{t.$ZodLiteral.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.literalProcessor(A,e,t,r),A.values=new Set(e.values),Object.defineProperty(A,"value",{get(){if(e.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function eb(A,e){return new eT({type:"literal",values:Array.isArray(A)?A:[A],...o.util.normalizeParams(e)})}let eH=e.$constructor("ZodFile",(A,e)=>{t.$ZodFile.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.fileProcessor(A,e,t,r),A.min=(e,t)=>A.check(i._minSize(e,t)),A.max=(e,t)=>A.check(i._maxSize(e,t)),A.mime=(e,t)=>A.check(i._mime(Array.isArray(e)?e:[e],t))});function eL(A){return i._file(eH,A)}let eO=e.$constructor("ZodTransform",(A,r)=>{t.$ZodTransform.init(A,r),G.init(A,r),A._zod.processJSONSchema=(e,t,r)=>g.transformProcessor(A,e,t,r),A._zod.parse=(t,n)=>{if("backward"===n.direction)throw new e.$ZodEncodeError(A.constructor.name);t.addIssue=e=>{"string"==typeof e?t.issues.push(o.util.issue(e,t.value,r)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=A),t.issues.push(o.util.issue(e)))};let i=r.transform(t.value,t);return i instanceof Promise?i.then(A=>(t.value=A,t.fallback=!0,t)):(t.value=i,t.fallback=!0,t)}});function eG(A){return new eO({type:"transform",transform:A})}let eJ=e.$constructor("ZodOptional",(A,e)=>{t.$ZodOptional.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.optionalProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function ev(A){return new eJ({type:"optional",innerType:A})}let ex=e.$constructor("ZodExactOptional",(A,e)=>{t.$ZodExactOptional.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.optionalProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function eV(A){return new ex({type:"optional",innerType:A})}let eP=e.$constructor("ZodNullable",(A,e)=>{t.$ZodNullable.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.nullableProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function eY(A){return new eP({type:"nullable",innerType:A})}function e_(A){return ev(eY(A))}let eK=e.$constructor("ZodDefault",(A,e)=>{t.$ZodDefault.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.defaultProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType,A.removeDefault=A.unwrap});function eq(A,e){return new eK({type:"default",innerType:A,get defaultValue(){return"function"==typeof e?e():o.util.shallowClone(e)}})}let eZ=e.$constructor("ZodPrefault",(A,e)=>{t.$ZodPrefault.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.prefaultProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function eW(A,e){return new eZ({type:"prefault",innerType:A,get defaultValue(){return"function"==typeof e?e():o.util.shallowClone(e)}})}let ez=e.$constructor("ZodNonOptional",(A,e)=>{t.$ZodNonOptional.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.nonoptionalProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function ej(A,e){return new ez({type:"nonoptional",innerType:A,...o.util.normalizeParams(e)})}let e$=e.$constructor("ZodSuccess",(A,e)=>{t.$ZodSuccess.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.successProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function eX(A){return new e$({type:"success",innerType:A})}let e0=e.$constructor("ZodCatch",(A,e)=>{t.$ZodCatch.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.catchProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType,A.removeCatch=A.unwrap});function e4(A,e){return new e0({type:"catch",innerType:A,catchValue:"function"==typeof e?e:()=>e})}let e2=e.$constructor("ZodNaN",(A,e)=>{t.$ZodNaN.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.nanProcessor(A,e,t,r)});function e8(A){return i._nan(e2,A)}let e1=e.$constructor("ZodPipe",(A,e)=>{t.$ZodPipe.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.pipeProcessor(A,e,t,r),A.in=e.in,A.out=e.out});function e3(A,e){return new e1({type:"pipe",in:A,out:e})}let e5=e.$constructor("ZodCodec",(A,e)=>{e1.init(A,e),t.$ZodCodec.init(A,e)});function e9(A,e,t){return new e5({type:"pipe",in:A,out:e,transform:t.decode,reverseTransform:t.encode})}function e6(A){let e=A._zod.def;return new e5({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}let e7=e.$constructor("ZodPreprocess",(A,e)=>{e1.init(A,e),t.$ZodPreprocess.init(A,e)}),tA=e.$constructor("ZodReadonly",(A,e)=>{t.$ZodReadonly.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.readonlyProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function te(A){return new tA({type:"readonly",innerType:A})}let tt=e.$constructor("ZodTemplateLiteral",(A,e)=>{t.$ZodTemplateLiteral.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.templateLiteralProcessor(A,e,t,r)});function tr(A,e){return new tt({type:"template_literal",parts:A,...o.util.normalizeParams(e)})}let tn=e.$constructor("ZodLazy",(A,e)=>{t.$ZodLazy.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.lazyProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.getter()});function ti(A){return new tn({type:"lazy",getter:A})}let ta=e.$constructor("ZodPromise",(A,e)=>{t.$ZodPromise.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.promiseProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function ts(A){return new ta({type:"promise",innerType:A})}let to=e.$constructor("ZodFunction",(A,e)=>{t.$ZodFunction.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.functionProcessor(A,e,t,r)});function tg(A){return new to({type:"function",input:Array.isArray(A?.input)?eu(A?.input):A?.input??ea(A6()),output:A?.output??A6()})}let tC=e.$constructor("ZodCustom",(A,e)=>{t.$ZodCustom.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.customProcessor(A,e,t,r)});function tQ(A){let e=new s.$ZodCheck({check:"custom"});return e._zod.check=A,e}function tl(A,e){return i._custom(tC,A??(()=>!0),e)}function tI(A,e={}){return i._refine(tC,A,e)}function td(A,e){return i._superRefine(A,e)}let tE=i.describe,tc=i.meta;function th(A,e={}){let t=new tC({type:"custom",check:"custom",fn:e=>e instanceof A,abort:!0,...o.util.normalizeParams(e)});return t._zod.bag.Class=A,t._zod.check=e=>{e.value instanceof A||e.issues.push({code:"invalid_type",expected:A.name,input:e.value,inst:t,path:[...t._zod.def.path??[]]})},t}let tB=(...A)=>i._stringbool({Codec:e5,Boolean:AK,String:v},...A);function tD(A){let e=ti(()=>eI([x(A),AJ(),Aq(),A1(),ea(e),ef(x(),e)]));return e}function tw(A,e){return new e7({type:"pipe",in:eG(A),out:e})}},104503,A=>{"use strict";var e=A.i(666680),t=A.i(184015),r=A.i(119909),n=A.i(243783);A.i(805422);var i=A.i(694355),a=A.i(661983);let s="default",o=["QUEUED","RUNNING"];function g(A){if("SUCCEEDED"!==A.status||!A.resultJson)throw Error(A.error||`${A.kind} failed`);let e=JSON.parse(A.resultJson);if(!e||"object"!=typeof e||Array.isArray(e))throw Error(`${A.kind} returned an invalid result`);return e}function C(A){try{let e=JSON.parse(A.capabilitiesJson);return Array.isArray(e)?e.filter(A=>"string"==typeof A):[]}catch{return[]}}function Q(A){return null!==A.lastSeenAt&&Date.now()-A.lastSeenAt.getTime()<=i.AGENT_ONLINE_WINDOW_MS&&null===A.disconnectedAt}A.s(["CodebasesService",0,class{agentControl;skillsService;constructor(A,e){for(const r of(this.agentControl=A,this.skillsService=e,[t.CODEBASE_REFRESH_JOB_KIND,t.CODEBASE_FETCH_JOB_KIND]))this.agentControl.registerCompletionHandler(r,A=>this.projectJob(A));this.agentControl.registerCompletionHandler(t.CODEBASE_GIT_OPERATION_JOB_KIND,A=>this.projectGitOperation(A))}async overview(){return await this.cleanupInternalJobs(),(await (0,n.getPrismaClient)()).codebaseRepository.findMany({orderBy:[{name:"asc"},{canonicalOrigin:"asc"}],include:{skillGroups:{include:{group:!0}},codebases:{orderBy:{folder:"asc"},include:{agent:!0,repository:!0,jobs:{where:{status:{in:["QUEUED","RUNNING"]}},orderBy:{createdAt:"desc"},take:1}}}}})}async repositoryDetail(A){return await this.cleanupInternalJobs(),(await (0,n.getPrismaClient)()).codebaseRepository.findUnique({where:{id:A},include:{skillGroups:{include:{group:!0}},codebases:{orderBy:[{agent:{name:"asc"}},{folder:"asc"}],include:{agent:!0,repository:!0,jobs:{where:{status:{in:["QUEUED","RUNNING"]}},orderBy:{createdAt:"desc"},take:1}}}}})}async detail(A){return await this.cleanupInternalJobs(),(await (0,n.getPrismaClient)()).codebase.findUnique({where:{id:A},include:{agent:!0,repository:{include:{skillGroups:{include:{group:!0}}}},jobs:{where:{status:{in:o}},orderBy:{createdAt:"desc"},take:1}}})}async agentCodebases(A){return(await (0,n.getPrismaClient)()).codebase.findMany({where:{agentId:A},orderBy:{folder:"asc"},select:{id:!0,folder:!0,defaultBranch:!0,lastFetchedAt:!0,lastFetchAttemptAt:!0,repository:{select:{canonicalOrigin:!0,keepBaseBranchUpToDate:!0}},worktrees:{where:{missingAt:null},select:{gitDirectory:!0,baseBranchOverride:!0}}}})}async settings(){let A=await (0,n.getPrismaClient)(),e=await A.codebaseSettings.findUnique({where:{id:s}});return e||A.codebaseSettings.upsert({where:{id:s},create:{id:s,refreshIntervalSeconds:t.DEFAULT_CODEBASE_RECONCILE_INTERVAL_SECONDS,fetchIntervalSeconds:r.DEFAULT_WORKTREE_FETCH_INTERVAL_SECONDS,defaultJiraBranchRegex:r.DEFAULT_JIRA_BRANCH_REGEX},update:{}})}async agentConfiguration(A){let[e,t]=await Promise.all([this.settings(),this.agentCodebases(A)]);return{refreshIntervalSeconds:e.refreshIntervalSeconds,fetchIntervalSeconds:e.fetchIntervalSeconds,codebases:t}}async updateSettings(A){let e="number"==typeof A?A:A.refreshIntervalSeconds,i="number"==typeof A?r.DEFAULT_WORKTREE_FETCH_INTERVAL_SECONDS:A.fetchIntervalSeconds;if(!Number.isInteger(e)||e<t.MIN_CODEBASE_RECONCILE_INTERVAL_SECONDS||e>t.MAX_CODEBASE_RECONCILE_INTERVAL_SECONDS)throw Error(`Refresh interval must be an integer from ${t.MIN_CODEBASE_RECONCILE_INTERVAL_SECONDS} to ${t.MAX_CODEBASE_RECONCILE_INTERVAL_SECONDS} seconds`);if(!Number.isInteger(i)||i<r.MIN_WORKTREE_FETCH_INTERVAL_SECONDS||i>r.MAX_WORKTREE_FETCH_INTERVAL_SECONDS)throw Error(`Fetch interval must be an integer from ${r.MIN_WORKTREE_FETCH_INTERVAL_SECONDS} to ${r.MAX_WORKTREE_FETCH_INTERVAL_SECONDS} seconds`);let a="number"==typeof A?r.DEFAULT_JIRA_BRANCH_REGEX:A.defaultJiraBranchRegex.trim();if(a)try{RegExp(a,"i")}catch{throw Error("Default Jira branch regex is invalid")}let o=await (0,n.getPrismaClient)(),g="number"==typeof A?{refreshIntervalSeconds:e}:{refreshIntervalSeconds:e,fetchIntervalSeconds:i,defaultJiraBranchRegex:a},C=await o.codebaseSettings.upsert({where:{id:s},create:{id:s,...g},update:g});return this.publish(null,null),C}async browse(A,e,r){await this.cleanupInternalJobs(),await this.requireAgentCapability(A,t.CODEBASE_BROWSE_JOB_KIND);let i=await this.agentControl.createJob({agentId:A,kind:t.CODEBASE_BROWSE_JOB_KIND,payload:{path:e},idempotencyKey:`codebase:browse:${r}`,timeoutSeconds:30,visibility:"SYSTEM"}),a=await this.waitForJob(i.id),s=(0,t.parseCodebaseDirectoryListing)(g(a).listing),o=await (0,n.getPrismaClient)();return await o.agentJob.deleteMany({where:{id:i.id}}),s}async inspect(A,e,r){await this.cleanupInternalJobs(),await this.requireAgentCapability(A,t.CODEBASE_INSPECT_JOB_KIND);let i=await this.agentControl.createJob({agentId:A,kind:t.CODEBASE_INSPECT_JOB_KIND,payload:{folder:e},idempotencyKey:`codebase:inspect:${r}`,timeoutSeconds:30,visibility:"SYSTEM"}),a=await this.waitForJob(i.id),s=(0,t.parseCodebaseSnapshot)(g(a).snapshot);if("AVAILABLE"!==s.availability)throw Error(s.error||"The selected folder is unavailable");if(s.linkedWorktree)throw Error("Linked Git worktrees are not supported yet");if(!s.canonicalOrigin)throw Error("Git origin is required");let o=await (0,n.getPrismaClient)(),C=await o.codebaseRepository.findUnique({where:{canonicalOrigin:s.canonicalOrigin}});return{jobId:i.id,snapshot:s,repository:C}}async confirm(A){let r=await (0,n.getPrismaClient)(),i=await r.agentJob.findUnique({where:{id:A.inspectionJobId}});if(!i||i.kind!==t.CODEBASE_INSPECT_JOB_KIND)throw Error("Codebase inspection was not found");if(!i.finishedAt||Date.now()-i.finishedAt.getTime()>9e5)throw Error("Codebase inspection expired; inspect the folder again");let a=(0,t.parseCodebaseSnapshot)(g(i).snapshot);if("AVAILABLE"!==a.availability||a.linkedWorktree||!a.canonicalOrigin||!a.displayOrigin||!a.observedOrigin)throw Error("Codebase inspection is not eligible for confirmation");let s=A.name?.trim()??"",o=A.description?.trim()??"";if(s.length>120)throw Error("Name must be 120 characters or fewer");if(o.length>2e3)throw Error("Description must be 2,000 characters or fewer");let C=await r.$transaction(async A=>{let t=await A.codebaseRepository.findUnique({where:{canonicalOrigin:a.canonicalOrigin}});if(!t){if(!s)throw Error("Name is required for a new repository");t=await A.codebaseRepository.upsert({where:{canonicalOrigin:a.canonicalOrigin},create:{id:(0,e.randomUUID)(),canonicalOrigin:a.canonicalOrigin,displayOrigin:a.displayOrigin,name:s,description:o},update:{}})}let r=await A.codebase.findUnique({where:{agentId_folder:{agentId:i.agentId,folder:a.folder}},select:{lastFetchedAt:!0}}),n=a.fetchedAt?new Date(a.fetchedAt):null,g=n&&(!r?.lastFetchedAt||n>r.lastFetchedAt)?n:r?.lastFetchedAt??null;return A.codebase.upsert({where:{agentId_folder:{agentId:i.agentId,folder:a.folder}},create:{id:(0,e.randomUUID)(),agentId:i.agentId,repositoryId:t.id,...this.snapshotData(a,g)},update:{repositoryId:t.id,...this.snapshotData(a,g)},include:{agent:!0,repository:!0,jobs:!0}})});return this.publish(C.id,C.repositoryId),await r.agentJob.deleteMany({where:{id:A.inspectionJobId,visibility:"SYSTEM"}}),await this.agentControl.requestCodebaseReconcile([C.agentId]),await this.skillsService?.requestAutoReconcile(),C}async updateRepository(A,e,t,r,i=!0,a){let s=e.trim(),o=t.trim();if(!s)throw Error("Name is required");if(s.length>120)throw Error("Name must be 120 characters or fewer");if(o.length>2e3)throw Error("Description must be 2,000 characters or fewer");let g=r?.trim()||null;if(g)try{RegExp(g,"i")}catch{throw Error("Jira branch regex is invalid")}let C=null==a?null:await this.skillsService?.validateGroupIds(a),Q=await (0,n.getPrismaClient)(),l=await Q.codebaseRepository.update({where:{id:A},data:{name:s,description:o,jiraBranchRegex:g,keepBaseBranchUpToDate:i}});return this.publish(null,A),C&&await this.skillsService?.setRepositoryGroups(A,C),l}async removeCodebase(A){let e=await (0,n.getPrismaClient)(),t=await e.$transaction(async e=>{let t=await e.codebase.findUnique({where:{id:A},select:{id:!0,repositoryId:!0}});if(!t)throw Error("Codebase not found");await e.codebase.delete({where:{id:A}});let r=0===await e.codebase.count({where:{repositoryId:t.repositoryId}});return r&&await e.codebaseRepository.delete({where:{id:t.repositoryId}}),{id:t.id,repositoryId:t.repositoryId,repositoryRemoved:r}});return this.publish(t.id,t.repositoryId),t}async report(A,e){let r=[],n=!1;try{for(let i of e.slice(0,500)){let e=(0,t.parseCodebaseSnapshot)(i.snapshot),a=await this.applySnapshot(A,i.codebaseId,e);r.push(a.codebase),n||=a.changed}}finally{n&&this.publish(null,null)}return r}async runOperation(A,e,r){if(!r.trim())throw Error("requestId is required");let i=await (0,n.getPrismaClient)(),a=await i.codebase.findMany({where:{id:{in:[...new Set(e)].slice(0,500)}},include:{agent:!0,repository:!0,jobs:{where:{status:{in:o}},select:{id:!0},take:1}}}),s=[],g=[];for(let e of a){if(e.jobs.length>0){g.push({codebaseId:e.id,reason:"ACTIVE_OPERATION"});continue}if(!Q(e.agent)){g.push({codebaseId:e.id,reason:"OFFLINE"});continue}if(!C(e.agent).includes(A)){g.push({codebaseId:e.id,reason:"UNSUPPORTED"});continue}if(A===t.CODEBASE_FETCH_JOB_KIND&&"AVAILABLE"!==e.availability){g.push({codebaseId:e.id,reason:e.availability});continue}try{s.push(await this.agentControl.createJob({agentId:e.agentId,codebaseId:e.id,kind:A,payload:{codebaseId:e.id,folder:e.folder,expectedOrigin:e.repository.canonicalOrigin,...A===t.CODEBASE_FETCH_JOB_KIND&&e.defaultBranch?{baseBranch:e.defaultBranch}:{},...A===t.CODEBASE_FETCH_JOB_KIND?{keepBaseBranchUpToDate:e.repository.keepBaseBranchUpToDate}:{}},idempotencyKey:`codebase:${A}:${r}:${e.id}`,timeoutSeconds:A===t.CODEBASE_FETCH_JOB_KIND?300:30}))}catch(A){if(!await i.agentJob.findFirst({where:{codebaseId:e.id,status:{in:o}},select:{id:!0}}))throw A;g.push({codebaseId:e.id,reason:"ACTIVE_OPERATION"})}}return{jobs:s,skipped:g}}async inspectGitState(A,e){if(!e.trim())throw Error("requestId is required");let r=await this.requireRunnableCodebase(A,t.CODEBASE_GIT_INSPECT_JOB_KIND),i=await this.agentControl.createJob({agentId:r.agentId,codebaseId:r.id,kind:t.CODEBASE_GIT_INSPECT_JOB_KIND,payload:{action:"STATE",codebaseId:r.id,folder:r.folder,expectedOrigin:r.repository.canonicalOrigin},idempotencyKey:`codebase:git:state:${e}:${r.id}`,timeoutSeconds:30,visibility:"SYSTEM"}),a=await (0,n.getPrismaClient)();try{let A=await this.waitForJob(i.id);return(0,t.parseCodebaseGitState)(g(A).state)}finally{await a.agentJob.deleteMany({where:{id:i.id,visibility:"SYSTEM"}})}}async inspectStash(A,e,r){if(!r.trim())throw Error("requestId is required");let i=await this.requireRunnableCodebase(A,t.CODEBASE_GIT_INSPECT_JOB_KIND),a=await this.agentControl.createJob({agentId:i.agentId,codebaseId:i.id,kind:t.CODEBASE_GIT_INSPECT_JOB_KIND,payload:{action:"STASH_DIFF",codebaseId:i.id,folder:i.folder,expectedOrigin:i.repository.canonicalOrigin,stashOid:e},idempotencyKey:`codebase:git:stash:${r}:${i.id}`,timeoutSeconds:30,visibility:"SYSTEM"}),s=await (0,n.getPrismaClient)();try{let A=await this.waitForJob(a.id);return(0,t.parseCodebaseStashDiff)(g(A).diff)}finally{await s.agentJob.deleteMany({where:{id:a.id,visibility:"SYSTEM"}})}}async runGitOperation(A){if(!A.requestId.trim())throw Error("requestId is required");let e=await this.requireRunnableCodebase(A.codebaseId,t.CODEBASE_GIT_OPERATION_JOB_KIND);return this.agentControl.createJob({agentId:e.agentId,codebaseId:e.id,kind:t.CODEBASE_GIT_OPERATION_JOB_KIND,payload:{codebaseId:e.id,folder:e.folder,expectedOrigin:e.repository.canonicalOrigin,defaultBranch:e.defaultBranch,operation:A.operation,...A.branch?{branch:A.branch}:{},...A.stashOid?{stashOid:A.stashOid}:{},..."SWITCH_BRANCH"===A.operation?{stashChanges:!!A.stashChanges}:{}},idempotencyKey:`codebase:git:${A.operation}:${A.requestId}:${e.id}`,timeoutSeconds:"PULL_BRANCH"===A.operation?300:60})}subscribe(){return a.agentEventBus.iterate(a.CODEBASE_CHANGED_TOPIC)}async projectJob(A){if(!A.codebaseId||!A.resultJson)return;let e=JSON.parse(A.resultJson);if(!e||"object"!=typeof e||Array.isArray(e))return;let r=e.snapshot;if(!r)return;let n=await this.applySnapshot(A.agentId,A.codebaseId,(0,t.parseCodebaseSnapshot)(r));n.changed&&this.publish(n.codebase.id,n.codebase.repositoryId)}async projectGitOperation(A){if("SUCCEEDED"===A.status)try{await this.projectJob(A)}catch(A){console.error("Could not project codebase Git operation:",A instanceof Error?A.message:A)}try{await this.agentControl.requestCodebaseReconcile([A.agentId])}catch(A){console.error("Could not request codebase reconciliation:",A instanceof Error?A.message:A)}}async applySnapshot(A,e,t){let r=await (0,n.getPrismaClient)(),i=await r.codebase.findUnique({where:{id:e},include:{repository:!0}});if(!i||i.agentId!==A)throw Error("Codebase not found for this agent");let a=new Date(t.checkedAt),s=null!==t.canonicalOrigin&&t.canonicalOrigin!==i.repository.canonicalOrigin,o=t.fetchedAt?new Date(t.fetchedAt):null,g=await r.codebase.updateMany({where:{id:e,agentId:A,OR:[{lastCheckedAt:null},{lastCheckedAt:{lt:a}}]},data:{folder:t.folder,...null===t.observedOrigin?{}:{observedOrigin:t.observedOrigin},branch:t.branch,headSha:t.headSha,upstream:t.upstream,ahead:t.ahead,behind:t.behind,syncState:t.syncState,availability:s?"ORIGIN_MISMATCH":t.availability,statusError:s?`Origin changed to ${t.displayOrigin??"an unknown remote"}`:t.error,lastCheckedAt:a}});g.count>0&&o&&await r.codebase.updateMany({where:{id:e,agentId:A,OR:[{lastFetchedAt:null},{lastFetchedAt:{lt:o}}]},data:{lastFetchedAt:o}});let C=await r.codebase.findUnique({where:{id:e},include:{agent:!0,repository:!0,jobs:!0}});if(!C||C.agentId!==A)throw Error("Codebase not found for this agent");return{codebase:C,changed:g.count>0}}snapshotData(A,e){return{folder:A.folder,observedOrigin:A.observedOrigin??"",branch:A.branch,headSha:A.headSha,upstream:A.upstream,ahead:A.ahead,behind:A.behind,syncState:A.syncState,availability:A.availability,statusError:A.error,lastCheckedAt:new Date(A.checkedAt),lastFetchedAt:e}}async requireAgentCapability(A,e){let t=await this.agentControl.getAgent(A);if(!t)throw Error("Agent not found");if(!Q(t))throw Error("Agent is offline");if(!C(t).includes(e))throw Error("Agent must be updated to use codebases")}async requireRunnableCodebase(A,e){await this.cleanupInternalJobs();let t=await (0,n.getPrismaClient)(),r=await t.codebase.findUnique({where:{id:A},include:{agent:!0,repository:!0,jobs:{where:{status:{in:o}},select:{id:!0},take:1}}});if(!r)throw Error("Codebase not found");if(!Q(r.agent))throw Error("Agent is offline");if(!C(r.agent).includes(e))throw Error("Agent must be updated to manage Git branches and stashes");if("AVAILABLE"!==r.availability)throw Error(r.statusError||"Codebase is unavailable");if(r.jobs.length)throw Error("Another codebase operation is already running");return r}async waitForJob(A){let e=a.agentEventBus.iterate((0,a.agentJobChangedTopic)(A)),t=Date.now()+3e4;try{for(;Date.now()<t;){let r=await this.agentControl.getJob(A);if(!r)throw Error("Agent job disappeared");if(["SUCCEEDED","FAILED","CANCELLED","TIMED_OUT"].includes(r.status))return r;await Promise.race([e.next(),new Promise(A=>setTimeout(A,t-Date.now()))])}throw await this.agentControl.cancelJob(A),Error("Agent did not respond in time")}finally{await e.return?.()}}publish(A,e){a.agentEventBus.publish(a.CODEBASE_CHANGED_TOPIC,{codebaseOverviewChanged:{codebaseId:A,repositoryId:e}})}async cleanupInternalJobs(){let A=await (0,n.getPrismaClient)();await A.agentJob.deleteMany({where:{visibility:"SYSTEM",kind:{in:[...t.CODEBASE_JOB_KINDS]},finishedAt:{lt:new Date(Date.now()-9e5)}}})}}])},250246,516785,715199,A=>{"use strict";A.i(104503);var e=A.i(907855);A.i(805422);var t=A.i(694355);let r=e.enum(["IN_SYNC","AHEAD","BEHIND","DIVERGED","NO_UPSTREAM","DETACHED","UNKNOWN"]),n=e.enum(["AVAILABLE","MISSING","NOT_REPOSITORY","ORIGIN_MISMATCH","ERROR"]),i=e.object({id:e.string(),path:e.string(),observedOrigin:e.string(),branch:e.string().nullable(),headSha:e.string().nullable(),upstream:e.string().nullable(),ahead:e.number().int().nullable(),behind:e.number().int().nullable(),syncState:r,availability:n,statusError:e.string().nullable(),lastCheckedAt:e.string().nullable(),lastFetchedAt:e.string().nullable(),lastFetchAttemptAt:e.string().nullable().optional(),lastFetchError:e.string().nullable().optional(),defaultBranch:e.string().nullable().optional(),localBranches:e.array(e.string()).optional(),remoteBranches:e.array(e.string()).optional(),createdAt:e.string().optional(),updatedAt:e.string().optional(),repository:e.object({id:e.string(),name:e.string(),description:e.string(),canonicalOrigin:e.string(),displayOrigin:e.string()}),agent:e.object({id:e.string(),name:e.string(),hostname:e.string(),connectionStatus:e.enum(["ONLINE","OFFLINE"])}),activeJob:e.object({id:e.string(),kind:e.string(),status:e.enum(["QUEUED","RUNNING"])}).nullable()}),a=e.object({codebases:e.array(i)}),s=e.object({}),o=e.union([e.object({id:e.string().min(1).describe("Registered codebase ID")}),e.object({path:e.string().min(1).describe("Exact absolute folder path of the codebase"),agentId:e.string().min(1).optional().describe("Agent ID used to disambiguate a shared folder path")})]),g=e.object({codebase:i}),C=e.object({query:e.string().min(1).optional(),agentId:e.string().min(1).optional(),repositoryId:e.string().min(1).optional(),branch:e.string().min(1).optional(),availability:n.optional(),syncState:r.optional(),limit:e.number().int().min(1).max(500).default(100)}).refine(({query:A,agentId:e,repositoryId:t,branch:r,availability:n,syncState:i})=>!!(A||e||t||r||n||i),{message:"At least one codebase search criterion is required"}),Q=e.object({codebases:e.array(i),matchingCount:e.number().int().nonnegative()}),l=e.object({id:e.string(),name:e.string(),description:e.string(),canonicalOrigin:e.string(),displayOrigin:e.string(),jiraBranchRegex:e.string().nullable(),keepBaseBranchUpToDate:e.boolean(),codebaseCount:e.number().int().nonnegative(),agentIds:e.array(e.string()),createdAt:e.string(),updatedAt:e.string()}),I=e.object({repositories:e.array(l)}),d=e.object({id:e.string().min(1)}),E=e.object({repository:l.extend({codebases:e.array(i)})});class c extends Error{code;matches;constructor(A,e,t=[]){super(e),this.code=A,this.matches=t,this.name="CodebaseLookupError"}}A.s(["CodebaseLookupError",0,c,"CodebaseToolRecordSchema",0,i,"CodebaseToolsService",0,class{codebasesService;constructor(A){this.codebasesService=A}stringArray(A){try{let e=JSON.parse(A);return Array.isArray(e)?e.filter(A=>"string"==typeof A):[]}catch{return[]}}record(A,e){var r;let n=e.jobs[0]??null;return i.parse({id:e.id,path:e.folder,observedOrigin:e.observedOrigin,branch:e.branch,headSha:e.headSha,upstream:e.upstream,ahead:e.ahead,behind:e.behind,syncState:e.syncState,availability:e.availability,statusError:e.statusError,lastCheckedAt:e.lastCheckedAt?.toISOString()??null,lastFetchedAt:e.lastFetchedAt?.toISOString()??null,lastFetchAttemptAt:e.lastFetchAttemptAt?.toISOString()??null,lastFetchError:e.lastFetchError,defaultBranch:e.defaultBranch,localBranches:this.stringArray(e.localBranchesJson),remoteBranches:this.stringArray(e.remoteBranchesJson),createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString(),repository:{id:A.id,name:A.name,description:A.description,canonicalOrigin:A.canonicalOrigin,displayOrigin:A.displayOrigin},agent:{id:e.agent.id,name:e.agent.name,hostname:e.agent.hostname,connectionStatus:null!==(r=e.agent).lastSeenAt&&Date.now()-r.lastSeenAt.getTime()<=t.AGENT_ONLINE_WINDOW_MS&&null===r.disconnectedAt?"ONLINE":"OFFLINE"},activeJob:n?{id:n.id,kind:n.kind,status:n.status}:null})}async list(){return(await this.codebasesService.overview()).flatMap(A=>A.codebases.map(e=>this.record(A,e)))}async getByPath(A,e){if("string"!=typeof A||0===A.trim().length)throw new c("INVALID_PATH","A non-empty codebase path is required");let t=(await this.list()).filter(t=>t.path===A&&(!e||t.agent.id===e));if(0===t.length)throw new c("CODEBASE_NOT_FOUND",`No codebase is registered at path ${A}`);if(t.length>1)throw new c("AMBIGUOUS_PATH",`More than one agent has a codebase registered at path ${A}`,t.map(({agent:A})=>({agentId:A.id,name:A.name,hostname:A.hostname})));return t[0]}async getById(A){let e=(await this.list()).find(e=>e.id===A);if(!e)throw new c("CODEBASE_NOT_FOUND",`No codebase is registered with id ${A}`);return e}async get(A){return"id"in A?this.getById(A.id):this.getByPath(A.path,A.agentId)}async search(A){let e=A.query?.toLocaleLowerCase(),t=(await this.list()).filter(t=>(!A.agentId||t.agent.id===A.agentId)&&(!A.repositoryId||t.repository.id===A.repositoryId)&&(!A.branch||t.branch===A.branch)&&(!A.availability||t.availability===A.availability)&&(!A.syncState||t.syncState===A.syncState)&&(!e||[t.id,t.path,t.observedOrigin,t.branch??"",t.repository.name,t.repository.description,t.repository.canonicalOrigin,t.agent.name,t.agent.hostname].some(A=>A.toLocaleLowerCase().includes(e))));return{codebases:t.slice(0,A.limit),matchingCount:t.length}}async repositories(){return(await this.codebasesService.overview()).map(A=>({id:A.id,name:A.name,description:A.description,canonicalOrigin:A.canonicalOrigin,displayOrigin:A.displayOrigin,jiraBranchRegex:A.jiraBranchRegex,keepBaseBranchUpToDate:A.keepBaseBranchUpToDate,codebaseCount:A.codebases.length,agentIds:[...new Set(A.codebases.map(A=>A.agentId))],createdAt:A.createdAt.toISOString(),updatedAt:A.updatedAt.toISOString()}))}async repository(A){let e=(await this.codebasesService.overview()).find(e=>e.id===A);if(!e)throw Error("Codebase repository not found");return{...(await this.repositories()).find(e=>e.id===A),codebases:e.codebases.map(A=>this.record(e,A))}}},"GetCodebaseInputSchema",0,o,"GetCodebaseOutputSchema",0,g,"GetCodebaseRepositoriesOutputSchema",0,I,"GetCodebaseRepositoryInputSchema",0,d,"GetCodebaseRepositoryOutputSchema",0,E,"GetCodebasesInputSchema",0,s,"GetCodebasesOutputSchema",0,a,"SearchCodebasesInputSchema",0,C,"SearchCodebasesOutputSchema",0,Q],516785);let h={openapi:"3.1.0",info:{title:"AI Development Environment Codebases API",version:"0.1.0",description:"Read-only access to registered codebase checkouts."},tags:[{name:"Codebases"}],paths:{"/api/codebases":{get:{tags:["Codebases"],operationId:"getCodebases",summary:"List codebases",responses:{200:{description:"Registered codebase checkouts",content:{"application/json":{schema:{type:"object",required:["codebases"],properties:{codebases:{type:"array",items:{$ref:"#/components/schemas/CodebaseToolRecord"}}}}}}},500:{$ref:"#/components/responses/InternalError"}}}},"/api/codebases/by-path":{get:{tags:["Codebases"],operationId:"getCodebaseByPath",summary:"Get a codebase by folder path",parameters:[{name:"path",in:"query",required:!0,description:"Exact absolute folder path of the codebase",schema:{type:"string",minLength:1}}],responses:{200:{description:"Matching codebase checkout",content:{"application/json":{schema:{type:"object",required:["codebase"],properties:{codebase:{$ref:"#/components/schemas/CodebaseToolRecord"}}}}}},400:{$ref:"#/components/responses/BadRequest"},404:{$ref:"#/components/responses/NotFound"},409:{$ref:"#/components/responses/AmbiguousPath"},500:{$ref:"#/components/responses/InternalError"}}}}},components:{schemas:{CodebaseToolRecord:A.i(865889).toJSONSchema(i),ErrorResponse:{type:"object",required:["error"],properties:{error:{type:"object",required:["code","message"],properties:{code:{type:"string"},message:{type:"string"},matches:{type:"array",items:{type:"object",required:["agentId","name","hostname"],properties:{agentId:{type:"string"},name:{type:"string"},hostname:{type:"string"}}}}}}}}},responses:Object.fromEntries([["BadRequest","The path is missing or invalid"],["NotFound","No codebase uses the requested path"],["AmbiguousPath","Multiple agents use the requested path"],["InternalError","Unexpected server error"]].map(([A,e])=>[A,{description:e,content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}]))}};A.s(["codebasesOpenApiDocument",0,h],715199),A.s([],250246)},247287,A=>{"use strict";var e=A.i(666680),t=A.i(246479),r=A.i(397554),n=A.i(827957);let i=new Set([429,500,503]);async function a(A){await new Promise(e=>setTimeout(e,A))}A.s(["ApnsClient",0,class{sessionFactory;sessions;jwtCache;constructor(A=t.connect){this.sessionFactory=A,this.sessions=new Map,this.jwtCache=new Map}close(){for(let A of this.sessions.values())A.close();this.sessions.clear()}session(A,e){let t="TOKEN"===e.kind?`token:${e.teamId}:${e.keyId}`:`certificate:${e.fingerprint}`,r=`${A}:${t}`,n=this.sessions.get(r);if(n&&!n.closed&&!n.destroyed)return n;let i="CERTIFICATE"===e.kind?{pfx:Buffer.from(e.p12Base64,"base64"),passphrase:e.passphrase}:{},a=this.sessionFactory("SANDBOX"===A?"https://api.sandbox.push.apple.com":"https://api.push.apple.com",i);return a.on("error",()=>{this.sessions.get(r)===a&&this.sessions.delete(r)}),a.on("close",()=>{this.sessions.get(r)===a&&this.sessions.delete(r)}),this.sessions.set(r,a),a}async authorization(A){let t;if("CERTIFICATE"===A.kind)return null;let i=`${A.teamId}:${A.keyId}:${(0,e.createHash)("sha256").update(A.privateKey).digest("hex")}`,a=this.jwtCache.get(i);if(a&&Date.now()-a.createdAt<3e6)return`bearer ${a.token}`;try{t=await (0,r.importPKCS8)(A.privateKey,"ES256")}catch{throw Error("The APNs .p8 key must be an ES256 PKCS#8 private key")}let s=await new n.SignJWT({}).setProtectedHeader({alg:"ES256",kid:A.keyId}).setIssuer(A.teamId).setIssuedAt().sign(t);return this.jwtCache.set(i,{token:s,createdAt:Date.now()}),`bearer ${s}`}async requestOnce(A){let e=await this.authorization(A.authentication),r=this.session(A.environment,A.authentication);return new Promise((n,i)=>{let a=r.request({[t.constants.HTTP2_HEADER_METHOD]:A.method??"POST",[t.constants.HTTP2_HEADER_PATH]:A.path,[t.constants.HTTP2_HEADER_SCHEME]:"https","content-type":"application/json",...e?{authorization:e}:{},...A.headers}),s={},o="";a.setEncoding("utf8"),a.on("response",A=>{s=A}),a.on("data",A=>{(o+=A).length>65536&&a.close(t.constants.NGHTTP2_CANCEL)}),a.on("error",i),a.on("end",()=>{let A=s[t.constants.HTTP2_HEADER_STATUS];n({status:Number(Array.isArray(A)?A[0]:A)||0,body:o,headers:s})}),a.setTimeout(2e4,()=>{a.close(t.constants.NGHTTP2_CANCEL),i(Error("APNs request timed out"))}),a.end(JSON.stringify(A.payload))})}async send(A){if(!A.deviceToken&&!A.broadcastTopic)throw Error("An APNs device token or broadcast topic is required");let t=A.deviceToken?`/3/device/${A.deviceToken.toLowerCase()}`:`/4/broadcasts/apps/${encodeURIComponent(A.broadcastTopic)}`,r=Date.now(),n=0;for(;;){let s;try{s=await this.requestOnce({...A,path:t})}catch(A){if(n>=3)throw A;await a(Math.min(4e3,250*2**n)),n+=1;continue}let o={};try{o=s.body?JSON.parse(s.body):{}}catch{o={}}if(i.has(s.status)&&n<3){await a(function(A,e){let t=Array.isArray(A)?A[0]:A;if(t){let A=Number(t);if(Number.isFinite(A))return Math.min(3e4,1e3*A);let e=Date.parse(t);if(Number.isFinite(e))return Math.max(0,Math.min(3e4,e-Date.now()))}return Math.min(4e3,250*2**e)}(s.headers["retry-after"],n)),n+=1;continue}let g=s.headers["apns-id"];return{status:s.status,reason:o.reason??null,timestamp:"number"==typeof o.timestamp?new Date(o.timestamp):null,apnsId:(Array.isArray(g)?g[0]:g)??A.headers["apns-id"]??(0,e.randomUUID)(),attempts:n+1,durationMs:Date.now()-r}}}async createBroadcastChannel(A){let e=await this.requestOnce({environment:A.environment,authentication:A.authentication,path:`/4/broadcasts/apps/${encodeURIComponent(A.bundleId)}`,payload:{"channel-storage-policy":+("NO_STORAGE"!==A.storagePolicy)},headers:{"apns-topic":`${A.bundleId}.push-type.liveactivity`,"apns-push-type":"liveactivity"}}),t=e.headers["apns-channel-id"],r=Array.isArray(t)?t[0]:t;if(![200,201].includes(e.status)||!r)throw Error(`APNs could not create the broadcast channel (HTTP ${e.status})`);return r}async deleteBroadcastChannel(A){let e=await this.requestOnce({environment:A.environment,authentication:A.authentication,method:"DELETE",path:`/4/broadcasts/apps/${encodeURIComponent(A.bundleId)}`,payload:{},headers:{"apns-topic":`${A.bundleId}.push-type.liveactivity`,"apns-push-type":"liveactivity","apns-channel-id":A.channelId}});if(![200,204].includes(e.status))throw Error(`APNs could not delete the broadcast channel (HTTP ${e.status})`)}}])},282790,474170,308810,A=>{"use strict";var e=A.i(247287),t=A.i(666680),r=A.i(685560),n=A.i(397554),i=A.i(243783);A.i(582482);var a=A.i(318905),s=A.i(91022),o=A.i(661983);let g=new Set(["alert","background","complication","controls","fileprovider","liveactivity","location","mdm","pushtotalk","voip","widgets"]),C=/^[A-Za-z0-9][A-Za-z0-9.-]{0,254}$/;function Q(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function l(A,e,t){if("string"!=typeof A||!A.trim())throw Error(`${e} is required`);let r=A.trim();if(r.length>t||r.includes("\0"))throw Error(`${e} is invalid`);return r}function I(A,e,t){return null==A||""===A?null:l(A,e,t)}function d(A,e){let t;if("HEX"===e){let e=A.replace(/[\s<>]/g,"");if(!/^[A-Fa-f0-9]{64}$/.test(e))throw Error("token must contain exactly 32 bytes of hexadecimal data");t=Buffer.from(e,"hex")}else{let e=A.trim();if(!/^[A-Za-z0-9+/_-]+={0,2}$/.test(e))throw Error("token is not valid Base64");try{t=Buffer.from(e.replaceAll("-","+").replaceAll("_","/"),"base64")}catch{throw Error("token is not valid Base64")}if(t.toString("base64").replace(/=+$/,"")!==e.replaceAll("-","+").replaceAll("_","/").replace(/=+$/,""))throw Error("token is not valid Base64")}if(32!==t.length)throw Error("token must decode to exactly 32 bytes");return t.toString("hex").toUpperCase()}function E(A){let e=Q(A,"registration"),t=new Set(["clientRegistrationId","token","tokenEncoding","topic","environment","supportedPushTypes","displayName","deviceModel","osVersion","appVersion","appBuild","locale","pushMagic"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected registration field: ${r}`);let n=l(e.tokenEncoding,"tokenEncoding",10);if("HEX"!==n&&"BASE64"!==n)throw Error("tokenEncoding must be HEX or BASE64");let i=l(e.environment,"environment",20);if("SANDBOX"!==i&&"PRODUCTION"!==i)throw Error("environment must be SANDBOX or PRODUCTION");let a=l(e.topic,"topic",255);if(!C.test(a))throw Error("topic is invalid");if(!Array.isArray(e.supportedPushTypes)||!e.supportedPushTypes.length)throw Error("supportedPushTypes must contain at least one push type");let s=[...new Set(e.supportedPushTypes.map(A=>{if("string"!=typeof A||!g.has(A))throw Error(`Unsupported APNs push type: ${String(A)}`);return A}))],o=I(e.pushMagic,"pushMagic",500);if(s.includes("mdm")&&!o)throw Error("pushMagic is required when MDM is supported");return{clientRegistrationId:l(e.clientRegistrationId,"clientRegistrationId",200),token:d(l(e.token,"token",1024),n),tokenEncoding:n,topic:a,environment:i,supportedPushTypes:s,displayName:l(e.displayName,"displayName",120),deviceModel:I(e.deviceModel,"deviceModel",120),osVersion:I(e.osVersion,"osVersion",50),appVersion:I(e.appVersion,"appVersion",50),appBuild:I(e.appBuild,"appBuild",50),locale:I(e.locale,"locale",35),pushMagic:o}}function c(A){let e,t=Q(A,"push editor"),r=l(t.pushType,"pushType",30);if(!g.has(r))throw Error("pushType is unsupported");let n=Q(t.headers??{},"headers"),i=Q(t.aps??{},"aps"),a=Q(t.custom??{},"custom"),s=I(t.credentialId,"credentialId",100),o=Number(n.priority??("background"===r?5:10));if(![1,5,10].includes(o))throw Error("APNs priority must be 1, 5, or 10");if("background"===r&&5!==o)throw Error("Background notifications require priority 5");if(["voip","mdm","pushtotalk"].includes(r)&&10!==o)throw Error(`${r} notifications require priority 10`);if(1===o&&"location"!==r)throw Error("Priority 1 is supported only for location notifications");let d=l(n.topic,"topic",255);if(!C.test(d))throw Error("topic is invalid");let E={complication:".complication",fileprovider:".pushkit.fileprovider",liveactivity:".push-type.liveactivity",location:".location-query",pushtotalk:".voip-ptt",voip:".voip",widgets:".push-type.widgets",controls:".push-type.controls"}[r];if(E&&!d.endsWith(E))throw Error(`${r} notifications require a topic ending in ${E}`);if("mdm"===r){if(!s)throw Error("MDM requires a certificate credential");if(Object.keys(i).length)throw Error("MDM payloads cannot contain aps");if(Object.keys(a).length)throw Error("MDM payloads cannot contain custom root fields");e={mdm:"__PUSH_MAGIC__"}}else{let A={...i},n=A["relevance-score"];if(void 0!==n&&("number"!=typeof n||n<0||n>1))throw Error("aps.relevance-score must be between 0 and 1");let s=A.badge;if(void 0!==s&&("number"!=typeof s||!Number.isInteger(s)||s<0))throw Error("aps.badge must be a non-negative integer");let o=A["interruption-level"];if(void 0!==o&&!["passive","active","time-sensitive","critical"].includes(String(o)))throw Error("aps.interruption-level is invalid");let g=A.sound;if(g&&"object"==typeof g&&!Array.isArray(g)){let A=g.volume;if("number"!=typeof A||!Number.isFinite(A)||A<0||A>1)throw Error("Critical sound volume must be between 0 and 1")}if("background"===r){for(let e of["alert","badge","sound"])if(void 0!==A[e])throw Error(`Background notifications cannot contain aps.${e}`);A["content-available"]=1}if("alert"===r&&!Object.keys(A).length)throw Error("Alert notifications require at least one aps field");if("liveactivity"===r){let e=Q(t.liveActivity??{},"liveActivity");if(!Number.isInteger(e.timestamp))throw Error("Live Activity timestamp must be an integer Unix timestamp");if(!["start","update","end"].includes(String(e.event)))throw Error("Live Activity event must be start, update, or end");Object.assign(A,e)}e={...a,aps:A}}let c=Buffer.byteLength(JSON.stringify(e)),h="voip"===r?5120:4096;if(c>h)throw Error(`Payload is ${c} bytes; ${r} allows ${h}`);let B={"apns-push-type":r,"apns-topic":d,"apns-priority":String(o)};for(let[A,e]of[["apns-id",n.id],["apns-expiration",n.expiration],["apns-collapse-id",n.collapseId],["apns-channel-id",n.broadcastChannelId]])null!=e&&""!==e&&(B[A]=l(e,A,"apns-collapse-id"===A?64:200));if(B["apns-id"]&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(B["apns-id"]))throw Error("apns-id must be a UUID");if(B["apns-expiration"]&&(!/^\d+$/.test(B["apns-expiration"])||0>Number(B["apns-expiration"])))throw Error("apns-expiration must be a non-negative Unix timestamp");return{editor:{pushType:r,headers:n,aps:i,custom:a,liveActivity:"liveactivity"===r?Q(t.liveActivity??{},"liveActivity"):null,credentialId:s},payload:e,headers:B,byteLength:c}}A.s(["normalizeDeviceToken",0,d,"parseApnsRegistrationInput",0,E,"validatePushEditor",0,c],474170);let h="default",B=["DEVICES","ALL","DIRECT","BROADCAST"];function D(A){return(0,t.createHash)("sha256").update(A).digest("hex").toUpperCase()}function w(A,e){let n;try{n=(0,r.createSecureContext)({pfx:A,passphrase:e})}catch{throw Error("The .p12 file or passphrase is invalid")}let i=n.context.getCertificate();if(!i?.length)throw Error("The .p12 file does not contain a leaf certificate");let a=new t.X509Certificate(i),s=new Date(a.validTo);if(Number.isNaN(s.getTime()))throw Error("The .p12 certificate expiration date is invalid");return{expiresAt:s,fingerprint:a.fingerprint256.replaceAll(":","").toUpperCase()}}function u(A){return JSON.parse(A)}function p(A){try{let e=JSON.parse(A);return Array.isArray(e)?e.filter(A=>"string"==typeof A):[]}catch{return[]}}function f(A,e,t=200){let r=A.trim();if(!r||r.length>t||r.includes("\0"))throw Error(`${e} is required or invalid`);return r}A.s(["PushNotificationsService",0,class{client;credentials;recoveryStarted;activeBatchIds;constructor(A=new e.ApnsClient,t=new s.CredentialService){this.client=A,this.credentials=t,this.recoveryStarted=!1,this.activeBatchIds=new Set,queueMicrotask(()=>void this.recover().catch(()=>void 0)),setInterval(()=>void this.recover().catch(()=>void 0),3e4).unref()}changed(){o.agentEventBus.publish(o.PUSH_NOTIFICATIONS_CHANGED_TOPIC,{changed:!0})}subscribe(){return o.agentEventBus.iterate(o.PUSH_NOTIFICATIONS_CHANGED_TOPIC)}async register(A,e){let t=E(A);return this.registerValidated(t,e)}async registerValidated(A,e){let r=await (0,i.getPrismaClient)(),n=D(A.token),a=new Date,s={clientRegistrationId:A.clientRegistrationId,topic:A.topic,environment:A.environment},o=await r.$transaction(async r=>{let i=await r.apnsRegistration.findUnique({where:{clientRegistrationId_topic_environment:s}}),o=await r.apnsRegistration.findUnique({where:{tokenHash_topic_environment:{tokenHash:n,topic:A.topic,environment:A.environment}}});o&&o.id!==i?.id&&await r.apnsRegistration.update({where:{id:o.id},data:{token:"",tokenHash:`REASSIGNED:${o.id}:${o.tokenHash}`,status:"INACTIVE",invalidatedAt:a,lastFailureReason:"TOKEN_REASSIGNED",lastFailureAt:a}});let g={token:A.token,tokenHash:n,pushTypesJson:JSON.stringify(A.supportedPushTypes),displayName:A.displayName,deviceModel:A.deviceModel,osVersion:A.osVersion,appVersion:A.appVersion,appBuild:A.appBuild,locale:A.locale,pushMagic:A.pushMagic,lastIpAddress:e,status:"ACTIVE",invalidatedAt:null,lastFailureReason:null,lastFailureAt:null,lastRegisteredAt:a};return{registration:i?await r.apnsRegistration.update({where:{id:i.id},data:g}):await r.apnsRegistration.create({data:{id:(0,t.randomUUID)(),...s,...g}}),created:!i}});return this.changed(),o}async registrations(){let A=await (0,i.getPrismaClient)();return(await A.apnsRegistration.findMany({orderBy:[{status:"asc"},{lastRegisteredAt:"desc"}]})).map(A=>({...A,tokenMasked:A.token?`${A.token.slice(0,8)}…${A.token.slice(-8)}`:"—",supportedPushTypes:p(A.pushTypesJson)}))}async renameRegistration(A,e){let t=await (0,i.getPrismaClient)(),r=await t.apnsRegistration.update({where:{id:A},data:{displayName:f(e,"Display name",120)}});return this.changed(),r}async setRegistrationActive(A,e){let t=await (0,i.getPrismaClient)(),r=await t.apnsRegistration.update({where:{id:A},data:{status:e?"ACTIVE":"INACTIVE",invalidatedAt:e?null:new Date}});return this.changed(),r}async deleteRegistration(A){let e=await (0,i.getPrismaClient)();return await e.apnsRegistration.delete({where:{id:A}}),this.changed(),!0}async rawSettings(){return(await (0,i.getPrismaClient)()).pushNotificationSettings.upsert({where:{id:h},create:{id:h},update:{}})}async settings(){let A=await (0,i.getPrismaClient)(),[e,t,r]=await Promise.all([this.rawSettings(),A.apnsCertificateCredential.findMany({orderBy:{name:"asc"}}),this.credentials.isConfigured(a.CREDENTIALS.apnsTokenPrivateKey)]);return{tokenConfigured:!!(e.tokenTeamId&&e.tokenKeyId&&r),tokenTeamId:e.tokenTeamId,tokenKeyId:e.tokenKeyId,tokenPrivateKeyFingerprint:e.tokenPrivateKeyFingerprint,tokenConfiguredAt:e.tokenConfiguredAt,tokenLastUsedAt:e.tokenLastUsedAt,tokenLastError:e.tokenLastError,certificates:t.map(A=>({id:A.id,name:A.name,topic:A.topic,environment:A.environment,fingerprint:A.fingerprint,expiresAt:A.expiresAt,lastTestedAt:A.lastTestedAt,lastError:A.lastError,createdAt:A.createdAt,updatedAt:A.updatedAt})),updatedAt:e.updatedAt}}async saveTokenSettings(A){await this.rawSettings();let e=f(A.teamId,"Team ID",20),t=f(A.keyId,"Key ID",20),r=A.privateKey?.trim()||await this.credentials.getText(a.CREDENTIALS.apnsTokenPrivateKey);if(!r?.includes("-----BEGIN PRIVATE KEY-----"))throw Error("An APNs PKCS#8 .p8 private key is required");try{await (0,n.importPKCS8)(r,"ES256")}catch{throw Error("The APNs .p8 key must be an ES256 PKCS#8 private key")}return await this.credentials.setText(a.CREDENTIALS.apnsTokenPrivateKey,r,async A=>{await A.pushNotificationSettings.update({where:{id:h},data:{tokenTeamId:e,tokenKeyId:t,tokenPrivateKeyFingerprint:D(r),tokenConfiguredAt:new Date,tokenLastError:null}})}),this.changed(),this.settings()}async clearTokenSettings(){return await this.credentials.delete(a.CREDENTIALS.apnsTokenPrivateKey,async A=>{await A.pushNotificationSettings.upsert({where:{id:h},create:{id:h},update:{tokenTeamId:null,tokenKeyId:null,tokenPrivateKeyFingerprint:null,tokenConfiguredAt:null,tokenLastUsedAt:null,tokenLastError:null}})}),this.changed(),this.settings()}async addCertificateCredential(A){let e=Buffer.from(A.p12Base64,"base64");if(!e.length||e.length>0x1400000)throw Error("The .p12 file is empty or larger than 20 MiB");if(!["SANDBOX","PRODUCTION"].includes(A.environment))throw Error("Certificate environment is invalid");let r=w(e,A.passphrase),n=(0,t.randomUUID)();return await this.credentials.setJson((0,a.apnsCertificateCredential)(n),{p12Base64:A.p12Base64,passphrase:A.passphrase},async e=>{await e.apnsCertificateCredential.create({data:{id:n,name:f(A.name,"Credential name",100),topic:f(A.topic,"Topic",255),environment:A.environment,fingerprint:r.fingerprint,expiresAt:r.expiresAt,lastTestedAt:new Date}})}),this.changed(),this.settings()}async deleteCertificateCredential(A){return await this.credentials.delete((0,a.apnsCertificateCredential)(A),async e=>{await e.apnsCertificateCredential.delete({where:{id:A}})}),this.changed(),!0}async retestCertificateCredential(A){let e=await (0,i.getPrismaClient)();if(!await e.apnsCertificateCredential.findUnique({where:{id:A}}))throw Error("APNs certificate credential not found");let t=await this.credentials.getJson((0,a.apnsCertificateCredential)(A));if(!t)throw Error("APNs certificate credential is not configured");try{let r=w(Buffer.from(t.p12Base64,"base64"),t.passphrase);await e.apnsCertificateCredential.update({where:{id:A},data:{fingerprint:r.fingerprint,expiresAt:r.expiresAt,lastTestedAt:new Date,lastError:null}})}catch(t){throw await e.apnsCertificateCredential.update({where:{id:A},data:{lastTestedAt:new Date,lastError:t instanceof Error?t.message:String(t)}}),this.changed(),t}return this.changed(),this.settings()}async channels(){return(await (0,i.getPrismaClient)()).apnsBroadcastChannel.findMany({orderBy:{createdAt:"desc"}})}async tokenAuthentication(A="APNs token authentication is not configured"){let e=await this.rawSettings();if(!e.tokenTeamId||!e.tokenKeyId)throw Error(A);let t=await this.credentials.getText(a.CREDENTIALS.apnsTokenPrivateKey);if(!t)throw Error(A);return{kind:"TOKEN",teamId:e.tokenTeamId,keyId:e.tokenKeyId,privateKey:t}}async createChannel(A){if(!["SANDBOX","PRODUCTION"].includes(A.environment))throw Error("Channel environment is invalid");if(!["NO_STORAGE","MOST_RECENT"].includes(A.storagePolicy))throw Error("Channel storage policy is invalid");let e=f(A.bundleId,"Bundle ID",255),r=A.channelId?null:await this.tokenAuthentication("APNs token authentication is required for broadcast channels"),n=A.channelId?.trim()||await this.client.createBroadcastChannel({environment:A.environment,authentication:r,bundleId:e,storagePolicy:A.storagePolicy}),a=await (0,i.getPrismaClient)(),s=await a.apnsBroadcastChannel.create({data:{id:(0,t.randomUUID)(),channelId:n,bundleId:e,environment:A.environment,storagePolicy:A.storagePolicy}});return this.changed(),s}async deleteChannel(A){let e=await (0,i.getPrismaClient)(),t=await e.apnsBroadcastChannel.findUnique({where:{id:A}});if(!t)throw Error("Broadcast channel not found");let r=await this.tokenAuthentication("APNs token authentication is required for broadcast channels");return await this.client.deleteBroadcastChannel({environment:t.environment,authentication:r,bundleId:t.bundleId,channelId:t.channelId}),await e.apnsBroadcastChannel.delete({where:{id:A}}),this.changed(),!0}async presets(){return(await (0,i.getPrismaClient)()).pushNotificationPreset.findMany({orderBy:{updatedAt:"desc"}})}async preset(A){return(await (0,i.getPrismaClient)()).pushNotificationPreset.findUnique({where:{id:A}})}async savePreset(A,e,r){let n=c(e),a=await (0,i.getPrismaClient)(),s=r?await a.pushNotificationPreset.update({where:{id:r},data:{name:f(A,"Preset name",100),editorJson:JSON.stringify(n.editor)}}):await a.pushNotificationPreset.create({data:{id:(0,t.randomUUID)(),name:f(A,"Preset name",100),editorJson:JSON.stringify(n.editor)}});return this.changed(),s}async deletePreset(A){let e=await (0,i.getPrismaClient)();return await e.pushNotificationPreset.delete({where:{id:A}}),this.changed(),!0}async history(A=100){return(await (0,i.getPrismaClient)()).pushNotificationBatch.findMany({include:{deliveries:{orderBy:{createdAt:"asc"}}},orderBy:{createdAt:"desc"},take:Math.max(1,Math.min(A,200))})}async historyItem(A){return(await (0,i.getPrismaClient)()).pushNotificationBatch.findUnique({where:{id:A},include:{deliveries:{orderBy:{createdAt:"asc"}}}})}async saveDraft(A){let e=c(A),r=await (0,i.getPrismaClient)(),n=await r.pushNotificationBatch.create({data:{id:(0,t.randomUUID)(),requestId:(0,t.randomUUID)(),status:"DRAFT",editorJson:JSON.stringify(e.editor),payloadJson:JSON.stringify(e.payload),headersJson:JSON.stringify(e.headers),targetMode:"DRAFT"},include:{deliveries:!0}});return this.changed(),n}async deleteHistory(A){let e=await (0,i.getPrismaClient)();if(1!==(await e.pushNotificationBatch.deleteMany({where:{id:A,status:{notIn:["QUEUED","SENDING"]}}})).count){if(!await e.pushNotificationBatch.findUnique({where:{id:A},select:{status:!0}}))throw Error("Push history item not found");throw Error("Queued or sending push notifications cannot be deleted")}return this.changed(),!0}async clearHistory(){let A=await (0,i.getPrismaClient)(),e=await A.pushNotificationBatch.deleteMany({where:{status:{notIn:["QUEUED","SENDING"]}}});return this.changed(),e.count}async send(A){var e;if(e=A.targetMode,!B.includes(e))throw Error(`Unsupported push target mode: ${A.targetMode}`);let r=A.targetMode,n=c(A.editor),a=await (0,i.getPrismaClient)(),s=await a.pushNotificationBatch.findUnique({where:{requestId:A.requestId},include:{deliveries:!0}});if(s)return s;let o=[],g=null,C=null;if("BROADCAST"===r){if("liveactivity"!==n.editor.pushType)throw Error("Broadcast delivery is available only for Live Activities");if(!A.channelId)throw Error("Select a broadcast channel");if(!(g=await a.apnsBroadcastChannel.findUnique({where:{id:A.channelId}})))throw Error("Broadcast channel not found")}else if("DIRECT"===r){if("liveactivity"!==n.editor.pushType)throw Error("Direct-token delivery is available only for Live Activities");if(!A.directToken)throw Error("Enter a Live Activity push token");let e=A.directTokenEncoding??"HEX";if("HEX"!==e&&"BASE64"!==e)throw Error("Direct token encoding must be HEX or BASE64");let t=A.directEnvironment??"SANDBOX";if("SANDBOX"!==t&&"PRODUCTION"!==t)throw Error("Direct token environment is invalid");let r=d(A.directToken,e);C={token:r,tokenHash:D(r),environment:t}}else{let e=[...new Set(A.registrationIds??[])];if(!(o=(await a.apnsRegistration.findMany({where:{status:"ACTIVE",topic:n.headers["apns-topic"],..."DEVICES"===r?{id:{in:e}}:{}}})).filter(A=>p(A.pushTypesJson).includes(n.editor.pushType)).map(A=>({id:A.id,tokenHash:A.tokenHash,topic:A.topic,environment:A.environment}))).length)throw Error("No eligible APNs devices selected")}let Q=await a.pushNotificationBatch.create({data:{id:(0,t.randomUUID)(),requestId:A.requestId,status:"QUEUED",editorJson:JSON.stringify(n.editor),payloadJson:JSON.stringify(n.payload),headersJson:JSON.stringify(n.headers),targetMode:r,channelId:g?.id??null,recipientCount:g||C?1:o.length,deliveries:{create:g?[{id:(0,t.randomUUID)(),topic:g.bundleId,environment:g.environment}]:C?[{id:(0,t.randomUUID)(),tokenHash:C.tokenHash,topic:n.headers["apns-topic"],environment:C.environment,recipientSecret:{create:{id:(0,t.randomUUID)(),token:C.token}}}]:o.map(A=>({id:(0,t.randomUUID)(),registrationId:A.id,tokenHash:A.tokenHash,topic:A.topic,environment:A.environment}))}},include:{deliveries:!0}});return this.changed(),this.processBatch(Q.id).catch(()=>void 0),Q}async resend(A,e){let t=await (0,i.getPrismaClient)(),r=await t.pushNotificationBatch.findUnique({where:{id:A},include:{deliveries:!0}});if(!r)throw Error("Push history item not found");if("DRAFT"===r.targetMode)throw Error("Choose recipients before sending a draft");if("DIRECT"===r.targetMode)throw Error("Direct Live Activity tokens are not retained; load the item and enter the token again");return this.send({requestId:e,editor:u(r.editorJson),targetMode:r.targetMode,registrationIds:r.deliveries.map(A=>A.registrationId).filter(A=>!!A),channelId:r.channelId})}async authentication(A,e,t){let r=await (0,i.getPrismaClient)();if(A.credentialId){let n=await r.apnsCertificateCredential.findUnique({where:{id:A.credentialId}});if(!n)throw Error("APNs certificate credential not found");if(n.environment!==e||n.topic!==t)throw Error("APNs certificate does not match the target topic/environment");let i=await this.credentials.getJson((0,a.apnsCertificateCredential)(n.id));if(!i)throw Error("APNs certificate credential is not configured");return{kind:"CERTIFICATE",p12Base64:i.p12Base64,passphrase:i.passphrase,fingerprint:n.fingerprint}}if("mdm"===A.pushType)throw Error("MDM requires certificate authentication");return this.tokenAuthentication()}async failDelivery(A,e){let t=await (0,i.getPrismaClient)();await t.pushNotificationDelivery.update({where:{id:A},data:{status:"FAILED",reason:e,finishedAt:new Date}}),this.changed()}async executeDelivery(A,e,t,r,n){let a=await (0,i.getPrismaClient)();await a.pushNotificationDelivery.update({where:{id:A.id},data:{status:"SENDING",startedAt:new Date}}),this.changed();try{let i=A.registrationId?await a.apnsRegistration.findUnique({where:{id:A.registrationId}}):null,s=A.registrationId?null:await a.apnsPushRecipientSecret.findUnique({where:{deliveryId:A.id}});if(A.registrationId&&(!i||"ACTIVE"!==i.status))return void await this.failDelivery(A.id,"Registration is no longer active");if(!i&&!s&&!n)return void await this.failDelivery(A.id,"Direct recipient token expired");let o=await this.authentication(e,A.environment,A.topic),g="mdm"===e.pushType?{mdm:i?.pushMagic}:t;if("mdm"===e.pushType&&!i?.pushMagic)return void await this.failDelivery(A.id,"Registration has no MDM push magic");let C=await this.client.send({environment:A.environment,authentication:o,deviceToken:i?.token||s?.token,broadcastTopic:n?.bundleId,payload:g,headers:{...r,...n?{"apns-channel-id":n.channelId}:{}}});await this.recordResponse(A.id,i,C,"TOKEN"===o.kind),"CERTIFICATE"===o.kind&&e.credentialId&&await a.apnsCertificateCredential.updateMany({where:{id:e.credentialId},data:{lastTestedAt:new Date,lastError:200===C.status?null:`HTTP ${C.status}${C.reason?`: ${C.reason}`:""}`}})}catch(t){if(!e.credentialId&&"mdm"!==e.pushType){let A=await (0,i.getPrismaClient)();await A.pushNotificationSettings.updateMany({where:{id:h},data:{tokenLastError:t instanceof Error?t.message:String(t)}})}if(e.credentialId){let A=await (0,i.getPrismaClient)();await A.apnsCertificateCredential.updateMany({where:{id:e.credentialId},data:{lastTestedAt:new Date,lastError:t instanceof Error?t.message:String(t)}})}await this.failDelivery(A.id,t instanceof Error?t.message:String(t))}finally{await a.apnsPushRecipientSecret.deleteMany({where:{deliveryId:A.id}})}}async recordResponse(A,e,t,r){let n=await (0,i.getPrismaClient)(),a=200===t.status;if(await n.pushNotificationDelivery.update({where:{id:A},data:{status:a?"SUCCEEDED":"FAILED",responseCode:t.status,reason:t.reason,responseTimestamp:t.timestamp,apnsId:t.apnsId,attempts:t.attempts,durationMs:t.durationMs,finishedAt:new Date}}),this.changed(),r&&await n.pushNotificationSettings.updateMany({where:{id:h},data:a?{tokenLastUsedAt:new Date,tokenLastError:null}:{tokenLastError:`HTTP ${t.status}${t.reason?`: ${t.reason}`:""}`}}),!e)return;if(a)return void await n.apnsRegistration.update({where:{id:e.id},data:{lastSentAt:new Date,lastFailureReason:null}});let s=410===t.status&&"Unregistered"===t.reason,o=400===t.status&&["BadDeviceToken","DeviceTokenNotForTopic"].includes(t.reason??""),g=!t.timestamp||t.timestamp>=e.lastRegisteredAt;s&&g||o?await n.apnsRegistration.updateMany({where:{id:e.id,lastRegisteredAt:e.lastRegisteredAt},data:{status:"INVALID",invalidatedAt:new Date,lastFailureReason:t.reason,lastFailureAt:new Date}}):await n.apnsRegistration.update({where:{id:e.id},data:{lastFailureReason:t.reason,lastFailureAt:new Date}})}async processBatch(A){let e=await (0,i.getPrismaClient)();if(1===(await e.pushNotificationBatch.updateMany({where:{id:A,status:"QUEUED"},data:{status:"SENDING",startedAt:new Date,error:null}})).count){this.activeBatchIds.add(A);try{let t=await e.pushNotificationBatch.findUnique({where:{id:A},include:{deliveries:{where:{status:"QUEUED"}}}});if(!t)return;let r=u(t.editorJson),n=u(t.payloadJson),i=u(t.headersJson),a=t.channelId?await e.apnsBroadcastChannel.findUnique({where:{id:t.channelId}}):null,s=0,o=Array.from({length:Math.min(16,t.deliveries.length)},async()=>{for(;s<t.deliveries.length;){let A=t.deliveries[s++];if(!A)return;await this.executeDelivery(A,r,n,i,a)}});await Promise.all(o);let g=await e.pushNotificationDelivery.findMany({where:{batchId:A},select:{status:!0}}),C=g.filter(A=>"SUCCEEDED"===A.status).length,Q=g.length-C;await e.pushNotificationBatch.update({where:{id:A},data:{status:Q?C?"PARTIAL":"FAILED":"SUCCEEDED",successCount:C,failureCount:Q,finishedAt:new Date}}),this.changed()}finally{this.activeBatchIds.delete(A)}}}async recover(){if(!this.recoveryStarted){this.recoveryStarted=!0;try{let A=await (0,i.getPrismaClient)();for(;;){let e=new Date(Date.now()-12e4),t=await A.pushNotificationBatch.findMany({where:{OR:[{status:"QUEUED"},{status:"SENDING",startedAt:{lt:e}}]},orderBy:{createdAt:"asc"},take:100});if(!t.length)break;let r=[];for(let n of t)if(!this.activeBatchIds.has(n.id)){if("SENDING"===n.status){await A.pushNotificationDelivery.updateMany({where:{batchId:n.id,status:"SENDING"},data:{status:"QUEUED",startedAt:null}});let t=await A.pushNotificationBatch.updateMany({where:{id:n.id,status:"SENDING",startedAt:{lt:e}},data:{status:"QUEUED",startedAt:null}});if(1!==t.count)continue}r.push(n.id)}if(!r.length)break;await Promise.all(r.map(A=>this.processBatch(A)))}}finally{this.recoveryStarted=!1}}}}],308810),A.s([],282790)},464841,218202,220629,689245,906148,A=>{"use strict";var e=A.i(135160);let t=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function r(A){return function A(e){return null===e?"null":Array.isArray(e)?`[${e.map(A).join(",")}]`:"object"==typeof e?`{${Object.entries(e).sort(([A],[e])=>A.localeCompare(e)).map(([e,t])=>`${JSON.stringify(e)}:${A(t)}`).join(",")}}`:JSON.stringify(e)}(A)}function n(A){return t.test(A)?`.${A}`:`[${JSON.stringify(A)}]`}function i(A,e){let t={},r=(A,e)=>{if(e&&"object"==typeof e&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype){let i=Object.entries(e);if(0===i.length)t[A]=e;else for(let[e,t]of i)r(`${A}${n(e)}`,t)}else t[A]=e};for(let[t,i]of Object.entries(e))r(`${A}${n(t)}`,i);return t}function a(A){let e={default:A.defaultParameters,additional:A.additionalParameters};return{...{source:A.entryType,time:A.clientTime,receivedAt:A.receivedAt,deviceIp:A.deviceIp,message:A.message,level:A.level,category:A.category,eventName:A.eventName,eventKind:A.eventKind,levelKind:A.level??A.eventKind,screenName:A.screenName,buildId:A.buildId,sessionId:A.sessionId,attributes:A.attributes,defaultParameters:A.defaultParameters,additionalParameters:A.additionalParameters,parameters:e,detail:"CONSOLE"===A.entryType?A.message:`${A.eventName??""}${A.screenName?` (${A.screenName})`:""}`},...i("attributes",A.attributes),...i("defaultParameters",A.defaultParameters),...i("additionalParameters",A.additionalParameters)}}function s(A){return null==A?"":"string"==typeof A?A:"number"==typeof A||"boolean"==typeof A?String(A):r(A)}function o(A){return Object.entries(a(A)).flatMap(([A,e])=>[A,s(e)]).join("\n")}let g=["CONSOLE","ANALYTICS","UNIFIED"],C=["TEXT","GLOB","REGEX"],Q=["CONTAINS","DOES_NOT_CONTAIN","IS","IS_NOT","MATCHES_GLOB","MATCHES_REGEX","NO_REGEX_MATCH","IS_EMPTY","IS_NOT_EMPTY"],l={CONSOLE:["time","level","category","message","buildId","sessionId"],ANALYTICS:["time","eventKind","eventName","screenName","parameters","buildId","sessionId"],UNIFIED:["time","source","levelKind","detail","buildId","sessionId"]},I=["gray","stone","red","rose","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink"];A.s(["DEFAULT_TELEMETRY_COLUMNS",0,l,"TELEMETRY_COLORS",0,I,"TELEMETRY_FILTER_OPERATORS",0,Q,"TELEMETRY_SEARCH_MODES",0,C,"TELEMETRY_VIEWS",0,g],218202);let d=new Map;function E(A,t,r){let n;if(t.length>1024)throw Error("Pattern must not exceed 1024 characters");if(!C.includes(A))throw Error("Unknown search mode");let i=`${A}\u0000${r?"1":"0"}\u0000${t}`,a=d.get(i);if(a)return a;if("TEXT"===A){let A=r?t:t.toLocaleLowerCase();n=e=>(r?e:e.toLocaleLowerCase()).includes(A)}else{let i="GLOB"===A?`^${function(A){let e="";for(let t=0;t<A.length;t+=1){let r=A[t];if("*"===r)e+=".*";else if("?"===r)e+=".";else if("["===r){let r=A.indexOf("]",t+1);if(-1===r)throw Error("Invalid glob pattern: missing ]");{let n=A.slice(t+1,r).replace(/^!/,"^");e+=`[${n}]`,t=r}}else e+=r.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}return e}(t)}$`:t,a=r?"su":"isu",s="REGEX"===A?new e.RE2(i,a):new RegExp(i,a);n=A=>s.test(A)}return d.set(i,n),d.size>100&&d.delete(d.keys().next().value),n}function c(A){return null==A||""===A||Array.isArray(A)&&0===A.length||"object"==typeof A&&!Array.isArray(A)&&0===Object.keys(A).length}function h(A){return"CONSOLE"===A?["CONSOLE"]:"ANALYTICS"===A?["ANALYTICS"]:["CONSOLE","ANALYTICS"]}function B(A,e){return"SEPARATOR"!==A.entryType&&!!h(e.view).includes(A.entryType)&&(!e.search||!!E(e.searchMode??"TEXT",e.search,!0===e.caseSensitive)(o(A)))&&function(A,e){if(!e)return!0;let t=a(A);return Object.entries(e).every(([A,e])=>0===e.length||e.includes(s(t[A])))}(A,e.quickFilters)&&function(A,e){if(!e?.conditions.length)return!0;let t=e.conditions.filter(e=>!e.sources?.length||"SEPARATOR"!==A.entryType&&e.sources.includes(A.entryType));if(0===t.length)return!0;let r=a(A),n=t.map(A=>(function(A,e){if(!Q.includes(e.operator))throw Error("Unknown filter operator");let t=A[e.field];if("IS_EMPTY"===e.operator)return c(t);if("IS_NOT_EMPTY"===e.operator)return!c(t);let r=s(t),n=e.value??"",i=!0===e.caseSensitive,a=i?r:r.toLocaleLowerCase(),o=i?n:n.toLocaleLowerCase();if("CONTAINS"===e.operator)return a.includes(o);if("DOES_NOT_CONTAIN"===e.operator)return!a.includes(o);if("IS"===e.operator)return a===o;if("IS_NOT"===e.operator)return a!==o;if("MATCHES_GLOB"===e.operator)return E("GLOB",n,i)(r);let g=E("REGEX",n,i)(r);return"MATCHES_REGEX"===e.operator?g:!g})(r,A));return"ANY"===e.mode?n.some(Boolean):n.every(Boolean)}(A,e.advancedFilter)}function D(A){for(let e of(A.search&&E(A.searchMode??"TEXT",A.search,!0===A.caseSensitive),A.advancedFilter?.conditions??[]))["MATCHES_GLOB","MATCHES_REGEX","NO_REGEX_MATCH"].includes(e.operator)&&E("MATCHES_GLOB"===e.operator?"GLOB":"REGEX",e.value??"",!0===e.caseSensitive)}var w=A.i(666680),u=A.i(243783);A.i(805422);var p=A.i(661983),f=A.i(660526);let y="default";function M(A){try{let e=JSON.parse(A);return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}catch{return{}}}function m(A){return{id:A.id,entryType:A.entryType,clientTime:A.clientTime.toISOString(),receivedAt:A.receivedAt.toISOString(),deviceIp:A.deviceIp,message:A.message,level:A.level,category:A.category,eventName:A.eventName,eventKind:A.eventKind,screenName:A.screenName,buildId:A.buildId,sessionId:A.sessionId,attributes:M(A.attributesJson),defaultParameters:M(A.defaultParametersJson),additionalParameters:M(A.additionalParametersJson),highlightColor:A.highlightColor,separatorKind:A.separatorKind,separatorName:A.separatorName}}function N(A){if(!g.includes(A))throw Error("Unknown telemetry view");return A}function S(A){let e=A.trim();if(!e||e.length>100)throw Error("Name must contain 1-100 characters");return{name:e,normalizedName:e.toLocaleLowerCase()}}function k(A){let e;try{e=new URL(A.trim())}catch{throw Error("Telemetry URL must be a valid HTTP(S) origin")}if(!["http:","https:"].includes(e.protocol)||e.username||e.password||"/"!==e.pathname&&""!==e.pathname||e.search||e.hash)throw Error("Telemetry URL must be an HTTP(S) origin without a path, credentials, query, or fragment");return e.origin}function U(A){return A?.trim()?k(A):null}function F(A){if(!A?.trim())return null;try{let e=new URL(A.trim());return["http:","https:"].includes(e.protocol)?e.origin:null}catch{return null}}function R(A){if(!A)return null;try{let e=JSON.parse(Buffer.from(A,"base64url").toString("utf8"));if(e&&"object"==typeof e&&"string"==typeof e.clientTime&&"string"==typeof e.receivedAt&&"string"==typeof e.id&&Number.isFinite(Date.parse(e.clientTime))&&Number.isFinite(Date.parse(e.receivedAt)))return e}catch{}throw Error("Invalid telemetry cursor")}function T(A){let e=new Date(A.clientTime),t=new Date(A.receivedAt);return{OR:[{clientTime:{lt:e}},{clientTime:e,receivedAt:{lt:t}},{clientTime:e,receivedAt:t,id:{lt:A.id}}]}}function b(A){return Buffer.from(JSON.stringify({clientTime:A.clientTime,receivedAt:A.receivedAt,id:A.id})).toString("base64url")}function H(A,e){return A.clientTime!==e.clientTime?A.clientTime<e.clientTime:A.receivedAt!==e.receivedAt?A.receivedAt<e.receivedAt:A.id<e.id}function L(A){return!!(A.search||Object.values(A.quickFilters??{}).some(A=>A.length)||A.advancedFilter?.conditions.length)}function O(A){return{entryType:{in:h(A)}}}let G={source:{name:"entryType",nullable:!1},deviceIp:{name:"deviceIp",nullable:!0},message:{name:"message",nullable:!0},level:{name:"level",nullable:!0},category:{name:"category",nullable:!0},eventName:{name:"eventName",nullable:!0},eventKind:{name:"eventKind",nullable:!0},screenName:{name:"screenName",nullable:!0},buildId:{name:"buildId",nullable:!0},sessionId:{name:"sessionId",nullable:!0}};function J(A){let e=[...new Set(A.map(A=>A.trim()).filter(Boolean))];if(0===e.length||e.length>100||e.some(A=>A.length>512))throw Error("Columns must contain 1-100 valid column identifiers");return JSON.stringify(e)}function v(A,e){try{let e=JSON.parse(A);if(Array.isArray(e)&&e.every(A=>"string"==typeof A)&&e.length)return e}catch{}return l[e]}A.s(["TelemetryService",0,class{subscribe(){return p.agentEventBus.iterate(p.TELEMETRY_CHANGED_TOPIC)}subscribeSettings(){return p.agentEventBus.iterate(p.TELEMETRY_SETTINGS_CHANGED_TOPIC)}publish(A,e){p.agentEventBus.publish(p.TELEMETRY_CHANGED_TOPIC,{ids:A,reason:e})}notifyChange(A,e){this.publish(A,e)}async rawSettings(){return(await (0,u.getPrismaClient)()).telemetrySettings.upsert({where:{id:y},create:{id:y},update:{}})}async settings(A={}){let[e,t]=await Promise.all([this.rawSettings(),Promise.resolve(function(A={}){let e,t=F(A.requestOrigin),r=(A.localOrigins??function(){let A=Number(process.env.PORT??3e3),e=Number.isInteger(A)&&A>0&&A<=65535?A:3e3;var t=(0,f.networkInterfaces)();let r=new Set;for(let A of Object.values(t))for(let t of A??[])t&&!t.internal&&("IPv4"===t.family?r.add(`http://${t.address}:${e}`):"IPv6"!==t.family||t.address.toLowerCase().startsWith("fe80:")||r.add(`http://[${t.address}]:${e}`));return[...r]}()).flatMap(A=>{try{return[k(A)]}catch{return[]}}),n=F(A.publicBaseUrl??process.env.PUBLIC_BASE_URL),i=!!t&&("localhost"===(e=new URL(t).hostname.toLowerCase().replace(/^\[|\]$/g,""))||"::1"===e||e.endsWith(".local")||/^127\./.test(e)||/^10\./.test(e)||/^192\.168\./.test(e)||/^172\.(1[6-9]|2\d|3[01])\./.test(e)),a=t&&i?t:r[0]??t??"http://127.0.0.1:3000",s=n??t??a;return{local:a,remote:s}}(A))]);return{localBaseUrlOverride:e.localBaseUrlOverride,remoteBaseUrlOverride:e.remoteBaseUrlOverride,consoleCollectionEnabled:e.consoleCollectionEnabled,analyticsCollectionEnabled:e.analyticsCollectionEnabled,detectedLocalBaseUrl:t.local,detectedRemoteBaseUrl:t.remote,effectiveLocalBaseUrl:e.localBaseUrlOverride??t.local,effectiveRemoteBaseUrl:e.remoteBaseUrlOverride??t.remote,updatedAt:e.updatedAt.toISOString()}}async saveSettings(A,e={}){let t=await (0,u.getPrismaClient)(),r=await this.rawSettings(),n=await t.telemetrySettings.update({where:{id:y},data:{localBaseUrlOverride:void 0===A.localBaseUrlOverride?r.localBaseUrlOverride:U(A.localBaseUrlOverride),remoteBaseUrlOverride:void 0===A.remoteBaseUrlOverride?r.remoteBaseUrlOverride:U(A.remoteBaseUrlOverride),consoleCollectionEnabled:A.consoleCollectionEnabled??r.consoleCollectionEnabled,analyticsCollectionEnabled:A.analyticsCollectionEnabled??r.analyticsCollectionEnabled}});return p.agentEventBus.publish(p.TELEMETRY_SETTINGS_CHANGED_TOPIC,{updatedAt:n.updatedAt.toISOString()}),this.settings(e)}async buildSettings(A,e={}){let t=await this.settings(e),r="SIMULATOR"===A?t.effectiveLocalBaseUrl:t.effectiveRemoteBaseUrl;return{localBaseUrl:t.effectiveLocalBaseUrl,remoteBaseUrl:t.effectiveRemoteBaseUrl,selectedBaseUrl:r,consoleLogsUrl:`${r}/api/telemetry/console-logs`,analyticsEventsUrl:`${r}/api/telemetry/analytics-events`,consoleCollectionEnabled:t.consoleCollectionEnabled,analyticsCollectionEnabled:t.analyticsCollectionEnabled}}async ingestConsole(A,e){if(!(await this.rawSettings()).consoleCollectionEnabled)return{collected:!1,items:[]};let t=await (0,u.getPrismaClient)(),r=new Date,n=A.map(A=>{let t={id:(0,w.randomUUID)(),entryType:"CONSOLE",clientTime:new Date(A.time),receivedAt:r,deviceIp:e,message:A.message,level:A.level,category:A.category,buildId:A.buildId,sessionId:A.sessionId,attributesJson:JSON.stringify(A.attributes),searchText:""},n=m({...t,eventName:null,eventKind:null,screenName:null,defaultParametersJson:"{}",additionalParametersJson:"{}",highlightColor:null,separatorKind:null,separatorName:null});return{...t,searchText:o(n)}});return await t.telemetryEntry.createMany({data:n}),this.publish(n.map(({id:A})=>A),"INGESTED"),{collected:!0,items:n.map(({id:A})=>({id:A,receivedAt:r.toISOString(),deviceIp:e}))}}async ingestAnalytics(A,e){if(!(await this.rawSettings()).analyticsCollectionEnabled)return{collected:!1,items:[]};let t=await (0,u.getPrismaClient)(),r=new Date,n=A.map(A=>{let t={id:(0,w.randomUUID)(),entryType:"ANALYTICS",clientTime:new Date(A.time),receivedAt:r,deviceIp:e,eventName:A.eventName,eventKind:A.kind,screenName:A.screenName,buildId:A.buildId,sessionId:A.sessionId,defaultParametersJson:JSON.stringify(A.defaultParameters),additionalParametersJson:JSON.stringify(A.additionalParameters),searchText:""},n=m({...t,message:null,level:null,category:null,attributesJson:"{}",highlightColor:null,separatorKind:null,separatorName:null});return{...t,searchText:o(n)}});return await t.telemetryEntry.createMany({data:n}),this.publish(n.map(({id:A})=>A),"INGESTED"),{collected:!0,items:n.map(({id:A})=>({id:A,receivedAt:r.toISOString(),deviceIp:e}))}}async scan(A,e,t=1e3){let r=await (0,u.getPrismaClient)(),n=null;for(;;){let i=await r.telemetryEntry.findMany({where:n?{AND:[A,{OR:[{clientTime:{lt:n.clientTime}},{clientTime:n.clientTime,receivedAt:{lt:n.receivedAt}},{clientTime:n.clientTime,receivedAt:n.receivedAt,id:{lt:n.id}}]}]}:A,orderBy:[{clientTime:"desc"},{receivedAt:"desc"},{id:"desc"}],take:t});for(let A of i)if(await e(m(A))===!1)return;if(i.length<t)break;n=i.at(-1)}}async timeline(A){let e=N(A.view);D(A);let t=Math.min(500,Math.max(1,A.first??200)),r=R(A.after),n=await (0,u.getPrismaClient)(),i=await n.telemetryEntry.count({where:O(e)}),a=L(A);if(!a){let A=[],n=0,a=!1,s=null,o=!1,g={entryType:{in:[...h(e),"SEPARATOR"]}};return(await this.scan(r?{AND:[g,T(r)]}:g,e=>{if("SEPARATOR"===e.entryType){o&&A.push(e),o=!1;return}if(n<t){A.push(e),n+=1,s=e,o=!0;return}return a=!0,!1},Math.min(1e3,t+1)),s)?{items:A,nextCursor:a?b(s):null,matchingCount:i,totalCount:i}:{items:[],nextCursor:null,matchingCount:i,totalCount:i}}let s=[],o=0,g=!1,C=0,Q=null,l=!1,I=!1,d=function(A){let e=[];for(let[t,r]of(A.search&&(A.searchMode??"TEXT")==="TEXT"&&!0===A.caseSensitive&&e.push({searchText:{contains:A.search}}),Object.entries(A.quickFilters??{}))){if(!r.length)continue;let A=G[t];if(!A)continue;let n=function(A,e){let t=[...new Set(e)],r=t.filter(Boolean),n=[];return(r.length&&n.push({[A.name]:{in:r}}),t.includes("")&&(n.push({[A.name]:""}),A.nullable&&n.push({[A.name]:null})),0===n.length)?null:1===n.length?n[0]:{OR:n}}(A,r);n&&e.push(n)}if(A.advancedFilter?.mode==="ALL")for(let t of A.advancedFilter.conditions){if(t.sources?.length||!0!==t.caseSensitive)continue;let A=G[t.field],r=t.value??"";A&&r&&("IS"===t.operator?e.push({[A.name]:r}):"CONTAINS"===t.operator&&e.push({[A.name]:{contains:r}}))}return e.length?1===e.length?e[0]:{AND:e}:null}(A);return(await this.scan(d?{OR:[{entryType:"SEPARATOR"},{AND:[O(e),d]}]}:{entryType:{in:[...h(e),"SEPARATOR"]}},e=>{if("SEPARATOR"===e.entryType){(!r||H(e,r))&&(!a&&!g||a&&l&&!I)&&s.push(e),l=!1,I=!1;return}!B(e,A)||(o+=1,(!r||H(e,r))&&(C<t?(s.push(e),C+=1,Q=e,l=!0):(g=!0,I=!0)))}),Q)?{items:s,nextCursor:g?b(Q):null,matchingCount:o,totalCount:i}:{items:[],nextCursor:null,matchingCount:o,totalCount:i}}async entries(A){let e=await (0,u.getPrismaClient)(),t=[...new Set(A)].slice(0,1e3);return(await e.telemetryEntry.findMany({where:{id:{in:t}}})).map(m)}async entry(A,e){let t=N(e),r=(await this.entries([A]))[0]??null;if(!r)return null;if("SEPARATOR"===r.entryType||!h(t).includes(r.entryType))throw Error(`Telemetry entry ${A} does not belong to ${t}`);return r}async latestSeparator(){let A=await (0,u.getPrismaClient)(),e=await A.telemetryEntry.findFirst({where:{entryType:"SEPARATOR"},orderBy:[{clientTime:"desc"},{receivedAt:"desc"},{id:"desc"}]});return e?m(e):null}async separators(A){let e=Math.min(500,Math.max(1,A.first??100)),t=R(A.after),r=[{entryType:"SEPARATOR"}];A.kind?.trim()&&r.push({separatorKind:A.kind.trim()}),A.name?.trim()&&r.push({separatorName:{contains:A.name.trim()}}),A.buildId?.trim()&&r.push({buildId:A.buildId.trim()}),t&&r.push(T(t));let n=await (0,u.getPrismaClient)(),i=await n.telemetryEntry.findMany({where:{AND:r},orderBy:[{clientTime:"desc"},{receivedAt:"desc"},{id:"desc"}],take:e+1}),a=i.length>e,s=i.slice(0,e).map(m);return{items:s,nextCursor:a&&s.length?b(s.at(-1)):null}}async timelineSinceLatestSeparator(A){let e,t,r=N(A.view);D(A);let n=Math.min(500,Math.max(1,A.first??200)),i=R(A.after),a=await this.latestSeparator(),s=a?{clientTime:a.clientTime,receivedAt:a.receivedAt,id:a.id}:null,o=L(A),g=s?{AND:[O(r),(e=new Date(s.clientTime),{OR:[{clientTime:{gt:e}},{clientTime:e,receivedAt:{gt:t=new Date(s.receivedAt)}},{clientTime:e,receivedAt:t,id:{gt:s.id}}]})]}:O(r);if(!o){let A=await (0,u.getPrismaClient)(),e=await A.telemetryEntry.count({where:g}),t=[],r=!1,s=null;return await this.scan(i?{AND:[g,T(i)]}:g,A=>{if(t.length<n){t.push(A),s=A;return}return r=!0,!1},Math.min(1e3,n+1)),{separator:a,items:t,nextCursor:r&&s?b(s):null,matchingCount:e,totalCount:e}}let C=[],Q=0,l=0,I=!1,d=null;return await this.scan(g,e=>{l+=1,!B(e,A)||(Q+=1,(!i||H(e,i))&&(C.length<n?(C.push(e),d=e):I=!0))}),{separator:a,items:C,nextCursor:I&&d?b(d):null,matchingCount:Q,totalCount:l}}async facets(A){let e=N(A),t="CONSOLE"===e?["level","category","deviceIp","buildId","sessionId"]:"ANALYTICS"===e?["eventKind","eventName","screenName","deviceIp","buildId","sessionId"]:["source","level","eventKind","deviceIp","buildId","sessionId"],r=Object.fromEntries(t.map(A=>[A,new Set]));return await this.scan(O(e),A=>{let n=a(A);for(let A of t){let e=n[A];null!=e&&""!==String(e)&&r[A].add(String(e))}"UNIFIED"===e&&r.source.add(A.entryType)}),Object.fromEntries(Object.entries(r).map(([A,e])=>[A,[...e].sort((A,e)=>A.localeCompare(e))]))}async fields(A){let e=N(A),t=new Set;return await this.scan(O(e),A=>{for(let e of Object.keys(a(A)))t.add(e)}),[...t].sort((A,e)=>A.localeCompare(e))}async addSeparator(A){let e=A?.trim()||null;if(e&&e.length>100)throw Error("Separator name must not exceed 100 characters");let t=await (0,u.getPrismaClient)(),r=await t.telemetryEntry.create({data:{id:(0,w.randomUUID)(),entryType:"SEPARATOR",clientTime:new Date,receivedAt:new Date,separatorKind:"MANUAL",separatorName:e}});return this.publish([r.id],"SEPARATOR_ADDED"),m(r)}async addBuildSeparator(A){let e=await (0,u.getPrismaClient)(),t=await e.telemetryEntry.upsert({where:{separatorKind_buildId:{separatorKind:"BUILD",buildId:A.buildId}},create:{id:(0,w.randomUUID)(),entryType:"SEPARATOR",clientTime:A.clientTime??new Date,receivedAt:new Date,separatorKind:"BUILD",separatorName:A.name.slice(0,100),buildId:A.buildId},update:{}});return this.publish([t.id],"BUILD_SEPARATOR_ADDED"),m(t)}async highlight(A,e){if(null!==e&&!I.includes(e))throw Error("Unknown telemetry highlight color");let t=await (0,u.getPrismaClient)();if("SEPARATOR"===(await t.telemetryEntry.findUniqueOrThrow({where:{id:A}})).entryType)throw Error("Separators cannot be highlighted");let r=await t.telemetryEntry.update({where:{id:A},data:{highlightColor:e}});return this.publish([A],"HIGHLIGHT_CHANGED"),m(r)}selectionRanges(A){return(Array.isArray(A.ranges)?A.ranges.slice(0,500):[]).map(A=>{if(!A||"object"!=typeof A)throw Error("Invalid telemetry selection range");let e=A.startTime?Date.parse(A.startTime):null,t=A.endTime?Date.parse(A.endTime):null;if(null!==e&&!Number.isFinite(e)||null!==t&&!Number.isFinite(t)||null!==e&&null!==t&&e>=t)throw Error("Invalid telemetry selection range");return{start:e,end:t,includeSeparators:!0===A.includeSeparators}})}async selectionIds(A){let e=new Set((Array.isArray(A.ids)?A.ids:[]).filter(A=>"string"==typeof A).slice(0,1e5)),t=new Set((Array.isArray(A.excludedIds)?A.excludedIds:[]).filter(A=>"string"==typeof A).slice(0,1e5));if(!A.query){for(let A of t)e.delete(A);return[...e]}if("object"!=typeof A.query||Array.isArray(A.query))throw Error("Invalid telemetry selection query");N(A.query.view),D(A.query);let r=this.selectionRanges(A);return await this.scan(A.includeSeparators||r.some(A=>A.includeSeparators)?{entryType:{in:[...h(A.query.view),"SEPARATOR"]}}:O(A.query.view),n=>{let i=Date.parse(n.clientTime),a=r.filter(A=>(null===A.start||i>=A.start)&&(null===A.end||i<A.end));if((!(r.length>0)||0!==a.length)&&!t.has(n.id)){if("SEPARATOR"===n.entryType){(A.includeSeparators||a.some(A=>A.includeSeparators))&&e.add(n.id);return}B(n,A.query)&&e.add(n.id)}}),[...e]}async clearSelected(A){let e=await this.selectionIds(A);if(!e.length)return 0;let t=await (0,u.getPrismaClient)(),r=0;for(let A=0;A<e.length;A+=500)r+=(await t.telemetryEntry.deleteMany({where:{id:{in:e.slice(A,A+500)}}})).count;return this.publish([],"CLEARED"),r}async clearAll(A,e=!1){let t=N(A),r=await (0,u.getPrismaClient)(),n=await r.telemetryEntry.deleteMany({where:e?{entryType:{in:[...h(t),"SEPARATOR"]}}:O(t)});return this.publish([],e?"CLEARED_WITH_SEPARATORS":"CLEARED"),n.count}async clearBeforeLatestSeparator(A,e=!1){let t=N(A),r=await this.latestSeparator();if(!r)return 0;let n=await (0,u.getPrismaClient)(),i=await n.telemetryEntry.deleteMany({where:{AND:[e?{entryType:{in:[...h(t),"SEPARATOR"]}}:O(t),T({clientTime:r.clientTime,receivedAt:r.receivedAt,id:r.id})]}});return this.publish([],"CLEARED_BEFORE_SEPARATOR"),i.count}async clearScoped(A){let e=N(A.view);if("ALL"===A.scope)return this.clearAll(e,!!A.includeSeparators);if("BEFORE_LATEST_SEPARATOR"===A.scope)return this.clearBeforeLatestSeparator(e,!!A.includeSeparators);if("MATCHING"===A.scope){if(!A.query)throw Error("A matching query is required");return this.clearSelected({query:{...A.query,view:e}})}let t=[...new Set(A.ids??[])].slice(0,1e3);if(!t.length)throw Error("At least one telemetry entry ID is required");let r=await (0,u.getPrismaClient)(),n=await r.telemetryEntry.findMany({where:{id:{in:t},entryType:{in:[...h(e),"SEPARATOR"]}},select:{id:!0}});if(!n.length)return 0;let i=await r.telemetryEntry.deleteMany({where:{id:{in:n.map(({id:A})=>A)}}});return this.publish([],"CLEARED"),i.count}async viewSettings(A){let e=N(A),t=await (0,u.getPrismaClient)(),r=await t.telemetryViewSettings.upsert({where:{view:e},create:{id:e,view:e,columnsJson:JSON.stringify(l[e])},update:{}});return{view:e,columns:v(r.columnsJson,e),timeFormat:"24"===r.timeFormat?"24":"12",activeColumnPresetId:r.activeColumnPresetId,activeSavedFilterId:r.activeSavedFilterId}}async saveViewSettings(A){let e=N(A.view);if(A.timeFormat&&!["12","24"].includes(A.timeFormat))throw Error("Unknown time format");let t=await this.viewSettings(e),r=await (0,u.getPrismaClient)();return await r.telemetryViewSettings.upsert({where:{view:e},create:{id:e,view:e,columnsJson:J(A.columns??t.columns),timeFormat:A.timeFormat??t.timeFormat,activeColumnPresetId:A.activeColumnPresetId??null,activeSavedFilterId:A.activeSavedFilterId??null},update:{columnsJson:A.columns?J(A.columns):void 0,timeFormat:A.timeFormat??void 0,activeColumnPresetId:void 0===A.activeColumnPresetId?void 0:A.activeColumnPresetId,activeSavedFilterId:void 0===A.activeSavedFilterId?void 0:A.activeSavedFilterId}}),this.viewSettings(e)}async columnPresets(A){let e=N(A),t=await (0,u.getPrismaClient)();return(await t.telemetryColumnPreset.findMany({where:{view:e},orderBy:[{isDefault:"desc"},{name:"asc"}]})).map(A=>({id:A.id,view:e,name:A.name,columns:v(A.columnsJson,e),isDefault:A.isDefault,createdAt:A.createdAt.toISOString(),updatedAt:A.updatedAt.toISOString()}))}async saveColumnPreset(A){let e=N(A.view),{name:t,normalizedName:r}=S(A.name),n=await (0,u.getPrismaClient)(),i=A.id??(0,w.randomUUID)();return await n.$transaction(async n=>{A.isDefault&&await n.telemetryColumnPreset.updateMany({where:{view:e},data:{isDefault:!1}}),await n.telemetryColumnPreset.upsert({where:{id:i},create:{id:i,view:e,name:t,normalizedName:r,columnsJson:J(A.columns),isDefault:!0===A.isDefault},update:{name:t,normalizedName:r,columnsJson:J(A.columns),isDefault:A.isDefault??void 0}})}),(await this.columnPresets(e)).find(A=>A.id===i)}async deleteColumnPreset(A){let e=await (0,u.getPrismaClient)();return await e.telemetryViewSettings.updateMany({where:{activeColumnPresetId:A},data:{activeColumnPresetId:null}}),(await e.telemetryColumnPreset.deleteMany({where:{id:A}})).count>0}async savedFilters(A){let e=N(A),t=await (0,u.getPrismaClient)();return(await t.telemetrySavedFilter.findMany({where:{view:e},orderBy:{name:"asc"}})).map(A=>({id:A.id,view:e,name:A.name,definition:JSON.parse(A.definitionJson),createdAt:A.createdAt.toISOString(),updatedAt:A.updatedAt.toISOString()}))}async saveFilter(A){let e=N(A.view);D({view:e,advancedFilter:A.definition});let{name:t,normalizedName:n}=S(A.name),i=await (0,u.getPrismaClient)(),a=A.id??(0,w.randomUUID)();return await i.telemetrySavedFilter.upsert({where:{id:a},create:{id:a,view:e,name:t,normalizedName:n,definitionJson:r(A.definition)},update:{name:t,normalizedName:n,definitionJson:r(A.definition)}}),(await this.savedFilters(e)).find(A=>A.id===a)}async deleteFilter(A){let e=await (0,u.getPrismaClient)();return await e.telemetryViewSettings.updateMany({where:{activeSavedFilterId:A},data:{activeSavedFilterId:null}}),(await e.telemetrySavedFilter.deleteMany({where:{id:A}})).count>0}async exportEntries(A){D(A.query);let e=A.selection??(A.ids?.length?{ids:A.ids}:null);if(e){let A=new Set(await this.selectionIds(e)),t=[],r=[...A];for(let A=0;A<r.length;A+=500)await this.scan({id:{in:r.slice(A,A+500)}},A=>{t.push(A)});return t.sort((A,e)=>{let t=e.clientTime.localeCompare(A.clientTime);return t||e.receivedAt.localeCompare(A.receivedAt)||e.id.localeCompare(A.id)}),t}let t=[],r=!1,n=L(A.query);return await this.scan({entryType:{in:[...h(A.query.view),"SEPARATOR"]}},e=>{"SEPARATOR"===e.entryType?((!n||r)&&t.push(e),r=!1):B(e,A.query)&&(t.push(e),r=!0)}),t}}],220629);let x={type:"object",additionalProperties:{description:"Any JSON value; objects may be nested to a maximum depth of 10."},maxProperties:500},V={type:"string",minLength:1,maxLength:256},P={type:"string",format:"date-time",description:"ISO-8601 timestamp including Z or an explicit UTC offset."},Y={id:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},entryType:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},receivedAt:{type:"string",format:"date-time",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},deviceIp:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},highlightColor:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},separatorKind:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},separatorName:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."}},_={type:"object",required:["collected","items"],properties:{collected:{type:"boolean"},items:{type:"array",items:{type:"object",required:["id","receivedAt","deviceIp"],properties:{id:{type:"string",format:"uuid"},receivedAt:{type:"string",format:"date-time"},deviceIp:{type:"string"}}}}}};function K(A,e,t){return{post:{tags:["Telemetry"],summary:t,description:"Unauthenticated ingestion. Accepts one record or an atomic `{ items: [...] }` batch of at most 500 records. The request body is capped at 2 MiB.",requestBody:{required:!0,content:{"application/json":{schema:{oneOf:[A,{type:"object",additionalProperties:!1,required:["items"],properties:{items:{type:"array",minItems:1,maxItems:500,items:A}}}]},examples:{single:{value:e},batch:{value:{items:[e]}}}}}},responses:{201:{description:"Records collected",content:{"application/json":{schema:_}}},202:{description:"Payload valid but collection is disabled",content:{"application/json":{schema:_}}},400:{$ref:"#/components/responses/TelemetryBadRequest"},413:{$ref:"#/components/responses/TelemetryPayloadTooLarge"},415:{$ref:"#/components/responses/TelemetryUnsupportedMediaType"},500:{$ref:"#/components/responses/InternalError"}}}}}let q={tags:[{name:"Telemetry"}],paths:{"/api/telemetry/console-logs":K({$ref:"#/components/schemas/ConsoleLogInput"},{message:"Checkout completed",time:"2026-07-20T18:30:00.000Z",level:"info",category:"checkout",buildId:"build-123",sessionId:"session-456",attributes:{durationMs:412,cache:{hit:!0}}},"Collect console logs"),"/api/telemetry/analytics-events":K({$ref:"#/components/schemas/AnalyticsEventInput"},{eventName:"checkout_completed",kind:"product",screenName:"Checkout",time:"2026-07-20T18:30:00.000Z",defaultParameters:{appVersion:"1.0"},additionalParameters:{cartItems:3},buildId:"build-123",sessionId:"session-456"},"Collect analytics events")},components:{schemas:{ConsoleLogInput:{type:"object",additionalProperties:!1,required:["message","time","level","category","buildId","sessionId","attributes"],properties:{...Y,message:{type:"string",minLength:1,maxLength:65536},time:P,level:V,category:V,buildId:V,sessionId:V,attributes:x}},AnalyticsEventInput:{type:"object",additionalProperties:!1,required:["eventName","kind","screenName","time","defaultParameters","additionalParameters","buildId","sessionId"],properties:{...Y,eventName:V,kind:V,screenName:V,time:P,defaultParameters:x,additionalParameters:x,buildId:V,sessionId:V}}},responses:{TelemetryBadRequest:{description:"Malformed or invalid telemetry payload"},TelemetryPayloadTooLarge:{description:"Request exceeds the 2 MiB limit"},TelemetryUnsupportedMediaType:{description:"Content-Type is not application/json"}}}};A.s(["telemetryOpenApiDocument",0,q],689245);var Z=A.i(750227),W=A.i(477685);let z="TelemetryUnicode",j="TelemetryEmoji",$=(0,Z.join)(process.cwd(),"node_modules","@fontpkg","unifont","unifont-15.0.01.ttf"),X=(0,Z.join)(process.cwd(),"node_modules","@expo-google-fonts","noto-emoji","400Regular","NotoEmoji_400Regular.ttf"),AA=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Ae=/\p{Extended_Pictographic}|\p{Regional_Indicator}|\u20e3|\ufe0f/u;function At(A,e){let t=Ae.test(e);return A.font(t?j:z),{emoji:t,value:e,width:A.widthOfString(e)}}function Ar(A){A.font(z);let e=A.currentLineHeight(!0);return A.font(j),Math.max(e,A.currentLineHeight(!0))}function An(A,e,t,r=1/0){let n=Math.max(1,t),i=[{glyphs:[],width:0}],a=!1;for(let{segment:t}of AA.segment(e)){if(/^[\r\n]+$/.test(t)){if(i.length>=r){a=!0;break}i.push({glyphs:[],width:0});continue}let e=At(A,t),s=i.at(-1);if(s.glyphs.length&&s.width+e.width>n){if(i.length>=r){a=!0;break}s={glyphs:[],width:0},i.push(s)}s.glyphs.push(e),s.width+=e.width}if(a){let e=i.at(-1),t=At(A,"…");for(;e.glyphs.length&&e.width+t.width>n;)e.width-=e.glyphs.pop().width;e.glyphs.push(t),e.width+=t.width}return i}function Ai(A,e,t,r,n){let i=Math.max(1,n.width??A.page.width-t-A.page.margins.right),a=Ar(A);An(A,e,i,!1===n.lineBreak?1:n.height?Math.max(1,Math.floor(n.height/a)):1/0).forEach((e,s)=>{let o="center"===n.align?t+(i-e.width)/2:"right"===n.align?t+i-e.width:t,g=[];for(let A of e.glyphs){let e=g.at(-1);e?.emoji===A.emoji?(e.value+=A.value,e.width+=A.width):g.push({...A})}for(let e of g)A.font(e.emoji?j:z).text(e.value,o,r+s*a,{lineBreak:!1}),o+=e.width})}let Aa={time:"Time",receivedAt:"Received",source:"Source",level:"Level",category:"Category",message:"Message",eventKind:"Kind",levelKind:"Level / Kind",eventName:"Name",screenName:"Screen Name",parameters:"Parameters",detail:"Detail",deviceIp:"Device IP",buildId:"Build ID",sessionId:"Session ID"},As={CONTAINS:"contains",DOES_NOT_CONTAIN:"does not contain",IS:"is",IS_NOT:"is not",MATCHES_GLOB:"matches glob",MATCHES_REGEX:"matches regex",NO_REGEX_MATCH:"does not match regex",IS_EMPTY:"is empty",IS_NOT_EMPTY:"is not empty"};function Ao(A){return null==A?"":"string"==typeof A?A:"number"==typeof A||"boolean"==typeof A?String(A):JSON.stringify(A)}function Ag(A){return Object.entries(a(A)).filter(([A])=>A.startsWith("defaultParameters.")||A.startsWith("defaultParameters[")||A.startsWith("additionalParameters.")||A.startsWith("additionalParameters[")).map(([A,e])=>`${A}: ${Ao(e)}`).join(" • ")}function AC(A,e,t){return new Intl.DateTimeFormat(e.locale||"en",{...t?{dateStyle:"medium"}:{},timeStyle:"medium",hour12:"24"!==e.timeFormat,...e.timeZone?{timeZone:e.timeZone}:{}}).format(new Date(A))}function AQ(A,e,t){return"time"===e?AC(A.clientTime,t,!0):"receivedAt"===e?AC(A.receivedAt,t,!0):"source"===e?"CONSOLE"===A.entryType?"Console":"Analytics":"levelKind"===e?A.level??A.eventKind??"":"parameters"===e?Ag(A):"detail"===e?"CONSOLE"===A.entryType?A.message??"":`${A.eventName??""}${A.screenName?` (${A.screenName})`:""}${Ag(A)?` - ${Ag(A)}`:""}`:Ao(a(A)[e])}function Al(A){let e=[...new Set(A.fields.map(A=>A.trim()).filter(Boolean))];return e.length?e.slice(0,30):l[A.view]}function AI(A){return Aa[A]?Aa[A]:A.replace(/^attributes[.[]/,"").replace(/^defaultParameters[.[]/,"Default: ").replace(/^additionalParameters[.[]/,"Additional: ").replace(/]$/g,"")}function Ad(A){return"message"===A||"detail"===A?2.8:"parameters"===A?2.4:"time"===A||"receivedAt"===A?1.35:"sessionId"===A?1.2:"buildId"===A||"screenName"===A?.95:"category"===A||"eventName"===A?.9:"level"===A||"eventKind"===A||"levelKind"===A||"source"===A?.65:A.startsWith("attributes.")||A.startsWith("attributes[")||"deviceIp"===A?.8:1}function AE(A){return String(A??"").replace(/\s+/g," ").trim().slice(0,200)}function Ac(A){let e=/^[=+\-@]/.test(A)?`'${A}`:A;return`"${e.replaceAll('"','""')}"`}function Ah(A){return A.replaceAll("|","\\|").replace(/[\r\n]+/g," ")}function AB(A,e){return new Intl.DateTimeFormat(e.locale||"en",{dateStyle:"full",...e.timeZone?{timeZone:e.timeZone}:{}}).format(new Date(A.clientTime))}async function AD(A,e){let t=Al(e),r=new W.default({size:"LETTER",layout:"landscape",margin:32,bufferPages:!0});r.registerFont(z,$),r.registerFont(j,X);let n=[];r.on("data",A=>n.push(A));let i=new Promise((A,e)=>{r.on("end",()=>{let e=new Uint8Array(n.reduce((A,e)=>A+e.byteLength,0)),t=0;for(let A of n)e.set(A,t),t+=A.byteLength;A(e)}),r.on("error",e)}),a=r.page.width-r.page.margins.left-r.page.margins.right,s=t.map(Ad),o=s.reduce((A,e)=>A+e,0),g=s.map(A=>a*A/o),C=r.page.margins.left,Q=g.map(A=>{let e=C;return C+=A,e}),l=()=>{r.font(z).fontSize(8).fillColor("#111111");let A=r.y;t.forEach((e,t)=>{Ai(r,AI(e),Q[t],A,{width:g[t]-6,lineBreak:!1,ellipsis:!0})}),r.x=r.page.margins.left,r.y=A+12,r.moveTo(r.page.margins.left,r.y).lineTo(r.page.width-r.page.margins.right,r.y).strokeColor("#aaaaaa").stroke(),r.y+=5},I=A=>{let e=r.y+5;r.fontSize(8).fillColor("#3f3f46"),Ai(r,A,r.page.margins.left,e,{width:a,align:"center",lineBreak:!1,ellipsis:!0});let t=e+14;r.save().strokeColor("#dddddd").moveTo(r.page.margins.left,t).lineTo(r.page.width-r.page.margins.right,t).stroke().restore(),r.x=r.page.margins.left,r.y=t+7};r.font(z).fontSize(16).text("Observability export"),r.font(z).fontSize(8).fillColor("#555555").text(`Generated ${AC(new Date().toISOString(),e,!0)} - ${A.filter(A=>"SEPARATOR"!==A.entryType).length} records`);let d=function(A){let e;if(!A)return["None"];try{e=JSON.parse(A)}catch{return["Custom filter applied"]}if(!e||"object"!=typeof e||Array.isArray(e))return["None"];let t=e,r=[];if("string"==typeof t.search&&t.search.trim()){let A="GLOB"===t.searchMode?"Glob":"REGEX"===t.searchMode?"Regex":"Text";r.push(`Search - ${A}, ${!0===t.caseSensitive?"case-sensitive":"case-insensitive"}: ${AE(t.search)}`)}if(t.quickFilters&&"object"==typeof t.quickFilters&&!Array.isArray(t.quickFilters))for(let[A,e]of Object.entries(t.quickFilters)){if(!Array.isArray(e))continue;let t=e.map(AE).filter(Boolean).slice(0,20);t.length&&r.push(`Quick filter - ${AI(A)}: ${t.join(", ")}`)}if(t.advancedFilter&&"object"==typeof t.advancedFilter&&!Array.isArray(t.advancedFilter)){let A=t.advancedFilter;if(Array.isArray(A.conditions)&&A.conditions.length)for(let e of(r.push(`Advanced filters - match ${"ANY"===A.mode?"any":"all"}:`),A.conditions)){if(!e||"object"!=typeof e||Array.isArray(e)||"string"!=typeof e.field)continue;let A="string"==typeof e.operator?As[e.operator]??e.operator.toLocaleLowerCase().replaceAll("_"," "):"matches",t=AE(e.value),n=Array.isArray(e.sources)?e.sources.filter(A=>"CONSOLE"===A||"ANALYTICS"===A):[],i=1===n.length?` [${"CONSOLE"===n[0]?"Console":"Analytics"} only]`:"",a=!0===e.caseSensitive?" (case-sensitive)":"";r.push(`${AI(e.field)} ${A}${t?` "${t}"`:""}${a}${i}`)}}return r.length?r:["None"]}(e.filterSummary),E=d.slice(0,6);d.length>E.length&&(E[E.length-1]=`${d.length-E.length+1} more filter conditions`);let c=r.y+5,h=20+10*E.length;r.save().lineWidth(.5).roundedRect(r.page.margins.left,c,a,h,4).fillAndStroke("#f7f7f8","#dddddd").restore(),r.font(z).fontSize(8).fillColor("#333333").text("Filters",r.page.margins.left+8,c+6,{width:a-16,lineBreak:!1}),r.font(z).fontSize(7).fillColor("#555555"),E.forEach((A,e)=>{Ai(r,`- ${A}`,r.page.margins.left+8,c+18+10*e,{width:a-16,lineBreak:!1,ellipsis:!0})}),r.x=r.page.margins.left,r.y=c+h+10,l();let B="";for(let n of A){let A=AB(n,e),i=A!==B,a="SEPARATOR"===n.entryType?(n.separatorName||"Separator").replace(/[·—–‑]/g,"-"):null;r.font(z).fontSize(7);let s=a?[]:t.map(A=>(function(A){let e="",t=0;for(let{segment:r}of AA.segment(A)){if(4e3===t)return`${e}…`;e+=r,t+=1}return e})(AQ(n,A,e))),o=a?0:Math.max(14,...s.map((A,e)=>(function(A,e,t){let r=Ar(A);return An(A,e,t).length*r})(r,A||" ",g[e]-6)))+4,C=Math.min(o,Math.max(14,r.page.height-60-r.page.margins.top-22-26*!!i)),d=26*!!i+(a?26:C+3);if(r.y+d>r.page.height-60&&(r.addPage(),l()),i&&I(B=A),a){I(a);continue}let E=r.y,c=Math.min(o,Math.max(14,r.page.height-60-E));r.font(z).fontSize(7).fillColor("#111111"),s.forEach((A,e)=>{let t=Math.max(1,c-4);Ai(r,A,Q[e],E,{width:g[e]-6,height:t})}),r.x=r.page.margins.left,r.y=E+c,r.moveTo(r.page.margins.left,r.y).lineTo(r.page.width-r.page.margins.right,r.y).strokeColor("#dddddd").stroke(),r.y+=3}let D=r.bufferedPageRange();for(let A=D.start;A<D.start+D.count;A+=1)r.switchToPage(A),r.font(z).fontSize(7).fillColor("#666666").text(`Page ${A+1} of ${D.count}`,r.page.margins.left,r.page.height-r.page.margins.bottom-10,{align:"right",width:a,lineBreak:!1});return r.end(),i}A.s(["telemetryCsv",0,function(A,e){let t=Al(e),r=[t.map(A=>Ac(AI(A))).join(",")],n="";for(let i of A){let A=AB(i,e);if(A!==n&&(n=A,r.push(t.map((A,e)=>Ac(0===e?`[Day] ${n}`:"")).join(","))),"SEPARATOR"===i.entryType){r.push(t.map((A,e)=>Ac(0===e?`[Separator] ${i.separatorName??""}`.trim():"")).join(","));continue}r.push(t.map(A=>Ac(AQ(i,A,e))).join(","))}return`${r.join("\r\n")}\r
183
- `},"telemetryMarkdown",0,function(A,e){let t=Al(e),r=["# Observability export",""];e.filterSummary&&r.push(`_Filters: ${e.filterSummary}_`,"");let n="",i=`| ${t.map(A=>Ah(AI(A))).join(" | ")} |`,a=`| ${t.map(()=>"---").join(" | ")} |`;for(let s of A){let A=AB(s,e);A!==n&&(n=A,r.push(`## ${n}`,"",i,a)),"SEPARATOR"===s.entryType?r.push(`| ${[`**${Ah(s.separatorName||"Separator")}**`,...t.slice(1).map(()=>"")].join(" | ")} |`):r.push(`| ${t.map(A=>Ah(AQ(s,A,e))).join(" | ")} |`)}return`${r.join("\n")}
184
- `},"telemetryPdf",0,AD],906148),A.s([],464841)}];
182
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let t of A.seen.entries()){let r=t[1];if(e===t[0]){n(t);continue}if(A.external){let r=A.external.registry.get(t[0])?.id;if(e!==t[0]&&r){n(t);continue}}if(A.metadataRegistry.get(t[0])?.id||r.cycle||r.count>1&&"ref"===A.reused){n(t);continue}}}function i(A,e){let t=A.seen.get(e);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");let r=e=>{let t=A.seen.get(e);if(null===t.ref)return;let n=t.def??t.schema,i={...n},a=t.ref;if(t.ref=null,a){r(a);let t=A.seen.get(a),s=t.schema;if(s.$ref&&("draft-07"===A.target||"draft-04"===A.target||"openapi-3.0"===A.target)?(n.allOf=n.allOf??[],n.allOf.push(s)):Object.assign(n,s),Object.assign(n,i),e._zod.parent===a)for(let A in n)"$ref"!==A&&"allOf"!==A&&(A in i||delete n[A]);if(s.$ref&&t.def)for(let A in n)"$ref"!==A&&"allOf"!==A&&A in t.def&&JSON.stringify(n[A])===JSON.stringify(t.def[A])&&delete n[A]}let s=e._zod.parent;if(s&&s!==a){r(s);let e=A.seen.get(s);if(e?.schema.$ref&&(n.$ref=e.schema.$ref,e.def))for(let A in n)"$ref"!==A&&"allOf"!==A&&A in e.def&&JSON.stringify(n[A])===JSON.stringify(e.def[A])&&delete n[A]}A.override({zodSchema:e,jsonSchema:n,path:t.path??[]})};for(let e of[...A.seen.entries()].reverse())r(e[0]);let n={};if("draft-2020-12"===A.target?n.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===A.target?n.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===A.target?n.$schema="http://json-schema.org/draft-04/schema#":A.target,A.external?.uri){let t=A.external.registry.get(e)?.id;if(!t)throw Error("Schema is missing an `id` property");n.$id=A.external.uri(t)}Object.assign(n,t.def??t.schema);let i=A.metadataRegistry.get(e)?.id;void 0!==i&&n.id===i&&delete n.id;let s=A.external?.defs??{};for(let e of A.seen.entries()){let A=e[1];A.def&&A.defId&&(A.def.id===A.defId&&delete A.def.id,s[A.defId]=A.def)}A.external||Object.keys(s).length>0&&("draft-2020-12"===A.target?n.$defs=s:n.definitions=s);try{let t=JSON.parse(JSON.stringify(n));return Object.defineProperty(t,"~standard",{value:{...e["~standard"],jsonSchema:{input:a(e,"input",A.processors),output:a(e,"output",A.processors)}},enumerable:!1,writable:!1}),t}catch(A){throw Error("Error converting schema to JSON.")}}let a=(A,e,a={})=>s=>{let{libraryOptions:o,target:g}=s??{},C=t({...o??{},target:g,io:e,processors:a});return r(A,C),n(C,A),i(C,A)};A.s(["createStandardJSONSchemaMethod",0,a,"createToJSONSchemaMethod",0,(A,e={})=>a=>{let s=t({...a,processors:e});return r(A,s),n(s,A),i(s,A)},"extractDefs",0,n,"finalize",0,i,"initializeContext",0,t,"process",0,r],207159);var s=A.i(486618);let o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},g=(A,e,t,r)=>{t.type="string";let{minimum:n,maximum:i,format:a,patterns:s,contentEncoding:g}=A._zod.bag;if("number"==typeof n&&(t.minLength=n),"number"==typeof i&&(t.maxLength=i),a&&(t.format=o[a]??a,""===t.format&&delete t.format,"time"===a&&delete t.format),g&&(t.contentEncoding=g),s&&s.size>0){let A=[...s];1===A.length?t.pattern=A[0].source:A.length>1&&(t.allOf=[...A.map(A=>({..."draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target?{type:"string"}:{},pattern:A.source}))])}},C=(A,e,t,r)=>{let{minimum:n,maximum:i,format:a,multipleOf:s,exclusiveMaximum:o,exclusiveMinimum:g}=A._zod.bag;"string"==typeof a&&a.includes("int")?t.type="integer":t.type="number";let C="number"==typeof g&&g>=(n??-1/0),Q="number"==typeof o&&o<=(i??1/0),l="draft-04"===e.target||"openapi-3.0"===e.target;C?l?(t.minimum=g,t.exclusiveMinimum=!0):t.exclusiveMinimum=g:"number"==typeof n&&(t.minimum=n),Q?l?(t.maximum=o,t.exclusiveMaximum=!0):t.exclusiveMaximum=o:"number"==typeof i&&(t.maximum=i),"number"==typeof s&&(t.multipleOf=s)},Q=(A,e,t,r)=>{t.type="boolean"},l=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},I=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},d=(A,e,t,r)=>{"openapi-3.0"===e.target?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"},E=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},c=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},h=(A,e,t,r)=>{t.not={}},B=(A,e,t,r)=>{},D=(A,e,t,r)=>{},w=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},u=(A,e,t,r)=>{let n=A._zod.def,i=(0,s.getEnumValues)(n.entries);i.every(A=>"number"==typeof A)&&(t.type="number"),i.every(A=>"string"==typeof A)&&(t.type="string"),t.enum=i},p=(A,e,t,r)=>{let n=A._zod.def,i=[];for(let A of n.values)if(void 0===A){if("throw"===e.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof A)if("throw"===e.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(A));else i.push(A);if(0===i.length);else if(1===i.length){let A=i[0];t.type=null===A?"null":typeof A,"draft-04"===e.target||"openapi-3.0"===e.target?t.enum=[A]:t.const=A}else i.every(A=>"number"==typeof A)&&(t.type="number"),i.every(A=>"string"==typeof A)&&(t.type="string"),i.every(A=>"boolean"==typeof A)&&(t.type="boolean"),i.every(A=>null===A)&&(t.type="null"),t.enum=i},f=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},y=(A,e,t,r)=>{let n=A._zod.pattern;if(!n)throw Error("Pattern not found in template literal");t.type="string",t.pattern=n.source},M=(A,e,t,r)=>{let n={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:s}=A._zod.bag;void 0!==i&&(n.minLength=i),void 0!==a&&(n.maxLength=a),s?1===s.length?(n.contentMediaType=s[0],Object.assign(t,n)):(Object.assign(t,n),t.anyOf=s.map(A=>({contentMediaType:A}))):Object.assign(t,n)},m=(A,e,t,r)=>{t.type="boolean"},N=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},S=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},k=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},U=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},F=(A,e,t,r)=>{if("throw"===e.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},R=(A,e,t,n)=>{let i=A._zod.def,{minimum:a,maximum:s}=A._zod.bag;"number"==typeof a&&(t.minItems=a),"number"==typeof s&&(t.maxItems=s),t.type="array",t.items=r(i.element,e,{...n,path:[...n.path,"items"]})},T=(A,e,t,n)=>{let i=A._zod.def;t.type="object",t.properties={};let a=i.shape;for(let A in a)t.properties[A]=r(a[A],e,{...n,path:[...n.path,"properties",A]});let s=new Set([...new Set(Object.keys(a))].filter(A=>{let t=i.shape[A]._zod;return"input"===e.io?void 0===t.optin:void 0===t.optout}));s.size>0&&(t.required=Array.from(s)),i.catchall?._zod.def.type==="never"?t.additionalProperties=!1:i.catchall?i.catchall&&(t.additionalProperties=r(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):"output"===e.io&&(t.additionalProperties=!1)},b=(A,e,t,n)=>{let i=A._zod.def,a=!1===i.inclusive,s=i.options.map((A,t)=>r(A,e,{...n,path:[...n.path,a?"oneOf":"anyOf",t]}));a?t.oneOf=s:t.anyOf=s},H=(A,e,t,n)=>{let i=A._zod.def,a=r(i.left,e,{...n,path:[...n.path,"allOf",0]}),s=r(i.right,e,{...n,path:[...n.path,"allOf",1]}),o=A=>"allOf"in A&&1===Object.keys(A).length;t.allOf=[...o(a)?a.allOf:[a],...o(s)?s.allOf:[s]]},L=(A,e,t,n)=>{let i=A._zod.def;t.type="array";let a="draft-2020-12"===e.target?"prefixItems":"items",s="draft-2020-12"===e.target||"openapi-3.0"===e.target?"items":"additionalItems",o=i.items.map((A,t)=>r(A,e,{...n,path:[...n.path,a,t]})),g=i.rest?r(i.rest,e,{...n,path:[...n.path,s,..."openapi-3.0"===e.target?[i.items.length]:[]]}):null;"draft-2020-12"===e.target?(t.prefixItems=o,g&&(t.items=g)):"openapi-3.0"===e.target?(t.items={anyOf:o},g&&t.items.anyOf.push(g),t.minItems=o.length,g||(t.maxItems=o.length)):(t.items=o,g&&(t.additionalItems=g));let{minimum:C,maximum:Q}=A._zod.bag;"number"==typeof C&&(t.minItems=C),"number"==typeof Q&&(t.maxItems=Q)},O=(A,e,t,n)=>{let i=A._zod.def;t.type="object";let a=i.keyType,s=a._zod.bag,o=s?.patterns;if("loose"===i.mode&&o&&o.size>0){let A=r(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});for(let e of(t.patternProperties={},o))t.patternProperties[e.source]=A}else("draft-07"===e.target||"draft-2020-12"===e.target)&&(t.propertyNames=r(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),t.additionalProperties=r(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let g=a._zod.values;if(g){let A=[...g].filter(A=>"string"==typeof A||"number"==typeof A);A.length>0&&(t.required=A)}},G=(A,e,t,n)=>{let i=A._zod.def,a=r(i.innerType,e,n),s=e.seen.get(A);"openapi-3.0"===e.target?(s.ref=i.innerType,t.nullable=!0):t.anyOf=[a,{type:"null"}]},J=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType},v=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},x=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType,"input"===e.io&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},V=(A,e,t,n)=>{let i,a=A._zod.def;r(a.innerType,e,n),e.seen.get(A).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}t.default=i},P=(A,e,t,n)=>{let i=A._zod.def,a=i.in._zod.traits.has("$ZodTransform"),s="input"===e.io?a?i.out:i.in:i.out;r(s,e,n),e.seen.get(A).ref=s},Y=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType,t.readOnly=!0},_=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType},K=(A,e,t,n)=>{let i=A._zod.def;r(i.innerType,e,n),e.seen.get(A).ref=i.innerType},q=(A,e,t,n)=>{let i=A._zod.innerType;r(i,e,n),e.seen.get(A).ref=i},Z={string:g,number:C,boolean:Q,bigint:l,symbol:I,null:d,undefined:E,void:c,never:h,any:B,unknown:D,date:w,enum:u,literal:p,nan:f,template_literal:y,file:M,success:m,custom:N,function:S,transform:k,map:U,set:F,array:R,object:T,union:b,intersection:H,tuple:L,record:O,nullable:G,nonoptional:J,default:v,prefault:x,catch:V,pipe:P,readonly:Y,promise:_,optional:K,lazy:q};A.s(["allProcessors",0,Z,"anyProcessor",0,B,"arrayProcessor",0,R,"bigintProcessor",0,l,"booleanProcessor",0,Q,"catchProcessor",0,V,"customProcessor",0,N,"dateProcessor",0,w,"defaultProcessor",0,v,"enumProcessor",0,u,"fileProcessor",0,M,"functionProcessor",0,S,"intersectionProcessor",0,H,"lazyProcessor",0,q,"literalProcessor",0,p,"mapProcessor",0,U,"nanProcessor",0,f,"neverProcessor",0,h,"nonoptionalProcessor",0,J,"nullProcessor",0,d,"nullableProcessor",0,G,"numberProcessor",0,C,"objectProcessor",0,T,"optionalProcessor",0,K,"pipeProcessor",0,P,"prefaultProcessor",0,x,"promiseProcessor",0,_,"readonlyProcessor",0,Y,"recordProcessor",0,O,"setProcessor",0,F,"stringProcessor",0,g,"successProcessor",0,m,"symbolProcessor",0,I,"templateLiteralProcessor",0,y,"toJSONSchema",0,function(A,e){if("_idmap"in A){let a=t({...e,processors:Z}),s={};for(let e of A._idmap.entries()){let[A,t]=e;r(t,a)}let o={};for(let t of(a.external={registry:A,uri:e?.uri,defs:s},A._idmap.entries())){let[A,e]=t;n(a,e),o[A]=i(a,e)}return Object.keys(s).length>0&&(o.__shared={["draft-2020-12"===a.target?"$defs":"definitions"]:s}),{schemas:o}}let a=t({...e,processors:Z});return r(A,a),n(a,A),i(a,A)},"transformProcessor",0,k,"tupleProcessor",0,L,"undefinedProcessor",0,E,"unionProcessor",0,b,"unknownProcessor",0,D,"voidProcessor",0,c],865889)},467662,628343,A=>{"use strict";var e=A.i(421131);A.s(["regexes",0,e],467662);var t=A.i(486618);A.s(["util",0,t],628343)},907855,551047,915874,248804,A=>{"use strict";A.s(["ZodAny",()=>A3,"ZodArray",()=>ei,"ZodBase64",()=>AM,"ZodBase64URL",()=>AN,"ZodBigInt",()=>AZ,"ZodBigIntFormat",()=>Az,"ZodBoolean",()=>AK,"ZodCIDRv4",()=>Au,"ZodCIDRv6",()=>Af,"ZodCUID",()=>Ai,"ZodCUID2",()=>As,"ZodCatch",()=>e0,"ZodCodec",()=>e5,"ZodCustom",()=>tC,"ZodCustomStringFormat",()=>AT,"ZodDate",()=>er,"ZodDefault",()=>eK,"ZodDiscriminatedUnion",()=>ec,"ZodE164",()=>Ak,"ZodEmail",()=>P,"ZodEmoji",()=>Ae,"ZodEnum",()=>eU,"ZodExactOptional",()=>ex,"ZodFile",()=>eH,"ZodFunction",()=>to,"ZodGUID",()=>_,"ZodIPv4",()=>AE,"ZodIPv6",()=>AD,"ZodIntersection",()=>eB,"ZodJWT",()=>AF,"ZodKSUID",()=>AI,"ZodLazy",()=>tn,"ZodLiteral",()=>eT,"ZodMAC",()=>Ah,"ZodMap",()=>em,"ZodNaN",()=>e2,"ZodNanoID",()=>Ar,"ZodNever",()=>A7,"ZodNonOptional",()=>ez,"ZodNull",()=>A8,"ZodNullable",()=>eP,"ZodNumber",()=>AG,"ZodNumberFormat",()=>Av,"ZodObject",()=>eo,"ZodOptional",()=>eJ,"ZodPipe",()=>e1,"ZodPrefault",()=>eZ,"ZodPreprocess",()=>e7,"ZodPromise",()=>ta,"ZodReadonly",()=>tA,"ZodRecord",()=>ep,"ZodSet",()=>eS,"ZodString",()=>v,"ZodStringFormat",()=>V,"ZodSuccess",()=>e$,"ZodSymbol",()=>AX,"ZodTemplateLiteral",()=>tt,"ZodTransform",()=>eO,"ZodTuple",()=>ew,"ZodType",()=>G,"ZodULID",()=>Ag,"ZodURL",()=>$,"ZodUUID",()=>q,"ZodUndefined",()=>A4,"ZodUnion",()=>el,"ZodUnknown",()=>A9,"ZodVoid",()=>ee,"ZodXID",()=>AQ,"ZodXor",()=>ed,"_ZodString",()=>J,"_default",()=>eq,"_function",()=>tg,"any",()=>A5,"array",()=>ea,"base64",()=>Am,"base64url",()=>AS,"bigint",()=>AW,"boolean",()=>Aq,"catch",()=>e4,"check",()=>tQ,"cidrv4",()=>Ap,"cidrv6",()=>Ay,"codec",()=>e9,"cuid",()=>Aa,"cuid2",()=>Ao,"custom",()=>tl,"date",()=>en,"describe",()=>tE,"discriminatedUnion",()=>eh,"e164",()=>AU,"email",()=>Y,"emoji",()=>At,"enum",()=>eF,"exactOptional",()=>eV,"file",()=>eL,"float32",()=>AV,"float64",()=>AP,"function",()=>tg,"guid",()=>K,"hash",()=>AO,"hex",()=>AL,"hostname",()=>AH,"httpUrl",()=>AA,"instanceof",()=>th,"int",()=>Ax,"int32",()=>AY,"int64",()=>Aj,"intersection",()=>eD,"invertCodec",()=>e6,"ipv4",()=>Ac,"ipv6",()=>Aw,"json",()=>tD,"jwt",()=>AR,"keyof",()=>es,"ksuid",()=>Ad,"lazy",()=>ti,"literal",()=>eb,"looseObject",()=>eQ,"looseRecord",()=>eM,"mac",()=>AB,"map",()=>eN,"meta",()=>tc,"nan",()=>e8,"nanoid",()=>An,"nativeEnum",()=>eR,"never",()=>eA,"nonoptional",()=>ej,"null",()=>A1,"nullable",()=>eY,"nullish",()=>e_,"number",()=>AJ,"object",()=>eg,"optional",()=>ev,"partialRecord",()=>ey,"pipe",()=>e3,"prefault",()=>eW,"preprocess",()=>tw,"promise",()=>ts,"readonly",()=>te,"record",()=>ef,"refine",()=>tI,"set",()=>ek,"strictObject",()=>eC,"string",()=>x,"stringFormat",()=>Ab,"stringbool",()=>tB,"success",()=>eX,"superRefine",()=>td,"symbol",()=>A0,"templateLiteral",()=>tr,"transform",()=>eG,"tuple",()=>eu,"uint32",()=>A_,"uint64",()=>A$,"ulid",()=>AC,"undefined",()=>A2,"union",()=>eI,"unknown",()=>A6,"url",()=>X,"uuid",()=>Z,"uuidv4",()=>W,"uuidv6",()=>z,"uuidv7",()=>j,"void",()=>et,"xid",()=>Al,"xor",()=>eE],907855);var e=A.i(127438),t=A.i(639510),r=A.i(486618),n=A.i(52637),i=A.i(862061),a=A.i(467662),s=A.i(236608),o=A.i(628343),g=A.i(865889),C=A.i(207159);A.s(["ZodISODate",()=>I,"ZodISODateTime",()=>Q,"ZodISODuration",()=>h,"ZodISOTime",()=>E,"date",()=>d,"datetime",()=>l,"duration",()=>B,"time",()=>c],551047);let Q=e.$constructor("ZodISODateTime",(A,e)=>{t.$ZodISODateTime.init(A,e),V.init(A,e)});function l(A){return i._isoDateTime(Q,A)}let I=e.$constructor("ZodISODate",(A,e)=>{t.$ZodISODate.init(A,e),V.init(A,e)});function d(A){return i._isoDate(I,A)}let E=e.$constructor("ZodISOTime",(A,e)=>{t.$ZodISOTime.init(A,e),V.init(A,e)});function c(A){return i._isoTime(E,A)}let h=e.$constructor("ZodISODuration",(A,e)=>{t.$ZodISODuration.init(A,e),V.init(A,e)});function B(A){return i._isoDuration(h,A)}var D=A.i(715143),w=A.i(67021);let u=(A,e)=>{w.$ZodError.init(A,e),A.name="ZodError",Object.defineProperties(A,{format:{value:e=>w.formatError(A,e)},flatten:{value:e=>w.flattenError(A,e)},addIssue:{value:e=>{A.issues.push(e),A.message=JSON.stringify(A.issues,r.jsonStringifyReplacer,2)}},addIssues:{value:e=>{A.issues.push(...e),A.message=JSON.stringify(A.issues,r.jsonStringifyReplacer,2)}},isEmpty:{get:()=>0===A.issues.length}})},p=e.$constructor("ZodError",u),f=e.$constructor("ZodError",u,{Parent:Error});A.s(["ZodError",0,p,"ZodRealError",0,f],915874);let y=D._parse(f),M=D._parseAsync(f),m=D._safeParse(f),N=D._safeParseAsync(f),S=D._encode(f),k=D._decode(f),U=D._encodeAsync(f),F=D._decodeAsync(f),R=D._safeEncode(f),T=D._safeDecode(f),b=D._safeEncodeAsync(f),H=D._safeDecodeAsync(f);A.s(["decode",0,k,"decodeAsync",0,F,"encode",0,S,"encodeAsync",0,U,"parse",0,y,"parseAsync",0,M,"safeDecode",0,T,"safeDecodeAsync",0,H,"safeEncode",0,R,"safeEncodeAsync",0,b,"safeParse",0,m,"safeParseAsync",0,N],248804);let L=new WeakMap;function O(A,e,t){let r=Object.getPrototypeOf(A),n=L.get(r);if(n||(n=new Set,L.set(r,n)),!n.has(e))for(let A in n.add(e),t){let e=t[A];Object.defineProperty(r,A,{configurable:!0,enumerable:!1,get(){let t=e.bind(this);return Object.defineProperty(this,A,{configurable:!0,writable:!0,enumerable:!0,value:t}),t},set(e){Object.defineProperty(this,A,{configurable:!0,writable:!0,enumerable:!0,value:e})}})}}let G=e.$constructor("ZodType",(A,e)=>(t.$ZodType.init(A,e),Object.assign(A["~standard"],{jsonSchema:{input:(0,C.createStandardJSONSchemaMethod)(A,"input"),output:(0,C.createStandardJSONSchemaMethod)(A,"output")}}),A.toJSONSchema=(0,C.createToJSONSchemaMethod)(A,{}),A.def=e,A.type=e.type,Object.defineProperty(A,"_def",{value:e}),A.parse=(e,t)=>y(A,e,t,{callee:A.parse}),A.safeParse=(e,t)=>m(A,e,t),A.parseAsync=async(e,t)=>M(A,e,t,{callee:A.parseAsync}),A.safeParseAsync=async(e,t)=>N(A,e,t),A.spa=A.safeParseAsync,A.encode=(e,t)=>S(A,e,t),A.decode=(e,t)=>k(A,e,t),A.encodeAsync=async(e,t)=>U(A,e,t),A.decodeAsync=async(e,t)=>F(A,e,t),A.safeEncode=(e,t)=>R(A,e,t),A.safeDecode=(e,t)=>T(A,e,t),A.safeEncodeAsync=async(e,t)=>b(A,e,t),A.safeDecodeAsync=async(e,t)=>H(A,e,t),O(A,"ZodType",{check(...A){let e=this.def;return this.clone(o.util.mergeDefs(e,{checks:[...e.checks??[],...A.map(A=>"function"==typeof A?{_zod:{check:A,def:{check:"custom"},onattach:[]}}:A)]}),{parent:!0})},with(...A){return this.check(...A)},clone(A,e){return r.clone(this,A,e)},brand(){return this},register(A,e){return A.add(this,e),this},refine(A,e){return this.check(tI(A,e))},superRefine(A,e){return this.check(td(A,e))},overwrite(A){return this.check(i._overwrite(A))},optional(){return ev(this)},exactOptional(){return eV(this)},nullable(){return eY(this)},nullish(){return ev(eY(this))},nonoptional(A){return ej(this,A)},array(){return ea(this)},or(A){return eI([this,A])},and(A){return eD(this,A)},transform(A){return e3(this,eG(A))},default(A){return eq(this,A)},prefault(A){return eW(this,A)},catch(A){return e4(this,A)},pipe(A){return e3(this,A)},readonly(){return te(this)},describe(A){let e=this.clone();return n.globalRegistry.add(e,{description:A}),e},meta(...A){if(0===A.length)return n.globalRegistry.get(this);let e=this.clone();return n.globalRegistry.add(e,A[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(A){return A(this)}}),Object.defineProperty(A,"description",{get:()=>n.globalRegistry.get(A)?.description,configurable:!0}),A)),J=e.$constructor("_ZodString",(A,e)=>{t.$ZodString.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.stringProcessor(A,e,t,r);let r=A._zod.bag;A.format=r.format??null,A.minLength=r.minimum??null,A.maxLength=r.maximum??null,O(A,"_ZodString",{regex(...A){return this.check(i._regex(...A))},includes(...A){return this.check(i._includes(...A))},startsWith(...A){return this.check(i._startsWith(...A))},endsWith(...A){return this.check(i._endsWith(...A))},min(...A){return this.check(i._minLength(...A))},max(...A){return this.check(i._maxLength(...A))},length(...A){return this.check(i._length(...A))},nonempty(...A){return this.check(i._minLength(1,...A))},lowercase(A){return this.check(i._lowercase(A))},uppercase(A){return this.check(i._uppercase(A))},trim(){return this.check(i._trim())},normalize(...A){return this.check(i._normalize(...A))},toLowerCase(){return this.check(i._toLowerCase())},toUpperCase(){return this.check(i._toUpperCase())},slugify(){return this.check(i._slugify())}})}),v=e.$constructor("ZodString",(A,e)=>{t.$ZodString.init(A,e),J.init(A,e),A.email=e=>A.check(i._email(P,e)),A.url=e=>A.check(i._url($,e)),A.jwt=e=>A.check(i._jwt(AF,e)),A.emoji=e=>A.check(i._emoji(Ae,e)),A.guid=e=>A.check(i._guid(_,e)),A.uuid=e=>A.check(i._uuid(q,e)),A.uuidv4=e=>A.check(i._uuidv4(q,e)),A.uuidv6=e=>A.check(i._uuidv6(q,e)),A.uuidv7=e=>A.check(i._uuidv7(q,e)),A.nanoid=e=>A.check(i._nanoid(Ar,e)),A.guid=e=>A.check(i._guid(_,e)),A.cuid=e=>A.check(i._cuid(Ai,e)),A.cuid2=e=>A.check(i._cuid2(As,e)),A.ulid=e=>A.check(i._ulid(Ag,e)),A.base64=e=>A.check(i._base64(AM,e)),A.base64url=e=>A.check(i._base64url(AN,e)),A.xid=e=>A.check(i._xid(AQ,e)),A.ksuid=e=>A.check(i._ksuid(AI,e)),A.ipv4=e=>A.check(i._ipv4(AE,e)),A.ipv6=e=>A.check(i._ipv6(AD,e)),A.cidrv4=e=>A.check(i._cidrv4(Au,e)),A.cidrv6=e=>A.check(i._cidrv6(Af,e)),A.e164=e=>A.check(i._e164(Ak,e)),A.datetime=e=>A.check(l(e)),A.date=e=>A.check(d(e)),A.time=e=>A.check(c(e)),A.duration=e=>A.check(B(e))});function x(A){return i._string(v,A)}let V=e.$constructor("ZodStringFormat",(A,e)=>{t.$ZodStringFormat.init(A,e),J.init(A,e)}),P=e.$constructor("ZodEmail",(A,e)=>{t.$ZodEmail.init(A,e),V.init(A,e)});function Y(A){return i._email(P,A)}let _=e.$constructor("ZodGUID",(A,e)=>{t.$ZodGUID.init(A,e),V.init(A,e)});function K(A){return i._guid(_,A)}let q=e.$constructor("ZodUUID",(A,e)=>{t.$ZodUUID.init(A,e),V.init(A,e)});function Z(A){return i._uuid(q,A)}function W(A){return i._uuidv4(q,A)}function z(A){return i._uuidv6(q,A)}function j(A){return i._uuidv7(q,A)}let $=e.$constructor("ZodURL",(A,e)=>{t.$ZodURL.init(A,e),V.init(A,e)});function X(A){return i._url($,A)}function AA(A){return i._url($,{protocol:a.regexes.httpProtocol,hostname:a.regexes.domain,...o.util.normalizeParams(A)})}let Ae=e.$constructor("ZodEmoji",(A,e)=>{t.$ZodEmoji.init(A,e),V.init(A,e)});function At(A){return i._emoji(Ae,A)}let Ar=e.$constructor("ZodNanoID",(A,e)=>{t.$ZodNanoID.init(A,e),V.init(A,e)});function An(A){return i._nanoid(Ar,A)}let Ai=e.$constructor("ZodCUID",(A,e)=>{t.$ZodCUID.init(A,e),V.init(A,e)});function Aa(A){return i._cuid(Ai,A)}let As=e.$constructor("ZodCUID2",(A,e)=>{t.$ZodCUID2.init(A,e),V.init(A,e)});function Ao(A){return i._cuid2(As,A)}let Ag=e.$constructor("ZodULID",(A,e)=>{t.$ZodULID.init(A,e),V.init(A,e)});function AC(A){return i._ulid(Ag,A)}let AQ=e.$constructor("ZodXID",(A,e)=>{t.$ZodXID.init(A,e),V.init(A,e)});function Al(A){return i._xid(AQ,A)}let AI=e.$constructor("ZodKSUID",(A,e)=>{t.$ZodKSUID.init(A,e),V.init(A,e)});function Ad(A){return i._ksuid(AI,A)}let AE=e.$constructor("ZodIPv4",(A,e)=>{t.$ZodIPv4.init(A,e),V.init(A,e)});function Ac(A){return i._ipv4(AE,A)}let Ah=e.$constructor("ZodMAC",(A,e)=>{t.$ZodMAC.init(A,e),V.init(A,e)});function AB(A){return i._mac(Ah,A)}let AD=e.$constructor("ZodIPv6",(A,e)=>{t.$ZodIPv6.init(A,e),V.init(A,e)});function Aw(A){return i._ipv6(AD,A)}let Au=e.$constructor("ZodCIDRv4",(A,e)=>{t.$ZodCIDRv4.init(A,e),V.init(A,e)});function Ap(A){return i._cidrv4(Au,A)}let Af=e.$constructor("ZodCIDRv6",(A,e)=>{t.$ZodCIDRv6.init(A,e),V.init(A,e)});function Ay(A){return i._cidrv6(Af,A)}let AM=e.$constructor("ZodBase64",(A,e)=>{t.$ZodBase64.init(A,e),V.init(A,e)});function Am(A){return i._base64(AM,A)}let AN=e.$constructor("ZodBase64URL",(A,e)=>{t.$ZodBase64URL.init(A,e),V.init(A,e)});function AS(A){return i._base64url(AN,A)}let Ak=e.$constructor("ZodE164",(A,e)=>{t.$ZodE164.init(A,e),V.init(A,e)});function AU(A){return i._e164(Ak,A)}let AF=e.$constructor("ZodJWT",(A,e)=>{t.$ZodJWT.init(A,e),V.init(A,e)});function AR(A){return i._jwt(AF,A)}let AT=e.$constructor("ZodCustomStringFormat",(A,e)=>{t.$ZodCustomStringFormat.init(A,e),V.init(A,e)});function Ab(A,e,t={}){return i._stringFormat(AT,A,e,t)}function AH(A){return i._stringFormat(AT,"hostname",a.regexes.hostname,A)}function AL(A){return i._stringFormat(AT,"hex",a.regexes.hex,A)}function AO(A,e){let t=e?.enc??"hex",r=`${A}_${t}`,n=a.regexes[r];if(!n)throw Error(`Unrecognized hash format: ${r}`);return i._stringFormat(AT,r,n,e)}let AG=e.$constructor("ZodNumber",(A,e)=>{t.$ZodNumber.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.numberProcessor(A,e,t,r),O(A,"ZodNumber",{gt(A,e){return this.check(i._gt(A,e))},gte(A,e){return this.check(i._gte(A,e))},min(A,e){return this.check(i._gte(A,e))},lt(A,e){return this.check(i._lt(A,e))},lte(A,e){return this.check(i._lte(A,e))},max(A,e){return this.check(i._lte(A,e))},int(A){return this.check(Ax(A))},safe(A){return this.check(Ax(A))},positive(A){return this.check(i._gt(0,A))},nonnegative(A){return this.check(i._gte(0,A))},negative(A){return this.check(i._lt(0,A))},nonpositive(A){return this.check(i._lte(0,A))},multipleOf(A,e){return this.check(i._multipleOf(A,e))},step(A,e){return this.check(i._multipleOf(A,e))},finite(){return this}});let r=A._zod.bag;A.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,A.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,A.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),A.isFinite=!0,A.format=r.format??null});function AJ(A){return i._number(AG,A)}let Av=e.$constructor("ZodNumberFormat",(A,e)=>{t.$ZodNumberFormat.init(A,e),AG.init(A,e)});function Ax(A){return i._int(Av,A)}function AV(A){return i._float32(Av,A)}function AP(A){return i._float64(Av,A)}function AY(A){return i._int32(Av,A)}function A_(A){return i._uint32(Av,A)}let AK=e.$constructor("ZodBoolean",(A,e)=>{t.$ZodBoolean.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.booleanProcessor(A,e,t,r)});function Aq(A){return i._boolean(AK,A)}let AZ=e.$constructor("ZodBigInt",(A,e)=>{t.$ZodBigInt.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.bigintProcessor(A,e,t,r),A.gte=(e,t)=>A.check(i._gte(e,t)),A.min=(e,t)=>A.check(i._gte(e,t)),A.gt=(e,t)=>A.check(i._gt(e,t)),A.gte=(e,t)=>A.check(i._gte(e,t)),A.min=(e,t)=>A.check(i._gte(e,t)),A.lt=(e,t)=>A.check(i._lt(e,t)),A.lte=(e,t)=>A.check(i._lte(e,t)),A.max=(e,t)=>A.check(i._lte(e,t)),A.positive=e=>A.check(i._gt(BigInt(0),e)),A.negative=e=>A.check(i._lt(BigInt(0),e)),A.nonpositive=e=>A.check(i._lte(BigInt(0),e)),A.nonnegative=e=>A.check(i._gte(BigInt(0),e)),A.multipleOf=(e,t)=>A.check(i._multipleOf(e,t));let r=A._zod.bag;A.minValue=r.minimum??null,A.maxValue=r.maximum??null,A.format=r.format??null});function AW(A){return i._bigint(AZ,A)}let Az=e.$constructor("ZodBigIntFormat",(A,e)=>{t.$ZodBigIntFormat.init(A,e),AZ.init(A,e)});function Aj(A){return i._int64(Az,A)}function A$(A){return i._uint64(Az,A)}let AX=e.$constructor("ZodSymbol",(A,e)=>{t.$ZodSymbol.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.symbolProcessor(A,e,t,r)});function A0(A){return i._symbol(AX,A)}let A4=e.$constructor("ZodUndefined",(A,e)=>{t.$ZodUndefined.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.undefinedProcessor(A,e,t,r)});function A2(A){return i._undefined(A4,A)}let A8=e.$constructor("ZodNull",(A,e)=>{t.$ZodNull.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.nullProcessor(A,e,t,r)});function A1(A){return i._null(A8,A)}let A3=e.$constructor("ZodAny",(A,e)=>{t.$ZodAny.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.anyProcessor(A,e,t,r)});function A5(){return i._any(A3)}let A9=e.$constructor("ZodUnknown",(A,e)=>{t.$ZodUnknown.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.unknownProcessor(A,e,t,r)});function A6(){return i._unknown(A9)}let A7=e.$constructor("ZodNever",(A,e)=>{t.$ZodNever.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.neverProcessor(A,e,t,r)});function eA(A){return i._never(A7,A)}let ee=e.$constructor("ZodVoid",(A,e)=>{t.$ZodVoid.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.voidProcessor(A,e,t,r)});function et(A){return i._void(ee,A)}let er=e.$constructor("ZodDate",(A,e)=>{t.$ZodDate.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.dateProcessor(A,e,t,r),A.min=(e,t)=>A.check(i._gte(e,t)),A.max=(e,t)=>A.check(i._lte(e,t));let r=A._zod.bag;A.minDate=r.minimum?new Date(r.minimum):null,A.maxDate=r.maximum?new Date(r.maximum):null});function en(A){return i._date(er,A)}let ei=e.$constructor("ZodArray",(A,e)=>{t.$ZodArray.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.arrayProcessor(A,e,t,r),A.element=e.element,O(A,"ZodArray",{min(A,e){return this.check(i._minLength(A,e))},nonempty(A){return this.check(i._minLength(1,A))},max(A,e){return this.check(i._maxLength(A,e))},length(A,e){return this.check(i._length(A,e))},unwrap(){return this.element}})});function ea(A,e){return i._array(ei,A,e)}function es(A){return eF(Object.keys(A._zod.def.shape))}let eo=e.$constructor("ZodObject",(A,e)=>{t.$ZodObjectJIT.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.objectProcessor(A,e,t,r),o.util.defineLazy(A,"shape",()=>e.shape),O(A,"ZodObject",{keyof(){return eF(Object.keys(this._zod.def.shape))},catchall(A){return this.clone({...this._zod.def,catchall:A})},passthrough(){return this.clone({...this._zod.def,catchall:A6()})},loose(){return this.clone({...this._zod.def,catchall:A6()})},strict(){return this.clone({...this._zod.def,catchall:eA()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(A){return o.util.extend(this,A)},safeExtend(A){return o.util.safeExtend(this,A)},merge(A){return o.util.merge(this,A)},pick(A){return o.util.pick(this,A)},omit(A){return o.util.omit(this,A)},partial(...A){return o.util.partial(eJ,this,A[0])},required(...A){return o.util.required(ez,this,A[0])}})});function eg(A,e){return new eo({type:"object",shape:A??{},...o.util.normalizeParams(e)})}function eC(A,e){return new eo({type:"object",shape:A,catchall:eA(),...o.util.normalizeParams(e)})}function eQ(A,e){return new eo({type:"object",shape:A,catchall:A6(),...o.util.normalizeParams(e)})}let el=e.$constructor("ZodUnion",(A,e)=>{t.$ZodUnion.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.unionProcessor(A,e,t,r),A.options=e.options});function eI(A,e){return new el({type:"union",options:A,...o.util.normalizeParams(e)})}let ed=e.$constructor("ZodXor",(A,e)=>{el.init(A,e),t.$ZodXor.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.unionProcessor(A,e,t,r),A.options=e.options});function eE(A,e){return new ed({type:"union",options:A,inclusive:!1,...o.util.normalizeParams(e)})}let ec=e.$constructor("ZodDiscriminatedUnion",(A,e)=>{el.init(A,e),t.$ZodDiscriminatedUnion.init(A,e)});function eh(A,e,t){return new ec({type:"union",options:e,discriminator:A,...o.util.normalizeParams(t)})}let eB=e.$constructor("ZodIntersection",(A,e)=>{t.$ZodIntersection.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.intersectionProcessor(A,e,t,r)});function eD(A,e){return new eB({type:"intersection",left:A,right:e})}let ew=e.$constructor("ZodTuple",(A,e)=>{t.$ZodTuple.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.tupleProcessor(A,e,t,r),A.rest=e=>A.clone({...A._zod.def,rest:e})});function eu(A,e,r){let n=e instanceof t.$ZodType,i=n?r:e;return new ew({type:"tuple",items:A,rest:n?e:null,...o.util.normalizeParams(i)})}let ep=e.$constructor("ZodRecord",(A,e)=>{t.$ZodRecord.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.recordProcessor(A,e,t,r),A.keyType=e.keyType,A.valueType=e.valueType});function ef(A,e,t){return new ep(e&&e._zod?{type:"record",keyType:A,valueType:e,...o.util.normalizeParams(t)}:{type:"record",keyType:x(),valueType:A,...o.util.normalizeParams(e)})}function ey(A,e,t){let n=r.clone(A);return n._zod.values=void 0,new ep({type:"record",keyType:n,valueType:e,...o.util.normalizeParams(t)})}function eM(A,e,t){return new ep({type:"record",keyType:A,valueType:e,mode:"loose",...o.util.normalizeParams(t)})}let em=e.$constructor("ZodMap",(A,e)=>{t.$ZodMap.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.mapProcessor(A,e,t,r),A.keyType=e.keyType,A.valueType=e.valueType,A.min=(...e)=>A.check(i._minSize(...e)),A.nonempty=e=>A.check(i._minSize(1,e)),A.max=(...e)=>A.check(i._maxSize(...e)),A.size=(...e)=>A.check(i._size(...e))});function eN(A,e,t){return new em({type:"map",keyType:A,valueType:e,...o.util.normalizeParams(t)})}let eS=e.$constructor("ZodSet",(A,e)=>{t.$ZodSet.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.setProcessor(A,e,t,r),A.min=(...e)=>A.check(i._minSize(...e)),A.nonempty=e=>A.check(i._minSize(1,e)),A.max=(...e)=>A.check(i._maxSize(...e)),A.size=(...e)=>A.check(i._size(...e))});function ek(A,e){return new eS({type:"set",valueType:A,...o.util.normalizeParams(e)})}let eU=e.$constructor("ZodEnum",(A,e)=>{t.$ZodEnum.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.enumProcessor(A,e,t,r),A.enum=e.entries,A.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));A.extract=(A,t)=>{let n={};for(let t of A)if(r.has(t))n[t]=e.entries[t];else throw Error(`Key ${t} not found in enum`);return new eU({...e,checks:[],...o.util.normalizeParams(t),entries:n})},A.exclude=(A,t)=>{let n={...e.entries};for(let e of A)if(r.has(e))delete n[e];else throw Error(`Key ${e} not found in enum`);return new eU({...e,checks:[],...o.util.normalizeParams(t),entries:n})}});function eF(A,e){return new eU({type:"enum",entries:Array.isArray(A)?Object.fromEntries(A.map(A=>[A,A])):A,...o.util.normalizeParams(e)})}function eR(A,e){return new eU({type:"enum",entries:A,...o.util.normalizeParams(e)})}let eT=e.$constructor("ZodLiteral",(A,e)=>{t.$ZodLiteral.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.literalProcessor(A,e,t,r),A.values=new Set(e.values),Object.defineProperty(A,"value",{get(){if(e.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function eb(A,e){return new eT({type:"literal",values:Array.isArray(A)?A:[A],...o.util.normalizeParams(e)})}let eH=e.$constructor("ZodFile",(A,e)=>{t.$ZodFile.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.fileProcessor(A,e,t,r),A.min=(e,t)=>A.check(i._minSize(e,t)),A.max=(e,t)=>A.check(i._maxSize(e,t)),A.mime=(e,t)=>A.check(i._mime(Array.isArray(e)?e:[e],t))});function eL(A){return i._file(eH,A)}let eO=e.$constructor("ZodTransform",(A,r)=>{t.$ZodTransform.init(A,r),G.init(A,r),A._zod.processJSONSchema=(e,t,r)=>g.transformProcessor(A,e,t,r),A._zod.parse=(t,n)=>{if("backward"===n.direction)throw new e.$ZodEncodeError(A.constructor.name);t.addIssue=e=>{"string"==typeof e?t.issues.push(o.util.issue(e,t.value,r)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=A),t.issues.push(o.util.issue(e)))};let i=r.transform(t.value,t);return i instanceof Promise?i.then(A=>(t.value=A,t.fallback=!0,t)):(t.value=i,t.fallback=!0,t)}});function eG(A){return new eO({type:"transform",transform:A})}let eJ=e.$constructor("ZodOptional",(A,e)=>{t.$ZodOptional.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.optionalProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function ev(A){return new eJ({type:"optional",innerType:A})}let ex=e.$constructor("ZodExactOptional",(A,e)=>{t.$ZodExactOptional.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.optionalProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function eV(A){return new ex({type:"optional",innerType:A})}let eP=e.$constructor("ZodNullable",(A,e)=>{t.$ZodNullable.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.nullableProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function eY(A){return new eP({type:"nullable",innerType:A})}function e_(A){return ev(eY(A))}let eK=e.$constructor("ZodDefault",(A,e)=>{t.$ZodDefault.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.defaultProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType,A.removeDefault=A.unwrap});function eq(A,e){return new eK({type:"default",innerType:A,get defaultValue(){return"function"==typeof e?e():o.util.shallowClone(e)}})}let eZ=e.$constructor("ZodPrefault",(A,e)=>{t.$ZodPrefault.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.prefaultProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function eW(A,e){return new eZ({type:"prefault",innerType:A,get defaultValue(){return"function"==typeof e?e():o.util.shallowClone(e)}})}let ez=e.$constructor("ZodNonOptional",(A,e)=>{t.$ZodNonOptional.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.nonoptionalProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function ej(A,e){return new ez({type:"nonoptional",innerType:A,...o.util.normalizeParams(e)})}let e$=e.$constructor("ZodSuccess",(A,e)=>{t.$ZodSuccess.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.successProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function eX(A){return new e$({type:"success",innerType:A})}let e0=e.$constructor("ZodCatch",(A,e)=>{t.$ZodCatch.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.catchProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType,A.removeCatch=A.unwrap});function e4(A,e){return new e0({type:"catch",innerType:A,catchValue:"function"==typeof e?e:()=>e})}let e2=e.$constructor("ZodNaN",(A,e)=>{t.$ZodNaN.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.nanProcessor(A,e,t,r)});function e8(A){return i._nan(e2,A)}let e1=e.$constructor("ZodPipe",(A,e)=>{t.$ZodPipe.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.pipeProcessor(A,e,t,r),A.in=e.in,A.out=e.out});function e3(A,e){return new e1({type:"pipe",in:A,out:e})}let e5=e.$constructor("ZodCodec",(A,e)=>{e1.init(A,e),t.$ZodCodec.init(A,e)});function e9(A,e,t){return new e5({type:"pipe",in:A,out:e,transform:t.decode,reverseTransform:t.encode})}function e6(A){let e=A._zod.def;return new e5({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}let e7=e.$constructor("ZodPreprocess",(A,e)=>{e1.init(A,e),t.$ZodPreprocess.init(A,e)}),tA=e.$constructor("ZodReadonly",(A,e)=>{t.$ZodReadonly.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.readonlyProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function te(A){return new tA({type:"readonly",innerType:A})}let tt=e.$constructor("ZodTemplateLiteral",(A,e)=>{t.$ZodTemplateLiteral.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.templateLiteralProcessor(A,e,t,r)});function tr(A,e){return new tt({type:"template_literal",parts:A,...o.util.normalizeParams(e)})}let tn=e.$constructor("ZodLazy",(A,e)=>{t.$ZodLazy.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.lazyProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.getter()});function ti(A){return new tn({type:"lazy",getter:A})}let ta=e.$constructor("ZodPromise",(A,e)=>{t.$ZodPromise.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.promiseProcessor(A,e,t,r),A.unwrap=()=>A._zod.def.innerType});function ts(A){return new ta({type:"promise",innerType:A})}let to=e.$constructor("ZodFunction",(A,e)=>{t.$ZodFunction.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.functionProcessor(A,e,t,r)});function tg(A){return new to({type:"function",input:Array.isArray(A?.input)?eu(A?.input):A?.input??ea(A6()),output:A?.output??A6()})}let tC=e.$constructor("ZodCustom",(A,e)=>{t.$ZodCustom.init(A,e),G.init(A,e),A._zod.processJSONSchema=(e,t,r)=>g.customProcessor(A,e,t,r)});function tQ(A){let e=new s.$ZodCheck({check:"custom"});return e._zod.check=A,e}function tl(A,e){return i._custom(tC,A??(()=>!0),e)}function tI(A,e={}){return i._refine(tC,A,e)}function td(A,e){return i._superRefine(A,e)}let tE=i.describe,tc=i.meta;function th(A,e={}){let t=new tC({type:"custom",check:"custom",fn:e=>e instanceof A,abort:!0,...o.util.normalizeParams(e)});return t._zod.bag.Class=A,t._zod.check=e=>{e.value instanceof A||e.issues.push({code:"invalid_type",expected:A.name,input:e.value,inst:t,path:[...t._zod.def.path??[]]})},t}let tB=(...A)=>i._stringbool({Codec:e5,Boolean:AK,String:v},...A);function tD(A){let e=ti(()=>eI([x(A),AJ(),Aq(),A1(),ea(e),ef(x(),e)]));return e}function tw(A,e){return new e7({type:"pipe",in:eG(A),out:e})}},104503,A=>{"use strict";var e=A.i(666680),t=A.i(184015),r=A.i(119909),n=A.i(243783);A.i(805422);var i=A.i(694355),a=A.i(661983);let s="default",o=["QUEUED","RUNNING"];function g(A){if("SUCCEEDED"!==A.status||!A.resultJson)throw Error(A.error||`${A.kind} failed`);let e=JSON.parse(A.resultJson);if(!e||"object"!=typeof e||Array.isArray(e))throw Error(`${A.kind} returned an invalid result`);return e}function C(A){try{let e=JSON.parse(A.capabilitiesJson);return Array.isArray(e)?e.filter(A=>"string"==typeof A):[]}catch{return[]}}function Q(A){return null!==A.lastSeenAt&&Date.now()-A.lastSeenAt.getTime()<=i.AGENT_ONLINE_WINDOW_MS&&null===A.disconnectedAt}A.s(["CodebasesService",0,class{agentControl;skillsService;constructor(A,e){for(const r of(this.agentControl=A,this.skillsService=e,[t.CODEBASE_REFRESH_JOB_KIND,t.CODEBASE_FETCH_JOB_KIND]))this.agentControl.registerCompletionHandler(r,A=>this.projectJob(A));this.agentControl.registerCompletionHandler(t.CODEBASE_GIT_OPERATION_JOB_KIND,A=>this.projectGitOperation(A))}async overview(){return await this.cleanupInternalJobs(),(await (0,n.getPrismaClient)()).codebaseRepository.findMany({orderBy:[{name:"asc"},{canonicalOrigin:"asc"}],include:{skillGroups:{include:{group:!0}},codebases:{orderBy:{folder:"asc"},include:{agent:!0,repository:!0,jobs:{where:{status:{in:["QUEUED","RUNNING"]}},orderBy:{createdAt:"desc"},take:1}}}}})}async repositoryDetail(A){return await this.cleanupInternalJobs(),(await (0,n.getPrismaClient)()).codebaseRepository.findUnique({where:{id:A},include:{skillGroups:{include:{group:!0}},codebases:{orderBy:[{agent:{name:"asc"}},{folder:"asc"}],include:{agent:!0,repository:!0,jobs:{where:{status:{in:["QUEUED","RUNNING"]}},orderBy:{createdAt:"desc"},take:1}}}}})}async detail(A){return await this.cleanupInternalJobs(),(await (0,n.getPrismaClient)()).codebase.findUnique({where:{id:A},include:{agent:!0,repository:{include:{skillGroups:{include:{group:!0}}}},jobs:{where:{status:{in:o}},orderBy:{createdAt:"desc"},take:1}}})}async agentCodebases(A){return(await (0,n.getPrismaClient)()).codebase.findMany({where:{agentId:A},orderBy:{folder:"asc"},select:{id:!0,folder:!0,defaultBranch:!0,lastFetchedAt:!0,lastFetchAttemptAt:!0,repository:{select:{canonicalOrigin:!0,keepBaseBranchUpToDate:!0}},worktrees:{where:{missingAt:null},select:{gitDirectory:!0,baseBranchOverride:!0}}}})}async settings(){let A=await (0,n.getPrismaClient)(),e=await A.codebaseSettings.findUnique({where:{id:s}});return e||A.codebaseSettings.upsert({where:{id:s},create:{id:s,refreshIntervalSeconds:t.DEFAULT_CODEBASE_RECONCILE_INTERVAL_SECONDS,fetchIntervalSeconds:r.DEFAULT_WORKTREE_FETCH_INTERVAL_SECONDS,defaultJiraBranchRegex:r.DEFAULT_JIRA_BRANCH_REGEX},update:{}})}async agentConfiguration(A){let[e,t]=await Promise.all([this.settings(),this.agentCodebases(A)]);return{refreshIntervalSeconds:e.refreshIntervalSeconds,fetchIntervalSeconds:e.fetchIntervalSeconds,codebases:t}}async updateSettings(A){let e="number"==typeof A?A:A.refreshIntervalSeconds,i="number"==typeof A?r.DEFAULT_WORKTREE_FETCH_INTERVAL_SECONDS:A.fetchIntervalSeconds;if(!Number.isInteger(e)||e<t.MIN_CODEBASE_RECONCILE_INTERVAL_SECONDS||e>t.MAX_CODEBASE_RECONCILE_INTERVAL_SECONDS)throw Error(`Refresh interval must be an integer from ${t.MIN_CODEBASE_RECONCILE_INTERVAL_SECONDS} to ${t.MAX_CODEBASE_RECONCILE_INTERVAL_SECONDS} seconds`);if(!Number.isInteger(i)||i<r.MIN_WORKTREE_FETCH_INTERVAL_SECONDS||i>r.MAX_WORKTREE_FETCH_INTERVAL_SECONDS)throw Error(`Fetch interval must be an integer from ${r.MIN_WORKTREE_FETCH_INTERVAL_SECONDS} to ${r.MAX_WORKTREE_FETCH_INTERVAL_SECONDS} seconds`);let a="number"==typeof A?r.DEFAULT_JIRA_BRANCH_REGEX:A.defaultJiraBranchRegex.trim();if(a)try{RegExp(a,"i")}catch{throw Error("Default Jira branch regex is invalid")}let o=await (0,n.getPrismaClient)(),g="number"==typeof A?{refreshIntervalSeconds:e}:{refreshIntervalSeconds:e,fetchIntervalSeconds:i,defaultJiraBranchRegex:a},C=await o.codebaseSettings.upsert({where:{id:s},create:{id:s,...g},update:g});return this.publish(null,null),C}async browse(A,e,r){await this.cleanupInternalJobs(),await this.requireAgentCapability(A,t.CODEBASE_BROWSE_JOB_KIND);let i=await this.agentControl.createJob({agentId:A,kind:t.CODEBASE_BROWSE_JOB_KIND,payload:{path:e},idempotencyKey:`codebase:browse:${r}`,timeoutSeconds:30,visibility:"SYSTEM"}),a=await this.waitForJob(i.id),s=(0,t.parseCodebaseDirectoryListing)(g(a).listing),o=await (0,n.getPrismaClient)();return await o.agentJob.deleteMany({where:{id:i.id}}),s}async inspect(A,e,r){await this.cleanupInternalJobs(),await this.requireAgentCapability(A,t.CODEBASE_INSPECT_JOB_KIND);let i=await this.agentControl.createJob({agentId:A,kind:t.CODEBASE_INSPECT_JOB_KIND,payload:{folder:e},idempotencyKey:`codebase:inspect:${r}`,timeoutSeconds:30,visibility:"SYSTEM"}),a=await this.waitForJob(i.id),s=(0,t.parseCodebaseSnapshot)(g(a).snapshot);if("AVAILABLE"!==s.availability)throw Error(s.error||"The selected folder is unavailable");if(s.linkedWorktree)throw Error("Linked Git worktrees are not supported yet");if(!s.canonicalOrigin)throw Error("Git origin is required");let o=await (0,n.getPrismaClient)(),C=await o.codebaseRepository.findUnique({where:{canonicalOrigin:s.canonicalOrigin}});return{jobId:i.id,snapshot:s,repository:C}}async confirm(A){let r=await (0,n.getPrismaClient)(),i=await r.agentJob.findUnique({where:{id:A.inspectionJobId}});if(!i||i.kind!==t.CODEBASE_INSPECT_JOB_KIND)throw Error("Codebase inspection was not found");if(!i.finishedAt||Date.now()-i.finishedAt.getTime()>9e5)throw Error("Codebase inspection expired; inspect the folder again");let a=(0,t.parseCodebaseSnapshot)(g(i).snapshot);if("AVAILABLE"!==a.availability||a.linkedWorktree||!a.canonicalOrigin||!a.displayOrigin||!a.observedOrigin)throw Error("Codebase inspection is not eligible for confirmation");let s=A.name?.trim()??"",o=A.description?.trim()??"";if(s.length>120)throw Error("Name must be 120 characters or fewer");if(o.length>2e3)throw Error("Description must be 2,000 characters or fewer");let C=await r.$transaction(async A=>{let t=await A.codebaseRepository.findUnique({where:{canonicalOrigin:a.canonicalOrigin}});if(!t){if(!s)throw Error("Name is required for a new repository");t=await A.codebaseRepository.upsert({where:{canonicalOrigin:a.canonicalOrigin},create:{id:(0,e.randomUUID)(),canonicalOrigin:a.canonicalOrigin,displayOrigin:a.displayOrigin,name:s,description:o},update:{}})}let r=await A.codebase.findUnique({where:{agentId_folder:{agentId:i.agentId,folder:a.folder}},select:{lastFetchedAt:!0}}),n=a.fetchedAt?new Date(a.fetchedAt):null,g=n&&(!r?.lastFetchedAt||n>r.lastFetchedAt)?n:r?.lastFetchedAt??null;return A.codebase.upsert({where:{agentId_folder:{agentId:i.agentId,folder:a.folder}},create:{id:(0,e.randomUUID)(),agentId:i.agentId,repositoryId:t.id,...this.snapshotData(a,g)},update:{repositoryId:t.id,...this.snapshotData(a,g)},include:{agent:!0,repository:!0,jobs:!0}})});return this.publish(C.id,C.repositoryId),await r.agentJob.deleteMany({where:{id:A.inspectionJobId,visibility:"SYSTEM"}}),await this.agentControl.requestCodebaseReconcile([C.agentId]),await this.skillsService?.requestAutoReconcile(),C}async updateRepository(A,e,t,r,i=!0,a){let s=e.trim(),o=t.trim();if(!s)throw Error("Name is required");if(s.length>120)throw Error("Name must be 120 characters or fewer");if(o.length>2e3)throw Error("Description must be 2,000 characters or fewer");let g=r?.trim()||null;if(g)try{RegExp(g,"i")}catch{throw Error("Jira branch regex is invalid")}let C=null==a?null:await this.skillsService?.validateGroupIds(a),Q=await (0,n.getPrismaClient)(),l=await Q.codebaseRepository.update({where:{id:A},data:{name:s,description:o,jiraBranchRegex:g,keepBaseBranchUpToDate:i}});return this.publish(null,A),C&&await this.skillsService?.setRepositoryGroups(A,C),l}async removeCodebase(A){let e=await (0,n.getPrismaClient)(),t=await e.$transaction(async e=>{let t=await e.codebase.findUnique({where:{id:A},select:{id:!0,repositoryId:!0}});if(!t)throw Error("Codebase not found");await e.codebase.delete({where:{id:A}});let r=0===await e.codebase.count({where:{repositoryId:t.repositoryId}});return r&&await e.codebaseRepository.delete({where:{id:t.repositoryId}}),{id:t.id,repositoryId:t.repositoryId,repositoryRemoved:r}});return this.publish(t.id,t.repositoryId),t}async report(A,e){let r=[],n=!1;try{for(let i of e.slice(0,500)){let e=(0,t.parseCodebaseSnapshot)(i.snapshot),a=await this.applySnapshot(A,i.codebaseId,e);r.push(a.codebase),n||=a.changed}}finally{n&&this.publish(null,null)}return r}async runOperation(A,e,r){if(!r.trim())throw Error("requestId is required");let i=await (0,n.getPrismaClient)(),a=await i.codebase.findMany({where:{id:{in:[...new Set(e)].slice(0,500)}},include:{agent:!0,repository:!0,jobs:{where:{status:{in:o}},select:{id:!0},take:1}}}),s=[],g=[];for(let e of a){if(e.jobs.length>0){g.push({codebaseId:e.id,reason:"ACTIVE_OPERATION"});continue}if(!Q(e.agent)){g.push({codebaseId:e.id,reason:"OFFLINE"});continue}if(!C(e.agent).includes(A)){g.push({codebaseId:e.id,reason:"UNSUPPORTED"});continue}if(A===t.CODEBASE_FETCH_JOB_KIND&&"AVAILABLE"!==e.availability){g.push({codebaseId:e.id,reason:e.availability});continue}try{s.push(await this.agentControl.createJob({agentId:e.agentId,codebaseId:e.id,kind:A,payload:{codebaseId:e.id,folder:e.folder,expectedOrigin:e.repository.canonicalOrigin,...A===t.CODEBASE_FETCH_JOB_KIND&&e.defaultBranch?{baseBranch:e.defaultBranch}:{},...A===t.CODEBASE_FETCH_JOB_KIND?{keepBaseBranchUpToDate:e.repository.keepBaseBranchUpToDate}:{}},idempotencyKey:`codebase:${A}:${r}:${e.id}`,timeoutSeconds:A===t.CODEBASE_FETCH_JOB_KIND?300:30}))}catch(A){if(!await i.agentJob.findFirst({where:{codebaseId:e.id,status:{in:o}},select:{id:!0}}))throw A;g.push({codebaseId:e.id,reason:"ACTIVE_OPERATION"})}}return{jobs:s,skipped:g}}async inspectGitState(A,e){if(!e.trim())throw Error("requestId is required");let r=await this.requireRunnableCodebase(A,t.CODEBASE_GIT_INSPECT_JOB_KIND),i=await this.agentControl.createJob({agentId:r.agentId,codebaseId:r.id,kind:t.CODEBASE_GIT_INSPECT_JOB_KIND,payload:{action:"STATE",codebaseId:r.id,folder:r.folder,expectedOrigin:r.repository.canonicalOrigin},idempotencyKey:`codebase:git:state:${e}:${r.id}`,timeoutSeconds:30,visibility:"SYSTEM"}),a=await (0,n.getPrismaClient)();try{let A=await this.waitForJob(i.id);return(0,t.parseCodebaseGitState)(g(A).state)}finally{await a.agentJob.deleteMany({where:{id:i.id,visibility:"SYSTEM"}})}}async inspectStash(A,e,r){if(!r.trim())throw Error("requestId is required");let i=await this.requireRunnableCodebase(A,t.CODEBASE_GIT_INSPECT_JOB_KIND),a=await this.agentControl.createJob({agentId:i.agentId,codebaseId:i.id,kind:t.CODEBASE_GIT_INSPECT_JOB_KIND,payload:{action:"STASH_DIFF",codebaseId:i.id,folder:i.folder,expectedOrigin:i.repository.canonicalOrigin,stashOid:e},idempotencyKey:`codebase:git:stash:${r}:${i.id}`,timeoutSeconds:30,visibility:"SYSTEM"}),s=await (0,n.getPrismaClient)();try{let A=await this.waitForJob(a.id);return(0,t.parseCodebaseStashDiff)(g(A).diff)}finally{await s.agentJob.deleteMany({where:{id:a.id,visibility:"SYSTEM"}})}}async runGitOperation(A){if(!A.requestId.trim())throw Error("requestId is required");let e=await this.requireRunnableCodebase(A.codebaseId,t.CODEBASE_GIT_OPERATION_JOB_KIND);return this.agentControl.createJob({agentId:e.agentId,codebaseId:e.id,kind:t.CODEBASE_GIT_OPERATION_JOB_KIND,payload:{codebaseId:e.id,folder:e.folder,expectedOrigin:e.repository.canonicalOrigin,defaultBranch:e.defaultBranch,operation:A.operation,...A.branch?{branch:A.branch}:{},...A.stashOid?{stashOid:A.stashOid}:{},..."SWITCH_BRANCH"===A.operation?{stashChanges:!!A.stashChanges}:{}},idempotencyKey:`codebase:git:${A.operation}:${A.requestId}:${e.id}`,timeoutSeconds:"PULL_BRANCH"===A.operation?300:60})}subscribe(){return a.agentEventBus.iterate(a.CODEBASE_CHANGED_TOPIC)}async projectJob(A){if(!A.codebaseId||!A.resultJson)return;let e=JSON.parse(A.resultJson);if(!e||"object"!=typeof e||Array.isArray(e))return;let r=e.snapshot;if(!r)return;let n=await this.applySnapshot(A.agentId,A.codebaseId,(0,t.parseCodebaseSnapshot)(r));n.changed&&this.publish(n.codebase.id,n.codebase.repositoryId)}async projectGitOperation(A){if("SUCCEEDED"===A.status)try{await this.projectJob(A)}catch(A){console.error("Could not project codebase Git operation:",A instanceof Error?A.message:A)}try{await this.agentControl.requestCodebaseReconcile([A.agentId])}catch(A){console.error("Could not request codebase reconciliation:",A instanceof Error?A.message:A)}}async applySnapshot(A,e,t){let r=await (0,n.getPrismaClient)(),i=await r.codebase.findUnique({where:{id:e},include:{repository:!0}});if(!i||i.agentId!==A)throw Error("Codebase not found for this agent");let a=new Date(t.checkedAt),s=null!==t.canonicalOrigin&&t.canonicalOrigin!==i.repository.canonicalOrigin,o=t.fetchedAt?new Date(t.fetchedAt):null,g=await r.codebase.updateMany({where:{id:e,agentId:A,OR:[{lastCheckedAt:null},{lastCheckedAt:{lt:a}}]},data:{folder:t.folder,...null===t.observedOrigin?{}:{observedOrigin:t.observedOrigin},branch:t.branch,headSha:t.headSha,upstream:t.upstream,ahead:t.ahead,behind:t.behind,syncState:t.syncState,availability:s?"ORIGIN_MISMATCH":t.availability,statusError:s?`Origin changed to ${t.displayOrigin??"an unknown remote"}`:t.error,lastCheckedAt:a}});g.count>0&&o&&await r.codebase.updateMany({where:{id:e,agentId:A,OR:[{lastFetchedAt:null},{lastFetchedAt:{lt:o}}]},data:{lastFetchedAt:o}});let C=await r.codebase.findUnique({where:{id:e},include:{agent:!0,repository:!0,jobs:!0}});if(!C||C.agentId!==A)throw Error("Codebase not found for this agent");return{codebase:C,changed:g.count>0}}snapshotData(A,e){return{folder:A.folder,observedOrigin:A.observedOrigin??"",branch:A.branch,headSha:A.headSha,upstream:A.upstream,ahead:A.ahead,behind:A.behind,syncState:A.syncState,availability:A.availability,statusError:A.error,lastCheckedAt:new Date(A.checkedAt),lastFetchedAt:e}}async requireAgentCapability(A,e){let t=await this.agentControl.getAgent(A);if(!t)throw Error("Agent not found");if(!Q(t))throw Error("Agent is offline");if(!C(t).includes(e))throw Error("Agent must be updated to use codebases")}async requireRunnableCodebase(A,e){await this.cleanupInternalJobs();let t=await (0,n.getPrismaClient)(),r=await t.codebase.findUnique({where:{id:A},include:{agent:!0,repository:!0,jobs:{where:{status:{in:o}},select:{id:!0},take:1}}});if(!r)throw Error("Codebase not found");if(!Q(r.agent))throw Error("Agent is offline");if(!C(r.agent).includes(e))throw Error("Agent must be updated to manage Git branches and stashes");if("AVAILABLE"!==r.availability)throw Error(r.statusError||"Codebase is unavailable");if(r.jobs.length)throw Error("Another codebase operation is already running");return r}async waitForJob(A){let e=a.agentEventBus.iterate((0,a.agentJobChangedTopic)(A)),t=Date.now()+3e4;try{for(;Date.now()<t;){let r=await this.agentControl.getJob(A);if(!r)throw Error("Agent job disappeared");if(["SUCCEEDED","FAILED","CANCELLED","TIMED_OUT"].includes(r.status))return r;await Promise.race([e.next(),new Promise(A=>setTimeout(A,t-Date.now()))])}throw await this.agentControl.cancelJob(A),Error("Agent did not respond in time")}finally{await e.return?.()}}publish(A,e){a.agentEventBus.publish(a.CODEBASE_CHANGED_TOPIC,{codebaseOverviewChanged:{codebaseId:A,repositoryId:e}})}async cleanupInternalJobs(){let A=await (0,n.getPrismaClient)();await A.agentJob.deleteMany({where:{visibility:"SYSTEM",kind:{in:[...t.CODEBASE_JOB_KINDS]},finishedAt:{lt:new Date(Date.now()-9e5)}}})}}])},250246,516785,715199,A=>{"use strict";A.i(104503);var e=A.i(907855);A.i(805422);var t=A.i(694355);let r=e.enum(["IN_SYNC","AHEAD","BEHIND","DIVERGED","NO_UPSTREAM","DETACHED","UNKNOWN"]),n=e.enum(["AVAILABLE","MISSING","NOT_REPOSITORY","ORIGIN_MISMATCH","ERROR"]),i=e.object({id:e.string(),path:e.string(),observedOrigin:e.string(),branch:e.string().nullable(),headSha:e.string().nullable(),upstream:e.string().nullable(),ahead:e.number().int().nullable(),behind:e.number().int().nullable(),syncState:r,availability:n,statusError:e.string().nullable(),lastCheckedAt:e.string().nullable(),lastFetchedAt:e.string().nullable(),lastFetchAttemptAt:e.string().nullable().optional(),lastFetchError:e.string().nullable().optional(),defaultBranch:e.string().nullable().optional(),localBranches:e.array(e.string()).optional(),remoteBranches:e.array(e.string()).optional(),createdAt:e.string().optional(),updatedAt:e.string().optional(),repository:e.object({id:e.string(),name:e.string(),description:e.string(),canonicalOrigin:e.string(),displayOrigin:e.string()}),agent:e.object({id:e.string(),name:e.string(),hostname:e.string(),connectionStatus:e.enum(["ONLINE","OFFLINE"])}),activeJob:e.object({id:e.string(),kind:e.string(),status:e.enum(["QUEUED","RUNNING"])}).nullable()}),a=e.object({codebases:e.array(i)}),s=e.object({}),o=e.union([e.object({id:e.string().min(1).describe("Registered codebase ID")}),e.object({path:e.string().min(1).describe("Exact absolute folder path of the codebase"),agentId:e.string().min(1).optional().describe("Agent ID used to disambiguate a shared folder path")})]),g=e.object({codebase:i}),C=e.object({query:e.string().min(1).optional(),agentId:e.string().min(1).optional(),repositoryId:e.string().min(1).optional(),branch:e.string().min(1).optional(),availability:n.optional(),syncState:r.optional(),limit:e.number().int().min(1).max(500).default(100)}).refine(({query:A,agentId:e,repositoryId:t,branch:r,availability:n,syncState:i})=>!!(A||e||t||r||n||i),{message:"At least one codebase search criterion is required"}),Q=e.object({codebases:e.array(i),matchingCount:e.number().int().nonnegative()}),l=e.object({id:e.string(),name:e.string(),description:e.string(),canonicalOrigin:e.string(),displayOrigin:e.string(),jiraBranchRegex:e.string().nullable(),keepBaseBranchUpToDate:e.boolean(),codebaseCount:e.number().int().nonnegative(),agentIds:e.array(e.string()),createdAt:e.string(),updatedAt:e.string()}),I=e.object({repositories:e.array(l)}),d=e.object({id:e.string().min(1)}),E=e.object({repository:l.extend({codebases:e.array(i)})});class c extends Error{code;matches;constructor(A,e,t=[]){super(e),this.code=A,this.matches=t,this.name="CodebaseLookupError"}}A.s(["CodebaseLookupError",0,c,"CodebaseToolRecordSchema",0,i,"CodebaseToolsService",0,class{codebasesService;constructor(A){this.codebasesService=A}stringArray(A){try{let e=JSON.parse(A);return Array.isArray(e)?e.filter(A=>"string"==typeof A):[]}catch{return[]}}record(A,e){var r;let n=e.jobs[0]??null;return i.parse({id:e.id,path:e.folder,observedOrigin:e.observedOrigin,branch:e.branch,headSha:e.headSha,upstream:e.upstream,ahead:e.ahead,behind:e.behind,syncState:e.syncState,availability:e.availability,statusError:e.statusError,lastCheckedAt:e.lastCheckedAt?.toISOString()??null,lastFetchedAt:e.lastFetchedAt?.toISOString()??null,lastFetchAttemptAt:e.lastFetchAttemptAt?.toISOString()??null,lastFetchError:e.lastFetchError,defaultBranch:e.defaultBranch,localBranches:this.stringArray(e.localBranchesJson),remoteBranches:this.stringArray(e.remoteBranchesJson),createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString(),repository:{id:A.id,name:A.name,description:A.description,canonicalOrigin:A.canonicalOrigin,displayOrigin:A.displayOrigin},agent:{id:e.agent.id,name:e.agent.name,hostname:e.agent.hostname,connectionStatus:null!==(r=e.agent).lastSeenAt&&Date.now()-r.lastSeenAt.getTime()<=t.AGENT_ONLINE_WINDOW_MS&&null===r.disconnectedAt?"ONLINE":"OFFLINE"},activeJob:n?{id:n.id,kind:n.kind,status:n.status}:null})}async list(){return(await this.codebasesService.overview()).flatMap(A=>A.codebases.map(e=>this.record(A,e)))}async getByPath(A,e){if("string"!=typeof A||0===A.trim().length)throw new c("INVALID_PATH","A non-empty codebase path is required");let t=(await this.list()).filter(t=>t.path===A&&(!e||t.agent.id===e));if(0===t.length)throw new c("CODEBASE_NOT_FOUND",`No codebase is registered at path ${A}`);if(t.length>1)throw new c("AMBIGUOUS_PATH",`More than one agent has a codebase registered at path ${A}`,t.map(({agent:A})=>({agentId:A.id,name:A.name,hostname:A.hostname})));return t[0]}async getById(A){let e=(await this.list()).find(e=>e.id===A);if(!e)throw new c("CODEBASE_NOT_FOUND",`No codebase is registered with id ${A}`);return e}async get(A){return"id"in A?this.getById(A.id):this.getByPath(A.path,A.agentId)}async search(A){let e=A.query?.toLocaleLowerCase(),t=(await this.list()).filter(t=>(!A.agentId||t.agent.id===A.agentId)&&(!A.repositoryId||t.repository.id===A.repositoryId)&&(!A.branch||t.branch===A.branch)&&(!A.availability||t.availability===A.availability)&&(!A.syncState||t.syncState===A.syncState)&&(!e||[t.id,t.path,t.observedOrigin,t.branch??"",t.repository.name,t.repository.description,t.repository.canonicalOrigin,t.agent.name,t.agent.hostname].some(A=>A.toLocaleLowerCase().includes(e))));return{codebases:t.slice(0,A.limit),matchingCount:t.length}}async repositories(){return(await this.codebasesService.overview()).map(A=>({id:A.id,name:A.name,description:A.description,canonicalOrigin:A.canonicalOrigin,displayOrigin:A.displayOrigin,jiraBranchRegex:A.jiraBranchRegex,keepBaseBranchUpToDate:A.keepBaseBranchUpToDate,codebaseCount:A.codebases.length,agentIds:[...new Set(A.codebases.map(A=>A.agentId))],createdAt:A.createdAt.toISOString(),updatedAt:A.updatedAt.toISOString()}))}async repository(A){let e=(await this.codebasesService.overview()).find(e=>e.id===A);if(!e)throw Error("Codebase repository not found");return{...(await this.repositories()).find(e=>e.id===A),codebases:e.codebases.map(A=>this.record(e,A))}}},"GetCodebaseInputSchema",0,o,"GetCodebaseOutputSchema",0,g,"GetCodebaseRepositoriesOutputSchema",0,I,"GetCodebaseRepositoryInputSchema",0,d,"GetCodebaseRepositoryOutputSchema",0,E,"GetCodebasesInputSchema",0,s,"GetCodebasesOutputSchema",0,a,"SearchCodebasesInputSchema",0,C,"SearchCodebasesOutputSchema",0,Q],516785);let h={openapi:"3.1.0",info:{title:"AI Development Environment Codebases API",version:"0.1.0",description:"Read-only access to registered codebase checkouts."},tags:[{name:"Codebases"}],paths:{"/api/codebases":{get:{tags:["Codebases"],operationId:"getCodebases",summary:"List codebases",responses:{200:{description:"Registered codebase checkouts",content:{"application/json":{schema:{type:"object",required:["codebases"],properties:{codebases:{type:"array",items:{$ref:"#/components/schemas/CodebaseToolRecord"}}}}}}},500:{$ref:"#/components/responses/InternalError"}}}},"/api/codebases/by-path":{get:{tags:["Codebases"],operationId:"getCodebaseByPath",summary:"Get a codebase by folder path",parameters:[{name:"path",in:"query",required:!0,description:"Exact absolute folder path of the codebase",schema:{type:"string",minLength:1}}],responses:{200:{description:"Matching codebase checkout",content:{"application/json":{schema:{type:"object",required:["codebase"],properties:{codebase:{$ref:"#/components/schemas/CodebaseToolRecord"}}}}}},400:{$ref:"#/components/responses/BadRequest"},404:{$ref:"#/components/responses/NotFound"},409:{$ref:"#/components/responses/AmbiguousPath"},500:{$ref:"#/components/responses/InternalError"}}}}},components:{schemas:{CodebaseToolRecord:A.i(865889).toJSONSchema(i),ErrorResponse:{type:"object",required:["error"],properties:{error:{type:"object",required:["code","message"],properties:{code:{type:"string"},message:{type:"string"},matches:{type:"array",items:{type:"object",required:["agentId","name","hostname"],properties:{agentId:{type:"string"},name:{type:"string"},hostname:{type:"string"}}}}}}}}},responses:Object.fromEntries([["BadRequest","The path is missing or invalid"],["NotFound","No codebase uses the requested path"],["AmbiguousPath","Multiple agents use the requested path"],["InternalError","Unexpected server error"]].map(([A,e])=>[A,{description:e,content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}]))}};A.s(["codebasesOpenApiDocument",0,h],715199),A.s([],250246)},247287,A=>{"use strict";var e=A.i(666680),t=A.i(246479),r=A.i(397554),n=A.i(827957);let i=new Set([429,500,503]);async function a(A){await new Promise(e=>setTimeout(e,A))}A.s(["ApnsClient",0,class{sessionFactory;sessions;jwtCache;constructor(A=t.connect){this.sessionFactory=A,this.sessions=new Map,this.jwtCache=new Map}close(){for(let A of this.sessions.values())A.close();this.sessions.clear()}session(A,e){let t="TOKEN"===e.kind?`token:${e.teamId}:${e.keyId}`:`certificate:${e.fingerprint}`,r=`${A}:${t}`,n=this.sessions.get(r);if(n&&!n.closed&&!n.destroyed)return n;let i="CERTIFICATE"===e.kind?{pfx:Buffer.from(e.p12Base64,"base64"),passphrase:e.passphrase}:{},a=this.sessionFactory("SANDBOX"===A?"https://api.sandbox.push.apple.com":"https://api.push.apple.com",i);return a.on("error",()=>{this.sessions.get(r)===a&&this.sessions.delete(r)}),a.on("close",()=>{this.sessions.get(r)===a&&this.sessions.delete(r)}),this.sessions.set(r,a),a}async authorization(A){let t;if("CERTIFICATE"===A.kind)return null;let i=`${A.teamId}:${A.keyId}:${(0,e.createHash)("sha256").update(A.privateKey).digest("hex")}`,a=this.jwtCache.get(i);if(a&&Date.now()-a.createdAt<3e6)return`bearer ${a.token}`;try{t=await (0,r.importPKCS8)(A.privateKey,"ES256")}catch{throw Error("The APNs .p8 key must be an ES256 PKCS#8 private key")}let s=await new n.SignJWT({}).setProtectedHeader({alg:"ES256",kid:A.keyId}).setIssuer(A.teamId).setIssuedAt().sign(t);return this.jwtCache.set(i,{token:s,createdAt:Date.now()}),`bearer ${s}`}async requestOnce(A){let e=await this.authorization(A.authentication),r=this.session(A.environment,A.authentication);return new Promise((n,i)=>{let a=r.request({[t.constants.HTTP2_HEADER_METHOD]:A.method??"POST",[t.constants.HTTP2_HEADER_PATH]:A.path,[t.constants.HTTP2_HEADER_SCHEME]:"https","content-type":"application/json",...e?{authorization:e}:{},...A.headers}),s={},o="";a.setEncoding("utf8"),a.on("response",A=>{s=A}),a.on("data",A=>{(o+=A).length>65536&&a.close(t.constants.NGHTTP2_CANCEL)}),a.on("error",i),a.on("end",()=>{let A=s[t.constants.HTTP2_HEADER_STATUS];n({status:Number(Array.isArray(A)?A[0]:A)||0,body:o,headers:s})}),a.setTimeout(2e4,()=>{a.close(t.constants.NGHTTP2_CANCEL),i(Error("APNs request timed out"))}),a.end(JSON.stringify(A.payload))})}async send(A){if(!A.deviceToken&&!A.broadcastTopic)throw Error("An APNs device token or broadcast topic is required");let t=A.deviceToken?`/3/device/${A.deviceToken.toLowerCase()}`:`/4/broadcasts/apps/${encodeURIComponent(A.broadcastTopic)}`,r=Date.now(),n=0;for(;;){let s;try{s=await this.requestOnce({...A,path:t})}catch(A){if(n>=3)throw A;await a(Math.min(4e3,250*2**n)),n+=1;continue}let o={};try{o=s.body?JSON.parse(s.body):{}}catch{o={}}if(i.has(s.status)&&n<3){await a(function(A,e){let t=Array.isArray(A)?A[0]:A;if(t){let A=Number(t);if(Number.isFinite(A))return Math.min(3e4,1e3*A);let e=Date.parse(t);if(Number.isFinite(e))return Math.max(0,Math.min(3e4,e-Date.now()))}return Math.min(4e3,250*2**e)}(s.headers["retry-after"],n)),n+=1;continue}let g=s.headers["apns-id"];return{status:s.status,reason:o.reason??null,timestamp:"number"==typeof o.timestamp?new Date(o.timestamp):null,apnsId:(Array.isArray(g)?g[0]:g)??A.headers["apns-id"]??(0,e.randomUUID)(),attempts:n+1,durationMs:Date.now()-r}}}async createBroadcastChannel(A){let e=await this.requestOnce({environment:A.environment,authentication:A.authentication,path:`/4/broadcasts/apps/${encodeURIComponent(A.bundleId)}`,payload:{"channel-storage-policy":+("NO_STORAGE"!==A.storagePolicy)},headers:{"apns-topic":`${A.bundleId}.push-type.liveactivity`,"apns-push-type":"liveactivity"}}),t=e.headers["apns-channel-id"],r=Array.isArray(t)?t[0]:t;if(![200,201].includes(e.status)||!r)throw Error(`APNs could not create the broadcast channel (HTTP ${e.status})`);return r}async deleteBroadcastChannel(A){let e=await this.requestOnce({environment:A.environment,authentication:A.authentication,method:"DELETE",path:`/4/broadcasts/apps/${encodeURIComponent(A.bundleId)}`,payload:{},headers:{"apns-topic":`${A.bundleId}.push-type.liveactivity`,"apns-push-type":"liveactivity","apns-channel-id":A.channelId}});if(![200,204].includes(e.status))throw Error(`APNs could not delete the broadcast channel (HTTP ${e.status})`)}}])},282790,474170,308810,A=>{"use strict";var e=A.i(247287),t=A.i(666680),r=A.i(685560),n=A.i(397554),i=A.i(243783);A.i(582482);var a=A.i(318905),s=A.i(91022),o=A.i(661983);let g=new Set(["alert","background","complication","controls","fileprovider","liveactivity","location","mdm","pushtotalk","voip","widgets"]),C=/^[A-Za-z0-9][A-Za-z0-9.-]{0,254}$/;function Q(A,e){if(!A||"object"!=typeof A||Array.isArray(A))throw Error(`${e} must be an object`);return A}function l(A,e,t){if("string"!=typeof A||!A.trim())throw Error(`${e} is required`);let r=A.trim();if(r.length>t||r.includes("\0"))throw Error(`${e} is invalid`);return r}function I(A,e,t){return null==A||""===A?null:l(A,e,t)}function d(A,e){let t;if("HEX"===e){let e=A.replace(/[\s<>]/g,"");if(!/^[A-Fa-f0-9]{64}$/.test(e))throw Error("token must contain exactly 32 bytes of hexadecimal data");t=Buffer.from(e,"hex")}else{let e=A.trim();if(!/^[A-Za-z0-9+/_-]+={0,2}$/.test(e))throw Error("token is not valid Base64");try{t=Buffer.from(e.replaceAll("-","+").replaceAll("_","/"),"base64")}catch{throw Error("token is not valid Base64")}if(t.toString("base64").replace(/=+$/,"")!==e.replaceAll("-","+").replaceAll("_","/").replace(/=+$/,""))throw Error("token is not valid Base64")}if(32!==t.length)throw Error("token must decode to exactly 32 bytes");return t.toString("hex").toUpperCase()}function E(A){let e=Q(A,"registration"),t=new Set(["clientRegistrationId","token","tokenEncoding","topic","environment","supportedPushTypes","displayName","deviceModel","osVersion","appVersion","appBuild","locale","pushMagic"]),r=Object.keys(e).find(A=>!t.has(A));if(r)throw Error(`Unexpected registration field: ${r}`);let n=l(e.tokenEncoding,"tokenEncoding",10);if("HEX"!==n&&"BASE64"!==n)throw Error("tokenEncoding must be HEX or BASE64");let i=l(e.environment,"environment",20);if("SANDBOX"!==i&&"PRODUCTION"!==i)throw Error("environment must be SANDBOX or PRODUCTION");let a=l(e.topic,"topic",255);if(!C.test(a))throw Error("topic is invalid");if(!Array.isArray(e.supportedPushTypes)||!e.supportedPushTypes.length)throw Error("supportedPushTypes must contain at least one push type");let s=[...new Set(e.supportedPushTypes.map(A=>{if("string"!=typeof A||!g.has(A))throw Error(`Unsupported APNs push type: ${String(A)}`);return A}))],o=I(e.pushMagic,"pushMagic",500);if(s.includes("mdm")&&!o)throw Error("pushMagic is required when MDM is supported");return{clientRegistrationId:l(e.clientRegistrationId,"clientRegistrationId",200),token:d(l(e.token,"token",1024),n),tokenEncoding:n,topic:a,environment:i,supportedPushTypes:s,displayName:l(e.displayName,"displayName",120),deviceModel:I(e.deviceModel,"deviceModel",120),osVersion:I(e.osVersion,"osVersion",50),appVersion:I(e.appVersion,"appVersion",50),appBuild:I(e.appBuild,"appBuild",50),locale:I(e.locale,"locale",35),pushMagic:o}}function c(A){let e,t=Q(A,"push editor"),r=l(t.pushType,"pushType",30);if(!g.has(r))throw Error("pushType is unsupported");let n=Q(t.headers??{},"headers"),i=Q(t.aps??{},"aps"),a=Q(t.custom??{},"custom"),s=I(t.credentialId,"credentialId",100),o=Number(n.priority??("background"===r?5:10));if(![1,5,10].includes(o))throw Error("APNs priority must be 1, 5, or 10");if("background"===r&&5!==o)throw Error("Background notifications require priority 5");if(["voip","mdm","pushtotalk"].includes(r)&&10!==o)throw Error(`${r} notifications require priority 10`);if(1===o&&"location"!==r)throw Error("Priority 1 is supported only for location notifications");let d=l(n.topic,"topic",255);if(!C.test(d))throw Error("topic is invalid");let E={complication:".complication",fileprovider:".pushkit.fileprovider",liveactivity:".push-type.liveactivity",location:".location-query",pushtotalk:".voip-ptt",voip:".voip",widgets:".push-type.widgets",controls:".push-type.controls"}[r];if(E&&!d.endsWith(E))throw Error(`${r} notifications require a topic ending in ${E}`);if("mdm"===r){if(!s)throw Error("MDM requires a certificate credential");if(Object.keys(i).length)throw Error("MDM payloads cannot contain aps");if(Object.keys(a).length)throw Error("MDM payloads cannot contain custom root fields");e={mdm:"__PUSH_MAGIC__"}}else{let A={...i},n=A["relevance-score"];if(void 0!==n&&("number"!=typeof n||n<0||n>1))throw Error("aps.relevance-score must be between 0 and 1");let s=A.badge;if(void 0!==s&&("number"!=typeof s||!Number.isInteger(s)||s<0))throw Error("aps.badge must be a non-negative integer");let o=A["interruption-level"];if(void 0!==o&&!["passive","active","time-sensitive","critical"].includes(String(o)))throw Error("aps.interruption-level is invalid");let g=A.sound;if(g&&"object"==typeof g&&!Array.isArray(g)){let A=g.volume;if("number"!=typeof A||!Number.isFinite(A)||A<0||A>1)throw Error("Critical sound volume must be between 0 and 1")}if("background"===r){for(let e of["alert","badge","sound"])if(void 0!==A[e])throw Error(`Background notifications cannot contain aps.${e}`);A["content-available"]=1}if("alert"===r&&!Object.keys(A).length)throw Error("Alert notifications require at least one aps field");if("liveactivity"===r){let e=Q(t.liveActivity??{},"liveActivity");if(!Number.isInteger(e.timestamp))throw Error("Live Activity timestamp must be an integer Unix timestamp");if(!["start","update","end"].includes(String(e.event)))throw Error("Live Activity event must be start, update, or end");Object.assign(A,e)}e={...a,aps:A}}let c=Buffer.byteLength(JSON.stringify(e)),h="voip"===r?5120:4096;if(c>h)throw Error(`Payload is ${c} bytes; ${r} allows ${h}`);let B={"apns-push-type":r,"apns-topic":d,"apns-priority":String(o)};for(let[A,e]of[["apns-id",n.id],["apns-expiration",n.expiration],["apns-collapse-id",n.collapseId],["apns-channel-id",n.broadcastChannelId]])null!=e&&""!==e&&(B[A]=l(e,A,"apns-collapse-id"===A?64:200));if(B["apns-id"]&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(B["apns-id"]))throw Error("apns-id must be a UUID");if(B["apns-expiration"]&&(!/^\d+$/.test(B["apns-expiration"])||0>Number(B["apns-expiration"])))throw Error("apns-expiration must be a non-negative Unix timestamp");return{editor:{pushType:r,headers:n,aps:i,custom:a,liveActivity:"liveactivity"===r?Q(t.liveActivity??{},"liveActivity"):null,credentialId:s},payload:e,headers:B,byteLength:c}}A.s(["normalizeDeviceToken",0,d,"parseApnsRegistrationInput",0,E,"validatePushEditor",0,c],474170);let h="default",B=["DEVICES","ALL","DIRECT","BROADCAST"];function D(A){return(0,t.createHash)("sha256").update(A).digest("hex").toUpperCase()}function w(A,e){let n;try{n=(0,r.createSecureContext)({pfx:A,passphrase:e})}catch{throw Error("The .p12 file or passphrase is invalid")}let i=n.context.getCertificate();if(!i?.length)throw Error("The .p12 file does not contain a leaf certificate");let a=new t.X509Certificate(i),s=new Date(a.validTo);if(Number.isNaN(s.getTime()))throw Error("The .p12 certificate expiration date is invalid");return{expiresAt:s,fingerprint:a.fingerprint256.replaceAll(":","").toUpperCase()}}function u(A){return JSON.parse(A)}function p(A){try{let e=JSON.parse(A);return Array.isArray(e)?e.filter(A=>"string"==typeof A):[]}catch{return[]}}function f(A,e,t=200){let r=A.trim();if(!r||r.length>t||r.includes("\0"))throw Error(`${e} is required or invalid`);return r}A.s(["PushNotificationsService",0,class{client;credentials;recoveryStarted;activeBatchIds;constructor(A=new e.ApnsClient,t=new s.CredentialService){this.client=A,this.credentials=t,this.recoveryStarted=!1,this.activeBatchIds=new Set,queueMicrotask(()=>void this.recover().catch(()=>void 0)),setInterval(()=>void this.recover().catch(()=>void 0),3e4).unref()}changed(){o.agentEventBus.publish(o.PUSH_NOTIFICATIONS_CHANGED_TOPIC,{changed:!0})}subscribe(){return o.agentEventBus.iterate(o.PUSH_NOTIFICATIONS_CHANGED_TOPIC)}async register(A,e){let t=E(A);return this.registerValidated(t,e)}async registerValidated(A,e){let r=await (0,i.getPrismaClient)(),n=D(A.token),a=new Date,s={clientRegistrationId:A.clientRegistrationId,topic:A.topic,environment:A.environment},o=await r.$transaction(async r=>{let i=await r.apnsRegistration.findUnique({where:{clientRegistrationId_topic_environment:s}}),o=await r.apnsRegistration.findUnique({where:{tokenHash_topic_environment:{tokenHash:n,topic:A.topic,environment:A.environment}}});o&&o.id!==i?.id&&await r.apnsRegistration.update({where:{id:o.id},data:{token:"",tokenHash:`REASSIGNED:${o.id}:${o.tokenHash}`,status:"INACTIVE",invalidatedAt:a,lastFailureReason:"TOKEN_REASSIGNED",lastFailureAt:a}});let g={token:A.token,tokenHash:n,pushTypesJson:JSON.stringify(A.supportedPushTypes),displayName:A.displayName,deviceModel:A.deviceModel,osVersion:A.osVersion,appVersion:A.appVersion,appBuild:A.appBuild,locale:A.locale,pushMagic:A.pushMagic,lastIpAddress:e,status:"ACTIVE",invalidatedAt:null,lastFailureReason:null,lastFailureAt:null,lastRegisteredAt:a};return{registration:i?await r.apnsRegistration.update({where:{id:i.id},data:g}):await r.apnsRegistration.create({data:{id:(0,t.randomUUID)(),...s,...g}}),created:!i}});return this.changed(),o}async registrations(){let A=await (0,i.getPrismaClient)();return(await A.apnsRegistration.findMany({orderBy:[{status:"asc"},{lastRegisteredAt:"desc"}]})).map(A=>({...A,tokenMasked:A.token?`${A.token.slice(0,8)}…${A.token.slice(-8)}`:"—",supportedPushTypes:p(A.pushTypesJson)}))}async renameRegistration(A,e){let t=await (0,i.getPrismaClient)(),r=await t.apnsRegistration.update({where:{id:A},data:{displayName:f(e,"Display name",120)}});return this.changed(),r}async setRegistrationActive(A,e){let t=await (0,i.getPrismaClient)(),r=await t.apnsRegistration.update({where:{id:A},data:{status:e?"ACTIVE":"INACTIVE",invalidatedAt:e?null:new Date}});return this.changed(),r}async deleteRegistration(A){let e=await (0,i.getPrismaClient)();return await e.apnsRegistration.delete({where:{id:A}}),this.changed(),!0}async rawSettings(){return(await (0,i.getPrismaClient)()).pushNotificationSettings.upsert({where:{id:h},create:{id:h},update:{}})}async settings(){let A=await (0,i.getPrismaClient)(),[e,t,r]=await Promise.all([this.rawSettings(),A.apnsCertificateCredential.findMany({orderBy:{name:"asc"}}),this.credentials.isConfigured(a.CREDENTIALS.apnsTokenPrivateKey)]);return{tokenConfigured:!!(e.tokenTeamId&&e.tokenKeyId&&r),tokenTeamId:e.tokenTeamId,tokenKeyId:e.tokenKeyId,tokenPrivateKeyFingerprint:e.tokenPrivateKeyFingerprint,tokenConfiguredAt:e.tokenConfiguredAt,tokenLastUsedAt:e.tokenLastUsedAt,tokenLastError:e.tokenLastError,certificates:t.map(A=>({id:A.id,name:A.name,topic:A.topic,environment:A.environment,fingerprint:A.fingerprint,expiresAt:A.expiresAt,lastTestedAt:A.lastTestedAt,lastError:A.lastError,createdAt:A.createdAt,updatedAt:A.updatedAt})),updatedAt:e.updatedAt}}async saveTokenSettings(A){await this.rawSettings();let e=f(A.teamId,"Team ID",20),t=f(A.keyId,"Key ID",20),r=A.privateKey?.trim()||await this.credentials.getText(a.CREDENTIALS.apnsTokenPrivateKey);if(!r?.includes("-----BEGIN PRIVATE KEY-----"))throw Error("An APNs PKCS#8 .p8 private key is required");try{await (0,n.importPKCS8)(r,"ES256")}catch{throw Error("The APNs .p8 key must be an ES256 PKCS#8 private key")}return await this.credentials.setText(a.CREDENTIALS.apnsTokenPrivateKey,r,async A=>{await A.pushNotificationSettings.update({where:{id:h},data:{tokenTeamId:e,tokenKeyId:t,tokenPrivateKeyFingerprint:D(r),tokenConfiguredAt:new Date,tokenLastError:null}})}),this.changed(),this.settings()}async clearTokenSettings(){return await this.credentials.delete(a.CREDENTIALS.apnsTokenPrivateKey,async A=>{await A.pushNotificationSettings.upsert({where:{id:h},create:{id:h},update:{tokenTeamId:null,tokenKeyId:null,tokenPrivateKeyFingerprint:null,tokenConfiguredAt:null,tokenLastUsedAt:null,tokenLastError:null}})}),this.changed(),this.settings()}async addCertificateCredential(A){let e=Buffer.from(A.p12Base64,"base64");if(!e.length||e.length>0x1400000)throw Error("The .p12 file is empty or larger than 20 MiB");if(!["SANDBOX","PRODUCTION"].includes(A.environment))throw Error("Certificate environment is invalid");let r=w(e,A.passphrase),n=(0,t.randomUUID)();return await this.credentials.setJson((0,a.apnsCertificateCredential)(n),{p12Base64:A.p12Base64,passphrase:A.passphrase},async e=>{await e.apnsCertificateCredential.create({data:{id:n,name:f(A.name,"Credential name",100),topic:f(A.topic,"Topic",255),environment:A.environment,fingerprint:r.fingerprint,expiresAt:r.expiresAt,lastTestedAt:new Date}})}),this.changed(),this.settings()}async deleteCertificateCredential(A){return await this.credentials.delete((0,a.apnsCertificateCredential)(A),async e=>{await e.apnsCertificateCredential.delete({where:{id:A}})}),this.changed(),!0}async retestCertificateCredential(A){let e=await (0,i.getPrismaClient)();if(!await e.apnsCertificateCredential.findUnique({where:{id:A}}))throw Error("APNs certificate credential not found");let t=await this.credentials.getJson((0,a.apnsCertificateCredential)(A));if(!t)throw Error("APNs certificate credential is not configured");try{let r=w(Buffer.from(t.p12Base64,"base64"),t.passphrase);await e.apnsCertificateCredential.update({where:{id:A},data:{fingerprint:r.fingerprint,expiresAt:r.expiresAt,lastTestedAt:new Date,lastError:null}})}catch(t){throw await e.apnsCertificateCredential.update({where:{id:A},data:{lastTestedAt:new Date,lastError:t instanceof Error?t.message:String(t)}}),this.changed(),t}return this.changed(),this.settings()}async channels(){return(await (0,i.getPrismaClient)()).apnsBroadcastChannel.findMany({orderBy:{createdAt:"desc"}})}async tokenAuthentication(A="APNs token authentication is not configured"){let e=await this.rawSettings();if(!e.tokenTeamId||!e.tokenKeyId)throw Error(A);let t=await this.credentials.getText(a.CREDENTIALS.apnsTokenPrivateKey);if(!t)throw Error(A);return{kind:"TOKEN",teamId:e.tokenTeamId,keyId:e.tokenKeyId,privateKey:t}}async createChannel(A){if(!["SANDBOX","PRODUCTION"].includes(A.environment))throw Error("Channel environment is invalid");if(!["NO_STORAGE","MOST_RECENT"].includes(A.storagePolicy))throw Error("Channel storage policy is invalid");let e=f(A.bundleId,"Bundle ID",255),r=A.channelId?null:await this.tokenAuthentication("APNs token authentication is required for broadcast channels"),n=A.channelId?.trim()||await this.client.createBroadcastChannel({environment:A.environment,authentication:r,bundleId:e,storagePolicy:A.storagePolicy}),a=await (0,i.getPrismaClient)(),s=await a.apnsBroadcastChannel.create({data:{id:(0,t.randomUUID)(),channelId:n,bundleId:e,environment:A.environment,storagePolicy:A.storagePolicy}});return this.changed(),s}async deleteChannel(A){let e=await (0,i.getPrismaClient)(),t=await e.apnsBroadcastChannel.findUnique({where:{id:A}});if(!t)throw Error("Broadcast channel not found");let r=await this.tokenAuthentication("APNs token authentication is required for broadcast channels");return await this.client.deleteBroadcastChannel({environment:t.environment,authentication:r,bundleId:t.bundleId,channelId:t.channelId}),await e.apnsBroadcastChannel.delete({where:{id:A}}),this.changed(),!0}async presets(){return(await (0,i.getPrismaClient)()).pushNotificationPreset.findMany({orderBy:{updatedAt:"desc"}})}async preset(A){return(await (0,i.getPrismaClient)()).pushNotificationPreset.findUnique({where:{id:A}})}async savePreset(A,e,r){let n=c(e),a=await (0,i.getPrismaClient)(),s=r?await a.pushNotificationPreset.update({where:{id:r},data:{name:f(A,"Preset name",100),editorJson:JSON.stringify(n.editor)}}):await a.pushNotificationPreset.create({data:{id:(0,t.randomUUID)(),name:f(A,"Preset name",100),editorJson:JSON.stringify(n.editor)}});return this.changed(),s}async deletePreset(A){let e=await (0,i.getPrismaClient)();return await e.pushNotificationPreset.delete({where:{id:A}}),this.changed(),!0}async history(A=100){return(await (0,i.getPrismaClient)()).pushNotificationBatch.findMany({include:{deliveries:{orderBy:{createdAt:"asc"}}},orderBy:{createdAt:"desc"},take:Math.max(1,Math.min(A,200))})}async historyItem(A){return(await (0,i.getPrismaClient)()).pushNotificationBatch.findUnique({where:{id:A},include:{deliveries:{orderBy:{createdAt:"asc"}}}})}async saveDraft(A){let e=c(A),r=await (0,i.getPrismaClient)(),n=await r.pushNotificationBatch.create({data:{id:(0,t.randomUUID)(),requestId:(0,t.randomUUID)(),status:"DRAFT",editorJson:JSON.stringify(e.editor),payloadJson:JSON.stringify(e.payload),headersJson:JSON.stringify(e.headers),targetMode:"DRAFT"},include:{deliveries:!0}});return this.changed(),n}async deleteHistory(A){let e=await (0,i.getPrismaClient)();if(1!==(await e.pushNotificationBatch.deleteMany({where:{id:A,status:{notIn:["QUEUED","SENDING"]}}})).count){if(!await e.pushNotificationBatch.findUnique({where:{id:A},select:{status:!0}}))throw Error("Push history item not found");throw Error("Queued or sending push notifications cannot be deleted")}return this.changed(),!0}async clearHistory(){let A=await (0,i.getPrismaClient)(),e=await A.pushNotificationBatch.deleteMany({where:{status:{notIn:["QUEUED","SENDING"]}}});return this.changed(),e.count}async send(A){var e;if(e=A.targetMode,!B.includes(e))throw Error(`Unsupported push target mode: ${A.targetMode}`);let r=A.targetMode,n=c(A.editor),a=await (0,i.getPrismaClient)(),s=await a.pushNotificationBatch.findUnique({where:{requestId:A.requestId},include:{deliveries:!0}});if(s)return s;let o=[],g=null,C=null;if("BROADCAST"===r){if("liveactivity"!==n.editor.pushType)throw Error("Broadcast delivery is available only for Live Activities");if(!A.channelId)throw Error("Select a broadcast channel");if(!(g=await a.apnsBroadcastChannel.findUnique({where:{id:A.channelId}})))throw Error("Broadcast channel not found")}else if("DIRECT"===r){if("liveactivity"!==n.editor.pushType)throw Error("Direct-token delivery is available only for Live Activities");if(!A.directToken)throw Error("Enter a Live Activity push token");let e=A.directTokenEncoding??"HEX";if("HEX"!==e&&"BASE64"!==e)throw Error("Direct token encoding must be HEX or BASE64");let t=A.directEnvironment??"SANDBOX";if("SANDBOX"!==t&&"PRODUCTION"!==t)throw Error("Direct token environment is invalid");let r=d(A.directToken,e);C={token:r,tokenHash:D(r),environment:t}}else{let e=[...new Set(A.registrationIds??[])];if(!(o=(await a.apnsRegistration.findMany({where:{status:"ACTIVE",topic:n.headers["apns-topic"],..."DEVICES"===r?{id:{in:e}}:{}}})).filter(A=>p(A.pushTypesJson).includes(n.editor.pushType)).map(A=>({id:A.id,tokenHash:A.tokenHash,topic:A.topic,environment:A.environment}))).length)throw Error("No eligible APNs devices selected")}let Q=await a.pushNotificationBatch.create({data:{id:(0,t.randomUUID)(),requestId:A.requestId,status:"QUEUED",editorJson:JSON.stringify(n.editor),payloadJson:JSON.stringify(n.payload),headersJson:JSON.stringify(n.headers),targetMode:r,channelId:g?.id??null,recipientCount:g||C?1:o.length,deliveries:{create:g?[{id:(0,t.randomUUID)(),topic:g.bundleId,environment:g.environment}]:C?[{id:(0,t.randomUUID)(),tokenHash:C.tokenHash,topic:n.headers["apns-topic"],environment:C.environment,recipientSecret:{create:{id:(0,t.randomUUID)(),token:C.token}}}]:o.map(A=>({id:(0,t.randomUUID)(),registrationId:A.id,tokenHash:A.tokenHash,topic:A.topic,environment:A.environment}))}},include:{deliveries:!0}});return this.changed(),this.processBatch(Q.id).catch(()=>void 0),Q}async resend(A,e){let t=await (0,i.getPrismaClient)(),r=await t.pushNotificationBatch.findUnique({where:{id:A},include:{deliveries:!0}});if(!r)throw Error("Push history item not found");if("DRAFT"===r.targetMode)throw Error("Choose recipients before sending a draft");if("DIRECT"===r.targetMode)throw Error("Direct Live Activity tokens are not retained; load the item and enter the token again");return this.send({requestId:e,editor:u(r.editorJson),targetMode:r.targetMode,registrationIds:r.deliveries.map(A=>A.registrationId).filter(A=>!!A),channelId:r.channelId})}async authentication(A,e,t){let r=await (0,i.getPrismaClient)();if(A.credentialId){let n=await r.apnsCertificateCredential.findUnique({where:{id:A.credentialId}});if(!n)throw Error("APNs certificate credential not found");if(n.environment!==e||n.topic!==t)throw Error("APNs certificate does not match the target topic/environment");let i=await this.credentials.getJson((0,a.apnsCertificateCredential)(n.id));if(!i)throw Error("APNs certificate credential is not configured");return{kind:"CERTIFICATE",p12Base64:i.p12Base64,passphrase:i.passphrase,fingerprint:n.fingerprint}}if("mdm"===A.pushType)throw Error("MDM requires certificate authentication");return this.tokenAuthentication()}async failDelivery(A,e){let t=await (0,i.getPrismaClient)();await t.pushNotificationDelivery.update({where:{id:A},data:{status:"FAILED",reason:e,finishedAt:new Date}}),this.changed()}async executeDelivery(A,e,t,r,n){let a=await (0,i.getPrismaClient)();await a.pushNotificationDelivery.update({where:{id:A.id},data:{status:"SENDING",startedAt:new Date}}),this.changed();try{let i=A.registrationId?await a.apnsRegistration.findUnique({where:{id:A.registrationId}}):null,s=A.registrationId?null:await a.apnsPushRecipientSecret.findUnique({where:{deliveryId:A.id}});if(A.registrationId&&(!i||"ACTIVE"!==i.status))return void await this.failDelivery(A.id,"Registration is no longer active");if(!i&&!s&&!n)return void await this.failDelivery(A.id,"Direct recipient token expired");let o=await this.authentication(e,A.environment,A.topic),g="mdm"===e.pushType?{mdm:i?.pushMagic}:t;if("mdm"===e.pushType&&!i?.pushMagic)return void await this.failDelivery(A.id,"Registration has no MDM push magic");let C=await this.client.send({environment:A.environment,authentication:o,deviceToken:i?.token||s?.token,broadcastTopic:n?.bundleId,payload:g,headers:{...r,...n?{"apns-channel-id":n.channelId}:{}}});await this.recordResponse(A.id,i,C,"TOKEN"===o.kind),"CERTIFICATE"===o.kind&&e.credentialId&&await a.apnsCertificateCredential.updateMany({where:{id:e.credentialId},data:{lastTestedAt:new Date,lastError:200===C.status?null:`HTTP ${C.status}${C.reason?`: ${C.reason}`:""}`}})}catch(t){if(!e.credentialId&&"mdm"!==e.pushType){let A=await (0,i.getPrismaClient)();await A.pushNotificationSettings.updateMany({where:{id:h},data:{tokenLastError:t instanceof Error?t.message:String(t)}})}if(e.credentialId){let A=await (0,i.getPrismaClient)();await A.apnsCertificateCredential.updateMany({where:{id:e.credentialId},data:{lastTestedAt:new Date,lastError:t instanceof Error?t.message:String(t)}})}await this.failDelivery(A.id,t instanceof Error?t.message:String(t))}finally{await a.apnsPushRecipientSecret.deleteMany({where:{deliveryId:A.id}})}}async recordResponse(A,e,t,r){let n=await (0,i.getPrismaClient)(),a=200===t.status;if(await n.pushNotificationDelivery.update({where:{id:A},data:{status:a?"SUCCEEDED":"FAILED",responseCode:t.status,reason:t.reason,responseTimestamp:t.timestamp,apnsId:t.apnsId,attempts:t.attempts,durationMs:t.durationMs,finishedAt:new Date}}),this.changed(),r&&await n.pushNotificationSettings.updateMany({where:{id:h},data:a?{tokenLastUsedAt:new Date,tokenLastError:null}:{tokenLastError:`HTTP ${t.status}${t.reason?`: ${t.reason}`:""}`}}),!e)return;if(a)return void await n.apnsRegistration.update({where:{id:e.id},data:{lastSentAt:new Date,lastFailureReason:null}});let s=410===t.status&&"Unregistered"===t.reason,o=400===t.status&&["BadDeviceToken","DeviceTokenNotForTopic"].includes(t.reason??""),g=!t.timestamp||t.timestamp>=e.lastRegisteredAt;s&&g||o?await n.apnsRegistration.updateMany({where:{id:e.id,lastRegisteredAt:e.lastRegisteredAt},data:{status:"INVALID",invalidatedAt:new Date,lastFailureReason:t.reason,lastFailureAt:new Date}}):await n.apnsRegistration.update({where:{id:e.id},data:{lastFailureReason:t.reason,lastFailureAt:new Date}})}async processBatch(A){let e=await (0,i.getPrismaClient)();if(1===(await e.pushNotificationBatch.updateMany({where:{id:A,status:"QUEUED"},data:{status:"SENDING",startedAt:new Date,error:null}})).count){this.activeBatchIds.add(A);try{let t=await e.pushNotificationBatch.findUnique({where:{id:A},include:{deliveries:{where:{status:"QUEUED"}}}});if(!t)return;let r=u(t.editorJson),n=u(t.payloadJson),i=u(t.headersJson),a=t.channelId?await e.apnsBroadcastChannel.findUnique({where:{id:t.channelId}}):null,s=0,o=Array.from({length:Math.min(16,t.deliveries.length)},async()=>{for(;s<t.deliveries.length;){let A=t.deliveries[s++];if(!A)return;await this.executeDelivery(A,r,n,i,a)}});await Promise.all(o);let g=await e.pushNotificationDelivery.findMany({where:{batchId:A},select:{status:!0}}),C=g.filter(A=>"SUCCEEDED"===A.status).length,Q=g.length-C;await e.pushNotificationBatch.update({where:{id:A},data:{status:Q?C?"PARTIAL":"FAILED":"SUCCEEDED",successCount:C,failureCount:Q,finishedAt:new Date}}),this.changed()}finally{this.activeBatchIds.delete(A)}}}async recover(){if(!this.recoveryStarted){this.recoveryStarted=!0;try{let A=await (0,i.getPrismaClient)();for(;;){let e=new Date(Date.now()-12e4),t=await A.pushNotificationBatch.findMany({where:{OR:[{status:"QUEUED"},{status:"SENDING",startedAt:{lt:e}}]},orderBy:{createdAt:"asc"},take:100});if(!t.length)break;let r=[];for(let n of t)if(!this.activeBatchIds.has(n.id)){if("SENDING"===n.status){await A.pushNotificationDelivery.updateMany({where:{batchId:n.id,status:"SENDING"},data:{status:"QUEUED",startedAt:null}});let t=await A.pushNotificationBatch.updateMany({where:{id:n.id,status:"SENDING",startedAt:{lt:e}},data:{status:"QUEUED",startedAt:null}});if(1!==t.count)continue}r.push(n.id)}if(!r.length)break;await Promise.all(r.map(A=>this.processBatch(A)))}}finally{this.recoveryStarted=!1}}}}],308810),A.s([],282790)},464841,218202,220629,689245,906148,A=>{"use strict";var e=A.i(135160);let t=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function r(A){return function A(e){return null===e?"null":Array.isArray(e)?`[${e.map(A).join(",")}]`:"object"==typeof e?`{${Object.entries(e).sort(([A],[e])=>A.localeCompare(e)).map(([e,t])=>`${JSON.stringify(e)}:${A(t)}`).join(",")}}`:JSON.stringify(e)}(A)}function n(A){return t.test(A)?`.${A}`:`[${JSON.stringify(A)}]`}function i(A,e){let t={},r=(A,e)=>{if(e&&"object"==typeof e&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype){let i=Object.entries(e);if(0===i.length)t[A]=e;else for(let[e,t]of i)r(`${A}${n(e)}`,t)}else t[A]=e};for(let[t,i]of Object.entries(e))r(`${A}${n(t)}`,i);return t}function a(A){let e={default:A.defaultParameters,additional:A.additionalParameters};return{...{source:A.entryType,time:A.clientTime,receivedAt:A.receivedAt,deviceIp:A.deviceIp,message:A.message,level:A.level,category:A.category,eventName:A.eventName,eventKind:A.eventKind,levelKind:A.level??A.eventKind,screenName:A.screenName,buildId:A.buildId,sessionId:A.sessionId,attributes:A.attributes,defaultParameters:A.defaultParameters,additionalParameters:A.additionalParameters,parameters:e,detail:"CONSOLE"===A.entryType?A.message:`${A.eventName??""}${A.screenName?` (${A.screenName})`:""}`},...i("attributes",A.attributes),...i("defaultParameters",A.defaultParameters),...i("additionalParameters",A.additionalParameters)}}function s(A){return null==A?"":"string"==typeof A?A:"number"==typeof A||"boolean"==typeof A?String(A):r(A)}function o(A){return Object.entries(a(A)).flatMap(([A,e])=>[A,s(e)]).join("\n")}let g=["CONSOLE","ANALYTICS","UNIFIED"],C=["TEXT","GLOB","REGEX"],Q=["CONTAINS","DOES_NOT_CONTAIN","IS","IS_NOT","MATCHES_GLOB","MATCHES_REGEX","NO_REGEX_MATCH","IS_EMPTY","IS_NOT_EMPTY"],l={CONSOLE:["time","level","category","message","buildId","sessionId"],ANALYTICS:["time","eventKind","eventName","screenName","parameters","buildId","sessionId"],UNIFIED:["time","source","levelKind","detail","buildId","sessionId"]},I=["gray","stone","red","rose","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink"];A.s(["DEFAULT_TELEMETRY_COLUMNS",0,l,"TELEMETRY_COLORS",0,I,"TELEMETRY_FILTER_OPERATORS",0,Q,"TELEMETRY_SEARCH_MODES",0,C,"TELEMETRY_VIEWS",0,g],218202);let d=new Map;function E(A,t,r){let n;if(t.length>1024)throw Error("Pattern must not exceed 1024 characters");if(!C.includes(A))throw Error("Unknown search mode");let i=`${A}\u0000${r?"1":"0"}\u0000${t}`,a=d.get(i);if(a)return a;if("TEXT"===A){let A=r?t:t.toLocaleLowerCase();n=e=>(r?e:e.toLocaleLowerCase()).includes(A)}else{let i="GLOB"===A?`^${function(A){let e="";for(let t=0;t<A.length;t+=1){let r=A[t];if("*"===r)e+=".*";else if("?"===r)e+=".";else if("["===r){let r=A.indexOf("]",t+1);if(-1===r)throw Error("Invalid glob pattern: missing ]");{let n=A.slice(t+1,r).replace(/^!/,"^");e+=`[${n}]`,t=r}}else e+=r.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}return e}(t)}$`:t,a=r?"su":"isu",s="REGEX"===A?new e.RE2(i,a):new RegExp(i,a);n=A=>s.test(A)}return d.set(i,n),d.size>100&&d.delete(d.keys().next().value),n}function c(A){return null==A||""===A||Array.isArray(A)&&0===A.length||"object"==typeof A&&!Array.isArray(A)&&0===Object.keys(A).length}function h(A){return"CONSOLE"===A?["CONSOLE"]:"ANALYTICS"===A?["ANALYTICS"]:["CONSOLE","ANALYTICS"]}function B(A,e){return"SEPARATOR"!==A.entryType&&!!h(e.view).includes(A.entryType)&&(!e.search||!!E(e.searchMode??"TEXT",e.search,!0===e.caseSensitive)(o(A)))&&function(A,e){if(!e)return!0;let t=a(A);return Object.entries(e).every(([A,e])=>0===e.length||e.includes(s(t[A])))}(A,e.quickFilters)&&function(A,e){if(!e?.conditions.length)return!0;let t=e.conditions.filter(e=>!e.sources?.length||"SEPARATOR"!==A.entryType&&e.sources.includes(A.entryType));if(0===t.length)return!0;let r=a(A),n=t.map(A=>(function(A,e){if(!Q.includes(e.operator))throw Error("Unknown filter operator");let t=A[e.field];if("IS_EMPTY"===e.operator)return c(t);if("IS_NOT_EMPTY"===e.operator)return!c(t);let r=s(t),n=e.value??"",i=!0===e.caseSensitive,a=i?r:r.toLocaleLowerCase(),o=i?n:n.toLocaleLowerCase();if("CONTAINS"===e.operator)return a.includes(o);if("DOES_NOT_CONTAIN"===e.operator)return!a.includes(o);if("IS"===e.operator)return a===o;if("IS_NOT"===e.operator)return a!==o;if("MATCHES_GLOB"===e.operator)return E("GLOB",n,i)(r);let g=E("REGEX",n,i)(r);return"MATCHES_REGEX"===e.operator?g:!g})(r,A));return"ANY"===e.mode?n.some(Boolean):n.every(Boolean)}(A,e.advancedFilter)}function D(A){for(let e of(A.search&&E(A.searchMode??"TEXT",A.search,!0===A.caseSensitive),A.advancedFilter?.conditions??[]))["MATCHES_GLOB","MATCHES_REGEX","NO_REGEX_MATCH"].includes(e.operator)&&E("MATCHES_GLOB"===e.operator?"GLOB":"REGEX",e.value??"",!0===e.caseSensitive)}var w=A.i(666680),u=A.i(243783);A.i(805422);var p=A.i(661983),f=A.i(660526);let y="default";function M(A){try{let e=JSON.parse(A);return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}catch{return{}}}function m(A){return{id:A.id,entryType:A.entryType,clientTime:A.clientTime.toISOString(),receivedAt:A.receivedAt.toISOString(),deviceIp:A.deviceIp,message:A.message,level:A.level,category:A.category,eventName:A.eventName,eventKind:A.eventKind,screenName:A.screenName,buildId:A.buildId,sessionId:A.sessionId,attributes:M(A.attributesJson),defaultParameters:M(A.defaultParametersJson),additionalParameters:M(A.additionalParametersJson),highlightColor:A.highlightColor,separatorKind:A.separatorKind,separatorName:A.separatorName}}function N(A){if(!g.includes(A))throw Error("Unknown telemetry view");return A}function S(A){let e=A.trim();if(!e||e.length>100)throw Error("Name must contain 1-100 characters");return{name:e,normalizedName:e.toLocaleLowerCase()}}function k(A){let e;try{e=new URL(A.trim())}catch{throw Error("Telemetry URL must be a valid HTTP(S) origin")}if(!["http:","https:"].includes(e.protocol)||e.username||e.password||"/"!==e.pathname&&""!==e.pathname||e.search||e.hash)throw Error("Telemetry URL must be an HTTP(S) origin without a path, credentials, query, or fragment");return e.origin}function U(A){return A?.trim()?k(A):null}function F(A){if(!A?.trim())return null;try{let e=new URL(A.trim());return["http:","https:"].includes(e.protocol)?e.origin:null}catch{return null}}function R(A){if(!A)return null;try{let e=JSON.parse(Buffer.from(A,"base64url").toString("utf8"));if(e&&"object"==typeof e&&"string"==typeof e.clientTime&&"string"==typeof e.receivedAt&&"string"==typeof e.id&&Number.isFinite(Date.parse(e.clientTime))&&Number.isFinite(Date.parse(e.receivedAt)))return e}catch{}throw Error("Invalid telemetry cursor")}function T(A){let e=new Date(A.clientTime),t=new Date(A.receivedAt);return{OR:[{clientTime:{lt:e}},{clientTime:e,receivedAt:{lt:t}},{clientTime:e,receivedAt:t,id:{lt:A.id}}]}}function b(A){return Buffer.from(JSON.stringify({clientTime:A.clientTime,receivedAt:A.receivedAt,id:A.id})).toString("base64url")}function H(A,e){return A.clientTime!==e.clientTime?A.clientTime<e.clientTime:A.receivedAt!==e.receivedAt?A.receivedAt<e.receivedAt:A.id<e.id}function L(A){return!!(A.search||Object.values(A.quickFilters??{}).some(A=>A.length)||A.advancedFilter?.conditions.length)}function O(A){return{entryType:{in:h(A)}}}let G={source:{name:"entryType",nullable:!1},deviceIp:{name:"deviceIp",nullable:!0},message:{name:"message",nullable:!0},level:{name:"level",nullable:!0},category:{name:"category",nullable:!0},eventName:{name:"eventName",nullable:!0},eventKind:{name:"eventKind",nullable:!0},screenName:{name:"screenName",nullable:!0},buildId:{name:"buildId",nullable:!0},sessionId:{name:"sessionId",nullable:!0}};function J(A){let e=[...new Set(A.map(A=>A.trim()).filter(Boolean))];if(0===e.length||e.length>100||e.some(A=>A.length>512))throw Error("Columns must contain 1-100 valid column identifiers");return JSON.stringify(e)}function v(A,e){try{let e=JSON.parse(A);if(Array.isArray(e)&&e.every(A=>"string"==typeof A)&&e.length)return e}catch{}return l[e]}A.s(["TelemetryService",0,class{subscribe(){return p.agentEventBus.iterate(p.TELEMETRY_CHANGED_TOPIC)}subscribeSettings(){return p.agentEventBus.iterate(p.TELEMETRY_SETTINGS_CHANGED_TOPIC)}publish(A,e){p.agentEventBus.publish(p.TELEMETRY_CHANGED_TOPIC,{ids:A,reason:e})}notifyChange(A,e){this.publish(A,e)}async rawSettings(){return(await (0,u.getPrismaClient)()).telemetrySettings.upsert({where:{id:y},create:{id:y},update:{}})}async settings(A={}){let[e,t]=await Promise.all([this.rawSettings(),Promise.resolve(function(A={}){let e,t=F(A.requestOrigin),r=(A.localOrigins??function(){let A=Number(process.env.PORT??3e3),e=Number.isInteger(A)&&A>0&&A<=65535?A:3e3;var t=(0,f.networkInterfaces)();let r=new Set;for(let A of Object.values(t))for(let t of A??[])t&&!t.internal&&("IPv4"===t.family?r.add(`http://${t.address}:${e}`):"IPv6"!==t.family||t.address.toLowerCase().startsWith("fe80:")||r.add(`http://[${t.address}]:${e}`));return[...r]}()).flatMap(A=>{try{return[k(A)]}catch{return[]}}),n=F(A.publicBaseUrl??process.env.PUBLIC_BASE_URL),i=!!t&&("localhost"===(e=new URL(t).hostname.toLowerCase().replace(/^\[|\]$/g,""))||"::1"===e||e.endsWith(".local")||/^127\./.test(e)||/^10\./.test(e)||/^192\.168\./.test(e)||/^172\.(1[6-9]|2\d|3[01])\./.test(e)),a=t&&i?t:r[0]??t??"http://127.0.0.1:3000",s=n??t??a;return{local:a,remote:s}}(A))]);return{localBaseUrlOverride:e.localBaseUrlOverride,remoteBaseUrlOverride:e.remoteBaseUrlOverride,consoleCollectionEnabled:e.consoleCollectionEnabled,analyticsCollectionEnabled:e.analyticsCollectionEnabled,detectedLocalBaseUrl:t.local,detectedRemoteBaseUrl:t.remote,effectiveLocalBaseUrl:e.localBaseUrlOverride??t.local,effectiveRemoteBaseUrl:e.remoteBaseUrlOverride??t.remote,updatedAt:e.updatedAt.toISOString()}}async saveSettings(A,e={}){let t=await (0,u.getPrismaClient)(),r=await this.rawSettings(),n=await t.telemetrySettings.update({where:{id:y},data:{localBaseUrlOverride:void 0===A.localBaseUrlOverride?r.localBaseUrlOverride:U(A.localBaseUrlOverride),remoteBaseUrlOverride:void 0===A.remoteBaseUrlOverride?r.remoteBaseUrlOverride:U(A.remoteBaseUrlOverride),consoleCollectionEnabled:A.consoleCollectionEnabled??r.consoleCollectionEnabled,analyticsCollectionEnabled:A.analyticsCollectionEnabled??r.analyticsCollectionEnabled}});return p.agentEventBus.publish(p.TELEMETRY_SETTINGS_CHANGED_TOPIC,{updatedAt:n.updatedAt.toISOString()}),this.settings(e)}async buildSettings(A,e={}){let t=await this.settings(e),r="SIMULATOR"===A?t.effectiveLocalBaseUrl:t.effectiveRemoteBaseUrl;return{localBaseUrl:t.effectiveLocalBaseUrl,remoteBaseUrl:t.effectiveRemoteBaseUrl,selectedBaseUrl:r,consoleLogsUrl:`${r}/api/telemetry/console-logs`,analyticsEventsUrl:`${r}/api/telemetry/analytics-events`,consoleCollectionEnabled:t.consoleCollectionEnabled,analyticsCollectionEnabled:t.analyticsCollectionEnabled}}async ingestConsole(A,e){if(!(await this.rawSettings()).consoleCollectionEnabled)return{collected:!1,items:[]};let t=await (0,u.getPrismaClient)(),r=new Date,n=A.map(A=>{let t={id:(0,w.randomUUID)(),entryType:"CONSOLE",clientTime:new Date(A.time),receivedAt:r,deviceIp:e,message:A.message,level:A.level,category:A.category,buildId:A.buildId,sessionId:A.sessionId,attributesJson:JSON.stringify(A.attributes),searchText:""},n=m({...t,eventName:null,eventKind:null,screenName:null,defaultParametersJson:"{}",additionalParametersJson:"{}",highlightColor:null,separatorKind:null,separatorName:null});return{...t,searchText:o(n)}});return await t.telemetryEntry.createMany({data:n}),this.publish(n.map(({id:A})=>A),"INGESTED"),{collected:!0,items:n.map(({id:A})=>({id:A,receivedAt:r.toISOString(),deviceIp:e}))}}async ingestAnalytics(A,e){if(!(await this.rawSettings()).analyticsCollectionEnabled)return{collected:!1,items:[]};let t=await (0,u.getPrismaClient)(),r=new Date,n=A.map(A=>{let t={id:(0,w.randomUUID)(),entryType:"ANALYTICS",clientTime:new Date(A.time),receivedAt:r,deviceIp:e,eventName:A.eventName,eventKind:A.kind,screenName:A.screenName,buildId:A.buildId,sessionId:A.sessionId,defaultParametersJson:JSON.stringify(A.defaultParameters),additionalParametersJson:JSON.stringify(A.additionalParameters),searchText:""},n=m({...t,message:null,level:null,category:null,attributesJson:"{}",highlightColor:null,separatorKind:null,separatorName:null});return{...t,searchText:o(n)}});return await t.telemetryEntry.createMany({data:n}),this.publish(n.map(({id:A})=>A),"INGESTED"),{collected:!0,items:n.map(({id:A})=>({id:A,receivedAt:r.toISOString(),deviceIp:e}))}}async scan(A,e,t=1e3){let r=await (0,u.getPrismaClient)(),n=null;for(;;){let i=await r.telemetryEntry.findMany({where:n?{AND:[A,{OR:[{clientTime:{lt:n.clientTime}},{clientTime:n.clientTime,receivedAt:{lt:n.receivedAt}},{clientTime:n.clientTime,receivedAt:n.receivedAt,id:{lt:n.id}}]}]}:A,orderBy:[{clientTime:"desc"},{receivedAt:"desc"},{id:"desc"}],take:t});for(let A of i)if(await e(m(A))===!1)return;if(i.length<t)break;n=i.at(-1)}}async timeline(A){let e=N(A.view);D(A);let t=Math.min(500,Math.max(1,A.first??200)),r=R(A.after),n=await (0,u.getPrismaClient)(),i=await n.telemetryEntry.count({where:O(e)}),a=L(A);if(!a){let A=[],n=0,a=!1,s=null,o=!1,g={entryType:{in:[...h(e),"SEPARATOR"]}};return(await this.scan(r?{AND:[g,T(r)]}:g,e=>{if("SEPARATOR"===e.entryType){o&&A.push(e),o=!1;return}if(n<t){A.push(e),n+=1,s=e,o=!0;return}return a=!0,!1},Math.min(1e3,t+1)),s)?{items:A,nextCursor:a?b(s):null,matchingCount:i,totalCount:i}:{items:[],nextCursor:null,matchingCount:i,totalCount:i}}let s=[],o=0,g=!1,C=0,Q=null,l=!1,I=!1,d=function(A){let e=[];for(let[t,r]of(A.search&&(A.searchMode??"TEXT")==="TEXT"&&!0===A.caseSensitive&&e.push({searchText:{contains:A.search}}),Object.entries(A.quickFilters??{}))){if(!r.length)continue;let A=G[t];if(!A)continue;let n=function(A,e){let t=[...new Set(e)],r=t.filter(Boolean),n=[];return(r.length&&n.push({[A.name]:{in:r}}),t.includes("")&&(n.push({[A.name]:""}),A.nullable&&n.push({[A.name]:null})),0===n.length)?null:1===n.length?n[0]:{OR:n}}(A,r);n&&e.push(n)}if(A.advancedFilter?.mode==="ALL")for(let t of A.advancedFilter.conditions){if(t.sources?.length||!0!==t.caseSensitive)continue;let A=G[t.field],r=t.value??"";A&&r&&("IS"===t.operator?e.push({[A.name]:r}):"CONTAINS"===t.operator&&e.push({[A.name]:{contains:r}}))}return e.length?1===e.length?e[0]:{AND:e}:null}(A);return(await this.scan(d?{OR:[{entryType:"SEPARATOR"},{AND:[O(e),d]}]}:{entryType:{in:[...h(e),"SEPARATOR"]}},e=>{if("SEPARATOR"===e.entryType){(!r||H(e,r))&&(!a&&!g||a&&l&&!I)&&s.push(e),l=!1,I=!1;return}!B(e,A)||(o+=1,(!r||H(e,r))&&(C<t?(s.push(e),C+=1,Q=e,l=!0):(g=!0,I=!0)))}),Q)?{items:s,nextCursor:g?b(Q):null,matchingCount:o,totalCount:i}:{items:[],nextCursor:null,matchingCount:o,totalCount:i}}async entries(A){let e=await (0,u.getPrismaClient)(),t=[...new Set(A)].slice(0,1e3);return(await e.telemetryEntry.findMany({where:{id:{in:t}}})).map(m)}async entry(A,e){let t=N(e),r=(await this.entries([A]))[0]??null;if(!r)return null;if("SEPARATOR"===r.entryType||!h(t).includes(r.entryType))throw Error(`Telemetry entry ${A} does not belong to ${t}`);return r}async latestSeparator(){let A=await (0,u.getPrismaClient)(),e=await A.telemetryEntry.findFirst({where:{entryType:"SEPARATOR"},orderBy:[{clientTime:"desc"},{receivedAt:"desc"},{id:"desc"}]});return e?m(e):null}async separators(A){let e=Math.min(500,Math.max(1,A.first??100)),t=R(A.after),r=[{entryType:"SEPARATOR"}];A.kind?.trim()&&r.push({separatorKind:A.kind.trim()}),A.name?.trim()&&r.push({separatorName:{contains:A.name.trim()}}),A.buildId?.trim()&&r.push({buildId:A.buildId.trim()}),t&&r.push(T(t));let n=await (0,u.getPrismaClient)(),i=await n.telemetryEntry.findMany({where:{AND:r},orderBy:[{clientTime:"desc"},{receivedAt:"desc"},{id:"desc"}],take:e+1}),a=i.length>e,s=i.slice(0,e).map(m);return{items:s,nextCursor:a&&s.length?b(s.at(-1)):null}}async timelineSinceLatestSeparator(A){let e,t,r=N(A.view);D(A);let n=Math.min(500,Math.max(1,A.first??200)),i=R(A.after),a=await this.latestSeparator(),s=a?{clientTime:a.clientTime,receivedAt:a.receivedAt,id:a.id}:null,o=L(A),g=s?{AND:[O(r),(e=new Date(s.clientTime),{OR:[{clientTime:{gt:e}},{clientTime:e,receivedAt:{gt:t=new Date(s.receivedAt)}},{clientTime:e,receivedAt:t,id:{gt:s.id}}]})]}:O(r);if(!o){let A=await (0,u.getPrismaClient)(),e=await A.telemetryEntry.count({where:g}),t=[],r=!1,s=null;return await this.scan(i?{AND:[g,T(i)]}:g,A=>{if(t.length<n){t.push(A),s=A;return}return r=!0,!1},Math.min(1e3,n+1)),{separator:a,items:t,nextCursor:r&&s?b(s):null,matchingCount:e,totalCount:e}}let C=[],Q=0,l=0,I=!1,d=null;return await this.scan(g,e=>{l+=1,!B(e,A)||(Q+=1,(!i||H(e,i))&&(C.length<n?(C.push(e),d=e):I=!0))}),{separator:a,items:C,nextCursor:I&&d?b(d):null,matchingCount:Q,totalCount:l}}async facets(A){let e=N(A),t="CONSOLE"===e?["level","category","deviceIp","buildId","sessionId"]:"ANALYTICS"===e?["eventKind","eventName","screenName","deviceIp","buildId","sessionId"]:["source","level","eventKind","deviceIp","buildId","sessionId"],r=Object.fromEntries(t.map(A=>[A,new Set]));return await this.scan(O(e),A=>{let n=a(A);for(let A of t){let e=n[A];null!=e&&""!==String(e)&&r[A].add(String(e))}"UNIFIED"===e&&r.source.add(A.entryType)}),Object.fromEntries(Object.entries(r).map(([A,e])=>[A,[...e].sort((A,e)=>A.localeCompare(e))]))}async fields(A){let e=N(A),t=new Set;return await this.scan(O(e),A=>{for(let e of Object.keys(a(A)))t.add(e)}),[...t].sort((A,e)=>A.localeCompare(e))}async addSeparator(A){let e=A?.trim()||null;if(e&&e.length>100)throw Error("Separator name must not exceed 100 characters");let t=await (0,u.getPrismaClient)(),r=await t.telemetryEntry.create({data:{id:(0,w.randomUUID)(),entryType:"SEPARATOR",clientTime:new Date,receivedAt:new Date,separatorKind:"MANUAL",separatorName:e}});return this.publish([r.id],"SEPARATOR_ADDED"),m(r)}async addBuildSeparator(A){let e=await (0,u.getPrismaClient)(),t=await e.telemetryEntry.upsert({where:{separatorKind_buildId:{separatorKind:"BUILD",buildId:A.buildId}},create:{id:(0,w.randomUUID)(),entryType:"SEPARATOR",clientTime:A.clientTime??new Date,receivedAt:new Date,separatorKind:"BUILD",separatorName:A.name.slice(0,100),buildId:A.buildId},update:{}});return this.publish([t.id],"BUILD_SEPARATOR_ADDED"),m(t)}async highlight(A,e){if(null!==e&&!I.includes(e))throw Error("Unknown telemetry highlight color");let t=await (0,u.getPrismaClient)();if("SEPARATOR"===(await t.telemetryEntry.findUniqueOrThrow({where:{id:A}})).entryType)throw Error("Separators cannot be highlighted");let r=await t.telemetryEntry.update({where:{id:A},data:{highlightColor:e}});return this.publish([A],"HIGHLIGHT_CHANGED"),m(r)}selectionRanges(A){return(Array.isArray(A.ranges)?A.ranges.slice(0,500):[]).map(A=>{if(!A||"object"!=typeof A)throw Error("Invalid telemetry selection range");let e=A.startTime?Date.parse(A.startTime):null,t=A.endTime?Date.parse(A.endTime):null;if(null!==e&&!Number.isFinite(e)||null!==t&&!Number.isFinite(t)||null!==e&&null!==t&&e>=t)throw Error("Invalid telemetry selection range");return{start:e,end:t,includeSeparators:!0===A.includeSeparators}})}async selectionIds(A){let e=new Set((Array.isArray(A.ids)?A.ids:[]).filter(A=>"string"==typeof A).slice(0,1e5)),t=new Set((Array.isArray(A.excludedIds)?A.excludedIds:[]).filter(A=>"string"==typeof A).slice(0,1e5));if(!A.query){for(let A of t)e.delete(A);return[...e]}if("object"!=typeof A.query||Array.isArray(A.query))throw Error("Invalid telemetry selection query");N(A.query.view),D(A.query);let r=this.selectionRanges(A);return await this.scan(A.includeSeparators||r.some(A=>A.includeSeparators)?{entryType:{in:[...h(A.query.view),"SEPARATOR"]}}:O(A.query.view),n=>{let i=Date.parse(n.clientTime),a=r.filter(A=>(null===A.start||i>=A.start)&&(null===A.end||i<A.end));if((!(r.length>0)||0!==a.length)&&!t.has(n.id)){if("SEPARATOR"===n.entryType){(A.includeSeparators||a.some(A=>A.includeSeparators))&&e.add(n.id);return}B(n,A.query)&&e.add(n.id)}}),[...e]}async clearSelected(A){let e=await this.selectionIds(A);if(!e.length)return 0;let t=await (0,u.getPrismaClient)(),r=0;for(let A=0;A<e.length;A+=500)r+=(await t.telemetryEntry.deleteMany({where:{id:{in:e.slice(A,A+500)}}})).count;return this.publish([],"CLEARED"),r}async clearAll(A,e=!1){let t=N(A),r=await (0,u.getPrismaClient)(),n=await r.telemetryEntry.deleteMany({where:e?{entryType:{in:[...h(t),"SEPARATOR"]}}:O(t)});return this.publish([],e?"CLEARED_WITH_SEPARATORS":"CLEARED"),n.count}async clearBeforeLatestSeparator(A,e=!1){let t=N(A),r=await this.latestSeparator();if(!r)return 0;let n=await (0,u.getPrismaClient)(),i=await n.telemetryEntry.deleteMany({where:{AND:[e?{entryType:{in:[...h(t),"SEPARATOR"]}}:O(t),T({clientTime:r.clientTime,receivedAt:r.receivedAt,id:r.id})]}});return this.publish([],"CLEARED_BEFORE_SEPARATOR"),i.count}async clearScoped(A){let e=N(A.view);if("ALL"===A.scope)return this.clearAll(e,!!A.includeSeparators);if("BEFORE_LATEST_SEPARATOR"===A.scope)return this.clearBeforeLatestSeparator(e,!!A.includeSeparators);if("MATCHING"===A.scope){if(!A.query)throw Error("A matching query is required");return this.clearSelected({query:{...A.query,view:e}})}let t=[...new Set(A.ids??[])].slice(0,1e3);if(!t.length)throw Error("At least one telemetry entry ID is required");let r=await (0,u.getPrismaClient)(),n=await r.telemetryEntry.findMany({where:{id:{in:t},entryType:{in:[...h(e),"SEPARATOR"]}},select:{id:!0}});if(!n.length)return 0;let i=await r.telemetryEntry.deleteMany({where:{id:{in:n.map(({id:A})=>A)}}});return this.publish([],"CLEARED"),i.count}async viewSettings(A){let e=N(A),t=await (0,u.getPrismaClient)(),r=await t.telemetryViewSettings.upsert({where:{view:e},create:{id:e,view:e,columnsJson:JSON.stringify(l[e])},update:{}});return{view:e,columns:v(r.columnsJson,e),timeFormat:"24"===r.timeFormat?"24":"12",activeColumnPresetId:r.activeColumnPresetId,activeSavedFilterId:r.activeSavedFilterId}}async saveViewSettings(A){let e=N(A.view);if(A.timeFormat&&!["12","24"].includes(A.timeFormat))throw Error("Unknown time format");let t=await this.viewSettings(e),r=await (0,u.getPrismaClient)();return await r.telemetryViewSettings.upsert({where:{view:e},create:{id:e,view:e,columnsJson:J(A.columns??t.columns),timeFormat:A.timeFormat??t.timeFormat,activeColumnPresetId:A.activeColumnPresetId??null,activeSavedFilterId:A.activeSavedFilterId??null},update:{columnsJson:A.columns?J(A.columns):void 0,timeFormat:A.timeFormat??void 0,activeColumnPresetId:void 0===A.activeColumnPresetId?void 0:A.activeColumnPresetId,activeSavedFilterId:void 0===A.activeSavedFilterId?void 0:A.activeSavedFilterId}}),this.viewSettings(e)}async columnPresets(A){let e=N(A),t=await (0,u.getPrismaClient)();return(await t.telemetryColumnPreset.findMany({where:{view:e},orderBy:[{isDefault:"desc"},{name:"asc"}]})).map(A=>({id:A.id,view:e,name:A.name,columns:v(A.columnsJson,e),isDefault:A.isDefault,createdAt:A.createdAt.toISOString(),updatedAt:A.updatedAt.toISOString()}))}async saveColumnPreset(A){let e=N(A.view),{name:t,normalizedName:r}=S(A.name),n=await (0,u.getPrismaClient)(),i=A.id??(0,w.randomUUID)();return await n.$transaction(async n=>{A.isDefault&&await n.telemetryColumnPreset.updateMany({where:{view:e},data:{isDefault:!1}}),await n.telemetryColumnPreset.upsert({where:{id:i},create:{id:i,view:e,name:t,normalizedName:r,columnsJson:J(A.columns),isDefault:!0===A.isDefault},update:{name:t,normalizedName:r,columnsJson:J(A.columns),isDefault:A.isDefault??void 0}})}),(await this.columnPresets(e)).find(A=>A.id===i)}async deleteColumnPreset(A){let e=await (0,u.getPrismaClient)();return await e.telemetryViewSettings.updateMany({where:{activeColumnPresetId:A},data:{activeColumnPresetId:null}}),(await e.telemetryColumnPreset.deleteMany({where:{id:A}})).count>0}async savedFilters(A){let e=N(A),t=await (0,u.getPrismaClient)();return(await t.telemetrySavedFilter.findMany({where:{view:e},orderBy:{name:"asc"}})).map(A=>({id:A.id,view:e,name:A.name,definition:JSON.parse(A.definitionJson),createdAt:A.createdAt.toISOString(),updatedAt:A.updatedAt.toISOString()}))}async saveFilter(A){let e=N(A.view);D({view:e,advancedFilter:A.definition});let{name:t,normalizedName:n}=S(A.name),i=await (0,u.getPrismaClient)(),a=A.id??(0,w.randomUUID)();return await i.telemetrySavedFilter.upsert({where:{id:a},create:{id:a,view:e,name:t,normalizedName:n,definitionJson:r(A.definition)},update:{name:t,normalizedName:n,definitionJson:r(A.definition)}}),(await this.savedFilters(e)).find(A=>A.id===a)}async deleteFilter(A){let e=await (0,u.getPrismaClient)();return await e.telemetryViewSettings.updateMany({where:{activeSavedFilterId:A},data:{activeSavedFilterId:null}}),(await e.telemetrySavedFilter.deleteMany({where:{id:A}})).count>0}async exportEntries(A){D(A.query);let e=A.selection??(A.ids?.length?{ids:A.ids}:null);if(e){let A=new Set(await this.selectionIds(e)),t=[],r=[...A];for(let A=0;A<r.length;A+=500)await this.scan({id:{in:r.slice(A,A+500)}},A=>{t.push(A)});return t.sort((A,e)=>{let t=e.clientTime.localeCompare(A.clientTime);return t||e.receivedAt.localeCompare(A.receivedAt)||e.id.localeCompare(A.id)}),t}let t=[],r=!1,n=L(A.query);return await this.scan({entryType:{in:[...h(A.query.view),"SEPARATOR"]}},e=>{"SEPARATOR"===e.entryType?((!n||r)&&t.push(e),r=!1):B(e,A.query)&&(t.push(e),r=!0)}),t}}],220629);let x={type:"object",additionalProperties:{description:"Any JSON value; objects may be nested to a maximum depth of 10."},maxProperties:500},V={type:"string",minLength:1,maxLength:256},P={type:"string",format:"date-time",description:"ISO-8601 timestamp including Z or an explicit UTC offset."},Y={id:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},entryType:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},receivedAt:{type:"string",format:"date-time",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},deviceIp:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},highlightColor:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},separatorKind:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."},separatorName:{type:"string",readOnly:!0,description:"Server-owned. Any client-supplied value is ignored."}},_={type:"object",required:["collected","items"],properties:{collected:{type:"boolean"},items:{type:"array",items:{type:"object",required:["id","receivedAt","deviceIp"],properties:{id:{type:"string",format:"uuid"},receivedAt:{type:"string",format:"date-time"},deviceIp:{type:"string"}}}}}};function K(A,e,t){return{post:{tags:["Telemetry"],summary:t,description:"Unauthenticated ingestion. Accepts one record or an atomic `{ items: [...] }` batch of at most 500 records. The request body is capped at 2 MiB.",requestBody:{required:!0,content:{"application/json":{schema:{oneOf:[A,{type:"object",additionalProperties:!1,required:["items"],properties:{items:{type:"array",minItems:1,maxItems:500,items:A}}}]},examples:{single:{value:e},batch:{value:{items:[e]}}}}}},responses:{201:{description:"Records collected",content:{"application/json":{schema:_}}},202:{description:"Payload valid but collection is disabled",content:{"application/json":{schema:_}}},400:{$ref:"#/components/responses/TelemetryBadRequest"},413:{$ref:"#/components/responses/TelemetryPayloadTooLarge"},415:{$ref:"#/components/responses/TelemetryUnsupportedMediaType"},500:{$ref:"#/components/responses/InternalError"}}}}}let q={tags:[{name:"Telemetry"}],paths:{"/api/telemetry/console-logs":K({$ref:"#/components/schemas/ConsoleLogInput"},{message:"Checkout completed",time:"2026-07-20T18:30:00.000Z",level:"info",category:"checkout",buildId:"build-123",sessionId:"session-456",attributes:{durationMs:412,cache:{hit:!0}}},"Collect console logs"),"/api/telemetry/analytics-events":K({$ref:"#/components/schemas/AnalyticsEventInput"},{eventName:"checkout_completed",kind:"product",screenName:"Checkout",time:"2026-07-20T18:30:00.000Z",defaultParameters:{appVersion:"1.0"},additionalParameters:{cartItems:3},buildId:"build-123",sessionId:"session-456"},"Collect analytics events")},components:{schemas:{ConsoleLogInput:{type:"object",additionalProperties:!1,required:["message","time","level","category","buildId","sessionId","attributes"],properties:{...Y,message:{type:"string",minLength:1,maxLength:65536},time:P,level:V,category:V,buildId:V,sessionId:V,attributes:x}},AnalyticsEventInput:{type:"object",additionalProperties:!1,required:["eventName","kind","screenName","time","defaultParameters","additionalParameters","buildId","sessionId"],properties:{...Y,eventName:V,kind:V,screenName:V,time:P,defaultParameters:x,additionalParameters:x,buildId:V,sessionId:V}}},responses:{TelemetryBadRequest:{description:"Malformed or invalid telemetry payload"},TelemetryPayloadTooLarge:{description:"Request exceeds the 2 MiB limit"},TelemetryUnsupportedMediaType:{description:"Content-Type is not application/json"}}}};A.s(["telemetryOpenApiDocument",0,q],689245);var Z=A.i(750227),W=A.i(477685);let z=new Map,j=new Map,$=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function X(A,e="short",t={}){let r=function(A){if(null==A||""===A)return null;let e=A instanceof Date?A:new Date(A);return Number.isFinite(e.getTime())?e:null}(A);if(!r)return t.fallback??"—";let n=t.locale||"en";if("relative"===e){var i=t.now??Date.now();let A=Math.round((r.getTime()-i)/1e3),e=function(A){let e=j.get(A);if(e)return e;let t=new Intl.RelativeTimeFormat(A,{numeric:"auto"});return j.set(A,t),t}(n);for(let[t,r]of $)if(Math.abs(A)>=r)return e.format(Math.round(A/r),t);return e.format(A,"second")}let a=t.hour12??!0,s=t.utc?"UTC":t.timeZone,o=t.showTime??!0;return(function(A,e,t){let r=z.get(A);if(r)return r;let n=new Intl.DateTimeFormat(e,t);return z.set(A,n),n})(`${n}|${e}|${a}|${s??""}|${o}`,n,function(A,e,t,r){let n={hourCycle:e?"h12":"h23"},i=t?{timeZone:t}:{};if("time"===A)return{timeStyle:"medium",...n,...i};let a="long"===A?"full":"medium";return r?{dateStyle:a,timeStyle:"medium",...n,...i}:{dateStyle:a,...i}}(e,a,s,o)).format(r)}let AA="TelemetryUnicode",Ae="TelemetryEmoji",At=(0,Z.join)(process.cwd(),"node_modules","@fontpkg","unifont","unifont-15.0.01.ttf"),Ar=(0,Z.join)(process.cwd(),"node_modules","@expo-google-fonts","noto-emoji","400Regular","NotoEmoji_400Regular.ttf"),An=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Ai=/\p{Extended_Pictographic}|\p{Regional_Indicator}|\u20e3|\ufe0f/u;function Aa(A,e){let t=Ai.test(e);return A.font(t?Ae:AA),{emoji:t,value:e,width:A.widthOfString(e)}}function As(A){A.font(AA);let e=A.currentLineHeight(!0);return A.font(Ae),Math.max(e,A.currentLineHeight(!0))}function Ao(A,e,t,r=1/0){let n=Math.max(1,t),i=[{glyphs:[],width:0}],a=!1;for(let{segment:t}of An.segment(e)){if(/^[\r\n]+$/.test(t)){if(i.length>=r){a=!0;break}i.push({glyphs:[],width:0});continue}let e=Aa(A,t),s=i.at(-1);if(s.glyphs.length&&s.width+e.width>n){if(i.length>=r){a=!0;break}s={glyphs:[],width:0},i.push(s)}s.glyphs.push(e),s.width+=e.width}if(a){let e=i.at(-1),t=Aa(A,"…");for(;e.glyphs.length&&e.width+t.width>n;)e.width-=e.glyphs.pop().width;e.glyphs.push(t),e.width+=t.width}return i}function Ag(A,e,t,r,n){let i=Math.max(1,n.width??A.page.width-t-A.page.margins.right),a=As(A);Ao(A,e,i,!1===n.lineBreak?1:n.height?Math.max(1,Math.floor(n.height/a)):1/0).forEach((e,s)=>{let o="center"===n.align?t+(i-e.width)/2:"right"===n.align?t+i-e.width:t,g=[];for(let A of e.glyphs){let e=g.at(-1);e?.emoji===A.emoji?(e.value+=A.value,e.width+=A.width):g.push({...A})}for(let e of g)A.font(e.emoji?Ae:AA).text(e.value,o,r+s*a,{lineBreak:!1}),o+=e.width})}let AC={time:"Time",receivedAt:"Received",source:"Source",level:"Level",category:"Category",message:"Message",eventKind:"Kind",levelKind:"Level / Kind",eventName:"Name",screenName:"Screen Name",parameters:"Parameters",detail:"Detail",deviceIp:"Device IP",buildId:"Build ID",sessionId:"Session ID"},AQ={CONTAINS:"contains",DOES_NOT_CONTAIN:"does not contain",IS:"is",IS_NOT:"is not",MATCHES_GLOB:"matches glob",MATCHES_REGEX:"matches regex",NO_REGEX_MATCH:"does not match regex",IS_EMPTY:"is empty",IS_NOT_EMPTY:"is not empty"};function Al(A){return null==A?"":"string"==typeof A?A:"number"==typeof A||"boolean"==typeof A?String(A):JSON.stringify(A)}function AI(A){return Object.entries(a(A)).filter(([A])=>A.startsWith("defaultParameters.")||A.startsWith("defaultParameters[")||A.startsWith("additionalParameters.")||A.startsWith("additionalParameters[")).map(([A,e])=>`${A}: ${Al(e)}`).join(" • ")}function Ad(A,e,t){return X(A,t?"short":"time",{locale:e.locale||"en",hour12:"24"!==e.timeFormat,timeZone:e.timeZone??void 0})}function AE(A,e,t){return"time"===e?Ad(A.clientTime,t,!0):"receivedAt"===e?Ad(A.receivedAt,t,!0):"source"===e?"CONSOLE"===A.entryType?"Console":"Analytics":"levelKind"===e?A.level??A.eventKind??"":"parameters"===e?AI(A):"detail"===e?"CONSOLE"===A.entryType?A.message??"":`${A.eventName??""}${A.screenName?` (${A.screenName})`:""}${AI(A)?` - ${AI(A)}`:""}`:Al(a(A)[e])}function Ac(A){let e=[...new Set(A.fields.map(A=>A.trim()).filter(Boolean))];return e.length?e.slice(0,30):l[A.view]}function Ah(A){return AC[A]?AC[A]:A.replace(/^attributes[.[]/,"").replace(/^defaultParameters[.[]/,"Default: ").replace(/^additionalParameters[.[]/,"Additional: ").replace(/]$/g,"")}function AB(A){return"message"===A||"detail"===A?2.8:"parameters"===A?2.4:"time"===A||"receivedAt"===A?1.35:"sessionId"===A?1.2:"buildId"===A||"screenName"===A?.95:"category"===A||"eventName"===A?.9:"level"===A||"eventKind"===A||"levelKind"===A||"source"===A?.65:A.startsWith("attributes.")||A.startsWith("attributes[")||"deviceIp"===A?.8:1}function AD(A){return String(A??"").replace(/\s+/g," ").trim().slice(0,200)}function Aw(A){let e=/^[=+\-@]/.test(A)?`'${A}`:A;return`"${e.replaceAll('"','""')}"`}function Au(A){return A.replaceAll("|","\\|").replace(/[\r\n]+/g," ")}function Ap(A,e){return X(A.clientTime,"long",{locale:e.locale||"en",showTime:!1,timeZone:e.timeZone??void 0})}async function Af(A,e){let t=Ac(e),r=new W.default({size:"LETTER",layout:"landscape",margin:32,bufferPages:!0});r.registerFont(AA,At),r.registerFont(Ae,Ar);let n=[];r.on("data",A=>n.push(A));let i=new Promise((A,e)=>{r.on("end",()=>{let e=new Uint8Array(n.reduce((A,e)=>A+e.byteLength,0)),t=0;for(let A of n)e.set(A,t),t+=A.byteLength;A(e)}),r.on("error",e)}),a=r.page.width-r.page.margins.left-r.page.margins.right,s=t.map(AB),o=s.reduce((A,e)=>A+e,0),g=s.map(A=>a*A/o),C=r.page.margins.left,Q=g.map(A=>{let e=C;return C+=A,e}),l=()=>{r.font(AA).fontSize(8).fillColor("#111111");let A=r.y;t.forEach((e,t)=>{Ag(r,Ah(e),Q[t],A,{width:g[t]-6,lineBreak:!1,ellipsis:!0})}),r.x=r.page.margins.left,r.y=A+12,r.moveTo(r.page.margins.left,r.y).lineTo(r.page.width-r.page.margins.right,r.y).strokeColor("#aaaaaa").stroke(),r.y+=5},I=A=>{let e=r.y+5;r.fontSize(8).fillColor("#3f3f46"),Ag(r,A,r.page.margins.left,e,{width:a,align:"center",lineBreak:!1,ellipsis:!0});let t=e+14;r.save().strokeColor("#dddddd").moveTo(r.page.margins.left,t).lineTo(r.page.width-r.page.margins.right,t).stroke().restore(),r.x=r.page.margins.left,r.y=t+7};r.font(AA).fontSize(16).text("Observability export"),r.font(AA).fontSize(8).fillColor("#555555").text(`Generated ${Ad(new Date().toISOString(),e,!0)} - ${A.filter(A=>"SEPARATOR"!==A.entryType).length} records`);let d=function(A){let e;if(!A)return["None"];try{e=JSON.parse(A)}catch{return["Custom filter applied"]}if(!e||"object"!=typeof e||Array.isArray(e))return["None"];let t=e,r=[];if("string"==typeof t.search&&t.search.trim()){let A="GLOB"===t.searchMode?"Glob":"REGEX"===t.searchMode?"Regex":"Text";r.push(`Search - ${A}, ${!0===t.caseSensitive?"case-sensitive":"case-insensitive"}: ${AD(t.search)}`)}if(t.quickFilters&&"object"==typeof t.quickFilters&&!Array.isArray(t.quickFilters))for(let[A,e]of Object.entries(t.quickFilters)){if(!Array.isArray(e))continue;let t=e.map(AD).filter(Boolean).slice(0,20);t.length&&r.push(`Quick filter - ${Ah(A)}: ${t.join(", ")}`)}if(t.advancedFilter&&"object"==typeof t.advancedFilter&&!Array.isArray(t.advancedFilter)){let A=t.advancedFilter;if(Array.isArray(A.conditions)&&A.conditions.length)for(let e of(r.push(`Advanced filters - match ${"ANY"===A.mode?"any":"all"}:`),A.conditions)){if(!e||"object"!=typeof e||Array.isArray(e)||"string"!=typeof e.field)continue;let A="string"==typeof e.operator?AQ[e.operator]??e.operator.toLocaleLowerCase().replaceAll("_"," "):"matches",t=AD(e.value),n=Array.isArray(e.sources)?e.sources.filter(A=>"CONSOLE"===A||"ANALYTICS"===A):[],i=1===n.length?` [${"CONSOLE"===n[0]?"Console":"Analytics"} only]`:"",a=!0===e.caseSensitive?" (case-sensitive)":"";r.push(`${Ah(e.field)} ${A}${t?` "${t}"`:""}${a}${i}`)}}return r.length?r:["None"]}(e.filterSummary),E=d.slice(0,6);d.length>E.length&&(E[E.length-1]=`${d.length-E.length+1} more filter conditions`);let c=r.y+5,h=20+10*E.length;r.save().lineWidth(.5).roundedRect(r.page.margins.left,c,a,h,4).fillAndStroke("#f7f7f8","#dddddd").restore(),r.font(AA).fontSize(8).fillColor("#333333").text("Filters",r.page.margins.left+8,c+6,{width:a-16,lineBreak:!1}),r.font(AA).fontSize(7).fillColor("#555555"),E.forEach((A,e)=>{Ag(r,`- ${A}`,r.page.margins.left+8,c+18+10*e,{width:a-16,lineBreak:!1,ellipsis:!0})}),r.x=r.page.margins.left,r.y=c+h+10,l();let B="";for(let n of A){let A=Ap(n,e),i=A!==B,a="SEPARATOR"===n.entryType?(n.separatorName||"Separator").replace(/[·—–‑]/g,"-"):null;r.font(AA).fontSize(7);let s=a?[]:t.map(A=>(function(A){let e="",t=0;for(let{segment:r}of An.segment(A)){if(4e3===t)return`${e}…`;e+=r,t+=1}return e})(AE(n,A,e))),o=a?0:Math.max(14,...s.map((A,e)=>(function(A,e,t){let r=As(A);return Ao(A,e,t).length*r})(r,A||" ",g[e]-6)))+4,C=Math.min(o,Math.max(14,r.page.height-60-r.page.margins.top-22-26*!!i)),d=26*!!i+(a?26:C+3);if(r.y+d>r.page.height-60&&(r.addPage(),l()),i&&I(B=A),a){I(a);continue}let E=r.y,c=Math.min(o,Math.max(14,r.page.height-60-E));r.font(AA).fontSize(7).fillColor("#111111"),s.forEach((A,e)=>{let t=Math.max(1,c-4);Ag(r,A,Q[e],E,{width:g[e]-6,height:t})}),r.x=r.page.margins.left,r.y=E+c,r.moveTo(r.page.margins.left,r.y).lineTo(r.page.width-r.page.margins.right,r.y).strokeColor("#dddddd").stroke(),r.y+=3}let D=r.bufferedPageRange();for(let A=D.start;A<D.start+D.count;A+=1)r.switchToPage(A),r.font(AA).fontSize(7).fillColor("#666666").text(`Page ${A+1} of ${D.count}`,r.page.margins.left,r.page.height-r.page.margins.bottom-10,{align:"right",width:a,lineBreak:!1});return r.end(),i}A.s(["telemetryCsv",0,function(A,e){let t=Ac(e),r=[t.map(A=>Aw(Ah(A))).join(",")],n="";for(let i of A){let A=Ap(i,e);if(A!==n&&(n=A,r.push(t.map((A,e)=>Aw(0===e?`[Day] ${n}`:"")).join(","))),"SEPARATOR"===i.entryType){r.push(t.map((A,e)=>Aw(0===e?`[Separator] ${i.separatorName??""}`.trim():"")).join(","));continue}r.push(t.map(A=>Aw(AE(i,A,e))).join(","))}return`${r.join("\r\n")}\r
183
+ `},"telemetryMarkdown",0,function(A,e){let t=Ac(e),r=["# Observability export",""];e.filterSummary&&r.push(`_Filters: ${e.filterSummary}_`,"");let n="",i=`| ${t.map(A=>Au(Ah(A))).join(" | ")} |`,a=`| ${t.map(()=>"---").join(" | ")} |`;for(let s of A){let A=Ap(s,e);A!==n&&(n=A,r.push(`## ${n}`,"",i,a)),"SEPARATOR"===s.entryType?r.push(`| ${[`**${Au(s.separatorName||"Separator")}**`,...t.slice(1).map(()=>"")].join(" | ")} |`):r.push(`| ${t.map(A=>Au(AE(s,A,e))).join(" | ")} |`)}return`${r.join("\n")}
184
+ `},"telemetryPdf",0,Af],906148),A.s([],464841)}];
185
185
 
186
186
  //# sourceMappingURL=_1javz-p._.js.map