@axhub/acp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (488) hide show
  1. package/.next/BUILD_ID +1 -0
  2. package/.next/app-path-routes-manifest.json +21 -0
  3. package/.next/build-manifest.json +22 -0
  4. package/.next/export-marker.json +6 -0
  5. package/.next/fallback-build-manifest.json +13 -0
  6. package/.next/images-manifest.json +68 -0
  7. package/.next/next-minimal-server.js.nft.json +1 -0
  8. package/.next/next-server.js.nft.json +1 -0
  9. package/.next/package.json +1 -0
  10. package/.next/prerender-manifest.json +90 -0
  11. package/.next/required-server-files.js +336 -0
  12. package/.next/required-server-files.json +336 -0
  13. package/.next/routes-manifest.json +171 -0
  14. package/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
  15. package/.next/server/app/_global-error/page/build-manifest.json +18 -0
  16. package/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
  17. package/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
  18. package/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
  19. package/.next/server/app/_global-error/page.js +10 -0
  20. package/.next/server/app/_global-error/page.js.nft.json +1 -0
  21. package/.next/server/app/_global-error/page_client-reference-manifest.js +3 -0
  22. package/.next/server/app/_global-error.html +1 -0
  23. package/.next/server/app/_global-error.meta +15 -0
  24. package/.next/server/app/_global-error.rsc +15 -0
  25. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
  26. package/.next/server/app/_global-error.segments/_full.segment.rsc +15 -0
  27. package/.next/server/app/_global-error.segments/_head.segment.rsc +6 -0
  28. package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
  29. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  30. package/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
  31. package/.next/server/app/_not-found/page/build-manifest.json +18 -0
  32. package/.next/server/app/_not-found/page/next-font-manifest.json +6 -0
  33. package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
  34. package/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
  35. package/.next/server/app/_not-found/page.js +13 -0
  36. package/.next/server/app/_not-found/page.js.nft.json +1 -0
  37. package/.next/server/app/_not-found/page_client-reference-manifest.js +3 -0
  38. package/.next/server/app/_not-found.html +1 -0
  39. package/.next/server/app/_not-found.meta +16 -0
  40. package/.next/server/app/_not-found.rsc +17 -0
  41. package/.next/server/app/_not-found.segments/_full.segment.rsc +17 -0
  42. package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
  43. package/.next/server/app/_not-found.segments/_index.segment.rsc +6 -0
  44. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
  45. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
  46. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
  47. package/.next/server/app/api/acp/capabilities/route/app-paths-manifest.json +3 -0
  48. package/.next/server/app/api/acp/capabilities/route/build-manifest.json +9 -0
  49. package/.next/server/app/api/acp/capabilities/route/server-reference-manifest.json +4 -0
  50. package/.next/server/app/api/acp/capabilities/route.js +9 -0
  51. package/.next/server/app/api/acp/capabilities/route.js.nft.json +1 -0
  52. package/.next/server/app/api/acp/capabilities/route_client-reference-manifest.js +3 -0
  53. package/.next/server/app/api/acp/commands/route/app-paths-manifest.json +3 -0
  54. package/.next/server/app/api/acp/commands/route/build-manifest.json +9 -0
  55. package/.next/server/app/api/acp/commands/route/server-reference-manifest.json +4 -0
  56. package/.next/server/app/api/acp/commands/route.js +6 -0
  57. package/.next/server/app/api/acp/commands/route.js.nft.json +1 -0
  58. package/.next/server/app/api/acp/commands/route_client-reference-manifest.js +3 -0
  59. package/.next/server/app/api/acp/runtime/route/app-paths-manifest.json +3 -0
  60. package/.next/server/app/api/acp/runtime/route/build-manifest.json +9 -0
  61. package/.next/server/app/api/acp/runtime/route/server-reference-manifest.json +4 -0
  62. package/.next/server/app/api/acp/runtime/route.js +6 -0
  63. package/.next/server/app/api/acp/runtime/route.js.nft.json +1 -0
  64. package/.next/server/app/api/acp/runtime/route_client-reference-manifest.js +3 -0
  65. package/.next/server/app/api/chat/route/app-paths-manifest.json +3 -0
  66. package/.next/server/app/api/chat/route/build-manifest.json +9 -0
  67. package/.next/server/app/api/chat/route/server-reference-manifest.json +4 -0
  68. package/.next/server/app/api/chat/route.js +9 -0
  69. package/.next/server/app/api/chat/route.js.nft.json +1 -0
  70. package/.next/server/app/api/chat/route_client-reference-manifest.js +3 -0
  71. package/.next/server/app/api/conversations/[threadId]/messages/route/app-paths-manifest.json +3 -0
  72. package/.next/server/app/api/conversations/[threadId]/messages/route/build-manifest.json +9 -0
  73. package/.next/server/app/api/conversations/[threadId]/messages/route/server-reference-manifest.json +4 -0
  74. package/.next/server/app/api/conversations/[threadId]/messages/route.js +8 -0
  75. package/.next/server/app/api/conversations/[threadId]/messages/route.js.nft.json +1 -0
  76. package/.next/server/app/api/conversations/[threadId]/messages/route_client-reference-manifest.js +3 -0
  77. package/.next/server/app/api/conversations/[threadId]/route/app-paths-manifest.json +3 -0
  78. package/.next/server/app/api/conversations/[threadId]/route/build-manifest.json +9 -0
  79. package/.next/server/app/api/conversations/[threadId]/route/server-reference-manifest.json +4 -0
  80. package/.next/server/app/api/conversations/[threadId]/route.js +8 -0
  81. package/.next/server/app/api/conversations/[threadId]/route.js.nft.json +1 -0
  82. package/.next/server/app/api/conversations/[threadId]/route_client-reference-manifest.js +3 -0
  83. package/.next/server/app/api/conversations/route/app-paths-manifest.json +3 -0
  84. package/.next/server/app/api/conversations/route/build-manifest.json +9 -0
  85. package/.next/server/app/api/conversations/route/server-reference-manifest.json +4 -0
  86. package/.next/server/app/api/conversations/route.js +8 -0
  87. package/.next/server/app/api/conversations/route.js.nft.json +1 -0
  88. package/.next/server/app/api/conversations/route_client-reference-manifest.js +3 -0
  89. package/.next/server/app/api/local-files/image/route/app-paths-manifest.json +3 -0
  90. package/.next/server/app/api/local-files/image/route/build-manifest.json +9 -0
  91. package/.next/server/app/api/local-files/image/route/server-reference-manifest.json +4 -0
  92. package/.next/server/app/api/local-files/image/route.js +6 -0
  93. package/.next/server/app/api/local-files/image/route.js.nft.json +1 -0
  94. package/.next/server/app/api/local-files/image/route_client-reference-manifest.js +3 -0
  95. package/.next/server/app/api/local-files/open/route/app-paths-manifest.json +3 -0
  96. package/.next/server/app/api/local-files/open/route/build-manifest.json +9 -0
  97. package/.next/server/app/api/local-files/open/route/server-reference-manifest.json +4 -0
  98. package/.next/server/app/api/local-files/open/route.js +6 -0
  99. package/.next/server/app/api/local-files/open/route.js.nft.json +1 -0
  100. package/.next/server/app/api/local-files/open/route_client-reference-manifest.js +3 -0
  101. package/.next/server/app/api/output-artifacts/workspace/route/app-paths-manifest.json +3 -0
  102. package/.next/server/app/api/output-artifacts/workspace/route/build-manifest.json +9 -0
  103. package/.next/server/app/api/output-artifacts/workspace/route/server-reference-manifest.json +4 -0
  104. package/.next/server/app/api/output-artifacts/workspace/route.js +6 -0
  105. package/.next/server/app/api/output-artifacts/workspace/route.js.nft.json +1 -0
  106. package/.next/server/app/api/output-artifacts/workspace/route_client-reference-manifest.js +3 -0
  107. package/.next/server/app/api/tools/image-generation/files/[id]/route/app-paths-manifest.json +3 -0
  108. package/.next/server/app/api/tools/image-generation/files/[id]/route/build-manifest.json +9 -0
  109. package/.next/server/app/api/tools/image-generation/files/[id]/route/server-reference-manifest.json +4 -0
  110. package/.next/server/app/api/tools/image-generation/files/[id]/route.js +7 -0
  111. package/.next/server/app/api/tools/image-generation/files/[id]/route.js.nft.json +1 -0
  112. package/.next/server/app/api/tools/image-generation/files/[id]/route_client-reference-manifest.js +3 -0
  113. package/.next/server/app/api/tools/image-generation/records/route/app-paths-manifest.json +3 -0
  114. package/.next/server/app/api/tools/image-generation/records/route/build-manifest.json +9 -0
  115. package/.next/server/app/api/tools/image-generation/records/route/server-reference-manifest.json +4 -0
  116. package/.next/server/app/api/tools/image-generation/records/route.js +7 -0
  117. package/.next/server/app/api/tools/image-generation/records/route.js.nft.json +1 -0
  118. package/.next/server/app/api/tools/image-generation/records/route_client-reference-manifest.js +3 -0
  119. package/.next/server/app/api/tools/user-choice/route/app-paths-manifest.json +3 -0
  120. package/.next/server/app/api/tools/user-choice/route/build-manifest.json +9 -0
  121. package/.next/server/app/api/tools/user-choice/route/server-reference-manifest.json +4 -0
  122. package/.next/server/app/api/tools/user-choice/route.js +6 -0
  123. package/.next/server/app/api/tools/user-choice/route.js.nft.json +1 -0
  124. package/.next/server/app/api/tools/user-choice/route_client-reference-manifest.js +3 -0
  125. package/.next/server/app/favicon.ico/route/app-paths-manifest.json +3 -0
  126. package/.next/server/app/favicon.ico/route/build-manifest.json +9 -0
  127. package/.next/server/app/favicon.ico/route.js +7 -0
  128. package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
  129. package/.next/server/app/favicon.ico.body +0 -0
  130. package/.next/server/app/favicon.ico.meta +1 -0
  131. package/.next/server/app/page/app-paths-manifest.json +3 -0
  132. package/.next/server/app/page/build-manifest.json +18 -0
  133. package/.next/server/app/page/next-font-manifest.json +6 -0
  134. package/.next/server/app/page/react-loadable-manifest.json +1 -0
  135. package/.next/server/app/page/server-reference-manifest.json +4 -0
  136. package/.next/server/app/page.js +14 -0
  137. package/.next/server/app/page.js.nft.json +1 -0
  138. package/.next/server/app/page_client-reference-manifest.js +3 -0
  139. package/.next/server/app/session/[provider]/[sessionId]/page/app-paths-manifest.json +3 -0
  140. package/.next/server/app/session/[provider]/[sessionId]/page/build-manifest.json +18 -0
  141. package/.next/server/app/session/[provider]/[sessionId]/page/next-font-manifest.json +6 -0
  142. package/.next/server/app/session/[provider]/[sessionId]/page/react-loadable-manifest.json +1 -0
  143. package/.next/server/app/session/[provider]/[sessionId]/page/server-reference-manifest.json +4 -0
  144. package/.next/server/app/session/[provider]/[sessionId]/page.js +16 -0
  145. package/.next/server/app/session/[provider]/[sessionId]/page.js.nft.json +1 -0
  146. package/.next/server/app/session/[provider]/[sessionId]/page_client-reference-manifest.js +3 -0
  147. package/.next/server/app/thread/[threadId]/page/app-paths-manifest.json +3 -0
  148. package/.next/server/app/thread/[threadId]/page/build-manifest.json +18 -0
  149. package/.next/server/app/thread/[threadId]/page/next-font-manifest.json +6 -0
  150. package/.next/server/app/thread/[threadId]/page/react-loadable-manifest.json +1 -0
  151. package/.next/server/app/thread/[threadId]/page/server-reference-manifest.json +4 -0
  152. package/.next/server/app/thread/[threadId]/page.js +15 -0
  153. package/.next/server/app/thread/[threadId]/page.js.nft.json +1 -0
  154. package/.next/server/app/thread/[threadId]/page_client-reference-manifest.js +3 -0
  155. package/.next/server/app-paths-manifest.json +21 -0
  156. package/.next/server/chunks/0zjb_server_app_api_conversations_[threadId]_messages_route_actions_0poed25.js +3 -0
  157. package/.next/server/chunks/0zjb_server_app_api_tools_image-generation_files_[id]_route_actions_0-tbvpw.js +3 -0
  158. package/.next/server/chunks/0zjb_server_app_api_tools_image-generation_records_route_actions_0vu38s2.js +3 -0
  159. package/.next/server/chunks/[externals]_next_dist_0.m~pv6._.js +3 -0
  160. package/.next/server/chunks/[root-of-the-server]__04xq..~._.js +3 -0
  161. package/.next/server/chunks/[root-of-the-server]__07sxz4_._.js +3 -0
  162. package/.next/server/chunks/[root-of-the-server]__0dwg3fr._.js +178 -0
  163. package/.next/server/chunks/[root-of-the-server]__0eanzwb._.js +3 -0
  164. package/.next/server/chunks/[root-of-the-server]__0gqx~5k._.js +3 -0
  165. package/.next/server/chunks/[root-of-the-server]__0iokgmz._.js +3 -0
  166. package/.next/server/chunks/[root-of-the-server]__0j-lxr4._.js +3 -0
  167. package/.next/server/chunks/[root-of-the-server]__0ly6hop._.js +3 -0
  168. package/.next/server/chunks/[root-of-the-server]__0nil~wi._.js +3 -0
  169. package/.next/server/chunks/[root-of-the-server]__0tmhg7j._.js +3 -0
  170. package/.next/server/chunks/[root-of-the-server]__0txmfnw._.js +4 -0
  171. package/.next/server/chunks/[root-of-the-server]__0wo0b8z._.js +3 -0
  172. package/.next/server/chunks/[root-of-the-server]__0~mtsby._.js +3 -0
  173. package/.next/server/chunks/[root-of-the-server]__10-n4io._.js +3 -0
  174. package/.next/server/chunks/[root-of-the-server]__10g507v._.js +3 -0
  175. package/.next/server/chunks/[turbopack]_runtime.js +903 -0
  176. package/.next/server/chunks/_next-internal_server_app_api_acp_capabilities_route_actions_08lck.p.js +3 -0
  177. package/.next/server/chunks/_next-internal_server_app_api_acp_commands_route_actions_0as.2z6.js +3 -0
  178. package/.next/server/chunks/_next-internal_server_app_api_acp_runtime_route_actions_0o1ybkn.js +3 -0
  179. package/.next/server/chunks/_next-internal_server_app_api_chat_route_actions_0tmcf6..js +3 -0
  180. package/.next/server/chunks/_next-internal_server_app_api_conversations_[threadId]_route_actions_12yq8z_.js +3 -0
  181. package/.next/server/chunks/_next-internal_server_app_api_conversations_route_actions_131xv69.js +3 -0
  182. package/.next/server/chunks/_next-internal_server_app_api_local-files_image_route_actions_0f~10mn.js +3 -0
  183. package/.next/server/chunks/_next-internal_server_app_api_local-files_open_route_actions_026mg-2.js +3 -0
  184. package/.next/server/chunks/_next-internal_server_app_api_output-artifacts_workspace_route_actions_1239-n7.js +3 -0
  185. package/.next/server/chunks/_next-internal_server_app_api_tools_user-choice_route_actions_09xqbn_.js +3 -0
  186. package/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_095lj93.js +3 -0
  187. package/.next/server/chunks/instrumentation_ts_0zq9-xz._.js +3 -0
  188. package/.next/server/chunks/lib_conversations_store_ts_0gzcj38._.js +7 -0
  189. package/.next/server/chunks/node_modules_@vercel_oidc_dist_token_0zdeuds.js +3 -0
  190. package/.next/server/chunks/node_modules_next_00hve1e._.js +13 -0
  191. package/.next/server/chunks/ssr/[root-of-the-server]__02qo-zr._.js +19 -0
  192. package/.next/server/chunks/ssr/[root-of-the-server]__0488vn3._.js +3 -0
  193. package/.next/server/chunks/ssr/[root-of-the-server]__08e5v4-._.js +3 -0
  194. package/.next/server/chunks/ssr/[root-of-the-server]__08iwq-u._.js +3 -0
  195. package/.next/server/chunks/ssr/[root-of-the-server]__0a1m1mq._.js +3 -0
  196. package/.next/server/chunks/ssr/[root-of-the-server]__0i9qg2.._.js +33 -0
  197. package/.next/server/chunks/ssr/[root-of-the-server]__0icm-_h._.js +3 -0
  198. package/.next/server/chunks/ssr/[root-of-the-server]__0piffp7._.js +3 -0
  199. package/.next/server/chunks/ssr/[root-of-the-server]__0xn-a8p._.js +3 -0
  200. package/.next/server/chunks/ssr/[root-of-the-server]__0~c929r._.js +33 -0
  201. package/.next/server/chunks/ssr/[turbopack]_runtime.js +903 -0
  202. package/.next/server/chunks/ssr/_0-oaqqe._.js +6 -0
  203. package/.next/server/chunks/ssr/_006q235._.js +3 -0
  204. package/.next/server/chunks/ssr/_03.pm1z._.js +108 -0
  205. package/.next/server/chunks/ssr/_0txwi90._.js +3 -0
  206. package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0k77kol.js +3 -0
  207. package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0eq97pa.js +3 -0
  208. package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_09-gtaw.js +3 -0
  209. package/.next/server/chunks/ssr/_next-internal_server_app_session_[provider]_[sessionId]_page_actions_0_67qh_.js +3 -0
  210. package/.next/server/chunks/ssr/_next-internal_server_app_thread_[threadId]_page_actions_11mcypo.js +3 -0
  211. package/.next/server/chunks/ssr/lib_conversations_store_ts_0-pd6d3._.js +4 -0
  212. package/.next/server/chunks/ssr/node_modules_09w7yel._.js +33 -0
  213. package/.next/server/chunks/ssr/node_modules_0tev5qq._.js +3 -0
  214. package/.next/server/chunks/ssr/node_modules_@vercel_oidc_dist_token_0yj7kvj.js +3 -0
  215. package/.next/server/chunks/ssr/node_modules_next_dist_09jzzl8._.js +3 -0
  216. package/.next/server/chunks/ssr/node_modules_next_dist_0h9llsw._.js +6 -0
  217. package/.next/server/chunks/ssr/node_modules_next_dist_0t-hj0x._.js +3 -0
  218. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0inhx6q._.js +3 -0
  219. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js +3 -0
  220. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js +3 -0
  221. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js +3 -0
  222. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_00297nb.js +4 -0
  223. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_002l7yi.js +4 -0
  224. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_02suzhc.js +4 -0
  225. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_04x9gct.js +4 -0
  226. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0nsg22r.js +4 -0
  227. package/.next/server/chunks/tools_image-generation_service_mjs_0k_th7-._.js +3 -0
  228. package/.next/server/edge/chunks/_0e82_ds._.js +3 -0
  229. package/.next/server/edge/chunks/turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_00ue99t.js +3 -0
  230. package/.next/server/functions-config-manifest.json +11 -0
  231. package/.next/server/instrumentation/middleware-manifest.json +12 -0
  232. package/.next/server/instrumentation.js +4 -0
  233. package/.next/server/instrumentation.js.nft.json +1 -0
  234. package/.next/server/interception-route-rewrite-manifest.js +1 -0
  235. package/.next/server/middleware-build-manifest.js +22 -0
  236. package/.next/server/middleware-manifest.json +6 -0
  237. package/.next/server/next-font-manifest.js +1 -0
  238. package/.next/server/next-font-manifest.json +6 -0
  239. package/.next/server/pages/404.html +1 -0
  240. package/.next/server/pages/500.html +1 -0
  241. package/.next/server/pages-manifest.json +4 -0
  242. package/.next/server/prefetch-hints.json +1 -0
  243. package/.next/server/server-reference-manifest.js +1 -0
  244. package/.next/server/server-reference-manifest.json +5 -0
  245. package/.next/static/chunks/01xlw8hd842-c.js +1 -0
  246. package/.next/static/chunks/03edqrb4zdj~g.js +31 -0
  247. package/.next/static/chunks/03qq5fxc~pg00.js +1 -0
  248. package/.next/static/chunks/03~yq9q893hmn.js +1 -0
  249. package/.next/static/chunks/0l-_vd.~~z2bw.js +2 -0
  250. package/.next/static/chunks/0qid5lwcbx9s0.js +1 -0
  251. package/.next/static/chunks/0t.k8~x~sghva.js +4 -0
  252. package/.next/static/chunks/0tmpufzgpw2-w.js +1 -0
  253. package/.next/static/chunks/0v_ue~msygctw.js +1 -0
  254. package/.next/static/chunks/0y2l0xgouorae.css +1 -0
  255. package/.next/static/chunks/0zftsky7gte_9.js +102 -0
  256. package/.next/static/chunks/13nvdsh0e09d0.js +1 -0
  257. package/.next/static/chunks/1610ha42i.fl~.css +1 -0
  258. package/.next/static/chunks/turbopack-0mxz-ap91rcoe.js +1 -0
  259. package/.next/static/mbk_N5Gs4ZJg3lciRL6ya/_buildManifest.js +11 -0
  260. package/.next/static/mbk_N5Gs4ZJg3lciRL6ya/_clientMiddlewareManifest.js +1 -0
  261. package/.next/static/mbk_N5Gs4ZJg3lciRL6ya/_ssgManifest.js +1 -0
  262. package/.next/static/media/favicon.0x3dzn~oxb6tn.ico +0 -0
  263. package/README.md +113 -0
  264. package/THIRD_PARTY_NOTICES.md +34 -0
  265. package/bin/acp.mjs +224 -0
  266. package/dist/app/globals.css +146 -0
  267. package/dist/components/assistant-ui/acp-command-menu.d.ts +2 -0
  268. package/dist/components/assistant-ui/acp-command-menu.mjs +176 -0
  269. package/dist/components/assistant-ui/acp-elicitation-option-list.d.ts +3 -0
  270. package/dist/components/assistant-ui/acp-elicitation-option-list.mjs +157 -0
  271. package/dist/components/assistant-ui/acp-selectors.d.ts +2 -0
  272. package/dist/components/assistant-ui/acp-selectors.mjs +301 -0
  273. package/dist/components/assistant-ui/acp-tool-content.d.ts +4 -0
  274. package/dist/components/assistant-ui/acp-tool-content.mjs +127 -0
  275. package/dist/components/assistant-ui/addons/host.d.ts +4 -0
  276. package/dist/components/assistant-ui/addons/host.mjs +85 -0
  277. package/dist/components/assistant-ui/addons/image-generation-records-section.d.ts +14 -0
  278. package/dist/components/assistant-ui/addons/image-generation-records-section.mjs +116 -0
  279. package/dist/components/assistant-ui/addons/output-artifacts-section.d.ts +9 -0
  280. package/dist/components/assistant-ui/addons/output-artifacts-section.mjs +24 -0
  281. package/dist/components/assistant-ui/addons/output-artifacts.d.ts +14 -0
  282. package/dist/components/assistant-ui/addons/output-artifacts.mjs +87 -0
  283. package/dist/components/assistant-ui/addons/plan-addon.d.ts +2 -0
  284. package/dist/components/assistant-ui/addons/plan-addon.mjs +39 -0
  285. package/dist/components/assistant-ui/addons/plan-data.d.ts +5 -0
  286. package/dist/components/assistant-ui/addons/plan-data.mjs +97 -0
  287. package/dist/components/assistant-ui/addons/registry.d.ts +2 -0
  288. package/dist/components/assistant-ui/addons/registry.mjs +8 -0
  289. package/dist/components/assistant-ui/addons/types.d.ts +13 -0
  290. package/dist/components/assistant-ui/addons/types.mjs +1 -0
  291. package/dist/components/assistant-ui/attachment.d.ts +7 -0
  292. package/dist/components/assistant-ui/attachment.mjs +88 -0
  293. package/dist/components/assistant-ui/file.d.ts +37 -0
  294. package/dist/components/assistant-ui/file.mjs +107 -0
  295. package/dist/components/assistant-ui/image-generation-settings-dialog.d.ts +4 -0
  296. package/dist/components/assistant-ui/image-generation-settings-dialog.mjs +28 -0
  297. package/dist/components/assistant-ui/image.d.ts +51 -0
  298. package/dist/components/assistant-ui/image.mjs +215 -0
  299. package/dist/components/assistant-ui/markdown-text.d.ts +2 -0
  300. package/dist/components/assistant-ui/markdown-text.mjs +208 -0
  301. package/dist/components/assistant-ui/thread/composer.d.ts +27 -0
  302. package/dist/components/assistant-ui/thread/composer.mjs +15 -0
  303. package/dist/components/assistant-ui/thread/context-chips.d.ts +2 -0
  304. package/dist/components/assistant-ui/thread/context-chips.mjs +123 -0
  305. package/dist/components/assistant-ui/thread/empty-state.d.ts +9 -0
  306. package/dist/components/assistant-ui/thread/empty-state.mjs +24 -0
  307. package/dist/components/assistant-ui/thread/index.d.ts +11 -0
  308. package/dist/components/assistant-ui/thread/index.mjs +43 -0
  309. package/dist/components/assistant-ui/thread/message-list.d.ts +3 -0
  310. package/dist/components/assistant-ui/thread/message-list.mjs +16 -0
  311. package/dist/components/assistant-ui/thread/messages.d.ts +9 -0
  312. package/dist/components/assistant-ui/thread/messages.mjs +71 -0
  313. package/dist/components/assistant-ui/thread/scroll-to-bottom.d.ts +2 -0
  314. package/dist/components/assistant-ui/thread/scroll-to-bottom.mjs +8 -0
  315. package/dist/components/assistant-ui/thread-list.d.ts +2 -0
  316. package/dist/components/assistant-ui/thread-list.mjs +31 -0
  317. package/dist/components/assistant-ui/thread.d.ts +1 -0
  318. package/dist/components/assistant-ui/thread.mjs +2 -0
  319. package/dist/components/assistant-ui/threadlist-sidebar.d.ts +6 -0
  320. package/dist/components/assistant-ui/threadlist-sidebar.mjs +32 -0
  321. package/dist/components/assistant-ui/tool-fallback.d.ts +31 -0
  322. package/dist/components/assistant-ui/tool-fallback.mjs +114 -0
  323. package/dist/components/assistant-ui/tooltip-icon-button.d.ts +7 -0
  324. package/dist/components/assistant-ui/tooltip-icon-button.mjs +23 -0
  325. package/dist/components/icons/github.d.ts +3 -0
  326. package/dist/components/icons/github.mjs +4 -0
  327. package/dist/components/theme-toggle.d.ts +1 -0
  328. package/dist/components/theme-toggle.mjs +26 -0
  329. package/dist/components/tool-ui/option-list.d.ts +34 -0
  330. package/dist/components/tool-ui/option-list.mjs +163 -0
  331. package/dist/components/ui/avatar.d.ts +11 -0
  332. package/dist/components/ui/avatar.mjs +40 -0
  333. package/dist/components/ui/button.d.ts +10 -0
  334. package/dist/components/ui/button.mjs +47 -0
  335. package/dist/components/ui/collapsible.d.ts +5 -0
  336. package/dist/components/ui/collapsible.mjs +27 -0
  337. package/dist/components/ui/dialog.d.ts +17 -0
  338. package/dist/components/ui/dialog.mjs +58 -0
  339. package/dist/components/ui/input.d.ts +3 -0
  340. package/dist/components/ui/input.mjs +18 -0
  341. package/dist/components/ui/label.d.ts +4 -0
  342. package/dist/components/ui/label.mjs +20 -0
  343. package/dist/components/ui/scroll-area.d.ts +5 -0
  344. package/dist/components/ui/scroll-area.mjs +26 -0
  345. package/dist/components/ui/select.d.ts +13 -0
  346. package/dist/components/ui/select.mjs +59 -0
  347. package/dist/components/ui/separator.d.ts +4 -0
  348. package/dist/components/ui/separator.mjs +20 -0
  349. package/dist/components/ui/sheet.d.ts +14 -0
  350. package/dist/components/ui/sheet.mjs +61 -0
  351. package/dist/components/ui/sidebar.d.ts +69 -0
  352. package/dist/components/ui/sidebar.mjs +245 -0
  353. package/dist/components/ui/skeleton.d.ts +2 -0
  354. package/dist/components/ui/skeleton.mjs +18 -0
  355. package/dist/components/ui/switch.d.ts +4 -0
  356. package/dist/components/ui/switch.mjs +20 -0
  357. package/dist/components/ui/tabs.d.ts +7 -0
  358. package/dist/components/ui/tabs.mjs +32 -0
  359. package/dist/components/ui/tooltip.d.ts +7 -0
  360. package/dist/components/ui/tooltip.mjs +32 -0
  361. package/dist/hooks/use-mobile.d.ts +1 -0
  362. package/dist/hooks/use-mobile.mjs +15 -0
  363. package/dist/lib/acp2aisdk/capabilities.d.ts +6 -0
  364. package/dist/lib/acp2aisdk/capabilities.mjs +210 -0
  365. package/dist/lib/acp2aisdk/capability-cache.d.ts +17 -0
  366. package/dist/lib/acp2aisdk/capability-cache.mjs +259 -0
  367. package/dist/lib/acp2aisdk/client-context.d.ts +38 -0
  368. package/dist/lib/acp2aisdk/client-context.mjs +247 -0
  369. package/dist/lib/acp2aisdk/commands.d.ts +11 -0
  370. package/dist/lib/acp2aisdk/commands.mjs +121 -0
  371. package/dist/lib/acp2aisdk/config-options.d.ts +3 -0
  372. package/dist/lib/acp2aisdk/config-options.mjs +86 -0
  373. package/dist/lib/acp2aisdk/context.d.ts +88 -0
  374. package/dist/lib/acp2aisdk/context.mjs +33 -0
  375. package/dist/lib/acp2aisdk/default-capabilities.d.ts +275 -0
  376. package/dist/lib/acp2aisdk/default-capabilities.mjs +421 -0
  377. package/dist/lib/acp2aisdk/elicitation.d.ts +37 -0
  378. package/dist/lib/acp2aisdk/elicitation.mjs +193 -0
  379. package/dist/lib/acp2aisdk/hitl.d.ts +25 -0
  380. package/dist/lib/acp2aisdk/hitl.mjs +134 -0
  381. package/dist/lib/acp2aisdk/index.d.ts +12 -0
  382. package/dist/lib/acp2aisdk/index.mjs +182 -0
  383. package/dist/lib/acp2aisdk/mcp-servers.d.ts +17 -0
  384. package/dist/lib/acp2aisdk/mcp-servers.mjs +153 -0
  385. package/dist/lib/acp2aisdk/model-selection.d.ts +16 -0
  386. package/dist/lib/acp2aisdk/model-selection.mjs +65 -0
  387. package/dist/lib/acp2aisdk/prompt-history.d.ts +9 -0
  388. package/dist/lib/acp2aisdk/prompt-history.mjs +168 -0
  389. package/dist/lib/acp2aisdk/provider-compat.d.ts +85 -0
  390. package/dist/lib/acp2aisdk/provider-compat.mjs +501 -0
  391. package/dist/lib/acp2aisdk/provider-registry.d.ts +15 -0
  392. package/dist/lib/acp2aisdk/provider-registry.mjs +196 -0
  393. package/dist/lib/acp2aisdk/response.d.ts +3 -0
  394. package/dist/lib/acp2aisdk/response.mjs +33 -0
  395. package/dist/lib/acp2aisdk/runtime-options.d.ts +2 -0
  396. package/dist/lib/acp2aisdk/runtime-options.mjs +10 -0
  397. package/dist/lib/acp2aisdk/session-runtime.d.ts +5 -0
  398. package/dist/lib/acp2aisdk/session-runtime.mjs +186 -0
  399. package/dist/lib/acp2aisdk/session-store.d.ts +31 -0
  400. package/dist/lib/acp2aisdk/session-store.mjs +169 -0
  401. package/dist/lib/acp2aisdk/skill-command-cache.d.ts +20 -0
  402. package/dist/lib/acp2aisdk/skill-command-cache.mjs +122 -0
  403. package/dist/lib/acp2aisdk/stream-metadata.d.ts +10 -0
  404. package/dist/lib/acp2aisdk/stream-metadata.mjs +251 -0
  405. package/dist/lib/acp2aisdk/types.d.ts +129 -0
  406. package/dist/lib/acp2aisdk/types.mjs +0 -0
  407. package/dist/lib/acp2aisdk/vendor/acp-ai-provider/index.d.ts +10 -0
  408. package/dist/lib/acp2aisdk/vendor/acp-ai-provider/index.mjs +10 -0
  409. package/dist/lib/acp2aisdk/vendor/acp-ai-provider/package/index.mjs +1945 -0
  410. package/dist/lib/api/client.d.ts +93 -0
  411. package/dist/lib/api/client.mjs +199 -0
  412. package/dist/lib/api/cors.d.ts +2 -0
  413. package/dist/lib/api/cors.mjs +47 -0
  414. package/dist/lib/conversations/client-adapter.d.ts +21 -0
  415. package/dist/lib/conversations/client-adapter.mjs +329 -0
  416. package/dist/lib/conversations/message-repository.d.ts +8 -0
  417. package/dist/lib/conversations/message-repository.mjs +87 -0
  418. package/dist/lib/conversations/store.d.ts +17 -0
  419. package/dist/lib/conversations/store.mjs +678 -0
  420. package/dist/lib/conversations/types.d.ts +92 -0
  421. package/dist/lib/conversations/types.mjs +0 -0
  422. package/dist/lib/local-image-files.d.ts +5 -0
  423. package/dist/lib/local-image-files.mjs +76 -0
  424. package/dist/lib/local-image-paths.d.ts +7 -0
  425. package/dist/lib/local-image-paths.mjs +106 -0
  426. package/dist/lib/output-artifacts/workspace.d.ts +8 -0
  427. package/dist/lib/output-artifacts/workspace.mjs +174 -0
  428. package/dist/lib/provider-history/codex.d.ts +4 -0
  429. package/dist/lib/provider-history/codex.mjs +272 -0
  430. package/dist/lib/provider-history/index.d.ts +7 -0
  431. package/dist/lib/provider-history/index.mjs +88 -0
  432. package/dist/lib/provider-history/types.d.ts +31 -0
  433. package/dist/lib/provider-history/types.mjs +0 -0
  434. package/dist/lib/server-runtime.d.ts +22 -0
  435. package/dist/lib/server-runtime.mjs +78 -0
  436. package/dist/lib/url-routing.d.ts +18 -0
  437. package/dist/lib/url-routing.mjs +59 -0
  438. package/dist/lib/utils.d.ts +2 -0
  439. package/dist/lib/utils.mjs +5 -0
  440. package/dist/lib/workspace-metadata.d.ts +2 -0
  441. package/dist/lib/workspace-metadata.mjs +20 -0
  442. package/dist/public-api/react.d.ts +14 -0
  443. package/dist/public-api/react.mjs +16 -0
  444. package/dist/public-api/runtime.d.ts +8 -0
  445. package/dist/public-api/runtime.mjs +7 -0
  446. package/dist/public-api/server.d.ts +5 -0
  447. package/dist/public-api/server.mjs +4 -0
  448. package/dist/public-api/styles.css +1 -0
  449. package/dist/public-api/ui.d.ts +13 -0
  450. package/dist/public-api/ui.mjs +13 -0
  451. package/dist/tools/client-registry.d.ts +9 -0
  452. package/dist/tools/client-registry.mjs +70 -0
  453. package/dist/tools/image-generation/client.d.ts +18 -0
  454. package/dist/tools/image-generation/client.mjs +31 -0
  455. package/dist/tools/image-generation/config.d.ts +9 -0
  456. package/dist/tools/image-generation/config.example.json +14 -0
  457. package/dist/tools/image-generation/config.mjs +11 -0
  458. package/dist/tools/image-generation/mcp-server.mjs +87 -0
  459. package/dist/tools/image-generation/registry.d.ts +13 -0
  460. package/dist/tools/image-generation/registry.mjs +30 -0
  461. package/dist/tools/image-generation/server.d.ts +6 -0
  462. package/dist/tools/image-generation/server.mjs +58 -0
  463. package/dist/tools/image-generation/service.mjs +978 -0
  464. package/dist/tools/image-generation/shared.d.ts +103 -0
  465. package/dist/tools/image-generation/shared.mjs +80 -0
  466. package/dist/tools/image-generation/storage.d.ts +22 -0
  467. package/dist/tools/image-generation/storage.mjs +8 -0
  468. package/dist/tools/image-generation/ui-detail.d.ts +26 -0
  469. package/dist/tools/image-generation/ui-detail.mjs +109 -0
  470. package/dist/tools/image-generation/ui.d.ts +8 -0
  471. package/dist/tools/image-generation/ui.mjs +121 -0
  472. package/dist/tools/registry.d.ts +32 -0
  473. package/dist/tools/registry.mjs +142 -0
  474. package/dist/tools/ui-registry.d.ts +3 -0
  475. package/dist/tools/ui-registry.mjs +20 -0
  476. package/dist/tools/user-choice/client.d.ts +10 -0
  477. package/dist/tools/user-choice/client.mjs +18 -0
  478. package/dist/tools/user-choice/registry.d.ts +12 -0
  479. package/dist/tools/user-choice/registry.mjs +21 -0
  480. package/dist/tools/user-choice/server.d.ts +6 -0
  481. package/dist/tools/user-choice/server.mjs +42 -0
  482. package/dist/tools/user-choice/shared.d.ts +79 -0
  483. package/dist/tools/user-choice/shared.mjs +56 -0
  484. package/dist/tools/user-choice/store.d.ts +19 -0
  485. package/dist/tools/user-choice/store.mjs +95 -0
  486. package/dist/tools/user-choice/ui.d.ts +3 -0
  487. package/dist/tools/user-choice/ui.mjs +396 -0
  488. package/package.json +118 -0
@@ -0,0 +1,102 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,t,r)=>{t.exports=e.r(76562)},55838,(e,t,r)=>{"use strict";var n=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=n.useState,o=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!i(e,r)}catch(e){return!0}}var d="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=a({inst:{value:r,getSnapshot:t}}),i=n[0].inst,d=n[1];return s(function(){i.value=r,i.getSnapshot=t,u(i)&&d({inst:i})},[e,r,t]),o(function(){return u(i)&&d({inst:i}),e(function(){u(i)&&d({inst:i})})},[e]),l(r),r};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:d},2239,(e,t,r)=>{"use strict";t.exports=e.r(55838)},67034,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=l(e),o=a[0],s=a[1],u=new i((o+s)*3/4-s),d=0,c=s>0?o-4:o;for(r=0;r<c;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[d++]=t>>16&255,u[d++]=t>>8&255,u[d++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[d++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[d++]=t>>8&255,u[d++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;o<s;o+=16383)a.push(function(e,t,n){for(var i,a=[],o=t;o<n;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,o,o+16383>s?s:o+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|m(n,i),l=o(a),u=l.write(n,i);return u!==a&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(C(e,ArrayBuffer)||e&&C(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(C(e,SharedArrayBuffer)||e&&C(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var d=e.valueOf&&e.valueOf();if(null!=d&&d!==e)return s.from(d,t,r);var f=function(e){if(s.isBuffer(e)){var t=0|p(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),o(e<0?0:0|p(e))}function c(e){for(var t=e.length<0?0:0|p(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=s,t.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function p(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function m(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||C(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return S(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:S(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,r){var i,a,o,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=T[e[a]];return i}(this,t,r);case"utf8":case"utf-8":return y(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,a=t,o=r,0===a&&o===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function h(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var a;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return v(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var a,o=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,s/=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var d=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===d?0:a-d)){if(-1===d&&(d=a),a-d+1===l)return d*o}else -1!==d&&(a-=a-d),d=-1}else for(r+l>s&&(r=s-l),a=r;a>=0;a--){for(var c=!0,p=0;p<l;p++)if(u(e,a+p)!==u(t,p)){c=!1;break}if(c)return a}return -1}s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(C(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),C(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(C(a,Uint8Array)&&(a=s.from(a)),!s.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},s.byteLength=m,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?y(this,0,e):f.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(C(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,o=r-t,l=Math.min(a,o),u=this.slice(n,i),d=e.slice(t,r),c=0;c<l;++c)if(u[c]!==d[c]){a=u[c],o=d[c];break}return a<o?-1:+(o<a)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function y(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,l,u=e[i],d=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(d=u);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&u)<<6|63&a)>127&&(d=l);break;case 3:a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(l=(15&u)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(d=l)}null===d?(d=65533,c=1):d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|1023&d),n.push(d),i+=c}var p=n,m=p.length;if(m<=4096)return String.fromCharCode.apply(String,p);for(var f="",h=0;h<m;)f+=String.fromCharCode.apply(String,p.slice(h,h+=4096));return f}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,i,a){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function _(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function w(e,t,r,n,a){return t*=1,r>>>=0,a||_(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function k(e,t,r,n,a){return t*=1,r>>>=0,a||_(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,o,s,l,u,d,c,p=this.length-t;if((void 0===r||r>p)&&(r=p),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var m=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s,l=parseInt(t.substr(2*o,2),16);if((s=l)!=s)break;e[r+o]=l}return o}(this,e,t,r);case"utf8":case"utf-8":return i=t,a=r,E(S(e,this.length-i),this,i,a);case"ascii":return o=t,s=r,E($(e),this,o,s);case"latin1":case"binary":return function(e,t,r,n){return E($(t),e,r,n)}(this,e,t,r);case"base64":return l=t,u=r,E(j(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d=t,c=r,E(function(e,t){for(var r,n,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i.push(r%256),i.push(n);return i}(e,this.length-d),this,d,c);default:if(m)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),m=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o<r&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return k(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return k(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var a=i-1;a>=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=s.isBuffer(e)?e:s.from(e,n),l=o.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%l]}return this};var I=/[^+/0-9A-Za-z-_]/g;function S(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function $(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function j(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function E(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function C(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var T=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,u=l>>1,d=-7,c=r?i-1:0,p=r?-1:1,m=e[t+c];for(c+=p,a=m&(1<<-d)-1,m>>=-d,d+=s;d>0;a=256*a+e[t+c],c+=p,d-=8);for(o=a&(1<<-d)-1,a>>=-d,d+=n;d>0;o=256*o+e[t+c],c+=p,d-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(m?-1:1);o+=Math.pow(2,n),a-=u}return(m?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,l,u=8*a-i-1,d=(1<<u)-1,c=d>>1,p=5960464477539062e-23*(23===i),m=n?0:a-1,f=n?1:-1,h=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=d):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?t+=p/l:t+=p*Math.pow(2,1-c),t*l>=2&&(o++,l/=2),o+c>=d?(s=0,o=d):o+c>=1?(s=(t*l-1)*Math.pow(2,i),o+=c):(s=t*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;e[r+m]=255&s,m+=f,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+m]=255&o,m+=f,o/=256,u-=8);e[r+m-f]|=128*h}}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},o=!0;try{n[e](r,r.exports,a),o=!1}finally{o&&delete i[e]}return r.exports}a.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=a(72)},82579,(e,t,r)=>{"use strict";var n=e.i(67034);let i=void 0!==n.Buffer,a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,o=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function s(e,t,r){null==r&&null!==t&&"object"==typeof t&&(r=t,t=void 0),i&&n.Buffer.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let s=JSON.parse(e,t);if(null===s||"object"!=typeof s)return s;let u=r&&r.protoAction||"error",d=r&&r.constructorAction||"error";if("ignore"===u&&"ignore"===d)return s;if("ignore"!==u&&"ignore"!==d){if(!1===a.test(e)&&!1===o.test(e))return s}else if("ignore"!==u&&"ignore"===d){if(!1===a.test(e))return s}else if(!1===o.test(e))return s;return l(s,{protoAction:u,constructorAction:d,safe:r&&r.safe})}function l(e,{protoAction:t="error",constructorAction:r="error",safe:n}={}){let i=[e];for(;i.length;){let e=i;for(let a of(i=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(a,"__proto__")){if(!0===n)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete a.__proto__}if("ignore"!==r&&Object.prototype.hasOwnProperty.call(a,"constructor")&&null!==a.constructor&&"object"==typeof a.constructor&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype")){if(!0===n)return null;if("error"===r)throw SyntaxError("Object contains forbidden prototype property");delete a.constructor}for(let e in a){let t=a[e];t&&"object"==typeof t&&i.push(t)}}}return e}function u(e,t,r){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return s(e,t,r)}finally{Error.stackTraceLimit=n}}t.exports=u,t.exports.default=u,t.exports.parse=u,t.exports.safeParse=function(e,t){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return s(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=r}},t.exports.scan=l},26568,(e,t,r)=>{"use strict";var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,a=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g;function c(e){return e?e.replace(d,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,d=1;function p(e){var t=e.match(i);t&&(r+=t.length);var n=e.lastIndexOf("\n");d=~n?e.length-n:d+e.length}function m(){var e={line:r,column:d};return function(t){return t.position=new f(e),g(a),t}}function f(e){this.start=e,this.end={line:r,column:d},this.source=t.source}function h(n){var i=Error(t.source+":"+r+":"+d+": "+n);if(i.reason=n,i.filename=t.source,i.line=r,i.column=d,i.source=e,t.silent);else throw i}function g(t){var r=t.exec(e);if(r){var n=r[0];return p(n),e=e.slice(n.length),r}}function v(e){var t;for(e=e||[];t=y();)!1!==t&&e.push(t);return e}function y(){var t=m();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;""!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return h("End of comment missing");var n=e.slice(2,r-2);return d+=2,p(n),e=e.slice(r),d+=2,t({type:"comment",comment:n})}}f.prototype.content=e,g(a);var b,x=[];for(v(x);b=function(){var e=m(),t=g(o);if(t){if(y(),!g(s))return h("property missing ':'");var r=g(l),i=e({type:"declaration",property:c(t[0].replace(n,"")),value:r?c(r[0].replace(n,"")):""});return g(u),i}}();)!1!==b&&(x.push(b),v(x));return x}},70454,(e,t,r)=>{"use strict";var n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){let r=null;if(!e||"string"!=typeof e)return r;let n=(0,i.default)(e),a="function"==typeof t;return n.forEach(e=>{if("declaration"!==e.type)return;let{property:n,value:i}=e;a?t(n,i,e):i&&((r=r||{})[n]=i)}),r};let i=n(e.r(26568))},65185,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,a=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},u=function(e,t){return"".concat(t,"-")};r.camelCase=function(e,t){var r;return(void 0===t&&(t={}),!(r=e)||a.test(r)||n.test(r))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(s,u):e.replace(o,u)).replace(i,l))}},15511,(e,t,r)=>{"use strict";var n=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(70454)),i=e.r(65185);function a(e,t){var r={};return e&&"string"==typeof e&&(0,n.default)(e,function(e,n){e&&n&&(r[(0,i.camelCase)(e,t)]=n)}),r}a.default=a,t.exports=a},4100,(e,t,r)=>{"use strict";var n=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,r=n.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!a)return!1;for(t in e);return void 0===t||n.call(e,t)},u=function(e,t){a&&"__proto__"===t.name?a(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},d=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;else if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,r,n,i,a,o,c=arguments[0],p=1,m=arguments.length,f=!1;for("boolean"==typeof c&&(f=c,c=arguments[1]||{},p=2),(null==c||"object"!=typeof c&&"function"!=typeof c)&&(c={});p<m;++p)if(t=arguments[p],null!=t)for(r in t)n=d(c,r),c!==(i=d(t,r))&&(f&&i&&(l(i)||(a=s(i)))?(a?(a=!1,o=n&&s(n)?n:[]):o=n&&l(n)?n:{},u(c,{name:r,newValue:e(f,o,i)})):void 0!==i&&u(c,{name:r,newValue:i}));return c}},43794,(e,t,r)=>{!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=i(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var a in e)r.call(e,a)&&e[a]&&(t=i(t,a));return t}(a)))}return e}function i(e,t){return t?e?e+" "+t:e+t:e}if(t.exports)n.default=n,t.exports=n;else if("function"==typeof define&&"object"==typeof define.amd&&define.amd)void 0!==n&&e.v(n);else window.classNames=n}()},99970,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>c};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);let d=Symbol.for("@vercel/request-context");function c(){let e=globalThis;return e[d]?.get?.()??{}}},91754,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={AccessTokenMissingError:()=>d,RefreshAccessTokenFailedError:()=>c};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);class d extends Error{constructor(){super("No authentication found. Please log in with the Vercel CLI (vercel login)."),this.name="AccessTokenMissingError"}}class c extends Error{constructor(e){super("Failed to refresh authentication token.",{cause:e}),this.name="RefreshAccessTokenFailedError"}}},25150,(e,t,r)=>{"use strict";var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={},l={AccessTokenMissingError:()=>c.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>c.RefreshAccessTokenFailedError,getContext:()=>d.getContext,getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>m,getVercelToken:()=>f};for(var u in l)n(s,u,{get:l[u],enumerable:!0});t.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of a(t))o.call(e,l)||l===r||n(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e})(n({},"__esModule",{value:!0}),s);var d=e.r(99970),c=e.r(91754);async function p(){return""}function m(){return""}async function f(){throw Error("getVercelToken is not supported in browser environments")}},61866,(e,t,r)=>{t.exports=function(e,t){let r;if("function"!=typeof e)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n=0;return function(...i){clearTimeout(r);let a=Date.now(),o=t-(a-n);o<=0?(n=a,e.apply(this,i)):r=setTimeout(()=>{n=Date.now(),e.apply(this,i)},o)}}},63454,e=>{"use strict";let t,r,n,i,a;var o,s,l,u,d,c,p,m,f,h,g,v,y,b,x,_,w,k,I,S,$,j,E,C,T,N,A,R,P,O,M,z,D,U,L,Z,F,B,V,q,W,J,H,K,G,Y,X,Q,ee,et,er,en,ei,ea,eo,es,el,eu,ed,ec,ep,em,ef,eh,eg,ev,ey,eb,ex,e_=e.i(18050),ew=e.i(47167),ek=e.i(71645);function eI(e){let t=[];for(let r of e.effectTasks)try{r()}catch(e){t.push(e)}if(t.length>0)if(1===t.length)throw t[0];else{for(let e of t)console.error(e);throw AggregateError(t,"Errors during commit")}}function eS(e){let t=[];for(let r of e.cells)if(r?.type==="effect"&&(r.deps=null,r.cleanup))try{r.cleanup?.()}catch(e){t.push(e)}finally{r.cleanup=void 0}if(t.length>0)if(1===t.length)throw t[0];else{for(let e of t)console.error(e);throw AggregateError(t,"Errors during cleanup")}}let e$=void 0!==ew.default&&!1,ej=null;function eE(){if(!ej)throw Error("No resource fiber available");return ej}let eC=Symbol("fnSymbol");function eT(e,t,r,n=function(e){return e$?ej?.devStrictMode?ej.isFirstRender?"child":"root":e?"root":null:null}(!1)){return{type:e,root:t,markDirty:r,devStrictMode:n,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function eN(e){if(!e.isMounted)throw Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,eS(e)}function eA(e,t){let r={effectTasks:[],props:t,output:void 0};e.currentIndex=0;let n=ej;ej=e;try{if((()=>{e.renderContext=r;try{r.output=function(e,t){let r=e[eC];if(!r)throw Error("ResourceElement.type is not a valid Resource");return r(t)}(e.type,t)}finally{e.renderContext=void 0}})(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{ej=n}return r}function eR(e,t){e.isMounted=!0,e$&&e.isNeverMounted&&"root"===e.devStrictMode&&(e.isNeverMounted=!1,eI(t),eS(e)),e.isNeverMounted=!1,eI(t)}let eP=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),eO=e=>{for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.current=t.workInProgress;e.committedVersion=e.version,e.changelog.length=0,e.dirtyCells.length=0},eM=(e,t)=>{let r=e.version>t;if(e.version=t,r){for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.workInProgress=t.current;if(e.dirtyCells.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw Error("Version is less than committed version");for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();e.changelog.forEach(e=>e()),eO(e)}}},ez=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))};function eD(e){let t=(0,ek.useMemo)(()=>eP(e=>n(e)),[]),[r,n]=(0,ek.useReducer)((e,r)=>(eM(t,e),e+ +!!r()),0);eM(t,r);let i=(()=>{if(!e$)return null;let e=(0,ek.useRef)(0),t=0===e.current;return((0,ek.useState)(()=>e.current++),2!==e.current)?null:t?"child":"root"})(),a=(0,ek.useMemo)(()=>(e.key,eT(e.type,t,void 0,i)),[e.type,e.key,t,i]),o=eA(a,e.props);return(0,ek.useLayoutEffect)(()=>()=>eN(a),[a]),(0,ek.useLayoutEffect)(()=>{eO(t),eR(a,o)}),o.output}function eU(e){let t=e=>({type:t,props:e});return t[eC]=e,t}let eL=(e,t)=>{let r=eE(),n=r.currentIndex++;if(!r.isFirstRender&&n>=r.cells.length)throw Error("Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.");let i=r.cells[n];if(i||(i=t(),r.cells[n]=i),i.type!==e)throw Error("Hook order changed between renders");return i};function eZ(e,t,r,n){let i=eL("reducer",()=>{let t=eE(),a=n?n(r):r;return e$&&t.devStrictMode&&n&&n(r),{type:"reducer",queue:new Set,dirty:!1,workInProgress:a,current:a,reducer:e,dispatch:r=>{let n={action:r,hasEagerState:!1,eagerState:void 0};if(t.renderContext)throw Error("Resource updated during render");if(t.isNeverMounted)throw Error("Resource updated before mount");t.root.dispatchUpdate(()=>{let a=0===t.root.dirtyCells.length&&!n.hasEagerState&&(n.eagerState=e(i.workInProgress,r),n.hasEagerState=!0,Object.is(i.current,n.eagerState))?null:()=>{ez(t,i),i.queue.add(n)};return!!a&&(a(),t.root.changelog.push(a),!0)})}}}),a=eE(),o=e===i.reducer;for(let t of(i.reducer=e,i.queue))t.hasEagerState&&o||(t.eagerState=e(i.workInProgress,t.action),t.hasEagerState=!0),e$&&a.devStrictMode&&e(i.workInProgress,t.action),i.workInProgress=t.eagerState;if(i.queue.clear(),t){let e=t(i.workInProgress);Object.is(e,i.workInProgress)||(ez(a,i),i.workInProgress=e)}return[i.workInProgress,i.dispatch]}let eF=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Object.is(e[r],t[r]))return!1;return!0},eB=()=>{throw Error("Memo reducer should not be called")},eV=(e,t)=>{let r=eE(),[n]=eZ(eB,n=>{if(n&&eF(n.deps,t))return n;let i=e();return e$&&r.devStrictMode&&e(),{value:i,deps:t}},null,void 0);return n.value},eq=()=>({type:"effect",cleanup:void 0,deps:null});function eW(e,t){let r=eL("effect",eq);if(!(t&&r.deps&&eF(r.deps,t))){if(null!==r.deps&&!!t!=!!r.deps)throw Error("tapEffect called with and without dependencies across re-renders");eE().renderContext.effectTasks.push(()=>{let n=[];try{r.cleanup?.()}catch(e){n.push(e)}finally{r.cleanup=void 0}try{let t=e();if(void 0!==t&&"function"!=typeof t)throw Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof t}`);r.cleanup=t}catch(e){n.push(e)}if(r.deps=t,n.length>0)if(1===n.length)throw n[0];else{for(let e of n)console.error(e);throw AggregateError(n,"Errors during commit")}})}}let eJ=(e,t)=>eV(()=>e,t),eH=(e,t)=>"function"==typeof t?t(e):t,eK=e=>"function"==typeof e?e():e;function eG(e){return eZ(eH,void 0,e,eK)}function eY(e,t){let[r]=eG(e);return r}function eX(e){let[t]=eG(()=>({current:e}));return t}function eQ(e,t){let r=eX(0),n=r.current,i=eY(eE,[]),a=eY(()=>()=>{r.current++,i.markDirty?.()},[]),o=eY(()=>new Map,[]),s=t?eJ(e,t):e,l=eV(()=>{let e=s(),t=new Set,r=[],n=0;for(let s=0;s<e.length;s++){let l=e[s],u=l.key;if(void 0===u)throw Error(`tapResources did not provide a key for array at index ${s}`);if(t.has(u))throw Error(`Duplicate key ${u} in tapResources`);t.add(u);let d=o.get(u);if(d)if(d.fiber.type!==l.type){let e=eT(l.type,i.root,a),t=eA(e,l.props);d.next=[e,t],r.push(t.output)}else d.next=eA(d.fiber,l.props),r.push(d.next.output);else{let e=eT(l.type,i.root,a),t=eA(e,l.props);d={fiber:e,next:t},n++,o.set(u,d),r.push(t.output)}}if(o.size>r.length-n)for(let e of o.keys())t.has(e)||(o.get(e).next="delete");return r},[s,n]);return eW(()=>()=>{for(let e of o.keys())eN(o.get(e).fiber)},[]),eW(()=>{for(let[e,t]of o.entries())"delete"===t.next?(t.fiber.isMounted&&eN(t.fiber),o.delete(e)):Array.isArray(t.next)?(eN(t.fiber),t.fiber=t.next[0],eR(t.fiber,t.next[1])):eR(t.fiber,t.next)},[l]),l}function e0(e,t){let r=eE(),n=eX(0),i=eV(()=>(e.key,eT(e.type,r.root,()=>{n.current++,r.markDirty?.()})),[e.type,e.key,r]),a=t?eV(()=>eA(i,e.props),[i,...t,n.current]):eA(i,e.props);return eW(()=>()=>eN(i),[i]),eW(()=>{eR(i,a)},[i,a]),a.output}function e1(e,t){return{...t,key:e}}let e2={schedulers:new Set([]),isScheduled:!1};class e4{_task;_isDirty=!1;constructor(e){this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,e2.schedulers.add(this),e6()}runTask(){this._isDirty=!1,this._task()}}let e6=()=>{e2.isScheduled||(e2.isScheduled=!0,e3())},e5=()=>{try{let e=[],t=0;for(let r of e2.schedulers)if(e2.schedulers.delete(r),r.isDirty){if(++t>50)throw Error("Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside tapEffect.");try{r.runTask()}catch(t){e.push(t)}}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e,"Errors occurred during flushSync")}}finally{e2.schedulers.clear(),e2.isScheduled=!1}},e3=(()=>{if("u">typeof MessageChannel){let e=new MessageChannel;return e.port1.onmessage=e5,()=>e.port2.postMessage(null)}return()=>setTimeout(e5,0)})(),e9=e=>{let t=e2;e2={schedulers:new Set([]),isScheduled:!0};try{let t=e();return e5(),t}finally{e2=t}};function e8(e){let t=eX(e);eW(()=>{t.current=e});let r=eE();return eJ((...e)=>{if(e$&&r.renderContext)throw Error("tapEffectEvent cannot be called during render");return t.current(...e)},[r])}let e7=Symbol("tap.Context"),te=e=>({[e7]:e}),tt=(e,t,r)=>{let n=e[e7];e[e7]=t;try{return r()}finally{e[e7]=n}},tr=e=>e[e7],tn=Symbol("assistant-ui.store.clientIndex"),ti=te([]),ta=new Set(["$$typeof","nodeType","then"]),to=(e,t)=>e===Symbol.toStringTag?t:"symbol"==typeof e?void 0:"toJSON"===e?()=>t:!!ta.has(e)&&void 0;class ts{getOwnPropertyDescriptor(e,t){let r=this.get(e,t);if(void 0!==r)return{value:r,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}}let tl=e=>{let t=eU(e);return e=>{let r=t(e);return void 0===e.key?r:e1(e.key,r)}},tu=Symbol("assistant-ui.store.getValue"),td=new Map;class tc extends ts{outputRef;index;boundFns;cachedReceiver;constructor(e,t){super(),this.outputRef=e,this.index=t}get(e,t,r){if(t===tu)return this.outputRef.current;if(t===tn)return this.index;let n=to(t,"ClientProxy");if(!1!==n)return n;let i=this.outputRef.current[t];if("function"==typeof i){this.cachedReceiver!==r&&(this.boundFns=new Map,this.cachedReceiver=r);let e=this.boundFns.get(t);if(!e){let n;e=(!(n=td.get(t))&&(n=function(...e){if(!this||"object"!=typeof this)throw Error(`Method "${String(t)}" called without proper context. This may indicate the function was called incorrectly.`);let r=this[tu];if(!r)throw Error(`Method "${String(t)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);let n=r[t];if(!n)throw Error(`Method "${String(t)}" is not implemented.`);if("function"!=typeof n)throw Error(`"${String(t)}" is not a function.`);return n(...e)},td.set(t,n)),n).bind(r),this.boundFns.set(t,e)}return e}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(e,t){return t===tu||t===tn||t in this.outputRef.current}}let tp=tl(e=>{var t;let r,n=eX(null),i=tr(ti).length,a=eV(()=>new Proxy({},new tc(n,i)),[i]),o=(t=()=>e0(e),r=tr(ti),tt(ti,eV(()=>[...r,a],[r,a]),t));return n.current||(n.current=o),eW(()=>{n.current=o}),{methods:a,state:o.getState?.(),key:e.key}}),tm=Symbol("assistant-ui.store.proxiedAssistantState"),tf=e=>"on"===e||"subscribe"===e||"symbol"==typeof e,th=e=>new Proxy({},new class extends ts{get(t,r){let n=to(r,"AssistantState");if(!1!==n)return n;if(!tf(r)){let t=e[r]()[tu];if(!t)throw Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");return t.getState?.()}}ownKeys(){return Object.keys(e).filter(e=>!tf(e))}has(t,r){return!tf(r)&&r in e}}),tg=()=>()=>{},tv=e=>{let t=()=>{throw Error(e)};return t.source=null,t.query=null,t},ty=new Proxy({},new class extends ts{get(e,t){if("subscribe"===t||"on"===t)return tg;if(t===tm)return tb;let r=to(t,"DefaultAssistantClient");return!1!==r?r:tv("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",tm]}has(e,t){return"subscribe"===t||"on"===t||t===tm}}),tb=th(ty),tx=(0,ek.createContext)(ty),t_=({value:e,children:t})=>(0,e_.jsx)(tx.Provider,{value:e,children:t}),tw=eU(e=>null),tk=Symbol("assistant-ui.transform-scopes");function tI(e,t){if(e[tk])throw Error("transformScopes is already attached to this resource");e[tk]=t}let tS=e=>eV(()=>e,[...Object.entries(e).flat()]),t$=e=>"string"==typeof e?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event},tj=eU(()=>eY(()=>{let e=new Map,t=new Set,r=new Set;return{on(r,n){if("*"===r)return t.add(n),()=>t.delete(n);let i=e.get(r);return i||(i=new Set,e.set(r,i)),i.add(n),()=>{i.delete(n),0===i.size&&e.delete(r)}},emit(r,n,i){let a=e.get(r);(a||0!==t.size)&&queueMicrotask(()=>{let e=[];if(a)for(let t of a)try{t(n,i)}catch(t){e.push(t)}if(t.size>0){let a={event:r,payload:n};for(let r of t)try{r(a,i)}catch(t){e.push(t)}}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e,"Errors occurred during event emission")}})},subscribe:e=>(r.add(e),()=>r.delete(e)),notifySubscribers(){for(let e of r)try{e()}catch(e){console.error("NotificationManager: subscriber callback error",e)}}}},[])),tE=te(null),tC=()=>{let e=tr(tE);if(!e)throw Error("AssistantTapContext is not available");return e},tT=()=>{let{emit:e}=tC(),t=tr(ti);return e8((r,n)=>{e(r,n,t)})},tN=e=>eV(()=>e,e),tA=eU(({element:e,emit:t,clientRef:r})=>{let{methods:n,state:i}=tt(tE,{clientRef:r,emit:t},()=>e0(tp(e)));return eV(()=>({state:i,methods:n}),[n,i])}),tR=eU(({element:e,notifications:t,clientRef:r,name:n})=>{var i;let a,o,s,l,u,d,c,p,m,f=(i=tA({element:e,emit:t.emit,clientRef:r}),a=eY(()=>new e4(()=>m(null)),[]),o=eY(()=>[],[]),eM((s=eV(()=>(i.key,eT(i.type,eP(e=>{(a.isDirty||e())&&(o.push(e),a.markDirty())}))),[i.type,i.key])).root,s.root.committedVersion),l=eA(s,i.props),u=eX(!1),d=eX(i.props),c=eX(l.output),p=eY(()=>new Set,[]),m=e8(e=>{if(null===e&&(eM(s.root,2),eM(s.root,1),o.forEach(e=>{e$&&s.devStrictMode&&e(),e()}),e$&&s.devStrictMode&&eA(s,d.current),e=eA(s,d.current)),a.isDirty)throw Error("Scheduler is dirty, this should never happen");eO(s.root),o.length=0,u.current&&eR(s,e),a.isDirty||c.current===e.output||(c.current=e.output,p.forEach(e=>e()))}),eW(()=>(u.current=!0,()=>{u.current=!1,eN(s)}),[s]),eW(()=>{d.current=l.props,eO(s.root),eR(s,l),a.isDirty||c.current===l.output||(c.current=l.output,p.forEach(e=>e()))}),eV(()=>({getValue:()=>c.current,subscribe:e=>(p.add(e),()=>p.delete(e))}),[]));return eW(()=>f.subscribe(t.notifySubscribers),[f,t]),eV(()=>{let e=()=>f.getValue().methods;return Object.defineProperties(e,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:n,configurable:!0}}),e},[f,n])}),tP=eU(()=>eV(()=>({clients:[],subscribe:void 0,on:void 0}),[])),tO=eU(({clients:e,clientRef:t})=>{let r=e0(tj());eW(()=>t.parent.subscribe(r.notifySubscribers),[t,r]);let n=tN(eQ(()=>Object.keys(e).map(n=>e1(n,tR({element:e[n],notifications:r,clientRef:t,name:n}))),[e,r,t]));return eV(()=>({clients:n,subscribe:r.subscribe,on:function(e,n){if(!this)throw Error("const { on } = useAui() is not supported. Use aui.on() instead.");let{scope:i,event:a}=t$(e);if("*"!==i&&null===this[i].source)throw Error(`Scope "${i}" is not available. Use { scope: "*", event: "${a}" } to listen globally.`);let o=r.on(a,(e,t)=>{if("*"===i)return void n(e);let r=this[i](),a=r[tn];r===t[a]&&n(e)});if("*"!==i&&null===t.parent[i].source)return o;let s=t.parent.on(e,n);return()=>{o(),s()}}}),[n,r,t])}),tM=eU(({element:e,clientRef:t,name:r})=>{let n=eX(e.props);return n.current=e.props,eV(()=>{let e=()=>n.current.get(t.current);return Object.defineProperties(e,{source:{value:n.current.source},query:{value:n.current.query},name:{value:r,configurable:!0}}),e},[t,r])}),tz=eU(({clients:e,clientRef:t})=>tN(eQ(()=>Object.keys(e).map(r=>{let n=e[r];return e1(((e,t)=>{let r;try{let e={};for(let r of Object.keys(t.query).sort())e[r]=t.query[r];r=JSON.stringify(e)}catch{r=String(t.query)}return`${e}::${t.source}::${r}`})(r,n.props),tM({element:n,clientRef:t,name:r}))}),[e,t]))),tD=eU(({parent:e,clients:t})=>{let{rootClients:r,derivedClients:n}=((e,t)=>{let{rootClients:r,derivedClients:n}=function(e,t){let r={...e},n=new Set,i=!0;for(;i;)for(let e of(i=!1,Object.values(r))){if(e.type===tw||n.has(e.type))continue;n.add(e.type);let a=e.type[tk];if(a){a(r,t),i=!0;break}}let a={},o={};for(let[e,t]of Object.entries(r))t.type===tw?o[e]=t:a[e]=t;return{rootClients:a,derivedClients:o}}(e,t);return{rootClients:tS(r),derivedClients:tS(n)}})(t,e),i=eX({parent:e,current:null}).current;eW(()=>{i.current=s});let a=e0(Object.keys(r).length>0?tO({clients:r,clientRef:i}):tP()),o=e0(tz({clients:n,clientRef:i})),s=eV(()=>{let t=Object.create(e===ty?new Proxy({},{get(e,t){let r=to(t,"AssistantClient");return!1!==r?r:tv(`The current scope does not have a "${String(t)}" property.`)}}):e);for(let r of(Object.assign(t,{subscribe:a.subscribe??e.subscribe,on:a.on??e.on,[tm]:th(t)}),a.clients))t[r.name]=r;for(let e of o)t[e.name]=e;return t},[e,a,o]);return null===i.current&&(i.current=s),s});function tU(e,{parent:t}={parent:(0,ek.useContext)(tx)}){if(e)return eD(tD({parent:t??ty,clients:e}));if(null===t)throw Error("received null parent, this usage is not allowed");return t}let tL=tl(e=>{if(void 0===e.key)throw Error("tapClientResource: Element has no key");return e0(tp(e))});function tZ(e,t){let r=eQ(()=>e().map(e=>tL(e)),t),n=eV(()=>Object.keys(r),[r]),i=eV(()=>r.reduce((e,t,r)=>(e[t.key]=r,e),{}),[r]);return{state:eV(()=>r.map(e=>e.state),[r]),get:e=>{if("index"in e){if(e.index<0||e.index>=n.length)throw Error(`tapClientLookup: Index ${e.index} out of bounds (length: ${n.length})`);return r[e.index].methods}let t=i[e.key];if(void 0===t)throw Error(`tapClientLookup: Key "${e.key}" not found`);return r[t].methods}}}let tF=e=>{let[,t]=eG(e.getState);return eW(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},tB=eU(({runtime:e})=>{let t=tF(e),r=tT();return eW(()=>{let t=[];for(let n of["switchedTo","switchedAway"]){let i=e.unstable_on(n,()=>{r(`threadListItem.${n}`,{threadId:e.getState().id})});t.push(i)}return()=>{for(let e of t)e()}},[e,r]),{getState:()=>t,switchTo:e.switchTo,rename:e.rename,archive:e.archive,unarchive:e.unarchive,delete:e.delete,generateTitle:e.generateTitle,initialize:e.initialize,detach:e.detach,__internal_getRuntime:()=>e}}),tV=eU(({runtime:e})=>{let t=tF(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),tq=eU(({runtime:e,index:t})=>e0(tV({runtime:eV(()=>e.getAttachmentByIndex(t),[e,t])}))),tW=eU(({threadIdRef:e,messageIdRef:t,runtime:r})=>{let n=tF(r),i=tT();eW(()=>{let n=[];for(let a of["send","attachmentAdd"]){let o=r.unstable_on(a,()=>{i(`composer.${a}`,{threadId:e.current,...t&&{messageId:t.current}})});n.push(o)}return n.push(r.unstable_on("attachmentAddError",r=>{i("composer.attachmentAddError",{threadId:e.current,...t&&{messageId:t.current},...r.attachmentId&&{attachmentId:r.attachmentId},reason:r.reason,message:r.message})})),()=>{for(let e of n)e()}},[r,i,e,t]);let a=tZ(()=>n.attachments.map((e,t)=>e1(e.id,tq({runtime:r,index:t}))),[n.attachments,r]),o=eV(()=>({text:n.text,role:n.role,attachments:a.state,runConfig:n.runConfig,isEditing:n.isEditing,canCancel:n.canCancel,canSend:n.canSend,attachmentAccept:n.attachmentAccept,isEmpty:n.isEmpty,type:n.type??"thread",dictation:n.dictation,quote:n.quote,queue:[]}),[n,a.state]);return{getState:()=>o,setText:r.setText,setRole:r.setRole,setRunConfig:r.setRunConfig,addAttachment:r.addAttachment,reset:r.reset,clearAttachments:r.clearAttachments,send:r.send,cancel:r.cancel,beginEdit:r.beginEdit??(()=>{throw Error("beginEdit is not supported in this runtime")}),startDictation:r.startDictation,stopDictation:r.stopDictation,setQuote:r.setQuote,attachment:e=>"id"in e?a.get({key:e.id}):a.get(e),queueItem:()=>{throw Error("Queue is not supported in this runtime")},__internal_getRuntime:()=>r}}),tJ=eU(({runtime:e})=>{let t=tF(e);return{getState:()=>t,addToolResult:t=>e.addToolResult(t),resumeToolCall:t=>e.resumeToolCall(t),__internal_getRuntime:()=>e}}),tH=eU(({runtime:e,index:t})=>e0(tV({runtime:eV(()=>e.getAttachmentByIndex(t),[e,t])}))),tK=eU(({runtime:e,index:t})=>e0(tJ({runtime:eV(()=>e.getMessagePartByIndex(t),[e,t])}))),tG=eU(({runtime:e,threadIdRef:t})=>{let r=tF(e),[n,i]=eG(!1),[a,o]=eG(!1),s=eV(()=>({get current(){return e.getState().id}}),[e]),l=e0(tp(tW({runtime:e.composer,threadIdRef:t,messageIdRef:s}))),u=tZ(()=>r.content.map((t,r)=>e1("toolCallId"in t&&null!=t.toolCallId?`toolCallId-${t.toolCallId}`:`index-${r}`,tK({runtime:e,index:r}))),[r.content,e]),d=tZ(()=>(r.attachments??[]).map((t,r)=>e1(t.id,tH({runtime:e,index:r}))),[r.attachments,e]),c=eV(()=>({...r,parts:u.state,composer:l.state,isCopied:n,isHovering:a}),[r,u.state,l.state,n,a]);return{getState:()=>c,composer:()=>l.methods,reload:t=>e.reload(t),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:t=>e.submitFeedback(t),switchToBranch:t=>e.switchToBranch(t),getCopyText:()=>e.unstable_getCopyText(),part:e=>"index"in e?u.get({index:e.index}):u.get({key:`toolCallId-${e.toolCallId}`}),attachment:e=>"id"in e?d.get({key:e.id}):d.get(e),setIsCopied:i,setIsHovering:o,__internal_getRuntime:()=>e}}),tY=eU(({runtime:e,id:t,threadIdRef:r})=>e0(tG({runtime:eV(()=>e.getMessageById(t),[e,t]),threadIdRef:r}))),tX=eU(({runtime:e})=>{let t=tF(e),r=tT();eW(()=>{let t=[];for(let n of["runStart","runEnd","initialize","modelContextUpdate"]){let i=e.unstable_on(n,()=>{r(`thread.${n}`,{threadId:e.getState()?.threadId||"unknown"})});t.push(i)}return()=>{for(let e of t)e()}},[e,r]);let n=eV(()=>({get current(){return e.getState().threadId}}),[e]),i=e0(tp(tW({runtime:e.composer,threadIdRef:n}))),a=tZ(()=>t.messages.map(t=>e1(t.id,tY({runtime:e,id:t.id,threadIdRef:n}))),[t.messages,e,n]),o=eV(()=>({isEmpty:0===a.state.length&&!t.isLoading,isDisabled:t.isDisabled,isLoading:t.isLoading,isRunning:t.isRunning,capabilities:t.capabilities,state:t.state,suggestions:t.suggestions,extras:t.extras,speech:t.speech,voice:t.voice,composer:i.state,messages:a.state}),[t,a,i.state]);return{getState:()=>o,composer:()=>i.methods,append:e.append,startRun:e.startRun,resumeRun:e.resumeRun,cancelRun:e.cancelRun,getModelContext:e.getModelContext,export:e.export,import:e.import,reset:e.reset,stopSpeaking:e.stopSpeaking,connectVoice:e.connectVoice,disconnectVoice:e.disconnectVoice,getVoiceVolume:e.getVoiceVolume,subscribeVoiceVolume:e.subscribeVoiceVolume,muteVoice:e.muteVoice,unmuteVoice:e.unmuteVoice,message:e=>"id"in e?a.get({key:e.id}):a.get(e),__internal_getRuntime:()=>e}}),tQ=eU(({runtime:e,id:t})=>e0(tB({runtime:eV(()=>e.getItemById(t),[e,t])}))),t0=eU(({runtime:e,__internal_assistantRuntime:t})=>{let r=tF(e),n=e0(tp(tX({runtime:e.main}))),i=tZ(()=>Object.keys(r.threadItems).map(t=>e1(t,tQ({runtime:e,id:t}))),[r.threadItems,e]),a=eV(()=>({mainThreadId:r.mainThreadId,newThreadId:r.newThreadId??null,isLoading:r.isLoading,isLoadingMore:r.isLoadingMore,hasMore:r.hasMore,threadIds:r.threadIds,archivedThreadIds:r.archivedThreadIds,threadItems:i.state,main:n.state}),[r,i.state,n.state]);return{getState:()=>a,thread:()=>n.methods,item:e=>{if("main"===e)return i.get({key:a.mainThreadId});if("id"in e)return i.get({key:e.id});let{index:t,archived:r=!1}=e,n=r?a.archivedThreadIds[t]:a.threadIds[t];return i.get({key:n})},switchToThread:async t=>{await e.switchToThread(t)},switchToNewThread:async()=>{await e.switchToNewThread()},getLoadThreadsPromise:()=>e.getLoadThreadsPromise(),reload:()=>e.reload(),loadMore:()=>e.loadMore(),__internal_getAssistantRuntime:()=>t}});class t1{_providers=new Set;getModelContext(){return Array.from(this._providers).map(e=>e.getModelContext()).sort((e,t)=>(t.priority??0)-(e.priority??0)).reduce((e,t)=>{if(t.system&&(e.system?e.system+=`
2
+
3
+ ${t.system}`:e.system=t.system),t.tools)for(let[r,n]of Object.entries(t.tools)){let t=e.tools?.[r];if(t&&t!==n)throw Error(`You tried to define a tool with the name ${r}, but it already exists.`);e.tools||(e.tools={}),e.tools[r]=n}return t.config&&(e.config={...e.config,...t.config}),t.callSettings&&(e.callSettings={...e.callSettings,...t.callSettings}),e},{})}registerModelContextProvider(e){this._providers.add(e);let t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}_subscribers=new Set;notifySubscribers(){for(let e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}}let t2=[],t4={modelName:void 0,toolNames:t2},t6=(e,t)=>{let r,n=e.getModelContext(),i=n.config?.modelName,a=n.tools?Object.keys(n.tools).sort():t2,o=a.length?a:t2;return i===t.modelName&&(o===(r=t.toolNames)||o.length===r.length&&o.every((e,t)=>e===r[t]))?t:{modelName:i,toolNames:o}},t5=eU(()=>{let e=eV(()=>new t1,[]),[t,r]=eG(()=>t6(e,t4));return eW(()=>(r(t=>t6(e,t)),e.subscribe(()=>{r(t=>t6(e,t))})),[e]),{getState:()=>t6(e,t),getModelContext:()=>e.getModelContext(),subscribe:t=>e.subscribe(t),register:t=>e.registerModelContextProvider(t)}}),t3=eU(e=>({getState:()=>e})),t9=eU(e=>{let[t]=eG(()=>({suggestions:(e??[]).map(e=>"string"==typeof e?{title:e,label:"",prompt:e}:{title:e.title,label:e.label,prompt:e.prompt})})),r=tZ(()=>t.suggestions.map((e,t)=>e1(t,t3(e))),[t.suggestions]);return{getState:()=>t,suggestion:({index:e})=>r.get({index:e})}}),t8=eU(e=>{let t=tC().clientRef;return eW(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),e0(t0({runtime:e.threads,__internal_assistantRuntime:e}))}),t7=eU(()=>{let[e,t]=eG(()=>({renderers:{},fallbacks:[]}));return{getState:()=>e,setDataUI:eJ((e,r)=>(t(t=>({...t,renderers:{...t.renderers,[e]:[...t.renderers[e]??[],r]}})),()=>{t(t=>({...t,renderers:{...t.renderers,[e]:t.renderers[e]?.filter(e=>e!==r)??[]}}))}),[]),setFallbackDataUI:eJ(e=>(t(t=>({...t,fallbacks:[...t.fallbacks,e]})),()=>{t(t=>({...t,fallbacks:t.fallbacks.filter(t=>t!==e)}))}),[])}}),re=eU(({toolkit:e,mcpApp:t})=>{let r=eQ(()=>t?[e1("mcpApp",t)]:[],[t])[0],[n,i]=eG(()=>({tools:{}})),a=eV(()=>({tools:n.tools,mcpApp:r}),[n,r]),o=tC().clientRef,s=eJ((e,t)=>(i(r=>({tools:{...r.tools,[e]:[...r.tools[e]??[],t]}})),()=>{i(r=>({tools:{...r.tools,[e]:r.tools[e]?.filter(e=>e!==t)??[]}}))}),[]);return eW(()=>{if(!e)return;let t=[];for(let[r,n]of Object.entries(e))n.render&&t.push(s(r,n.render));let r=Object.entries(e).reduce((e,[t,r])=>{let{render:n,...i}=r;return e[t]=i,e},{});return t.push(o.current.modelContext().register({getModelContext:()=>({tools:r})})),()=>{t.forEach(e=>e())}},[e,s,o]),{getState:()=>a,setToolUI:s}});tI(re,(e,t)=>{e.modelContext||null!==t.modelContext.source||(e.modelContext=t5())});let rt=eU(e=>e0(t8(e)));tI(rt,(e,t)=>{e.thread??=tw({source:"threads",query:{type:"main"},get:e=>e.threads().thread("main")}),e.threadListItem??=tw({source:"threads",query:{type:"main"},get:e=>e.threads().item("main")}),e.composer??=tw({source:"thread",query:{},get:e=>e.threads().thread("main").composer()}),e.modelContext||null!==t.modelContext.source||(e.modelContext=t5()),e.suggestions||null!==t.suggestions.source||(e.suggestions=t9()),e.tools||null!==t.tools.source||(e.tools=re({})),e.dataRenderers||null!==t.dataRenderers.source||(e.dataRenderers=t7())});let rr=(0,ek.memo)(({runtime:e,aui:t=null,children:r})=>{let n=tU({threads:rt(e)},{parent:t}),i=e._core?.RenderComponent;return(0,e_.jsxs)(t_,{value:n,children:[i&&(0,e_.jsx)(i,{}),r]})}),rn=e=>{let t,r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,a={setState:n,getState:i,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e))},o=t=e(n,i,a);return a},ri=e=>{let t=e?rn(e):rn,r=e=>(function(e,t=e=>e){let r=ek.default.useSyncExternalStore(e.subscribe,ek.default.useCallback(()=>t(e.getState()),[e,t]),ek.default.useCallback(()=>t(e.getInitialState()),[e,t]));return ek.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},ra=e=>e?ri(e):ri,ro=e=>{let t=new Map,r=()=>{let r=0;for(let e of t.values())r+=e;e(r)};return{register:()=>{let e=Symbol();return t.set(e,0),{setHeight:n=>{t.get(e)!==n&&(t.set(e,n),r())},unregister:()=>{t.delete(e),r()}}}}};function rs(e,t){function r(r){let n=e(r);return n?n[t]:null}return{[t]:function(e){let t,n=!1;"function"==typeof e?t=e:e&&"object"==typeof e&&(n=!!e.optional,t=e.selector);let i=r({optional:n});return i?t?i(t):i():null},[`${t}Store`]:r}}let rl=(0,ek.createContext)(null),{useThreadViewport:ru,useThreadViewportStore:rd}=rs(function(e){let t=(0,ek.useContext)(rl);if(!e?.optional&&!t)throw Error("This component must be used within ThreadPrimitive.Viewport.");return t},"useThreadViewport"),rc=({children:e,options:t={}})=>{let r=(e=>{let t=rd({optional:!0}),[r]=(0,ek.useState)(()=>((e={})=>{let t=new Set,r=ro(e=>{a.setState({height:{...a.getState().height,viewport:e}})}),n=ro(e=>{a.setState({height:{...a.getState().height,inset:e}})}),i=(e,t)=>(a.setState({element:{...a.getState().element,[e]:t}}),()=>{a.getState().element[e]===t&&a.setState({element:{...a.getState().element,[e]:null}})}),a=ra(()=>({isAtBottom:!0,scrollToBottom:({behavior:e="auto"}={})=>{for(let r of t)r({behavior:e})},onScrollToBottom:e=>(t.add(e),()=>{t.delete(e)}),turnAnchor:e.turnAnchor??"bottom",topAnchorMessageClamp:{tallerThan:e.topAnchorMessageClamp?.tallerThan??"10em",visibleHeight:e.topAnchorMessageClamp?.visibleHeight??"6em"},height:{viewport:0,inset:0},element:{viewport:null,anchor:null,target:null},targetConfig:null,topAnchorTurn:null,registerViewport:r.register,registerContentInset:n.register,registerViewportElement:e=>i("viewport",e),registerAnchorElement:e=>i("anchor",e),registerAnchorTargetElement:(e,t)=>(a.setState({element:{...a.getState().element,target:e},targetConfig:e&&t?t:null}),()=>{a.getState().element.target===e&&a.setState({element:{...a.getState().element,target:null},targetConfig:null})}),setTopAnchorTurn:e=>{a.setState({topAnchorTurn:e})}}));return a})(e));return(0,ek.useEffect)(()=>t?.getState().onScrollToBottom(()=>{r.getState().scrollToBottom()}),[t,r]),(0,ek.useEffect)(()=>{if(t)return r.subscribe(e=>{t.getState().isAtBottom!==e.isAtBottom&&t.setState({isAtBottom:e.isAtBottom})})},[r,t]),r})(t),[n]=(0,ek.useState)(()=>({useThreadViewport:r}));return(0,e_.jsx)(rl.Provider,{value:n,children:e})},rp=()=>{let e=tU();return(0,ek.useEffect)(()=>{},[e]),null},rm=(0,ek.memo)(({children:e,aui:t,runtime:r})=>(0,e_.jsxs)(rr,{runtime:r,aui:t??null,children:[(0,e_.jsx)(rp,{}),(0,e_.jsx)(rc,{children:e})]}));var rf=e.i(18566),rh=e.i(20783);function rg(e){var t;let r,n=(t=e,(r=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=ek.forwardRef((e,t)=>{let{children:r,...i}=e,a=ek.Children.toArray(r),o=a.find(r_);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(n,{...i,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var rv=rg("Slot"),ry=Symbol("radix.slottable");function rb(e){let t=({children:e})=>(0,e_.jsx)(e_.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=ry,t}var rx=rb("Slottable");function r_(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ry}e.s(["Root",0,rv,"Slot",0,rv,"Slottable",0,rx,"createSlot",0,rg,"createSlottable",0,rb],43556);var rw=e.i(43556),rw=rw,rk=e.i(7670);let rI=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,rS=rk.clsx,r$=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return rS(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:a}=t,o=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],n=null==a?void 0:a[e];if(null===t)return null;let o=rI(t)||rI(n);return i[e][o]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return rS(e,o,null==t||null==(n=t.compoundVariants)?void 0:n.reduce((e,t)=>{let{class:r,className:n,...i}=t;return Object.entries(i).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...a,...s}[t]):({...a,...s})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)};var rw=rw,rj=e.i(47163);let rE=r$("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function rC({className:e,variant:t="default",size:r="default",asChild:n=!1,...i}){let a=n?rw.Root:"button";return(0,e_.jsx)(a,{"data-slot":"button","data-variant":t,"data-size":r,className:(0,rj.cn)(rE({variant:t,size:r,className:e})),...i})}var rT=e.i(28231);let rN=(0,ek.forwardRef)(({children:e,tooltip:t,side:r="bottom",className:n,...i},a)=>(0,e_.jsx)(rT.TooltipProvider,{delayDuration:0,children:(0,e_.jsxs)(rT.Tooltip,{children:[(0,e_.jsx)(rT.TooltipTrigger,{asChild:!0,children:(0,e_.jsxs)(rC,{variant:"ghost",size:"icon",...i,className:(0,rj.cn)("aui-button-icon size-6 p-1",n),ref:a,children:[(0,e_.jsx)(rw.Slottable,{children:e}),(0,e_.jsx)("span",{className:"aui-sr-only sr-only",children:t})]})}),(0,e_.jsx)(rT.TooltipContent,{side:r,children:t})]})}));rN.displayName="TooltipIconButton";let rA=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),rR=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var rP={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let rO=(0,ek.createContext)({}),rM=(0,ek.forwardRef)(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:n,className:i="",children:a,iconNode:o,...s},l)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:c=!1,color:p="currentColor",className:m=""}=(0,ek.useContext)(rO)??{},f=n??c?24*Number(r??d)/Number(t??u):r??d;return(0,ek.createElement)("svg",{ref:l,...rP,width:t??u??rP.width,height:t??u??rP.height,stroke:e??p,strokeWidth:f,className:rA("lucide",m,i),...!a&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(s)&&{"aria-hidden":"true"},...s},[...o.map(([e,t])=>(0,ek.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),rz=(e,t)=>{let r=(0,ek.forwardRef)(({className:r,...n},i)=>(0,ek.createElement)(rM,{ref:i,iconNode:t,className:rA(`lucide-${rR(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...n}));return r.displayName=rR(e),r},rD=rz("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var rU=e.i(81140),rL=e.i(10772),rZ=e.i(69340),rF=e.i(26330),rB=e.i(74080),rV=Symbol("radix.slottable");function rq(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===rV}var rW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(rq);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),rJ=e.i(30207),rH="focusScope.autoFocusOnMount",rK="focusScope.autoFocusOnUnmount",rG={bubbles:!1,cancelable:!0},rY=ek.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=ek.useState(null),u=(0,rJ.useCallbackRef)(i),d=(0,rJ.useCallbackRef)(a),c=ek.useRef(null),p=(0,rh.useComposedRefs)(t,e=>l(e)),m=ek.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ek.useEffect(()=>{if(n){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?c.current=t:r0(c.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;null!==t&&(s.contains(t)||r0(c.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&r0(s)});return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,s,m.paused]),ek.useEffect(()=>{if(s){r1.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(rH,rG);s.addEventListener(rH,u),s.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(r0(n,{select:t}),document.activeElement!==r)return}(rX(s).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&r0(s))}return()=>{s.removeEventListener(rH,u),setTimeout(()=>{let t=new CustomEvent(rK,rG);s.addEventListener(rK,d),s.dispatchEvent(t),t.defaultPrevented||r0(e??document.body,{select:!0}),s.removeEventListener(rK,d),r1.remove(m)},0)}}},[s,u,d,m]);let f=ek.useCallback(e=>{if(!r&&!n||m.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){var a;let t,n=e.currentTarget,[o,s]=[rQ(t=rX(a=n),a),rQ(t.reverse(),a)];o&&s?e.shiftKey||i!==s?e.shiftKey&&i===o&&(e.preventDefault(),r&&r0(s,{select:!0})):(e.preventDefault(),r&&r0(o,{select:!0})):i===n&&e.preventDefault()}},[r,n,m.paused]);return(0,e_.jsx)(rW.div,{tabIndex:-1,...o,ref:p,onKeyDown:f})});function rX(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function rQ(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function r0(e,{select:t=!1}={}){if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}rY.displayName="FocusScope";var r1=(a=[],{add(e){let t=a[0];e!==t&&t?.pause(),(a=r2(a,e)).unshift(e)},remove(e){a=r2(a,e),a[0]?.resume()}});function r2(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}var r4=e.i(74606),r6=e.i(96626);function r5(e){var t;let r,n=(t=e,(r=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=ek.forwardRef((e,t)=>{let{children:r,...i}=e,a=ek.Children.toArray(r),o=a.find(r9);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(n,{...i,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var r3=Symbol("radix.slottable");function r9(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===r3}var r8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=r5(`Primitive.${t}`),n=ek.forwardRef((e,n)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(i?r:t,{...a,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),r7=0;function ne(){ek.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nt()),document.body.insertAdjacentElement("beforeend",e[1]??nt()),r7++,()=>{1===r7&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),r7--}},[])}function nt(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var nr=function(){return(nr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function nn(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var ni=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),na="width-before-scroll-bar";function no(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var ns="u">typeof window?ek.useLayoutEffect:ek.useEffect,nl=new WeakMap,nu=(void 0===o&&(o={}),(void 0===s&&(s=function(e){return e}),l=[],u=!1,d={read:function(){if(u)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return l.length?l[l.length-1]:null},useMedium:function(e){var t=s(e,u);return l.push(t),function(){l=l.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(u=!0;l.length;){var t=l;l=[],t.forEach(e)}l={push:function(t){return e(t)},filter:function(){return l}}},assignMedium:function(e){u=!0;var t=[];if(l.length){var r=l;l=[],r.forEach(e),t=l}var n=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(n)};i(),l={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),l}}}}).options=nr({async:!0,ssr:!1},o),d),nd=function(){},nc=ek.forwardRef(function(e,t){var r,n,i,a,o=ek.useRef(null),s=ek.useState({onScrollCapture:nd,onWheelCapture:nd,onTouchMoveCapture:nd}),l=s[0],u=s[1],d=e.forwardProps,c=e.children,p=e.className,m=e.removeScrollBar,f=e.enabled,h=e.shards,g=e.sideCar,v=e.noRelative,y=e.noIsolation,b=e.inert,x=e.allowPinchZoom,_=e.as,w=e.gapMode,k=nn(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=(r=[o,t],n=function(e){return r.forEach(function(t){return no(t,e)})},(i=(0,ek.useState)(function(){return{value:null,callback:n,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=n,a=i.facade,ns(function(){var e=nl.get(a);if(e){var t=new Set(e),n=new Set(r),i=a.current;t.forEach(function(e){n.has(e)||no(e,null)}),n.forEach(function(e){t.has(e)||no(e,i)})}nl.set(a,r)},[r]),a),S=nr(nr({},k),l);return ek.createElement(ek.Fragment,null,f&&ek.createElement(g,{sideCar:nu,removeScrollBar:m,shards:h,noRelative:v,noIsolation:y,inert:b,setCallbacks:u,allowPinchZoom:!!x,lockRef:o,gapMode:w}),d?ek.cloneElement(ek.Children.only(c),nr(nr({},S),{ref:I})):ek.createElement(void 0===_?"div":_,nr({},S,{className:p,ref:I}),c))});nc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nc.classNames={fullWidth:na,zeroRight:ni};var np=function(e){var t=e.sideCar,r=nn(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return ek.createElement(n,nr({},r))};np.isSideCarExport=!0;var nm=function(){var e=0,t=null;return{add:function(r){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=_||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var n,i;(n=t).styleSheet?n.styleSheet.cssText=r:n.appendChild(document.createTextNode(r)),i=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nf=function(){var e=nm();return function(t,r){ek.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},nh=function(){var e=nf();return function(t){return e(t.styles,t.dynamic),null}},ng={left:0,top:0,right:0,gap:0},nv=function(e){return parseInt(e||"",10)||0},ny=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[nv(r),nv(n),nv(i)]},nb=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return ng;var t=ny(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},nx=nh(),n_="data-scroll-locked",nw=function(e,t,r,n){var i=e.left,a=e.top,o=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(n_,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(ni," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(na," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(ni," .").concat(ni," {\n right: 0 ").concat(n,";\n }\n \n .").concat(na," .").concat(na," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(n_,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},nk=function(){var e=parseInt(document.body.getAttribute(n_)||"0",10);return isFinite(e)?e:0},nI=function(){ek.useEffect(function(){return document.body.setAttribute(n_,(nk()+1).toString()),function(){var e=nk()-1;e<=0?document.body.removeAttribute(n_):document.body.setAttribute(n_,e.toString())}},[])},nS=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=void 0===n?"margin":n;nI();var a=ek.useMemo(function(){return nb(i)},[i]);return ek.createElement(nx,{styles:nw(a,!t,i,r?"":"!important")})},n$=!1;if("u">typeof window)try{var nj=Object.defineProperty({},"passive",{get:function(){return n$=!0,!0}});window.addEventListener("test",nj,nj),window.removeEventListener("test",nj,nj)}catch(e){n$=!1}var nE=!!n$&&{passive:!1},nC=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&(r.overflowY!==r.overflowX||"TEXTAREA"===e.tagName||"visible"!==r[t])},nT=function(e,t){var r=t.ownerDocument,n=t;do{if("u">typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),nN(e,n)){var i=nA(e,n);if(i[1]>i[2])return!0}n=n.parentNode}while(n&&n!==r.body)return!1},nN=function(e,t){return"v"===e?nC(t,"overflowY"):nC(t,"overflowX")},nA=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},nR=function(e,t,r,n,i){var a,o=(a=window.getComputedStyle(t).direction,"h"===e&&"rtl"===a?-1:1),s=o*n,l=r.target,u=t.contains(l),d=!1,c=s>0,p=0,m=0;do{if(!l)break;var f=nA(e,l),h=f[0],g=f[1]-f[2]-o*h;(h||g)&&nN(e,l)&&(p+=g,m+=h);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!u&&l!==document.body||u&&(t.contains(l)||t===l))return c&&(i&&1>Math.abs(p)||!i&&s>p)?d=!0:!c&&(i&&1>Math.abs(m)||!i&&-s>m)&&(d=!0),d},nP=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nO=function(e){return[e.deltaX,e.deltaY]},nM=function(e){return e&&"current"in e?e.current:e},nz=0,nD=[];let nU=(c=function(e){var t=ek.useRef([]),r=ek.useRef([0,0]),n=ek.useRef(),i=ek.useState(nz++)[0],a=ek.useState(nh)[0],o=ek.useRef(e);ek.useEffect(function(){o.current=e},[e]),ek.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(function(e,t,r){if(r||2==arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(nM),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=ek.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var i,a=nP(e),s=r.current,l="deltaX"in e?e.deltaX:s[0]-a[0],u="deltaY"in e?e.deltaY:s[1]-a[1],d=e.target,c=Math.abs(l)>Math.abs(u)?"h":"v";if("touches"in e&&"h"===c&&"range"===d.type)return!1;var p=window.getSelection(),m=p&&p.anchorNode;if(m&&(m===d||m.contains(d)))return!1;var f=nT(c,d);if(!f)return!0;if(f?i=c:(i="v"===c?"h":"v",f=nT(c,d)),!f)return!1;if(!n.current&&"changedTouches"in e&&(l||u)&&(n.current=i),!i)return!0;var h=n.current||i;return nR(h,t,e,"h"===h?l:u,!0)},[]),l=ek.useCallback(function(e){if(nD.length&&nD[nD.length-1]===a){var r="deltaY"in e?nO(e):nP(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta,n[0]===r[0]&&n[1]===r[1])})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var i=(o.current.shards||[]).map(nM).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?s(e,i[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),u=ek.useCallback(function(e,r,n,i){var a={name:e,delta:r,target:n,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=ek.useCallback(function(e){r.current=nP(e),n.current=void 0},[]),c=ek.useCallback(function(t){u(t.type,nO(t),t.target,s(t,e.lockRef.current))},[]),p=ek.useCallback(function(t){u(t.type,nP(t),t.target,s(t,e.lockRef.current))},[]);ek.useEffect(function(){return nD.push(a),e.setCallbacks({onScrollCapture:c,onWheelCapture:c,onTouchMoveCapture:p}),document.addEventListener("wheel",l,nE),document.addEventListener("touchmove",l,nE),document.addEventListener("touchstart",d,nE),function(){nD=nD.filter(function(e){return e!==a}),document.removeEventListener("wheel",l,nE),document.removeEventListener("touchmove",l,nE),document.removeEventListener("touchstart",d,nE)}},[]);var m=e.removeScrollBar,f=e.inert;return ek.createElement(ek.Fragment,null,f?ek.createElement(a,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,m?ek.createElement(nS,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},nu.useMedium(c),np);var nL=ek.forwardRef(function(e,t){return ek.createElement(nc,nr({},e,{ref:t,sideCar:nU}))});nL.classNames=nc.classNames;var nZ=new WeakMap,nF=new WeakMap,nB={},nV=0,nq=function(e){return e&&(e.host||nq(e.parentNode))},nW=function(e,t,r,n){var i=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=nq(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});nB[r]||(nB[r]=new WeakMap);var a=nB[r],o=[],s=new Set,l=new Set(i),u=function(e){!e||s.has(e)||(s.add(e),u(e.parentNode))};i.forEach(u);var d=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),i=null!==t&&"false"!==t,l=(nZ.get(e)||0)+1,u=(a.get(e)||0)+1;nZ.set(e,l),a.set(e,u),o.push(e),1===l&&i&&nF.set(e,!0),1===u&&e.setAttribute(r,"true"),i||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),nV++,function(){o.forEach(function(e){var t=nZ.get(e)-1,i=a.get(e)-1;nZ.set(e,t),a.set(e,i),t||(nF.has(e)||e.removeAttribute(n),nF.delete(e)),i||e.removeAttribute(r)}),--nV||(nZ=new WeakMap,nZ=new WeakMap,nF=new WeakMap,nB={})}},nJ=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),nW(n,i,r,"aria-hidden")):function(){return null}},nH="Dialog",[nK,nG]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(nH),[nY,nX]=nK(nH),nQ=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=ek.useRef(null),l=ek.useRef(null),[u,d]=(0,rZ.useControllableState)({prop:n,defaultProp:i??!1,onChange:a,caller:nH});return(0,e_.jsx)(nY,{scope:t,triggerRef:s,contentRef:l,contentId:(0,rL.useId)(),titleId:(0,rL.useId)(),descriptionId:(0,rL.useId)(),open:u,onOpenChange:d,onOpenToggle:ek.useCallback(()=>d(e=>!e),[d]),modal:o,children:r})};nQ.displayName=nH;var n0="DialogTrigger",n1=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=nX(n0,r),a=(0,rh.useComposedRefs)(t,i.triggerRef);return(0,e_.jsx)(r8.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ip(i.open),...n,ref:a,onClick:(0,rU.composeEventHandlers)(e.onClick,i.onOpenToggle)})});n1.displayName=n0;var n2="DialogPortal",[n4,n6]=nK(n2,{forceMount:void 0}),n5=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:i}=e,a=nX(n2,t);return(0,e_.jsx)(n4,{scope:t,forceMount:r,children:ek.Children.map(n,e=>(0,e_.jsx)(r6.Presence,{present:r||a.open,children:(0,e_.jsx)(r4.Portal,{asChild:!0,container:i,children:e})}))})};n5.displayName=n2;var n3="DialogOverlay",n9=ek.forwardRef((e,t)=>{let r=n6(n3,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=nX(n3,e.__scopeDialog);return a.modal?(0,e_.jsx)(r6.Presence,{present:n||a.open,children:(0,e_.jsx)(n7,{...i,ref:t})}):null});n9.displayName=n3;var n8=r5("DialogOverlay.RemoveScroll"),n7=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=nX(n3,r);return(0,e_.jsx)(nL,{as:n8,allowPinchZoom:!0,shards:[i.contentRef],children:(0,e_.jsx)(r8.div,{"data-state":ip(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ie="DialogContent",it=ek.forwardRef((e,t)=>{let r=n6(ie,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=nX(ie,e.__scopeDialog);return(0,e_.jsx)(r6.Presence,{present:n||a.open,children:a.modal?(0,e_.jsx)(ir,{...i,ref:t}):(0,e_.jsx)(ii,{...i,ref:t})})});it.displayName=ie;var ir=ek.forwardRef((e,t)=>{let r=nX(ie,e.__scopeDialog),n=ek.useRef(null),i=(0,rh.useComposedRefs)(t,r.contentRef,n);return ek.useEffect(()=>{let e=n.current;if(e)return nJ(e)},[]),(0,e_.jsx)(ia,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,rU.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:(0,rU.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,rU.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),ii=ek.forwardRef((e,t)=>{let r=nX(ie,e.__scopeDialog),n=ek.useRef(!1),i=ek.useRef(!1);return(0,e_.jsx)(ia,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(n.current||r.triggerRef.current?.focus(),t.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let a=t.target;r.triggerRef.current?.contains(a)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),ia=ek.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=nX(ie,r),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l);return ne(),(0,e_.jsxs)(e_.Fragment,{children:[(0,e_.jsx)(rY,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,e_.jsx)(rF.DismissableLayer,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ip(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),(0,e_.jsxs)(e_.Fragment,{children:[(0,e_.jsx)(iv,{titleId:s.titleId}),(0,e_.jsx)(iy,{contentRef:l,descriptionId:s.descriptionId})]})]})}),io="DialogTitle",is=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=nX(io,r);return(0,e_.jsx)(r8.h2,{id:i.titleId,...n,ref:t})});is.displayName=io;var il="DialogDescription",iu=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=nX(il,r);return(0,e_.jsx)(r8.p,{id:i.descriptionId,...n,ref:t})});iu.displayName=il;var id="DialogClose",ic=ek.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=nX(id,r);return(0,e_.jsx)(r8.button,{type:"button",...n,ref:t,onClick:(0,rU.composeEventHandlers)(e.onClick,()=>i.onOpenChange(!1))})});function ip(e){return e?"open":"closed"}ic.displayName=id;var im="DialogTitleWarning",[ih,ig]=(p={contentName:ie,titleName:io,docsSlug:"dialog"},r=ek.createContext(p),(n=e=>{let{children:t,...n}=e,i=ek.useMemo(()=>n,Object.values(n));return(0,e_.jsx)(r.Provider,{value:i,children:t})}).displayName=im+"Provider",[n,function(e){let t=ek.useContext(r);if(t)return t;if(void 0!==p)return p;throw Error(`\`${e}\` must be used within \`${im}\``)}]),iv=({titleId:e})=>{let t=ig(im),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
4
+
5
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
6
+
7
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return ek.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},iy=({contentRef:e,descriptionId:t})=>{let r=ig("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return ek.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null};e.s(["Close",0,ic,"Content",0,it,"Description",0,iu,"Dialog",0,nQ,"DialogClose",0,ic,"DialogContent",0,it,"DialogDescription",0,iu,"DialogOverlay",0,n9,"DialogPortal",0,n5,"DialogTitle",0,is,"DialogTrigger",0,n1,"Overlay",0,n9,"Portal",0,n5,"Root",0,nQ,"Title",0,is,"Trigger",0,n1,"WarningProvider",0,ih,"createDialogScope",0,nG],26999);var ib=e.i(26999),ib=ib;function ix({...e}){return(0,e_.jsx)(ib.Root,{"data-slot":"sheet",...e})}function i_({...e}){return(0,e_.jsx)(ib.Portal,{"data-slot":"sheet-portal",...e})}function iw({className:e,...t}){return(0,e_.jsx)(ib.Overlay,{"data-slot":"sheet-overlay",className:(0,rj.cn)("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...t})}function ik({className:e,children:t,side:r="right",showCloseButton:n=!0,...i}){return(0,e_.jsxs)(i_,{children:[(0,e_.jsx)(iw,{}),(0,e_.jsxs)(ib.Content,{"data-slot":"sheet-content",className:(0,rj.cn)("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500","right"===r&&"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm","left"===r&&"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm","top"===r&&"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top","bottom"===r&&"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",e),...i,children:[t,n&&(0,e_.jsxs)(ib.Close,{className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,e_.jsx)(rD,{className:"size-4"}),(0,e_.jsx)("span",{className:"sr-only",children:"关闭"})]})]})]})}function iI({className:e,...t}){return(0,e_.jsx)("div",{"data-slot":"sheet-header",className:(0,rj.cn)("flex flex-col gap-1.5 p-4",e),...t})}function iS({className:e,...t}){return(0,e_.jsx)(ib.Title,{"data-slot":"sheet-title",className:(0,rj.cn)("font-semibold text-foreground",e),...t})}function i$({className:e,...t}){return(0,e_.jsx)(ib.Description,{"data-slot":"sheet-description",className:(0,rj.cn)("text-sm text-muted-foreground",e),...t})}let ij=e=>{let t=tU(),r=t[tm],n=(0,ek.useSyncExternalStore)(t.subscribe,()=>e(r),()=>e(r));if(n===r)throw Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return(0,ek.useDebugValue)(n),n},iE=new Set(["high","medium","low"]),iC=new Set(["pending","in_progress","completed"]);function iT(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function iN(e){return Array.isArray(e)?e.flatMap(e=>{if(!iT(e))return[];let{content:t,priority:r,status:n}=e;return"string"==typeof t&&"string"==typeof r&&iE.has(r)&&"string"==typeof n&&iC.has(n)?[{content:t,priority:r,status:n}]:[]}):[]}function iA(){let e=ij(e=>e.thread.messages);return(0,ek.useMemo)(()=>{for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(!r)continue;if("user"===r.role)break;if("assistant"!==r.role)continue;let n=r.metadata?.custom,i=function(e){var t;let r=e?.acpPlans;if(!iT(r))return[];let n=iT(r.byId)?r.byId:{},i=iT(r.removed)?r.removed:{},a="string"==typeof(t=r.latestId)?t.trim():"",o=Object.entries(n).sort(([,e],[,t])=>{let r=iT(e)?Number(e.updatedAt):0;return(iT(t)?Number(t.updatedAt):0)-r});for(let[e,t]of a?[[a,n[a]],...o.filter(([e])=>e!==a)]:o){if(i[e]||!iT(t)||t.removed||"items"!==t.type)continue;let r=iN(t.entries);if(r.length>0)return r}return[]}(n);if(i.length>0)return i;let a=iN(n?.acpPlan);if(a.length>0)return a}return[]},[e])}let iR=rz("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),iP=rz("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),iO=rz("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),iM=rz("list-x",[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"m15.5 9.5 5 5",key:"ytk86i"}],["path",{d:"m20.5 9.5-5 5",key:"17o44f"}]]),iz=rz("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),iD=rz("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),iU=rz("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function iL(e=[],t=new Date().toISOString()){return{version:"2",items:e,updatedAt:t}}function iZ(e){return"file"===e||"annotation"===e}function iF(e,t){if(!t)return e;let r=new Set(t);return{...e,items:e.items.filter(e=>r.has(e.kind))}}let iB=["claude","codex","gemini","opencode"],iV="bypassPermissions",iq="full-access",iW="bypassPermissions",iJ="build",iH={openai:"codex"},iK={claude:{provider:"claude",label:"Claude",command:"npx",args:["-y","@agentclientprotocol/claude-agent-acp@^0.39.0"],defaultModel:"sonnet",defaultModeId:iV,supportsImages:!0,enabledInP0:!1},codex:{provider:"codex",label:"Codex",command:"./node_modules/.bin/codex-acp",defaultModeId:iq,supportsImages:!0,enabledInP0:!0},gemini:{provider:"gemini",label:"Gemini",command:"npx",args:["-y","@google/gemini-cli@^0.44.1","--acp","--skip-trust"],defaultModel:"gemini-3-pro-preview",defaultModeId:iW,supportsImages:!1,enabledInP0:!1},opencode:{provider:"opencode",label:"OpenCode",command:"npx",args:["-y","opencode-ai@^1.15.13","acp"],defaultModel:"opencode/big-pickle",defaultModeId:iJ,supportsImages:!1,enabledInP0:!1}};function iG(e){let t=String(e||"codex").trim().toLowerCase(),r=iH[t]??t;return iB.includes(r)?r:"codex"}let iY="image-generation",iX="acp-ui-image-generation",iQ="generate_image",i0=`Tool: ${iX}/${iQ}`,i1="acp.acp_provider_agent_dynamic_tool";function i2(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function i4(e){if(!i2(e))return null;let t="string"==typeof e.toolName?e.toolName:null;return t?{toolCallId:"string"==typeof e.toolCallId?e.toolCallId:void 0,toolName:t,args:e.args}:null}function i6(e){return i2(e)&&("completed"===e.status||"failed"===e.status)&&"string"==typeof e.requestId&&"string"==typeof e.prompt&&Array.isArray(e.images)}function i5(e){if(i6(e))return e;if(i2(e)&&i6(e.structuredContent))return e.structuredContent;if("string"==typeof e)try{return i5(JSON.parse(e))}catch{}return null}let i3={enabled:!0,baseUrl:"",apiKey:"",model:"",preservePrompt:!0};function i9(e){if(!i2(e))return i3;let t=t=>"string"==typeof e[t]?e[t].trim():"";return{enabled:!1!==e.enabled,baseUrl:t("baseUrl"),apiKey:t("apiKey"),model:t("model"),savePathPattern:t("savePathPattern")||void 0,preservePrompt:"boolean"!=typeof e.preservePrompt||e.preservePrompt}}let i8="user-choice",i7="acp-ui-user-choice",ae="ask_user_choice",at=`Tool: ${i7}/${ae}`,ar="自定义",an="USER_CHOICE_RESULT";function ai(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}let aa={enabled:!0,waitTimeoutMs:12e4,allowCustomInput:!0,customInputLabel:ar};function ao(e){var t,r;return{...aa,...!ai(t=e)?{enabled:!0,waitTimeoutMs:12e4,allowCustomInput:!0,customInputLabel:ar}:{enabled:!1!==t.enabled,waitTimeoutMs:function(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(18e4,Math.max(5e3,Math.floor(e)))}(t.waitTimeoutMs)??12e4,allowCustomInput:!1!==t.allowCustomInput,customInputLabel:("string"==typeof(r=t.customInputLabel)&&r.trim()?r.trim():void 0)??ar}}}let as="acp-ui-builtin-tool-settings",al=[{id:iY,defaultSettings:i3,legacyStorageKey:"acp-ui-image-generation-tool-settings",normalizeSettings:i9,isEnabled:e=>i9(e).enabled},{id:i8,defaultSettings:aa,normalizeSettings:ao,isEnabled:e=>ao(e).enabled}];function au(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ad(e){try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function ac(e,t){window.localStorage.setItem(e,JSON.stringify(t))}function ap(e){let t=au(e)?e:{},r={};for(let e of al)r[e.id]=e.normalizeSettings(e.id in t?t[e.id]:e.defaultSettings);return r}let am="codex",af=(0,ek.createContext)(null);function ah(e){return e.map(e=>{let t;return{...e,id:"string"==typeof e.id&&e.id.trim()?e.id.trim():(t={...e},delete t.id,`${e.kind}:${function(e){let t=0x811c9dc5;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,0x1000193);return(t>>>0).toString(36)}(function e(t){return Array.isArray(t)?`[${t.map(t=>e(t)).join(",")}]`:t&&"object"==typeof t?`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${e(t[r])}`).join(",")}}`:JSON.stringify(t)}(t))}`)}})}function ag(e){return iL(e,new Date().toISOString())}function av(e){return e.map(e=>e.id).filter(e=>!!e)}function ay(e,t){window.dispatchEvent(new CustomEvent("acp.context.local-change",{detail:{context:e,change:t}}))}function ab({children:e,workspacePath:t,defaultProvider:r}){let[n,i]=(0,ek.useState)(()=>iG(r??am)),[a,o]=(0,ek.useState)(null),[s,l]=(0,ek.useState)(null),[u,d]=(0,ek.useState)(null),[c,p]=(0,ek.useState)(null),[m,f]=(0,ek.useState)(null),[h,g]=(0,ek.useState)(null),[v,y]=(0,ek.useState)({}),[b,x]=(0,ek.useState)(()=>iL()),_=(0,ek.useRef)(b),w=(0,ek.useCallback)(e=>{_.current=e,x(e)},[]);(0,ek.useEffect)(()=>{y(function(){let e=ad(as),t=au(e)?{...e}:{};for(let e of al){if(e.id in t||!e.legacyStorageKey)continue;let r=ad(e.legacyStorageKey);r&&(t[e.id]=r)}return ap(t)}())},[]);let k=(0,ek.useCallback)(e=>String(e??"").trim()||null,[]),I=(0,ek.useCallback)(e=>{let t=iG(e??am);i(e=>e===t?e:(o(null),l(null),d(null),p(null),f(null),g(null),t))},[]),S=(0,ek.useCallback)(e=>{let t=k(e);o(t),p(t)},[k]),$=(0,ek.useCallback)(e=>{let t=k(e);l(t),f(t)},[k]),j=(0,ek.useCallback)(e=>{let t=k(e);d(t),g(t)},[k]),E=(0,ek.useCallback)((e,t)=>{y(r=>{let n,i,a=(n=r[e],i="function"==typeof t?t(n):t,ap({...r,[e]:i})),o=ap(a);for(let e of(ac(as,o),al))e.legacyStorageKey&&ac(e.legacyStorageKey,o[e.id]);return a})},[]),C=(0,ek.useCallback)(e=>o(k(e)),[k]),T=(0,ek.useCallback)(e=>l(k(e)),[k]),N=(0,ek.useCallback)(e=>d(k(e)),[k]),A=(0,ek.useCallback)(e=>{let t=ah(e),r=new Map(_.current.items.map(e=>[e.id,e]));for(let e of t)r.set(e.id,e);let n=ag([...r.values()]),i={operation:"add",ids:av(t),items:t};return w(n),ay(n,i),{context:n,change:i}},[w]),R=(0,ek.useCallback)(e=>{let t=e.map(e=>e.trim()).filter(Boolean),r=new Set(t),n=ag(_.current.items.filter(e=>!r.has(e.id??""))),i={operation:"remove",ids:t};return w(n),ay(n,i),{context:n,change:i}},[w]),P=(0,ek.useCallback)(e=>{let t=ah(e),r=ag(t),n={operation:"replace",ids:av(t),items:t};return w(r),ay(r,n),{context:r,change:n}},[w]),O=(0,ek.useCallback)(e=>{let t=e?new Set(e):null,r=ag(t?_.current.items.filter(e=>!t.has(e.kind)):[]),n={operation:"clear",kinds:e};return w(r),ay(r,n),{context:r,change:n}},[w]),M=(0,ek.useCallback)(e=>iF(_.current,e),[]),z=(0,ek.useCallback)(()=>{let e=_.current;if(0===e.items.length)return null;let t=ag([]);return w(t),ay(t,{operation:"consume",ids:av(e.items),items:e.items}),e},[w]),D=(0,ek.useMemo)(()=>({provider:n,model:a,modeId:s,thoughtLevel:u,explicitModel:c,explicitModeId:m,explicitThoughtLevel:h,permissionMode:"bypassPermissions",workspacePath:k(t??null),builtinToolSettings:v,contextBundle:b,setProvider:I,setModel:S,setModeId:$,setThoughtLevel:j,setBuiltinToolSettings:E,syncModel:C,syncModeId:T,syncThoughtLevel:N,addContextItems:A,removeContextItems:R,replaceContextItems:P,clearContextItems:O,getContextBundle:M,consumeContextBundle:z}),[A,O,z,b,v,m,c,h,M,a,s,k,n,R,P,$,S,I,E,T,C,N,j,u,t]);return(0,e_.jsx)(af.Provider,{value:D,children:e})}function ax(){let e=(0,ek.useContext)(af);if(!e)throw Error("useAcpUiRuntimeContext must be used inside AcpUiProvider");return e}let a_={};function aw(e){return{apiBasePath:ak(e?.apiBasePath),apiBaseUrl:ak(e?.apiBaseUrl)}}function ak(e){return String(e??"").trim()||null}function aI(e,t){let r,n,i,a,o=e.startsWith("/")?e:`/${e}`,s=(a=String((r=aw({...a_,...aw(window.__ACP_UI_RUNTIME_CONFIG__)})).apiBaseUrl??r.apiBasePath??null??(i=aw({apiBasePath:(n=new URLSearchParams(window.location.search)).get("acpApiBasePath"),apiBaseUrl:n.get("acpApiBaseUrl")})).apiBaseUrl??i.apiBasePath??null??ak(ew.default.env.NEXT_PUBLIC_ACP_UI_API_BASE_URL)??ak(ew.default.env.NEXT_PUBLIC_ACP_UI_API_BASE_PATH)??"").trim())?a.replace(/\/+$/,""):"/api",l=window.location.origin,u=new URL(`${s}${o}`,l);for(let[e,r]of Object.entries(t??{}))null!=r&&""!==r&&u.searchParams.set(e,String(r));return u.origin===l?`${u.pathname}${u.search}`:u.toString()}async function aS(e,t){let r=await fetch(e,{...t,headers:{"content-type":"application/json",...t?.headers}});if(!r.ok){let e=`${r.status} ${r.statusText}`,t=await r.json().catch(()=>null);throw Error(t?.error??e)}return r.json()}function a$(e){return`/conversations/${encodeURIComponent(e)}`}let aj=(e,t)=>aI("/conversations",{workspacePath:e,limit:t?.limit,after:t?.after,refreshProvider:t?.refreshProvider}),aE=(e,t)=>aI(a$(e),{workspacePath:t}),aC=(e,t,r)=>aI(`${a$(e)}/messages`,{workspacePath:t,format:r}),aT={chatUrl:()=>aI("/chat"),listConversations:async(e,t)=>aS(aj(e,t)),upsertConversation:async(e,t)=>aS(aj(t),{method:"POST",body:JSON.stringify(e)}),getConversation:async(e,t)=>aS(aE(e,t)),renameConversation:async(e,t,r)=>aS(aE(e,r),{method:"PATCH",body:JSON.stringify({title:t})}),archiveConversation:async(e,t,r)=>aS(aE(e,r),{method:"PATCH",body:JSON.stringify({archived:t})}),async deleteConversation(e,t){let r=await fetch(aE(e,t),{method:"DELETE"});if(!r.ok)throw Error(`${r.status} ${r.statusText}`)},loadConversationMessages:async(e,t,r)=>aS(aC(e,t,r)),saveConversationMessage:async(e,t,r)=>aS(aC(e,t,r.format),{method:"POST",body:JSON.stringify(r)}),listImageGenerationRecords:async(e,t,r)=>{let n,i;return aS((n=e,i=t,aI("/tools/image-generation/records",{workspacePath:n,threadId:i,limit:r})))},getUserChoiceRequest:async e=>aS(aI("/tools/user-choice",e)),answerUserChoiceRequest:async e=>{let t;return aS(aI("/tools/user-choice",t),{method:"POST",body:JSON.stringify(e)})},listWorkspaceOutputArtifacts:async(e,t,r)=>{let n,i;return aS((n=e,i=t,aI("/output-artifacts/workspace",{workspacePath:n,threadId:i,sinceMs:r})))},getCapabilities:async e=>aS((({provider:e,threadId:t,workspacePath:r})=>aI("/acp/capabilities",{provider:e,threadId:t,workspacePath:r}))(e)),listCommands:async e=>aS((({provider:e,threadId:t,workspacePath:r})=>aI("/acp/commands",{provider:e,threadId:t,workspacePath:r}))(e))},aN=rz("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),aA=rz("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),aR=rz("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);var ib=ib;function aP({...e}){return(0,e_.jsx)(ib.Root,{"data-slot":"dialog",...e})}function aO({...e}){return(0,e_.jsx)(ib.Trigger,{"data-slot":"dialog-trigger",...e})}function aM({...e}){return(0,e_.jsx)(ib.Portal,{"data-slot":"dialog-portal",...e})}function az({...e}){return(0,e_.jsx)(ib.Close,{"data-slot":"dialog-close",...e})}function aD({className:e,...t}){return(0,e_.jsx)(ib.Overlay,{"data-slot":"dialog-overlay",className:(0,rj.cn)("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t})}function aU({className:e,children:t,showCloseButton:r=!0,...n}){return(0,e_.jsxs)(aM,{"data-slot":"dialog-portal",children:[(0,e_.jsx)(aD,{}),(0,e_.jsxs)(ib.Content,{"data-slot":"dialog-content",className:(0,rj.cn)("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg outline-none duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",e),...n,children:[t,r&&(0,e_.jsxs)(ib.Close,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",children:[(0,e_.jsx)(rD,{}),(0,e_.jsx)("span",{className:"sr-only",children:"关闭"})]})]})]})}function aL({className:e,...t}){return(0,e_.jsx)("div",{"data-slot":"dialog-header",className:(0,rj.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function aZ({className:e,showCloseButton:t=!1,children:r,...n}){return(0,e_.jsxs)("div",{"data-slot":"dialog-footer",className:(0,rj.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...n,children:[r,t&&(0,e_.jsx)(ib.Close,{asChild:!0,children:(0,e_.jsx)(rC,{variant:"outline",children:"关闭"})})]})}function aF({className:e,...t}){return(0,e_.jsx)(ib.Title,{"data-slot":"dialog-title",className:(0,rj.cn)("font-semibold text-lg leading-none",e),...t})}function aB({className:e,...t}){return(0,e_.jsx)(ib.Description,{"data-slot":"dialog-description",className:(0,rj.cn)("text-muted-foreground text-sm",e),...t})}let aV=rz("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),aq=rz("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),aW=rz("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),aJ=rz("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);var aH=e.i(34620),aK=Symbol("radix.slottable");function aG(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===aK}var aY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(aG);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),aX="Collapsible",[aQ,a0]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(aX),[a1,a2]=aQ(aX),a4=ek.forwardRef((e,t)=>{let{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[l,u]=(0,rZ.useControllableState)({prop:n,defaultProp:i??!1,onChange:o,caller:aX});return(0,e_.jsx)(a1,{scope:r,disabled:a,contentId:(0,rL.useId)(),open:l,onOpenToggle:ek.useCallback(()=>u(e=>!e),[u]),children:(0,e_.jsx)(aY.div,{"data-state":a7(l),"data-disabled":a?"":void 0,...s,ref:t})})});a4.displayName=aX;var a6="CollapsibleTrigger",a5=ek.forwardRef((e,t)=>{let{__scopeCollapsible:r,...n}=e,i=a2(a6,r);return(0,e_.jsx)(aY.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":a7(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...n,ref:t,onClick:(0,rU.composeEventHandlers)(e.onClick,i.onOpenToggle)})});a5.displayName=a6;var a3="CollapsibleContent",a9=ek.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=a2(a3,e.__scopeCollapsible);return(0,e_.jsx)(r6.Presence,{present:r||i.open,children:({present:e})=>(0,e_.jsx)(a8,{...n,ref:t,present:e})})});a9.displayName=a3;var a8=ek.forwardRef((e,t)=>{let{__scopeCollapsible:r,present:n,children:i,...a}=e,o=a2(a3,r),[s,l]=ek.useState(n),u=ek.useRef(null),d=(0,rh.useComposedRefs)(t,u),c=ek.useRef(0),p=c.current,m=ek.useRef(0),f=m.current,h=o.open||s,g=ek.useRef(h),v=ek.useRef(void 0);return ek.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,aH.useLayoutEffect)(()=>{let e=u.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();c.current=t.height,m.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),l(n)}},[o.open,n]),(0,e_.jsx)(aY.div,{"data-state":a7(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!h,...a,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":f?`${f}px`:void 0,...e.style},children:h&&i})});function a7(e){return e?"open":"closed"}e.s(["Collapsible",0,a4,"CollapsibleContent",0,a9,"CollapsibleTrigger",0,a5,"Content",0,a9,"Root",0,a4,"Trigger",0,a5,"createCollapsibleScope",0,a0],87607);var oe=e.i(87607),oe=oe;function ot({...e}){return(0,e_.jsx)(oe.Root,{"data-slot":"collapsible",...e})}function or({...e}){return(0,e_.jsx)(oe.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...e})}function on({...e}){return(0,e_.jsx)(oe.CollapsibleContent,{"data-slot":"collapsible-content",...e})}var oi=Symbol("radix.slottable");function oa(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===oi}var oo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(oa);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),os="horizontal",ol=["horizontal","vertical"],ou=ek.forwardRef((e,t)=>{var r;let{decorative:n,orientation:i=os,...a}=e,o=(r=i,ol.includes(r))?i:os;return(0,e_.jsx)(oo.div,{"data-orientation":o,...n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"},...a,ref:t})});ou.displayName="Separator",e.s(["Root",0,ou,"Separator",0,ou],86392);var od=e.i(86392),od=od;function oc({className:e,orientation:t="horizontal",decorative:r=!0,...n}){return(0,e_.jsx)(od.Root,{"data-slot":"separator",decorative:r,orientation:t,className:(0,rj.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}let op={model:"模型",size:"尺寸",quality:"质量",outputFormat:"格式",background:"背景"};function om(e){e&&"u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).catch(()=>{})}function of({image:e,alt:t,compact:r}){let[n,i]=(0,ek.useState)(!1);return e?.url?(0,e_.jsxs)("div",{className:"relative flex size-full items-center justify-center overflow-hidden",children:[!n&&(0,e_.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:(0,e_.jsx)(aR,{className:"size-5 animate-spin text-muted-foreground"})}),(0,e_.jsx)("img",{src:e.url,alt:t,className:(0,rj.cn)("block object-contain",r?"size-full object-cover":"max-h-full max-w-full",!n&&"invisible"),onLoad:()=>i(!0)})]}):(0,e_.jsx)("div",{className:(0,rj.cn)("flex size-full items-center justify-center text-muted-foreground",!r&&"min-h-24"),children:(0,e_.jsx)(iD,{className:r?"size-5":"size-8"})})}function oh({result:e,prompt:t,image:r,altText:n,status:i,statusDetail:a,isRunning:o}){let s=i.Icon,l=r?.revisedPrompt||e?.revisedPrompt;return(0,e_.jsxs)(aU,{"data-image-generation-detail":!0,className:"grid h-[min(88vh,900px)] max-h-[88vh] grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden p-0 sm:max-w-5xl",showCloseButton:!1,children:[(0,e_.jsx)(aL,{className:"border-b px-5 py-4",children:(0,e_.jsxs)("div",{className:"flex min-h-9 items-center justify-between gap-4",children:[(0,e_.jsx)(aF,{className:"min-w-0 truncate",children:"图片生成详情"}),(0,e_.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[(0,e_.jsxs)("span",{className:(0,rj.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border px-2 font-medium text-xs",i.chip),children:[(0,e_.jsx)(s,{className:(0,rj.cn)("size-3.5",o&&"animate-spin")}),i.label]}),(0,e_.jsx)(az,{asChild:!0,children:(0,e_.jsxs)(rC,{type:"button",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground",children:[(0,e_.jsx)(rD,{className:"size-4"}),(0,e_.jsx)("span",{className:"sr-only",children:"关闭"})]})})]})]})}),(0,e_.jsxs)("div",{className:"grid min-h-0 overflow-y-auto lg:grid-cols-[minmax(0,1.15fr)_minmax(320px,0.85fr)] lg:overflow-hidden",children:[(0,e_.jsxs)("div",{className:"min-w-0 border-b bg-muted/20 p-4 lg:border-r lg:border-b-0",children:[(0,e_.jsx)("div",{className:"flex h-[min(62vh,720px)] min-h-72 items-center justify-center overflow-hidden rounded-lg border bg-background",children:(0,e_.jsx)(of,{image:r,alt:n})}),r&&(0,e_.jsxs)("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 rounded-md border bg-background px-3 py-2",children:[(0,e_.jsx)("p",{className:"min-w-0 flex-1 truncate text-muted-foreground text-xs",children:r.fileName}),(0,e_.jsx)("div",{className:"flex items-center gap-1",children:(0,e_.jsx)(rC,{asChild:!0,variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",children:(0,e_.jsxs)("a",{href:r.url,download:r.fileName,children:[(0,e_.jsx)(aW,{className:"size-3.5"}),"下载"]})})})]})]}),(0,e_.jsxs)("div",{className:"min-h-0 min-w-0 space-y-4 p-5 lg:overflow-y-auto",children:[(0,e_.jsx)(og,{prompt:t,revisedPrompt:l}),(0,e_.jsx)(oy,{requested:e?.requestedParams,actual:r?.actualParams||e?.actualParams}),(0,e_.jsx)(ob,{detail:a}),e?.rawResponseSummary!==void 0&&(0,e_.jsx)(ox,{value:e.rawResponseSummary})]})]})]})}function og({prompt:e,revisedPrompt:t}){let r=!!t?.trim()&&t?.trim()!==e.trim();return(0,e_.jsxs)("section",{className:"space-y-3",children:[(0,e_.jsx)(ov,{label:"提示词",value:e,primary:!0}),r&&(0,e_.jsx)(ov,{label:"API 改写提示词",value:t})]})}function ov({label:e,value:t,primary:r}){let[n,i]=(0,ek.useState)(!1);return t?(0,e_.jsxs)("div",{className:"space-y-1.5",children:[(0,e_.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e_.jsx)("h3",{className:(0,rj.cn)("font-medium text-sm",r&&"text-base"),children:e}),(0,e_.jsx)(rN,{tooltip:n?"已复制":"复制",size:"icon-xs",className:"size-6",onClick:()=>{om(t),i(!0),window.setTimeout(()=>i(!1),1200)},children:n?(0,e_.jsx)(aA,{}):(0,e_.jsx)(aq,{})})]}),(0,e_.jsx)("pre",{className:(0,rj.cn)("max-h-56 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-muted/30 px-3 py-2 font-sans text-xs leading-relaxed",r&&"text-sm"),children:t})]}):null}function oy({requested:e,actual:t}){let r=["model","size","quality","outputFormat","background"].map(r=>{let n=e?.[r],i=t?.[r];return{key:r,label:op[r],value:i??n,requested:n,actual:i,changed:void 0!==n&&void 0!==i&&n!==i}}).filter(e=>void 0!==e.value);return 0===r.length?null:(0,e_.jsxs)("section",{className:"space-y-2",children:[(0,e_.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e_.jsx)(aJ,{className:"size-4 text-muted-foreground"}),(0,e_.jsx)("h3",{className:"font-medium text-sm",children:"参数"})]}),(0,e_.jsx)("div",{className:"flex flex-wrap gap-2",children:r.map(e=>(0,e_.jsxs)("div",{className:"min-w-0 rounded-md border bg-background px-2.5 py-2 text-xs",children:[(0,e_.jsx)("p",{className:"text-muted-foreground",children:e.label}),(0,e_.jsx)("p",{className:(0,rj.cn)("mt-1 max-w-52 truncate font-medium",e.changed&&"text-amber-700 dark:text-amber-400"),children:e.changed?`${String(e.requested)} -> ${String(e.actual)}`:String(e.value)})]},e.key))})]})}function ob({detail:e}){return(0,e_.jsxs)("section",{className:"space-y-1.5",children:[(0,e_.jsx)("h3",{className:"font-medium text-sm",children:"任务状态"}),(0,e_.jsx)("p",{className:"rounded-md border bg-muted/30 px-3 py-2 text-muted-foreground text-sm",children:e})]})}function ox({value:e}){let t=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}(e);return(0,e_.jsxs)(ot,{className:"rounded-md border",children:[(0,e_.jsx)(or,{asChild:!0,children:(0,e_.jsxs)(rC,{type:"button",variant:"ghost",className:"h-9 w-full justify-between rounded-md px-3",children:[(0,e_.jsx)("span",{children:"原始响应摘要"}),(0,e_.jsx)(aV,{className:"size-4"})]})}),(0,e_.jsxs)(on,{children:[(0,e_.jsx)(oc,{}),(0,e_.jsx)("div",{className:"flex items-center justify-end px-2 py-1",children:(0,e_.jsx)(rN,{tooltip:"复制",size:"icon-xs",className:"size-6",onClick:()=>om(t),children:(0,e_.jsx)(aq,{})})}),(0,e_.jsx)("pre",{className:"max-h-56 overflow-auto whitespace-pre-wrap break-words px-3 pb-3 font-mono text-[11px] text-muted-foreground",children:t})]})]})}function o_({result:e,prompt:t,visualStatus:r,statusDetail:n,compact:i}){var a;let o=e?.images[0],s=function(e){switch(e){case"running":return{label:"生成中",tone:"text-muted-foreground",chip:"border-border bg-muted/60 text-muted-foreground",Icon:aR};case"failed":return{label:"失败",tone:"text-destructive",chip:"border-destructive/30 bg-destructive/10 text-destructive",Icon:aN};case"incomplete":return{label:"未完成",tone:"text-muted-foreground",chip:"border-border bg-muted/60 text-muted-foreground",Icon:aN};default:return{label:"已完成",tone:"text-emerald-700 dark:text-emerald-400",chip:"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",Icon:aA}}}(r),l=s.Icon,u=e?.revisedPrompt||t||"Generated image",d="running"===r;return(0,e_.jsxs)(aP,{children:[(0,e_.jsx)(aO,{asChild:!0,children:(0,e_.jsxs)("button",{type:"button","data-image-generation-card":!0,"data-image-generation-card-trigger":!0,className:(0,rj.cn)("aui-tool-fallback-root group/image-generation-card my-2.5 w-full overflow-hidden rounded-lg border bg-background text-left text-sm transition-colors first:mt-0 last:mb-0 hover:bg-muted/30",i&&"my-0"),children:[(0,e_.jsxs)("div",{className:(0,rj.cn)("grid w-full grid-cols-[112px_minmax(0,1fr)] gap-4 p-4 max-sm:grid-cols-[88px_minmax(0,1fr)] max-sm:gap-3",i&&"grid-cols-[72px_minmax(0,1fr)] gap-3 p-3"),children:[(0,e_.jsx)("div",{className:(0,rj.cn)("relative aspect-square size-28 shrink-0 overflow-hidden rounded-md border bg-muted text-muted-foreground max-sm:size-22",i&&"size-18 max-sm:size-18"),children:(0,e_.jsx)(of,{image:o,alt:u,compact:!0})}),(0,e_.jsxs)("div",{className:(0,rj.cn)("flex min-h-28 min-w-0 flex-col max-sm:min-h-22",i&&"min-h-18 max-sm:min-h-18"),children:[(0,e_.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e_.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e_.jsx)(l,{className:(0,rj.cn)("size-4 shrink-0",s.tone,d&&"animate-spin")}),(0,e_.jsx)("span",{className:"truncate font-medium",children:"图片生成"})]}),(0,e_.jsx)("span",{className:(0,rj.cn)("shrink-0 rounded-md border px-1.5 py-0.5 font-medium text-[11px]",s.chip),children:s.label})]}),(0,e_.jsx)("p",{className:(0,rj.cn)("mt-2 line-clamp-2 text-muted-foreground leading-6 max-sm:text-xs",i&&"mt-1 leading-5"),children:t||"等待图片生成参数"}),(0,e_.jsxs)("div",{className:(0,rj.cn)("mt-auto flex min-w-0 flex-wrap gap-1.5 pt-3 text-muted-foreground text-xs",i&&"pt-2"),children:[(0,e_.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5",children:"查看详情"}),!i&&e?.actualParams.model&&(0,e_.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5",children:e.actualParams.model}),e?.actualParams.size&&(0,e_.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5",children:e.actualParams.size}),o?.sizeBytes&&(0,e_.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5",children:(a=o.sizeBytes)?a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`:""})]})]})]}),"failed"===r&&(0,e_.jsx)("p",{className:"mx-4 mb-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-destructive text-xs",children:n})]})}),(0,e_.jsx)(oh,{result:e,prompt:t,image:o,altText:u,status:s,statusDetail:n,isRunning:d})]})}function ow(e){let t,r=e.toolName===i0?e.args:(t=i4(e.args),t?.args),n=(0,ek.useMemo)(()=>i5(e.result),[e.result]),i=n?.prompt||function e(t){return i2(t)?"string"==typeof t.prompt?t.prompt:i2(t.arguments)&&"string"==typeof t.arguments.prompt?t.arguments.prompt:i2(t.args)?e(t.args):"":""}(r),a=e.status?.type==="running"||e.status?.type==="requires-action"?"running":e.isError||n?.status==="failed"?"failed":e.status?.type==="incomplete"?"incomplete":"completed";return(0,e_.jsx)(o_,{result:n,prompt:i,visualStatus:a,statusDetail:n?.error?n.error:e.status?.type==="incomplete"?`工具调用未完成:${e.status.reason}`:e.isError?"工具调用返回错误。":e.status?.type==="running"||e.status?.type==="requires-action"?"正在等待图片服务返回结果。":"图片已生成并保存到本地工具存储。"})}function ok({record:e,compact:t}){let r={status:e.status,recordId:e.id,requestId:e.requestId||e.id,provider:e.provider,prompt:e.prompt,...e.revisedPrompt?{revisedPrompt:e.revisedPrompt}:{},requestedParams:e.requestedParams,actualParams:e.actualParams,images:e.images,durationMs:e.durationMs,...e.error?{error:e.error}:{}};return(0,e_.jsx)(o_,{result:r,prompt:e.prompt,visualStatus:e.status,statusDetail:e.error||("failed"===e.status?"图片生成失败。":"图片已生成并保存到本地工具存储。"),compact:t})}let oI=({compact:e,records:t,loading:r,error:n,showSection:i,loadRecords:a})=>i?(0,e_.jsxs)("section",{"data-slot":"thread-image-generation-records",className:"flex min-h-0 flex-col gap-2",children:[(0,e_.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e_.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e_.jsx)(iD,{className:"size-4 shrink-0 text-muted-foreground"}),(0,e_.jsx)("h2",{className:"truncate font-medium text-muted-foreground text-sm",children:"图片记录"})]}),(0,e_.jsx)(rN,{tooltip:"刷新图片记录",size:"icon-xs",className:"size-7",onClick:()=>void a(),children:(0,e_.jsx)(iU,{className:(0,rj.cn)("size-3.5",r&&"animate-spin")})})]}),(0,e_.jsx)("div",{className:(0,rj.cn)("min-h-0 overflow-y-auto pr-1",e?"max-h-72":"max-h-[min(42vh,24rem)]"),children:t.length>0?(0,e_.jsx)("div",{className:"flex flex-col gap-2",children:t.map(e=>(0,e_.jsx)(ok,{record:e,compact:!0},e.id))}):(0,e_.jsx)("div",{className:"rounded-md border border-dashed px-3 py-4 text-muted-foreground text-sm",children:r?"正在加载图片记录":"暂无图片记录"})}),n?(0,e_.jsx)("p",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-destructive text-xs",children:n}):null]}):null,oS=rz("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),o$=rz("package-open",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);function oj(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function oE(e){return"string"==typeof e?e.trim():""}function oC(){let e=ij(e=>e.thread.messages);return(0,ek.useMemo)(()=>(function(e){let t=new Map;for(let r of e){let e=function(e){if(!oj(e))return;let t=oj(e.metadata)?e.metadata:void 0;return t&&oj(t.custom)?t.custom:void 0}(r),n=e?.acpToolContent;if(!oj(n))continue;let i=n.byToolCallId;if(oj(i)){for(let[e,r]of Object.entries(i))if(oj(r))for(let n of function(e,t){var r;return(Array.isArray(r=e.diffs)?r.filter(e=>oj(e)):!oj(r)?[]:Object.values(r).filter(e=>oj(e))).flatMap(e=>{let r=function(e,t){let r,n=oE(e.type);if(n&&"diff"!==n)return;let i=oE(e.toolCallId)||t;if(!i)return;let a=oE(e.path),o=null===e.oldText||void 0===e.oldText?"新增":"修改",s=a||"未命名文件";return{id:`diff:${i}:${a||s}`,kind:"diff",title:s,detail:o,status:o,path:a||void 0,oldText:"string"==typeof e.oldText||null===e.oldText?e.oldText:void 0,newText:"string"==typeof e.newText?e.newText:void 0,toolCallId:i,updatedAt:Number.isFinite(r=Number(e.updatedAt))?r:0}}(e,t);return r?[r]:[]})}(r,e)){let e=function(e){let t=e.path||e.title;return`${e.kind}:${e.toolCallId}:${t||e.title}`}(n),r=t.get(e);(!r||n.updatedAt>=r.updatedAt)&&t.set(e,n)}}}return[...t.values()].sort((e,t)=>e.updatedAt-t.updatedAt)})([...e]),[e])}function oT({artifact:e}){let t=e.status??"文件";return(0,e_.jsxs)("li",{className:"flex min-w-0 items-start gap-2 rounded-md border border-border/70 bg-muted/15 px-2.5 py-2",children:[(0,e_.jsx)(oS,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground"}),(0,e_.jsx)("div",{className:"min-w-0 flex-1",children:(0,e_.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e_.jsx)("p",{className:"truncate font-medium text-sm leading-5",children:e.title}),(0,e_.jsx)("span",{className:"shrink-0 rounded-sm border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground leading-none",children:t})]})})]})}let oN=({artifacts:e,compact:t})=>0===e.length?null:(0,e_.jsxs)("section",{"data-slot":"thread-output-artifacts",className:"flex min-h-0 flex-col gap-2",children:[(0,e_.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e_.jsx)(o$,{className:"size-4 shrink-0 text-muted-foreground"}),(0,e_.jsx)("h2",{className:"truncate font-medium text-muted-foreground text-sm",children:"产物"})]}),(0,e_.jsx)("ol",{className:(0,rj.cn)("flex min-h-0 flex-col gap-2 overflow-y-auto pr-1",t?"max-h-56":"max-h-[min(28vh,16rem)]"),children:e.map(e=>(0,e_.jsx)(oT,{artifact:e},e.id))})]}),oA={pending:iP,in_progress:iz,completed:iR},oR={pending:"待处理",in_progress:"进行中",completed:"已完成"},oP=[{id:"plan",label:"任务",Icon:iO,Panel:({location:e})=>{let t=iA(),r=oC(),n=function(){let{workspacePath:e}=ax(),t=ij(e=>e.thread.isRunning),r=ij(e=>e.thread.messages),n=ij(e=>e.threadListItem.remoteId??e.threads.mainThreadId),i=(0,ek.useMemo)(()=>(function(e){let t=new Set,r=0;for(let n of e)if(i2(n)&&Array.isArray(n.content))for(let e of n.content){if(!function(e){var t;if(!i2(e)||"tool-call"!==e.type)return!1;if(e.toolName===i0)return!0;let r=i4(e.args);return e.toolName===i1&&(r?.toolName===iQ||r?.toolName===i0||i2(t=r?.args)&&t.server===iX&&t.tool===iQ)}(e))continue;let n=i5(e.result);n?.recordId?t.add(n.recordId):r+=1}return 0===t.size&&0===r?"":JSON.stringify({completed:[...t].sort(),running:r})})([...r]),[r]),[a,o]=(0,ek.useState)([]),[s,l]=(0,ek.useState)("idle"),[u,d]=(0,ek.useState)(null),c=(0,ek.useRef)(0),p=(0,ek.useCallback)(async()=>{let t=c.current+1;if(c.current=t,!n)return void o([]);l(e=>"idle"===e?"loading":e);try{let r=await aT.listImageGenerationRecords(e,n,20);if(t!==c.current)return;o(r.records),d(null),l("idle")}catch(e){if(t!==c.current)return;d(e instanceof Error?e.message:String(e)),l("error")}},[n,e]);(0,ek.useEffect)(()=>{p()},[p]),(0,ek.useEffect)(()=>{i&&p()},[p,i]),(0,ek.useEffect)(()=>{let e=window.setInterval(()=>{p()},t?1500:12e3);return()=>window.clearInterval(e)},[t,p]);let m=a.length>0;return{records:a,loading:"loading"===s,error:"error"===s?u:null,showSection:m,loadRecords:p}}(),i="mobile"===e,a=t.length>0,o=r.length>0,s=!a&&!o&&!n.showSection;return(0,e_.jsxs)("div",{"data-slot":"thread-plan-addon",className:(0,rj.cn)("flex h-full min-h-0 flex-col gap-5",i&&"px-1"),children:[a?(0,e_.jsxs)("section",{className:"flex min-h-0 flex-col gap-3",children:[(0,e_.jsx)("h2",{className:"font-medium text-muted-foreground text-sm",children:"任务进度"}),(0,e_.jsx)("ol",{className:"flex max-h-[min(56vh,32rem)] flex-col gap-3 overflow-x-hidden overflow-y-auto pr-1",children:t.map(e=>{let t=oA[e.status],r="in_progress"===e.status;return(0,e_.jsxs)("li",{className:"flex min-w-0 items-start gap-3",children:[(0,e_.jsx)("span",{"aria-hidden":"true",className:(0,rj.cn)("mt-0.5 flex size-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground",r&&"text-foreground"),children:(0,e_.jsx)(t,{className:(0,rj.cn)("size-4 shrink-0","completed"===e.status&&"fill-muted-foreground text-background",r&&"animate-spin motion-reduce:animate-none")})}),(0,e_.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e_.jsx)("p",{className:"wrap-break-word font-medium text-sm leading-5",children:e.content}),(0,e_.jsx)("span",{className:"sr-only",children:oR[e.status]})]})]},`${e.status}-${e.priority}-${e.content}`)})})]}):null,(0,e_.jsx)(oN,{artifacts:r,compact:i}),(0,e_.jsx)(oI,{compact:i,...n}),s?(0,e_.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed px-4 py-8 text-center text-muted-foreground text-sm",children:[(0,e_.jsx)(iM,{className:"size-5"}),(0,e_.jsx)("p",{children:"暂无任务、产物和工具记录"})]}):null]})},order:10}],oO=(0,ek.createContext)(null);function oM(){let e=(0,ek.useContext)(oO);if(!e)throw Error("useThreadAddonContext must be used within ThreadAddonProvider.");return e}function oz({children:e}){var t;let r=(0,ek.useMemo)(()=>[...oP].sort((e,t)=>e.order-t.order),[]),n=r[0]?.id??null,[i,a]=(0,ek.useState)(n),[o,s]=(0,ek.useState)(!1),l=function(){let[e,t]=(0,ek.useState)(!1);return(0,ek.useEffect)(()=>{let e=window.matchMedia("(min-width: 1280px)"),r=()=>t(e.matches);return r(),e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}(),u=0===(t=iA()).length?"":JSON.stringify(t),d=(0,ek.useRef)("");(0,ek.useEffect)(()=>{l&&u&&d.current!==u&&(d.current=u,a("plan"),s(!0))},[l,u]);let c=r.find(e=>e.id===i)??r[0]??null,p=(0,ek.useMemo)(()=>({addons:r,activeAddon:c,activeAddonId:c?.id??null,isDesktop:l,isOpen:o,closeAddon:()=>s(!1),toggleAddon:e=>{a(e),s(t=>!t||c?.id!==e)}}),[c,r,l,o]);return(0,e_.jsx)(oO.Provider,{value:p,children:e})}function oD(){let{addons:e,activeAddonId:t,isOpen:r,toggleAddon:n}=oM();return 0===e.length?null:(0,e_.jsx)("div",{"data-slot":"thread-addon-toolbar",className:"ml-auto flex items-center gap-1",children:e.map(e=>{let i=e.Icon,a=r&&t===e.id;return(0,e_.jsx)(rN,{tooltip:e.label,"aria-pressed":a,className:(0,rj.cn)("size-8 rounded-lg bg-background/80 text-muted-foreground backdrop-blur-sm [&_svg]:size-4",a&&"bg-muted text-foreground"),onClick:()=>n(e.id),children:(0,e_.jsx)(i,{className:"size-4"})},e.id)})})}function oU({children:e}){let{activeAddon:t,closeAddon:r,isDesktop:n,isOpen:i}=oM(),a=t?.Panel,o=!!(a&&i&&!n);return(0,e_.jsxs)("div",{"data-slot":"thread-addon-host",className:"flex h-full min-h-0 w-full",children:[(0,e_.jsx)("div",{className:"min-w-0 flex-1 overflow-hidden",children:e}),a&&n&&i?(0,e_.jsx)("aside",{"data-slot":"thread-addon-desktop-panel",className:"hidden w-[22rem] shrink-0 bg-background px-3 pt-20 pb-4 xl:block",children:(0,e_.jsx)(a,{location:"desktop"})}):null,(0,e_.jsx)(ix,{open:o,onOpenChange:e=>!e&&r(),children:(0,e_.jsxs)(ik,{className:"w-[88vw] gap-0 p-0 sm:max-w-md",children:[(0,e_.jsxs)(iI,{className:"sr-only",children:[(0,e_.jsx)(iS,{children:t?.label??"扩展面板"}),(0,e_.jsx)(i$,{children:"显示当前对话的扩展面板。"})]}),(0,e_.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 pt-20",children:a?(0,e_.jsx)(a,{location:"mobile"}):null})]})})]})}let oL=({children:e,condition:t})=>ij(t)?e:null;oL.displayName="AuiIf",e.s([],20891),e.i(20891);var oZ=Symbol.for("react.lazy"),oF=ek[" use ".trim().toString()];function oB(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===oZ&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var oV=Symbol("radix.slottable");function oq(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===oV}var oW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(oB(r)&&"function"==typeof oF&&(r=oF(r._payload)),ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e;oB(r)&&"function"==typeof oF&&(r=oF(r._payload));let i=ek.Children.toArray(r),o=i.find(oq);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{});function oJ(e){let t=(0,ek.forwardRef)(({render:t,asChild:r,children:n,...i},a)=>{if(t&&(0,ek.isValidElement)(t)){let r=void 0!==n?n:t.props.children;return(0,e_.jsx)(e,{...i,asChild:!0,ref:a,children:(0,ek.cloneElement)(t,void 0,r)})}return(0,e_.jsx)(e,{...i,asChild:r,ref:a,children:n})});return t.displayName="string"==typeof e?e:e.displayName??e.name??"Component",t}let oH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r;return e[t]=((r=oJ(oW[t])).displayName=`Primitive.${t}`,r),e},{}),oK=(0,ek.forwardRef)((e,t)=>(0,e_.jsx)(oH.div,{...e,ref:t}));oK.displayName="ThreadPrimitive.Root";let oG=({children:e})=>ij(e=>e.thread.isEmpty)?e:null;oG.displayName="ThreadPrimitive.Empty";let oY=({children:e,...t})=>ij(e=>(!0!==t.empty||!!e.thread.isEmpty)&&(!1!==t.empty||!e.thread.isEmpty)&&(!0!==t.running||!!e.thread.isRunning)&&(!1!==t.running||!e.thread.isRunning)&&(!0!==t.disabled||!!e.thread.isDisabled)&&(!1!==t.disabled||!e.thread.isDisabled)&&!0)?e:null;oY.displayName="ThreadPrimitive.If";let oX=ek.default.createContext(!0);function oQ(){throw Error("A function wrapped in useEffectEvent can't be called during rendering.")}let o0="use"in ek.default?()=>{try{return ek.default.use(oX)}catch{return!1}}:()=>!1,o1=(e,t)=>{let r,n=tU(),i=(r=ek.default.useRef(oQ),ek.default.useInsertionEffect(()=>{r.current=t},[t]),(...e)=>(o0()&&oQ(),(0,r.current)(...e))),{scope:a,event:o}=t$(e);(0,ek.useEffect)(()=>n.on({scope:a,event:o},i),[n,a,o,i])},o2=e=>{let t=(0,ek.useRef)(void 0);return(0,ek.useCallback)(r=>{t.current&&(t.current(),t.current=void 0),r&&(t.current=e(r))},[e])},o4=e=>{let t=(0,rJ.useCallbackRef)(e),r=ru(e=>e.onScrollToBottom);(0,ek.useEffect)(()=>r(t),[r,t])},o6=(e,t)=>o2((0,ek.useCallback)(r=>{if(!e)return;let n=e(),i=()=>{let e=t?t(r):r.offsetHeight;n.setHeight(e)},a=new ResizeObserver(i);return a.observe(r),i(),()=>{a.disconnect(),n.unregister()}},[e,t])),o5=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},o3=({viewport:e,anchor:t,tallerThan:r,visibleHeight:n})=>{let i=((e,t)=>{let r=0,n=e;for(;n&&n!==t;)r+=n.offsetTop,n=n.offsetParent;return n===t?r:o5(e)-o5(t)})(t,e),a=t.offsetHeight;return i+Math.max(0,a-(a<=r?a:n))},o9=(e,t)=>{let r=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!r)return 1/0;let n=Number(r[1]),i=r[2];return"px"===i?n:"em"===i?n*(parseFloat(getComputedStyle(t).fontSize)||16):"rem"===i?n*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):1/0},o8=(e,t)=>{let r=`${t}px`;return e.style.height!==r&&(e.style.height=r,!0)},o7=({isRunning:e,messages:t})=>{if(!e)return null;let r=t.at(-1),n=t.at(-2);return n?.role!=="user"||r?.role!=="assistant"?null:{anchorId:n.id,targetId:r.id}},se=(0,ek.forwardRef)(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:r,scrollToBottomOnThreadSwitch:n,children:i,...a},o)=>{let s,l,u,d,c,p,m=(({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:r=!0,scrollToBottomOnThreadSwitch:n=!0})=>{var i;let a,o=(0,ek.useRef)(null),s=ij(e=>e.thread.messages.length>0),l=(0,ek.useRef)(!1),u=(0,ek.useRef)(null),d=rd();void 0===e&&(e="top"!==d.getState().turnAnchor);let c=(0,ek.useRef)(0),p=(0,ek.useRef)(null),m=(0,ek.useCallback)(e=>{let t=o.current;t&&(p.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),f=(0,ek.useCallback)(e=>{p.current=e,null!==u.current&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null,m(e)})},[m]);(0,ek.useLayoutEffect)(()=>()=>{null!==u.current&&cancelAnimationFrame(u.current)},[]);let h=(0,ek.useCallback)(()=>{let e=d.getState();return"top"===e.turnAnchor&&e.element.viewport===o.current&&null!==e.element.anchor},[d]),g=()=>{let e=o.current;if(!e)return;let t=d.getState().isAtBottom,r=1>Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)||e.scrollHeight<=e.clientHeight;!r&&c.current<e.scrollTop||(r&&e.scrollHeight>e.clientHeight+1&&(p.current=null),(r||null===p.current)&&r!==t&&d.setState({isAtBottom:r})),c.current=e.scrollTop},v=(i=()=>{let t=p.current;t&&h()?p.current=null:t?m(t):e&&d.getState().isAtBottom&&m("instant"),g()},a=(0,rJ.useCallbackRef)(i),o2((0,ek.useCallback)(e=>{let t=new ResizeObserver(()=>{a()}),r=new MutationObserver(e=>{e.some(e=>"attributes"!==e.type||"style"!==e.attributeName)&&a()});return t.observe(e),r.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),r.disconnect()}},[a]))),y=o2(e=>(e.addEventListener("scroll",g),()=>{e.removeEventListener("scroll",g)}));return(0,ek.useLayoutEffect)(()=>{if(r){if(!s){l.current=!1;return}l.current||(l.current=!0,null===p.current&&f("instant"))}},[s,f,r]),o4(({behavior:e})=>{m(e)}),o1("thread.runStart",()=>{t&&"top"!==d.getState().turnAnchor&&f("auto")}),o1("threadListItem.switchedTo",()=>{n&&f("instant")}),(0,rh.useComposedRefs)(v,y,o)})({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:r,scrollToBottomOnThreadSwitch:n}),f=o6(ru(e=>e.registerViewport),(0,ek.useCallback)(e=>e.clientHeight,[])),h=o2(ru(e=>e.registerViewportElement)),g="top"===rd().getState().turnAnchor;s=rd(),l=ij(e=>{if(g){let t;return t=e.thread,o7(t)?.anchorId}}),u=ij(e=>{if(g){let t;return t=e.thread,o7(t)?.targetId}}),d=(0,ek.useMemo)(()=>l&&u?{anchorId:l,targetId:u}:null,[l,u]),(0,ek.useLayoutEffect)(()=>{if(!d)return;let e=s.getState(),t=e.topAnchorTurn;(t?.anchorId!==d.anchorId||t.targetId!==d.targetId)&&e.setTopAnchorTurn(d)},[d,s]),o1("thread.initialize",c=(0,ek.useCallback)(()=>{s.getState().setTopAnchorTurn(null)},[s])),o1("threadListItem.switchedTo",c),p=rd(),(0,ek.useLayoutEffect)(()=>{if(g){var e,t;let r,n,i,a,o,s,l,u,d,c,m,f;return n=null,e=function(){var e;let t,i,o=p.getState(),{viewport:s,anchor:l,target:u}=o.element,d=o.targetConfig;if("top"!==o.turnAnchor||!s||!l||!u||!d){m.disconnect(),n&&(o8(n,0),n.remove());return}if(((n??=((t=document.createElement("div")).dataset.auiTopAnchorReserve="",t.style.height="0px",t.style.flexShrink="0",t.style.pointerEvents="none",t.setAttribute("aria-hidden","true"),t)).parentElement!==u.parentElement||n.previousElementSibling!==u)&&u.after(n),m.target(s,l,u),o8(n,(({viewport:e,reserve:t,...r})=>(({scrollHeight:e,...t})=>{let{viewport:r}=t;return Math.max(0,o3(t)+r.clientHeight-e)})({viewport:e,...r,scrollHeight:e.scrollHeight-t.offsetHeight}))({viewport:s,anchor:l,reserve:n,...d})))return void a.schedule();let c=l.dataset.messageId;if(void 0!==c&&r===c)return;let f=(e=o3({viewport:s,anchor:l,...d}),Math.round(e*(i=window.devicePixelRatio||1))/i);Math.abs(s.scrollTop-f)>1&&s.scrollTo({top:f,behavior:"smooth"}),void 0!==c&&(r=c)},i=null,o=new ResizeObserver(t=(a={schedule:()=>{null===i&&(i=requestAnimationFrame(()=>{i=null,e()}))},cancel:()=>{null!==i&&(cancelAnimationFrame(i),i=null)}}).schedule),s=new MutationObserver(t),l=null,u=null,d=null,m={target:(e,t,r)=>{(l!==e||u!==t||d!==r)&&(c(),o.observe(e),o.observe(t),o.observe(r),s.observe(r,{childList:!0,subtree:!0,characterData:!0}),l=e,u=t,d=r)},disconnect:c=()=>{o.disconnect(),s.disconnect(),l=null,u=null,d=null}},a.schedule(),f=p.subscribe(a.schedule),()=>{a.cancel(),f(),m.disconnect(),n?.remove()}}},[g,p]);let v=(0,rh.useComposedRefs)(o,m,f,h);return(0,e_.jsx)(oH.div,{...a,ref:v,children:i})});se.displayName="ThreadPrimitive.ViewportScrollable";let st=(0,ek.forwardRef)(({turnAnchor:e,topAnchorMessageClamp:t,...r},n)=>(0,e_.jsx)(rc,{options:{turnAnchor:e,topAnchorMessageClamp:t},children:(0,e_.jsx)(se,{...r,ref:n})}));st.displayName="ThreadPrimitive.Viewport";let sr=(0,ek.forwardRef)((e,t)=>{let r=o6(ru(e=>e.registerContentInset),(0,ek.useCallback)(e=>{let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t},[])),n=(0,rh.useComposedRefs)(t,r);return(0,e_.jsx)(oH.div,{...e,ref:n})});sr.displayName="ThreadPrimitive.ViewportFooter";let sn=Object.freeze({});function si({getItemState:e,children:t}){let r,n,i;return sa(t((r=tU(),i=(n=(0,ek.useRef)(!1)).current?null:e(r),ij(()=>n.current?e(r):i),()=>(n.current=!0,e(r)))))}let sa=e=>{let t="object"==typeof e&&null!=e&&"type"in e?e:null,r=t?.type,n=t?.key,i="object"==typeof t?.props&&null!=t.props&&0===Object.entries(t.props).length?sn:t?.props;return(0,ek.useMemo)(()=>t,[r,n,i])??e},so=({index:e,children:t})=>{let r=tU({message:tw({source:"thread",query:{type:"index",index:e},get:t=>t.thread().message({index:e})}),composer:tw({source:"message",query:{},get:t=>t.thread().message({index:e}).composer()})});return(0,e_.jsx)(t_,{value:r,children:t})},ss=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,sl=()=>null,su=({components:e})=>{let t=((e,t,r)=>{switch(t){case"user":if(r)return e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message;return e.UserMessage??e.Message;case"assistant":if(r)return e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message;return e.AssistantMessage??e.Message;case"system":if(r)return e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message;return e.SystemMessage??e.Message??sl;default:throw Error(`Unknown message role: ${t}`)}})(e,ij(e=>e.message.role),ij(e=>e.message.composer.isEditing));return(0,e_.jsx)(t,{})},sd=(0,ek.memo)(({index:e,components:t})=>(0,e_.jsx)(so,{index:e,children:(0,e_.jsx)(su,{components:t})}),(e,t)=>e.index===t.index&&ss(e.components,t.components));sd.displayName="ThreadPrimitive.MessageByIndex";let sc=({children:e})=>{let t=ij(e=>e.thread.messages.length);return(0,ek.useMemo)(()=>0===t?null:Array.from({length:t},(t,r)=>(0,e_.jsx)(so,{index:r,children:(0,e_.jsx)(si,{getItemState:e=>e.thread().message({index:r}).getState(),children:t=>e({get message(){return t()}})})},r)),[t,e])},sp=({components:e,children:t})=>e?(0,e_.jsx)(sc,{children:()=>(0,e_.jsx)(su,{components:e})}):(0,e_.jsx)(sc,{children:t});sp.displayName="ThreadPrimitive.Messages";let sm=(0,ek.memo)(sp,(e,t)=>e.children||t.children?e.children===t.children:ss(e.components,t.components)),sf=(e,t,r=[])=>{let n=(0,ek.forwardRef)((e,n)=>{let i={},a={};Object.keys(e).forEach(t=>{r.includes(t)?i[t]=e[t]:a[t]=e[t]});let o=t(i)??void 0;return(0,e_.jsx)(oH.button,{...a,type:"button",ref:n,disabled:a.disabled||!o,onClick:(0,rU.composeEventHandlers)(a.onClick,o)})});return n.displayName=e,n},sh=sf("ThreadPrimitive.ScrollToBottom",({behavior:e}={})=>{let t=ru(e=>e.isAtBottom),r=rd(),n=(0,ek.useCallback)(()=>{r.getState().scrollToBottom({behavior:e})},[r,e]);return t?null:n},["behavior"]),sg=sf("ThreadPrimitive.Suggestion",({prompt:e,send:t,clearComposer:r,autoSend:n,method:i})=>{let{disabled:a,trigger:o}=(({prompt:e,send:t,clearComposer:r=!0})=>{let n=tU(),i=ij(e=>e.thread.isDisabled),a=t??!1;return{trigger:(0,ek.useCallback)(()=>{let t=n.thread().getState().isRunning;if(a&&!t)n.thread().append({content:[{type:"text",text:e}],runConfig:n.composer().getState().runConfig}),r&&n.composer().setText("");else if(r)n.composer().setText(e);else{let t=n.composer().getState().text;n.composer().setText(t.trim()?`${t} ${e}`:e)}},[n,a,r,e]),disabled:i}})({prompt:e,send:t??n??!1,clearComposer:r});return a?null:o},["prompt","send","clearComposer","autoSend","method"]),sv=({index:e,children:t})=>{let r=tU({suggestion:tw({source:"suggestions",query:{index:e},get:t=>t.suggestions().suggestion({index:e})})});return(0,e_.jsx)(t_,{value:r,children:t})},sy=({components:e})=>{let t=e.Suggestion;return(0,e_.jsx)(t,{})},sb=(0,ek.memo)(({index:e,components:t})=>(0,e_.jsx)(sv,{index:e,children:(0,e_.jsx)(sy,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);sb.displayName="ThreadPrimitive.SuggestionByIndex";let sx=({children:e})=>{let t=ij(e=>e.suggestions.suggestions.length);return(0,ek.useMemo)(()=>0===t?null:Array.from({length:t},(t,r)=>(0,e_.jsx)(sv,{index:r,children:(0,e_.jsx)(si,{getItemState:e=>e.suggestions().suggestion({index:r}).getState(),children:t=>e({get suggestion(){return t()}})})},r)),[t,e])},s_=({components:e,children:t})=>e?(0,e_.jsx)(sx,{children:()=>(0,e_.jsx)(sy,{components:e})}):(0,e_.jsx)(sx,{children:t});s_.displayName="ThreadPrimitive.Suggestions";let sw=(0,ek.memo)(s_,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion);e.s(["Empty",0,oG,"If",0,oY,"MessageByIndex",0,sd,"Messages",0,sm,"Root",0,oK,"ScrollToBottom",0,sh,"Suggestion",0,sg,"SuggestionByIndex",0,sb,"Suggestions",0,sw,"Viewport",0,st,"ViewportFooter",0,sr,"ViewportProvider",0,rc],59002);var sk=e.i(59002),sk=sk;e.s([],59182),e.i(59182);let sI=()=>{let e,t,{disabled:r,send:n}=(e=tU(),t=ij(e=>!e.composer.canSend||e.thread.isRunning&&!e.thread.capabilities.queue),{send:(0,ek.useCallback)(t=>{e.composer().send(t)},[e]),disabled:t}),i=(0,ek.useCallback)(()=>n(),[n]);return r?null:i},sS=sf("ComposerPrimitive.Send",sI),s$=(0,ek.forwardRef)(({onSubmit:e,...t},r)=>{let n=sI();return(0,e_.jsx)(oH.form,{...t,ref:r,onSubmit:(0,rU.composeEventHandlers)(e,e=>{e.preventDefault(),n&&n()})})});s$.displayName="ComposerPrimitive.Root";var rw=rw;function sj(){return(sj=Object.assign.bind()).apply(null,arguments)}var sE=ek.useLayoutEffect,sC=function(e){var t=ek.default.useRef(e);return sE(function(){t.current=e}),t},sT=function(e,t){"function"==typeof e?e(t):e.current=t},sN=function(e,t){var r=ek.default.useRef();return ek.default.useCallback(function(n){e.current=n,r.current&&sT(r.current,null),r.current=t,t&&sT(t,n)},[t])},sA={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},sR=function(e){Object.keys(sA).forEach(function(t){e.style.setProperty(t,sA[t],"important")})},sP=null,sO=function(e,t){var r=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?r+t.borderSize:r-t.paddingSize},sM=function(){},sz=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],sD=!!document.documentElement.currentStyle,sU=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var r=sz.reduce(function(e,r){return e[r]=t[r],e},{}),n=r.boxSizing;if(""===n)return null;sD&&"border-box"===n&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),a=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:a}};function sL(e,t,r){var n=sC(r);ek.useLayoutEffect(function(){var r=function(e){return n.current(e)};if(e)return e.addEventListener(t,r),function(){return e.removeEventListener(t,r)}},[])}var sZ=function(e,t){sL(document.body,"reset",function(r){e.current.form===r.target&&t(r)})},sF=function(e){sL(window,"resize",e)},sB=function(e){sL(document.fonts,"loadingdone",e)},sV=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],sq=ek.forwardRef(function(e,t){var r=e.cacheMeasurements,n=e.maxRows,i=e.minRows,a=e.onChange,o=void 0===a?sM:a,s=e.onHeightChange,l=void 0===s?sM:s,u=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,sV),d=void 0!==u.value,c=ek.useRef(null),p=sN(c,t),m=ek.useRef(0),f=ek.useRef(),h=function(){var e=c.current,t=r&&f.current?f.current:sU(e);if(t){f.current=t;var a,o,s,u,d,p,h,g,v,y,b,x=(a=e.value||e.placeholder||"x",void 0===(o=i)&&(o=1),void 0===(s=n)&&(s=1/0),sP||((sP=document.createElement("textarea")).setAttribute("tabindex","-1"),sP.setAttribute("aria-hidden","true"),sR(sP)),null===sP.parentNode&&document.body.appendChild(sP),u=t.paddingSize,d=t.borderSize,h=(p=t.sizingStyle).boxSizing,Object.keys(p).forEach(function(e){sP.style[e]=p[e]}),sR(sP),sP.value=a,g=sO(sP,t),sP.value=a,g=sO(sP,t),sP.value="x",y=(v=sP.scrollHeight-u)*o,"border-box"===h&&(y=y+u+d),g=Math.max(y,g),b=v*s,"border-box"===h&&(b=b+u+d),[g=Math.min(b,g),v]),_=x[0],w=x[1];m.current!==_&&(m.current=_,e.style.setProperty("height",_+"px","important"),l(_,{rowHeight:w}))}};return ek.useLayoutEffect(h),sZ(c,function(){if(!d){var e=c.current.value;requestAnimationFrame(function(){var t=c.current;t&&e!==t.value&&h()})}}),sF(h),sB(h),ek.createElement("textarea",sj({},u,{onChange:function(e){d||h(),o(e)},ref:p}))}),sW=e.i(26083);let sJ=(0,ek.createContext)(null),sH=()=>(0,ek.useContext)(sJ),sK=({children:e})=>{let t=(0,ek.useRef)(new Map),r=(0,ek.useRef)([]),n=(0,ek.useCallback)(()=>{let e=Array.from(t.current.entries());e.sort((e,t)=>t[1]-e[1]),r.current=e.map(([e])=>e)},[]),i=(0,ek.useCallback)((e,r)=>{let i=r?.priority??0;return t.current.set(e,i),n(),()=>{t.current.delete(e),n()}},[n]),a=(0,ek.useCallback)(()=>r.current,[]),o=(0,ek.useMemo)(()=>({register:i,getPlugins:a}),[i,a]);return(0,e_.jsx)(sJ.Provider,{value:o,children:e})},sG=(0,ek.createContext)(null),sY=(0,ek.createContext)(null),sX=()=>{let e=(0,ek.useContext)(sG);if(!e)throw Error("useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot");return e},sQ=()=>(0,ek.useContext)(sG),s0=new Map,s1=()=>()=>{},s2=()=>s0,s4=()=>null;function s6(){let e=(0,ek.useRef)(new Set);return{notify:(0,ek.useCallback)(()=>{for(let t of e.current)t()},[]),subscribe:(0,ek.useCallback)(t=>(e.current.add(t),()=>{e.current.delete(t)}),[])}}let s5=({children:e})=>{let t=(0,ek.useRef)(new Map),r=(0,ek.useRef)(new Set),{notify:n,subscribe:i}=s6(),a=(0,ek.useCallback)(e=>{let{char:i}=e;if(t.current.has(i))return()=>{};let a=new Map(t.current);for(let o of(a.set(i,e),t.current=a,n(),r.current))o.added(e);return()=>{let e=new Map(t.current);for(let a of(e.delete(i),t.current=e,n(),r.current))a.removed(i)}},[n]),o=(0,ek.useCallback)(()=>t.current,[]),s=(0,ek.useCallback)(e=>(r.current.add(e),()=>{r.current.delete(e)}),[]),l=(0,ek.useRef)(null),u=(0,ek.useRef)(null),{notify:d,subscribe:c}=s6(),p=(0,ek.useCallback)((e,t)=>{if(null===t){if(u.current!==e)return;l.current=null,u.current=null,d();return}let r=l.current;(u.current!==e||null===r||r.popoverId!==t.popoverId||r.highlightedItemId!==t.highlightedItemId)&&(l.current=t,u.current=e,d())},[d]),m=(0,ek.useCallback)(()=>l.current,[]),f=(0,ek.useMemo)(()=>({register:a,getTriggers:o,subscribe:i,subscribeLifecycle:s,getActiveAria:m,subscribeAria:c}),[a,o,i,s,m,c]),h=(0,ek.useMemo)(()=>({setActiveAria:p}),[p]);return(0,e_.jsx)(sG.Provider,{value:f,children:(0,e_.jsx)(sY.Provider,{value:h,children:e})})},s3=({children:e})=>sH()?(0,e_.jsx)(s5,{children:e}):(0,e_.jsx)(sK,{children:(0,e_.jsx)(s5,{children:e})});s3.displayName="ComposerPrimitive.TriggerPopoverRoot";let s9=(0,ek.forwardRef)(({autoFocus:e=!1,asChild:t,render:r,disabled:n,onChange:i,onKeyDown:a,onPaste:o,onSelect:s,submitOnEnter:l,submitMode:u,cancelOnEscape:d=!0,unstable_focusOnRunStart:c=!0,unstable_focusOnScrollToBottom:p=!0,unstable_focusOnThreadSwitched:m=!0,addAttachmentOnPaste:f=!0,...h},g)=>{let v,y=tU(),b=sH(),x=(v=sQ(),(0,ek.useSyncExternalStore)(v?v.subscribeAria:s1,v?v.getActiveAria:s4,v?v.getActiveAria:s4)),_=u??(!1===l?"none":"enter"),w=ij(e=>e.composer.isEditing?e.composer.text:""),k=ij(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||n,I=(0,ek.useRef)(null),S=(0,rh.useComposedRefs)(g,I),$=(0,ek.useRef)(!1);(0,sW.useEscapeKeydown)(e=>{if(!I.current?.contains(e.target))return;if(b){for(let t of b.getPlugins())if(t.handleKeyDown(e))return}if(!d)return;let t=y.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let j=async e=>{if(!f)return;let t=y.thread().getState().capabilities,r=Array.from(e.clipboardData?.files||[]);if(t.attachments&&r.length>0)try{e.preventDefault(),await Promise.all(r.map(e=>y.composer().addAttachment(e)))}catch(e){console.error("Error adding attachment:",e)}},E=e&&!k,C=(0,ek.useCallback)(()=>{let e=I.current;e&&E&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[E]);(0,ek.useEffect)(()=>C(),[C]),o4(()=>{"thread"===y.composer().getState().type&&p&&C()}),(0,ek.useEffect)(()=>{if("thread"===y.composer().getState().type&&c)return y.on("thread.runStart",C)},[c,C,y]),(0,ek.useEffect)(()=>{if("thread"===y.composer().getState().type&&m)return y.on("threadListItem.switchedTo",C)},[m,C,y]);let T=x?{"aria-controls":x.popoverId,"aria-expanded":!0,"aria-haspopup":"listbox","aria-activedescendant":x.highlightedItemId}:{},N={name:"input",value:w,...h,...T,ref:S,disabled:k,onChange:(0,rU.composeEventHandlers)(i,e=>{if(!y.composer().getState().isEditing)return;let t=!0===e.nativeEvent.isComposing;$.current&&!t&&($.current=!1);let r=t||$.current;if(e9(()=>{y.composer().setText(e.target.value)}),r)return;let n=e.target.selectionStart??e.target.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(n)}),onKeyDown:(0,rU.composeEventHandlers)(a,e=>{if(!k&&!e.nativeEvent.isComposing){if(b){for(let t of b.getPlugins())if(t.handleKeyDown(e))return}if("Enter"===e.key){let t=y.thread().getState(),r=t.capabilities.queue;if(e.shiftKey&&(e.ctrlKey||e.metaKey)&&r&&"none"!==_&&y.composer().getState().canSend){e.preventDefault(),y.composer().send({steer:!0});return}if(e.shiftKey||t.isRunning&&!r)return;let n=!1;"ctrlEnter"===_?n=e.ctrlKey||e.metaKey:"enter"===_&&(n=!0),n&&(e.preventDefault(),I.current?.closest("form")?.requestSubmit())}}}),onCompositionStart:(0,rU.composeEventHandlers)(h.onCompositionStart,()=>{$.current=!0}),onCompositionEnd:(0,rU.composeEventHandlers)(h.onCompositionEnd,e=>{if($.current=!1,!y.composer().getState().isEditing)return;let t=e.target;e9(()=>{y.composer().setText(t.value)});let r=t.selectionStart??t.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(r)}),onSelect:(0,rU.composeEventHandlers)(s,e=>{if($.current)return;let t=e.target,r=t.selectionStart??t.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(r)}),onPaste:(0,rU.composeEventHandlers)(o,j)};if(r&&(0,ek.isValidElement)(r)){let e=void 0!==h.children?h.children:r.props.children;return(0,e_.jsx)(rw.Root,{...N,children:(0,ek.cloneElement)(r,void 0,e)})}let A=t?rw.Root:sq;return(0,e_.jsx)(A,{...N})});s9.displayName="ComposerPrimitive.Input";let s8=sf("ComposerPrimitive.Cancel",()=>{let e,t,{disabled:r,cancel:n}=(e=tU(),t=ij(e=>!e.composer.canCancel),{cancel:(0,ek.useCallback)(()=>{e.composer().cancel()},[e]),disabled:t});return r?null:n}),s7=sf("ComposerPrimitive.AddAttachment",({multiple:e=!0}={})=>{let t,r,{disabled:n,addAttachment:i}=(t=tU(),r=ij(e=>!e.composer.isEditing),{addAttachment:(0,ek.useCallback)(e=>t.composer().addAttachment(e),[t]),disabled:r}),a=tU(),o=(0,ek.useCallback)(()=>{let t=document.createElement("input");t.type="file",t.multiple=e,t.hidden=!0;let r=a.composer().getState().attachmentAccept;"*"!==r&&(t.accept=r),document.body.appendChild(t),t.onchange=e=>{let r=e.target.files;if(r){for(let e of r)i(e);document.body.removeChild(t)}},t.oncancel=()=>{t.files&&0!==t.files.length||document.body.removeChild(t)},t.click()},[a,e,i]);return n?null:o},["multiple"]),le=({index:e,children:t})=>{let r=tU({attachment:tw({source:"message",query:{type:"index",index:e},get:t=>t.message().attachment({index:e})})});return(0,e_.jsx)(t_,{value:r,children:t})},lt=({index:e,children:t})=>{let r=tU({attachment:tw({source:"composer",query:{type:"index",index:e},get:t=>t.composer().attachment({index:e})})});return(0,e_.jsx)(t_,{value:r,children:t})},lr=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},ln=({components:e})=>{let t=ij(e=>e.attachment);if(!t)return null;let r=lr(e,t);return r?(0,e_.jsx)(r,{}):null},li=(0,ek.memo)(({index:e,components:t})=>(0,e_.jsx)(lt,{index:e,children:(0,e_.jsx)(ln,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);li.displayName="ComposerPrimitive.AttachmentByIndex";let la=({children:e})=>{let t=ij(e=>e.composer.attachments.length);return(0,ek.useMemo)(()=>Array.from({length:t},(t,r)=>(0,e_.jsx)(lt,{index:r,children:(0,e_.jsx)(si,{getItemState:e=>e.composer().attachment({index:r}).getState(),children:t=>e({get attachment(){return t()}})})},r)),[t,e])},lo=({components:e,children:t})=>e?(0,e_.jsx)(la,{children:({attachment:t})=>{let r=lr(e,t);return r?(0,e_.jsx)(r,{}):null}}):(0,e_.jsx)(la,{children:t});lo.displayName="ComposerPrimitive.Attachments";var rw=rw;let ls=(0,ek.forwardRef)(({disabled:e,asChild:t=!1,render:r,children:n,...i},a)=>{let[o,s]=(0,ek.useState)(!1),l=tU(),u=(0,ek.useCallback)(t=>{e||(t.preventDefault(),s(!0))},[e]),d=(0,ek.useCallback)(t=>{!e&&(t.preventDefault(),o||s(!0))},[e,o]),c=(0,ek.useCallback)(t=>{if(e)return;t.preventDefault();let r=t.relatedTarget;r&&t.currentTarget.contains(r)||s(!1)},[e]),p=(0,ek.useCallback)(async t=>{if(e)return;t.preventDefault(),s(!1);let r=Array.from(t.dataTransfer.files);await Promise.all(r.map(async e=>{try{await l.composer().addAttachment(e)}catch(e){console.error("Failed to add attachment:",e)}}))},[e,l]),m={...o?{"data-dragging":"true"}:null,...i,onDragEnterCapture:(0,rU.composeEventHandlers)(i.onDragEnterCapture,u),onDragOverCapture:(0,rU.composeEventHandlers)(i.onDragOverCapture,d),onDragLeaveCapture:(0,rU.composeEventHandlers)(i.onDragLeaveCapture,c),onDropCapture:(0,rU.composeEventHandlers)(i.onDropCapture,p),ref:a};if(r&&(0,ek.isValidElement)(r)){let e=void 0!==n?n:r.props.children;return(0,e_.jsx)(rw.Root,{...m,children:(0,ek.cloneElement)(r,void 0,e)})}let f=t?rw.Root:"div";return(0,e_.jsx)(f,{...m,children:n})});ls.displayName="ComposerPrimitive.AttachmentDropzone";let ll=sf("ComposerPrimitive.Dictate",()=>{let e,t,{disabled:r,startDictation:n}=(e=tU(),t=ij(e=>null!=e.composer.dictation||!e.thread.capabilities.dictation||!e.composer.isEditing),{startDictation:(0,ek.useCallback)(()=>{e.composer().startDictation()},[e]),disabled:t});return r?null:n}),lu=sf("ComposerPrimitive.StopDictation",()=>{let e=tU(),t=ij(e=>null!=e.composer.dictation),r=(0,ek.useCallback)(()=>{e.composer().stopDictation()},[e]);return t?r:null}),ld=(0,ek.forwardRef)(({children:e,...t},r)=>{let n=ij(e=>e.composer.dictation?.transcript);return n?(0,e_.jsx)(oH.span,{...t,ref:r,children:e??n}):null});ld.displayName="ComposerPrimitive.DictationTranscript";let lc=({children:e,...t})=>ij(e=>{if(!0===t.editing&&!e.composer.isEditing||!1===t.editing&&e.composer.isEditing)return!1;let r=null!=e.composer.dictation;return(!0!==t.dictation||!!r)&&(!1!==t.dictation||!r)})?e:null;lc.displayName="ComposerPrimitive.If";let lp=(0,ek.forwardRef)((e,t)=>ij(e=>e.composer.quote)?(0,e_.jsx)(oH.div,{...e,ref:t}):null);lp.displayName="ComposerPrimitive.Quote";let lm=(0,ek.forwardRef)(({children:e,...t},r)=>{let n=ij(e=>e.composer.quote?.text);return n?(0,e_.jsx)(oH.span,{...t,ref:r,children:e??n}):null});lm.displayName="ComposerPrimitive.QuoteText";let lf=(0,ek.forwardRef)(({onClick:e,...t},r)=>{let n=tU(),i=(0,ek.useCallback)(()=>{n.composer().setQuote(void 0)},[n]);return(0,e_.jsx)(oH.button,{type:"button",...t,ref:r,onClick:(0,rU.composeEventHandlers)(e,i)})});lf.displayName="ComposerPrimitive.QuoteDismiss";let lh=({index:e,children:t})=>{let r=tU({queueItem:tw({source:"composer",query:{index:e},get:t=>t.composer().queueItem({index:e})})});return(0,e_.jsx)(t_,{value:r,children:t})},lg=(0,ek.memo)(({children:e})=>{let t=ij(e=>e.composer.queue.length);return(0,ek.useMemo)(()=>Array.from({length:t},(t,r)=>(0,e_.jsx)(lh,{index:r,children:(0,e_.jsx)(si,{getItemState:e=>e.composer().queueItem({index:r}).getState(),children:t=>e({get queueItem(){return t()}})})},r)),[t,e])});lg.displayName="ComposerPrimitive.Queue";let lv=/\s/u,ly=eU(({text:e,triggerChar:t})=>{let[r,n]=eG(e.length),i=eV(()=>{let n=Math.min(r,e.length),i=e.slice(0,n);for(let e=i.length-1;e>=0;e--){let r=i[e];if(lv.test(r))break;if(i.startsWith(t,e)){if(e>0&&!lv.test(i[e-1]))continue;return{query:i.slice(e+t.length),offset:e}}}return null},[r,e,t]),a=i?.query??"";return{trigger:i,query:a,setCursorPosition:n}}),lb=eU(({navigableList:e,isSearchMode:t,activeCategoryId:r,query:n,popoverId:i,open:a,selectItem:o,selectCategory:s,goBack:l,close:u})=>{let[d,c]=eG(0);eW(()=>{c(0)},[e]),eW(()=>{c(0)},[t,r]);let p=e8(t=>{t<0||t>=e.length||t!==d&&c(t)}),m=e8(t=>{if(!a)return!1;switch(t.key){case"ArrowDown":return t.preventDefault(),c(t=>{let r=e.length;return 0===r?0:t<r-1?t+1:0}),!0;case"ArrowUp":return t.preventDefault(),c(t=>{let r=e.length;return 0===r?0:t>0?t-1:r-1}),!0;case"Enter":case"Tab":{if(t.shiftKey)return!1;t.preventDefault();let r=e[d];if(!r)return!0;return"type"in r?o(r):s(r.id),!0}case"Escape":return t.preventDefault(),u(),!0;case"Backspace":if(r&&""===n)return t.preventDefault(),l(),!0;return!1;default:return!1}}),f=e[d];return{highlightedIndex:d,highlightedItemId:a&&f?`${i}-option-${f.id}`:void 0,highlightIndex:p,handleKeyDown:m}});function lx(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}let l_=eU(({adapter:e,query:t,open:r})=>{let[n,i]=eG(null);eW(()=>{r||i(null)},[r]);let a=eV(()=>r&&e?e.categories():[],[r,e]),o=r?n:null,s=eV(()=>o&&e?e.categoryItems(o):[],[o,e]),l=eV(()=>{if(!r||!e||o||!t&&a.length>0)return null;if(e.search)return e.search(t);let n=[],i=t.toLowerCase();for(let t of a)for(let r of e.categoryItems(t.id))lx(r,i)&&n.push(r);return n},[r,e,t,o,a]),u=null!==l,d=eV(()=>{if(u)return[];if(!t)return a;let e=t.toLowerCase();return a.filter(t=>t.label.toLowerCase().includes(e))},[a,t,u]),c=eV(()=>{if(u)return l??[];if(!t)return s;let e=t.toLowerCase();return s.filter(t=>lx(t,e))},[s,t,u,l]),p=eV(()=>u?l??[]:o?c:d,[u,l,o,c,d]);return{categories:d,items:c,isSearchMode:u,activeCategoryId:o,navigableList:p,selectCategory:e8(e=>{i(e)}),goBack:e8(()=>{i(null)})}}),lw=eU(({behavior:e,trigger:t,aui:r,triggerChar:n,setCursorPosition:i,onSelected:a})=>{let o=eX(null),s=e8(e=>(o.current=e,()=>{o.current===e&&(o.current=null)}));return{selectItem:e8(i=>{if(!t||!e)return;if(o.current?.(i))return void a();let s=r.composer().getState().text,l=s.slice(0,t.offset),u=s.slice(t.offset+n.length+t.query.length),d=()=>{let t=e.formatter.serialize(i);r.composer().setText(l+t+(u.startsWith(" ")?u:` ${u}`))};"directive"===e.kind?(d(),e.onInserted?.(i)):(e.removeOnExecute?r.composer().setText(l+(u.startsWith(" ")?u.slice(1):u)):d(),e.onExecute(i)),a()}),close:e8(()=>{a(),t&&i(t.offset)}),registerSelectItemOverride:s}}),lk=eU(({adapter:e,text:t,triggerChar:r,behavior:n,aui:i,popoverId:a})=>{let o=e0(ly({text:t,triggerChar:r})),s=null!==o.trigger&&void 0!==e&&void 0!==n,l=e0(l_({adapter:e,query:o.query,open:s})),u=e8(()=>{l.goBack()}),d=e0(lw({behavior:n,trigger:o.trigger,aui:i,triggerChar:r,setCursorPosition:o.setCursorPosition,onSelected:u})),c=e0(lb({navigableList:l.navigableList,isSearchMode:l.isSearchMode,activeCategoryId:l.activeCategoryId,query:o.query,popoverId:a,open:s,selectItem:d.selectItem,selectCategory:l.selectCategory,goBack:l.goBack,close:d.close}));return{open:s,query:o.query,activeCategoryId:l.activeCategoryId,categories:l.categories,items:l.items,highlightedIndex:c.highlightedIndex,isSearchMode:l.isSearchMode,popoverId:a,highlightedItemId:c.highlightedItemId,selectCategory:l.selectCategory,goBack:l.goBack,selectItem:d.selectItem,close:d.close,highlightIndex:c.highlightIndex,handleKeyDown:c.handleKeyDown,setCursorPosition:o.setCursorPosition,registerSelectItemOverride:d.registerSelectItemOverride}}),lI=(0,ek.createContext)(null),lS=()=>{let e=(0,ek.useContext)(lI);if(!e)throw Error("useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover");return e},l$=(0,ek.createContext)(null),lj=()=>{let e=(0,ek.useContext)(l$);if(!e)throw Error("TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover");return e},lE=(0,ek.forwardRef)(({char:e,adapter:t,"aria-label":r,children:n,...i},a)=>{let o=tU(),s=ij(e=>e.composer.text),l=(0,ek.useId)(),u=(0,ek.useRef)(null),[d,c]=(0,ek.useState)(null),p=(0,ek.useRef)(0),m=(0,ek.useCallback)(e=>(p.current+=1,u.current=e,c(e),()=>{p.current=Math.max(0,p.current-1),u.current===e&&(u.current=null,c(null))}),[e]),f=(0,ek.useMemo)(()=>({register:m}),[m]),h=eD(lk({adapter:t,text:s,triggerChar:e,behavior:d??void 0,aui:o,popoverId:l})),g=(0,ek.useRef)(h);g.current=h;let v=sX();(0,ek.useEffect)(()=>v.register({char:e,...d?{behavior:d}:{},resource:g.current}),[v,e,d]);let y=sH();(0,ek.useEffect)(()=>{if(y)return y.register(g.current)},[y]);let b=null!==d&&h.open,x=(()=>{let e=(0,ek.useContext)(sY);if(!e)throw Error("useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot");return e})();return(0,ek.useEffect)(()=>{if(b)return()=>{x.setActiveAria(e,null)}},[x,e,b]),(0,ek.useEffect)(()=>{b&&x.setActiveAria(e,{popoverId:l,highlightedItemId:h.highlightedItemId})},[x,e,l,b,h.highlightedItemId]),(0,e_.jsx)(l$.Provider,{value:f,children:(0,e_.jsx)(lI.Provider,{value:h,children:b?(0,e_.jsx)(oH.div,{role:"listbox",id:l,"aria-label":r??"Suggestions","aria-activedescendant":h.highlightedItemId,"data-state":"open",...i,ref:a,children:n}):n})})});lE.displayName="ComposerPrimitive.TriggerPopover";let lC=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,lT={serialize(e){let t=e.id!==e.label?`{name=${e.id}}`:"";return`:${e.type}[${e.label}]${t}`},parse(e){let t=[],r=0;for(let n of e.matchAll(lC)){n.index>r&&t.push({kind:"text",text:e.slice(r,n.index)});let i=n[2];t.push({kind:"mention",type:n[1],label:i,id:n[3]??i}),r=n.index+n[0].length}return r<e.length&&t.push({kind:"text",text:e.slice(r)}),t}},lN=({formatter:e,onExecute:t,removeOnExecute:r})=>{let{register:n}=lj(),i=(0,ek.useRef)(t);return i.current=t,(0,ek.useEffect)(()=>n({kind:"action",formatter:e??lT,onExecute:e=>i.current(e),...void 0!==r?{removeOnExecute:r}:{}}),[n,e,r]),null};lN.displayName="ComposerPrimitive.TriggerPopoverAction";let lA=({formatter:e,onInserted:t})=>{let{register:r}=lj(),n=(0,ek.useRef)(t);return n.current=t,(0,ek.useEffect)(()=>r({kind:"directive",formatter:e??lT,onInserted:e=>n.current?.(e)}),[r,e]),null};lA.displayName="ComposerPrimitive.TriggerPopoverDirective";let lR=Object.assign(lE,{Directive:lA,Action:lN}),lP=(0,ek.forwardRef)(({children:e,"aria-label":t,...r},n)=>{let{categories:i,activeCategoryId:a,isSearchMode:o,open:s}=lS();return!s||a||o?null:(0,e_.jsx)(oH.div,{role:"group","aria-label":t??"Categories",...r,ref:n,children:e(i)})});lP.displayName="ComposerPrimitive.TriggerPopoverCategories";let lO=(0,ek.forwardRef)(({categoryId:e,onClick:t,onMouseMove:r,...n},i)=>{let{selectCategory:a,highlightIndex:o,categories:s,highlightedIndex:l,activeCategoryId:u,isSearchMode:d,popoverId:c}=lS(),p=(0,ek.useCallback)(()=>{a(e)},[a,e]),m=s.findIndex(t=>t.id===e),f=!u&&!d&&m===l,h=(0,ek.useCallback)(()=>{o(m)},[o,m]);return(0,e_.jsx)(oH.button,{type:"button",role:"option",id:`${c}-option-${e}`,"aria-selected":f,"data-highlighted":f?"":void 0,...n,ref:i,onClick:(0,rU.composeEventHandlers)(t,p),onMouseMove:(0,rU.composeEventHandlers)(r,h)})});lO.displayName="ComposerPrimitive.TriggerPopoverCategoryItem";let lM=(0,ek.forwardRef)(({children:e,"aria-label":t,...r},n)=>{let{items:i,activeCategoryId:a,isSearchMode:o,open:s}=lS();return s&&(a||o)?(0,e_.jsx)(oH.div,{role:"group","aria-label":t??"Items",...r,ref:n,children:e(i)}):null});lM.displayName="ComposerPrimitive.TriggerPopoverItems";let lz=(0,ek.forwardRef)(({item:e,index:t,onClick:r,onMouseMove:n,...i},a)=>{let{selectItem:o,highlightIndex:s,items:l,highlightedIndex:u,activeCategoryId:d,isSearchMode:c,popoverId:p}=lS(),m=(0,ek.useCallback)(()=>{o(e)},[o,e]),f=t??l.findIndex(t=>t.id===e.id),h=(c||null!==d)&&f===u,g=(0,ek.useCallback)(()=>{s(f)},[s,f]);return(0,e_.jsx)(oH.button,{type:"button",role:"option",id:`${p}-option-${e.id}`,"aria-selected":h,"data-highlighted":h?"":void 0,...i,ref:a,onClick:(0,rU.composeEventHandlers)(r,m),onMouseMove:(0,rU.composeEventHandlers)(n,g)})});lz.displayName="ComposerPrimitive.TriggerPopoverItem";let lD=(0,ek.forwardRef)(({onClick:e,...t},r)=>{let{activeCategoryId:n,isSearchMode:i,goBack:a,open:o}=lS();return o&&n&&!i?(0,e_.jsx)(oH.button,{type:"button",...t,ref:r,onClick:(0,rU.composeEventHandlers)(e,a)}):null});lD.displayName="ComposerPrimitive.TriggerPopoverBack",e.s(["AddAttachment",0,s7,"AttachmentByIndex",0,li,"AttachmentDropzone",0,ls,"Attachments",0,lo,"Cancel",0,s8,"Dictate",0,ll,"DictationTranscript",0,ld,"If",0,lc,"Input",0,s9,"Queue",0,lg,"Quote",0,lp,"QuoteDismiss",0,lf,"QuoteText",0,lm,"Root",0,s$,"Send",0,sS,"StopDictation",0,lu,"Unstable_TriggerPopover",0,lR,"Unstable_TriggerPopoverBack",0,lD,"Unstable_TriggerPopoverCategories",0,lP,"Unstable_TriggerPopoverCategoryItem",0,lO,"Unstable_TriggerPopoverItem",0,lz,"Unstable_TriggerPopoverItems",0,lM,"Unstable_TriggerPopoverRoot",0,s3,"unstable_useTriggerPopoverRootContext",0,sX,"unstable_useTriggerPopoverRootContextOptional",0,sQ,"unstable_useTriggerPopoverScopeContext",0,lS,"unstable_useTriggerPopoverScopeContextOptional",0,()=>(0,ek.useContext)(lI),"unstable_useTriggerPopoverTriggers",0,()=>{let e=sX();return(0,ek.useSyncExternalStore)(e.subscribe,e.getTriggers,e.getTriggers)},"unstable_useTriggerPopoverTriggersOptional",0,()=>{let e=sQ();return(0,ek.useSyncExternalStore)(e?e.subscribe:s1,e?e.getTriggers:s2,e?e.getTriggers:s2)}],36964);var lU=e.i(36964),lU=lU;let lL=rz("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),lZ=rz("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var lU=lU;let lF=rz("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),lB={claude:{provider:"claude",sessionId:null,source:"generated-default",updatedAt:"2026-05-27T10:18:02.000Z",ttl:18e5,agentVersion:null,capabilities:{model:{key:"model",currentValue:"sonnet",configId:"model",configKey:"model",source:"fallback",options:[{value:"sonnet",label:"Sonnet",description:"Claude Sonnet 默认模型。",order:0},{value:"opus",label:"Opus",description:"Claude Opus 高能力模型。",order:1},{value:"haiku",label:"Haiku",description:"Claude Haiku 快速模型。",order:2},{value:"opusplan",label:"Opus Plan",description:"Claude Opus 规划模式。",order:3},{value:"sonnet[1m]",label:"Sonnet [1M]",description:"Claude Sonnet 长上下文模型。",order:4}]},mode:{key:"mode",currentValue:iV,configId:"mode",configKey:"mode",source:"fallback",options:[{value:"default",label:"默认",description:"使用供应商默认权限策略。",order:0},{value:"acceptEdits",label:"接受编辑",description:"允许编辑类操作更顺畅地继续。",order:1},{value:"bypassPermissions",label:"绕过权限",description:"尽量减少权限确认,适合受信任工作区。",order:2},{value:"plan",label:"计划",description:"先规划再执行,适合复杂任务。",order:3}]},thought_level:{key:"thought_level",currentValue:"none",configId:"thought_level",configKey:"thought_level",source:"fallback",options:[{value:"none",label:"无",description:"不额外请求思考深度。",order:0},{value:"think",label:"Think",description:"轻量思考。",order:1},{value:"think-hard",label:"Think Hard",description:"更深入思考。",order:2},{value:"think-harder",label:"Think Harder",description:"高强度思考。",order:3},{value:"ultrathink",label:"Ultrathink",description:"最高强度思考。",order:4}]}},metadata:{availableCommands:[],tokenUsage:null,rawSession:null}},codex:{provider:"codex",sessionId:null,source:"generated-default",updatedAt:"2026-05-26T06:24:12.704Z",ttl:18e5,agentVersion:null,capabilities:{model:{key:"model",currentValue:"gpt-5.5",configId:"model",configKey:"model",source:"fallback",options:[{value:"gpt-5.5",label:"GPT-5.5",description:"适合复杂编码、研究和真实工作场景的前沿模型。",order:0},{value:"gpt-5.4",label:"gpt-5.4",description:"适合日常编码的强力模型。",order:1},{value:"gpt-5.4-mini",label:"GPT-5.4-Mini",description:"适合简单编码任务的小型、快速且高性价比模型。",order:2},{value:"gpt-5.3-codex",label:"gpt-5.3-codex",description:"针对编码优化的模型。",order:3},{value:"gpt-5.2",label:"gpt-5.2",description:"针对专业工作和长时间运行的 agent 优化。",order:4}]},mode:{key:"mode",currentValue:iq,configId:"mode",configKey:"mode",source:"fallback",options:[{value:"read-only",label:"只读",description:"Codex 可以读取当前工作区文件。编辑文件或访问互联网需要审批。",order:0},{value:"auto",label:"默认",description:"Codex 可以读取和编辑当前工作区文件,并运行命令。访问互联网或编辑其他文件需要审批。(等同于 Agent 模式)",order:1},{value:"full-access",label:"完全访问",description:"Codex 可以编辑工作区外的文件并访问互联网,无需请求审批。使用时请谨慎。",order:2}]},thought_level:{key:"thought_level",currentValue:"xhigh",configId:"reasoning_effort",configKey:"reasoning_effort",source:"fallback",options:[{value:"low",label:"低",description:"更轻量推理,响应更快",order:0},{value:"medium",label:"中",description:"在速度和推理深度之间取得平衡,适合日常任务",order:1},{value:"high",label:"高",description:"为复杂问题提供更深的推理",order:2},{value:"xhigh",label:"极高",description:"为复杂问题提供极高推理深度",order:3}]}},metadata:{availableCommands:[],tokenUsage:null,rawSession:null}},gemini:{provider:"gemini",sessionId:null,source:"generated-default",updatedAt:"2026-05-27T10:18:02.000Z",ttl:18e5,agentVersion:null,capabilities:{model:{key:"model",currentValue:"gemini-3-pro-preview",configId:"model",configKey:"model",source:"fallback",options:[{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro",description:"Gemini Pro 稳定模型。",order:0},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash",description:"Gemini Flash 快速模型。",order:1},{value:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview",description:"Gemini 3 Pro 预览模型。",order:2},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview",description:"Gemini 3 Flash 预览模型。",order:3}]},mode:{key:"mode",currentValue:iW,configId:"mode",configKey:"mode",source:"fallback",options:[{value:"default",label:"默认",description:"使用供应商默认权限策略。",order:0},{value:"acceptEdits",label:"接受编辑",description:"允许编辑类操作更顺畅地继续。",order:1},{value:"bypassPermissions",label:"绕过权限",description:"尽量减少权限确认,适合受信任工作区。",order:2}]},thought_level:{key:"thought_level",currentValue:"none",configId:"thought_level",configKey:"thought_level",source:"fallback",options:[{value:"none",label:"无",description:"不额外请求思考深度。",order:0}]}},metadata:{availableCommands:[],tokenUsage:null,rawSession:null}},opencode:{provider:"opencode",sessionId:null,source:"generated-default",updatedAt:"2026-05-27T10:18:02.000Z",ttl:18e5,agentVersion:null,capabilities:{model:{key:"model",currentValue:"opencode/big-pickle",configId:"model",configKey:"model",source:"fallback",options:[{value:"opencode/big-pickle",label:"OpenCode Zen/Big Pickle",description:"OpenCode 默认模型。",order:0},{value:"opencode/nemotron-3-super-free",label:"OpenCode Zen/Nemotron 3 Super Free",description:"OpenCode 可用模型。",order:1},{value:"opencode/deepseek-v4-flash-free",label:"OpenCode Zen/DeepSeek V4 Flash Free",description:"OpenCode 可用模型。",order:2}]},mode:{key:"mode",currentValue:iJ,configId:"mode",configKey:"mode",source:"fallback",options:[{value:"build",label:"build",description:"The default agent. Executes tools based on configured permissions.",order:0},{value:"plan",label:"plan",description:"Plan mode. Disallows all edit tools.",order:1}]},thought_level:{key:"thought_level",currentValue:"none",configId:"thought_level",configKey:"thought_level",source:"fallback",options:[{value:"none",label:"无",description:"不额外请求思考深度。",order:0}]}},metadata:{availableCommands:[],tokenUsage:null,rawSession:null}}};lB.codex;let lV=["model","mode","thought_level"],lq="acp.capabilities.updated",lW={getItem(e){try{return window.localStorage.getItem(e)}catch{return null}},removeItem(e){try{window.localStorage.removeItem(e)}catch{}},setItem(e,t){try{window.localStorage.setItem(e,t)}catch{}}};function lJ(e){return"string"==typeof e?e.trim():""}function lH(e){return lJ(e).toLowerCase()||"unknown"}function lK(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t=lJ(e.name??e.command??e.id).replace(/^\/+/,"");return t?{name:t,description:lJ(e.description),input:e.input,source:"acp"}:null}function lG(e){return(Array.isArray(e)?e:[]).map(lK).filter(e=>!!e)}function lY(e,t=0){if(null==e)return null;if("string"==typeof e||"number"==typeof e||"boolean"==typeof e){let r=String(e).trim();return r?{value:r,label:r,description:"",order:t}:null}if("object"!=typeof e||Array.isArray(e))return null;let r=lJ(e.value??e.id??e.modeId??e.const??(Array.isArray(e.enum)?e.enum[0]:void 0)??e.name);return r?{value:r,label:lJ(e.label??e.title??e.name??e.description)||r,description:lJ(e.description),order:Number.isInteger(e.order)?Number(e.order):t}:null}function lX(e){let t=new Set;return e.filter(e=>!(!e.value||t.has(e.value))&&(t.add(e.value),!0))}function lQ(e,t){if(!e)return t??null;if(!t)return e;let r={...e.capabilities??{}};for(let e of lV){var n,i;let a=(n=r[e],i=t.capabilities?.[e],n?i?{...n,...i,options:i.options.length?lX(i.options):n.options,currentValue:void 0!==i.currentValue?i.currentValue:n.currentValue}:n:i??null);a&&(r[e]=a)}return{...e,...t,capabilities:r,metadata:{...e.metadata??{availableCommands:[]},...t.metadata??{availableCommands:[]},tokenUsage:t.metadata?.tokenUsage??e.metadata?.tokenUsage??null,availableCommands:function(e,t){let r=[],n=new Set;for(let i of[...lG(t),...lG(e)]){let e=i.name.replace(/^\/+/,"").toLowerCase();!e||n.has(e)||(n.add(e),r.push(i))}return r}(e.metadata?.availableCommands,t.metadata?.availableCommands)}}}function l0(e,t){if(!t||"object"!=typeof t||Array.isArray(t))return null;let r={},n=t.capabilities&&"object"==typeof t.capabilities?t.capabilities:{};for(let e of lV){let t=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t=lJ(e.key);if("model"!==t&&"mode"!==t&&"thought_level"!==t)return null;let r=lX((Array.isArray(e.options)?e.options:[]).map(lY).filter(e=>!!e));return{key:t,currentValue:lJ(e.currentValue)||null,options:r,configId:lJ(e.configId)||t,configKey:lJ(e.configKey)||lJ(e.configId)||t,source:"session"===e.source||"config-option"===e.source||"fallback"===e.source?e.source:"fallback"}}(n[e]);t&&(r[e]=t)}let i=t.metadata&&"object"==typeof t.metadata?t.metadata:{};return{...void 0===t?t:JSON.parse(JSON.stringify(t)),provider:lH(t.provider||e),sessionId:lJ(t.sessionId)||null,source:lJ(t.source)||null,updatedAt:lJ(t.updatedAt)||new Date().toISOString(),ttl:Number.isFinite(Number(t.ttl))&&Number(t.ttl)>0?Number(t.ttl):18e5,agentVersion:lJ(t.agentVersion)||null,capabilities:r,metadata:{...i,tokenUsage:i.tokenUsage??null,availableCommands:lG(i.availableCommands)}}}function l1(e,t){let r=encodeURIComponent(lH(e)),n=lJ(t);return`acp-capabilities:v1:${r}:${n?encodeURIComponent(n):"global"}`}function l2(e,t,r=lW){let n=l1(e,t),i=r.getItem(n);if(!i)return null;try{return l0(e,JSON.parse(i))}catch{return r.removeItem(n),null}}function l4(e,t,r,n=lW){let i=l0(e,r),a=l1(e,t);return i?(n.setItem(a,JSON.stringify(i)),i):(n.removeItem(a),null)}function l6(e){let t=Date.parse(e?.updatedAt||"");return Number.isFinite(t)?t:0}function l5(e,t,r=function(e){return lB[String(e??"").trim().toLowerCase()]??null}(e),n=lW){let i=l0(e,r);if(!i)return l2(e,t,n);let a=l2(e,t,n);return a?l4(e,t,l6(i)>=l6(a)?lQ(i,function(e){let t={...e.capabilities??{}};for(let e of lV)t[e]?.source==="fallback"&&delete t[e];return{...e,capabilities:t}}(a)):lQ(i,a),n):l4(e,t,i,n)}function l3(e){return"string"==typeof e?e.trim():""}function l9(e){return l3(e).toLowerCase()||"unknown"}function l8(e){let t;if(!e||"object"!=typeof e||Array.isArray(e))return null;let r=(t=l3(e.name).replace(/^\/+/,""))?`/${t}`:"";if(!r)return null;let n=l3(e.scope),i="acp"===l3(e.source)?"acp":"skill",a="acp"===l3(e.namespace)||"acp"===i?"acp":"skill";return{name:r,description:l3(e.description)||("acp"===i?"ACP command":"Codex 技能"),namespace:a,source:i,..."skill"===i&&l3(e.path)?{path:l3(e.path)}:{},..."skill"===i&&("project"===n||"system"===n||"user"===n)?{scope:n}:{}}}function l7(e){let t=new Set;return(Array.isArray(e)?e:[]).map(l8).filter(e=>{if(!e)return!1;let r=e.name.toLowerCase();return!t.has(r)&&(t.add(r),!0)})}function ue(e,t,r){return Array.isArray(r)?{provider:l9(e),workspacePath:l3(t)||null,updatedAt:new Date().toISOString(),ttl:18e5,commands:l7(r)}:!r||"object"!=typeof r||Array.isArray(r)?null:{...void 0===r?r:JSON.parse(JSON.stringify(r)),provider:l9(r.provider||e),workspacePath:l3(r.workspacePath)||l3(t)||null,updatedAt:l3(r.updatedAt)||new Date().toISOString(),ttl:Number.isFinite(Number(r.ttl))&&Number(r.ttl)>0?Number(r.ttl):18e5,commands:l7(r.commands)}}function ut(e,t){let r=encodeURIComponent(l9(e)),n=l3(t);return`skill-commands:v1:${r}:${n?encodeURIComponent(n):"global"}`}function ur(e,t,r=lW){let n=ut(e,t),i=r.getItem(n);if(!i)return null;try{return ue(e,t,JSON.parse(i))}catch{return r.removeItem(n),null}}function un(e,t,r,n=lW){let i=ue(e,t,r),a=ut(e,t);return i?(n.setItem(a,JSON.stringify(i)),i):(n.removeItem(a),null)}function ui(e){return{id:e.name,type:"command",label:e.name,description:e.description,metadata:{namespace:e.namespace,source:e.source,...e.scope?{scope:e.scope}:{},...e.path?{path:e.path}:{}}}}function ua(e){return"string"==typeof e?e.trim():""}function uo(e){return e.map(e=>`${e.name}\u0000${e.description}\u0000${e.source}`).join("\n")}function us(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function ul(){let e=tU(),{provider:t,workspacePath:r}=ax(),n=ij(e=>e.threads.mainThreadId),i=ij(e=>e.thread.messages),a=(0,ek.useMemo)(()=>(function(e){if(!Array.isArray(e))return[];for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(!us(r))continue;if("user"===r.role)break;if("assistant"!==r.role)continue;let n=function(e){if(!us(e)||!us(e.acpAvailableCommands))return[];let t=e.acpAvailableCommands.byName;return us(t)?Object.values(t).flatMap(e=>{let t;if(!us(e))return[];let r=(t=ua(e.name).replace(/^\/+/,""))?`/${t}`:"";return r?[{name:r,description:ua(e.description)||"ACP command",namespace:"acp",source:"acp"}]:[]}):[]}((us(r.metadata)?r.metadata:{}).custom);if(n.length>0)return n}return[]})(i),[i]),[o,s]=(0,ek.useState)(()=>ur(t,r)?.commands??[]),l=(0,ek.useRef)(o);(0,ek.useEffect)(()=>{let e=!1,i=ur(t,r);if(i&&(l.current=i.commands,s(i.commands)),function(e,{force:t=!1,now:r=Date.now()}={}){return t||!function(e,t=Date.now()){if(!e)return!1;let r=Date.parse(e.updatedAt||"");if(!Number.isFinite(r))return!1;let n=Number(e.ttl||18e5);return Number.isFinite(n)&&n>0&&t-r<n}(e,r)}(i))return aT.listCommands({provider:t,threadId:n,workspacePath:r}).then(n=>{if(e)return;let i=un(t,r,Array.isArray(n?.commands)?n.commands:[]),a=i?.commands??[];l.current=a,s(a)}).catch(()=>{!e&&(i||(l.current=[],s([])))}),()=>{e=!0}},[t,n,r]),(0,ek.useEffect)(()=>{if(!a.length)return;let e=function(e,t){let r=new Map;for(let t of e)r.set(t.name.toLowerCase(),t);for(let e of t)r.set(e.name.toLowerCase(),e);return[...r.values()]}(l.current,a);if(uo(e)===uo(l.current))return;let n=un(t,r,e),i=n?.commands??e;l.current=i,s(i)},[t,a,r]);let u=(0,ek.useMemo)(()=>({categories:()=>[],categoryItems:()=>[],search:e=>o.filter(t=>{let r;return!(r=e.toLowerCase())||t.name.toLowerCase().includes(r)||t.description.toLowerCase().includes(r)||t.namespace.includes(r)||t.source.includes(r)}).map(ui)}),[o]);return(0,e_.jsxs)(lU.Unstable_TriggerPopover,{char:"/",adapter:u,className:"absolute bottom-full left-0 z-50 mb-3 w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",children:[(0,e_.jsx)(lU.Unstable_TriggerPopover.Action,{removeOnExecute:!0,onExecute:t=>{let r=l.current.find(e=>e.name===t.id),n=r?.name??t.label;e.thread().composer().setText(`${n} `)}}),(0,e_.jsx)("div",{className:"max-h-80 overflow-y-auto p-1.5",children:(0,e_.jsx)(lU.Unstable_TriggerPopoverItems,{children:e=>e.length?e.map((e,t)=>(0,e_.jsxs)(lU.Unstable_TriggerPopoverItem,{item:e,index:t,className:(0,rj.cn)("flex min-h-10 w-full items-start gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground data-[highlighted=true]:bg-accent"),children:[(0,e_.jsx)(lF,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,e_.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e_.jsx)("span",{className:"block truncate font-mono",children:e.label}),e.description?(0,e_.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:e.description}):null]})]},`${e.type}-${e.id}`)):(0,e_.jsx)(uu,{})})})]})}function uu(){return(0,e_.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"暂无可用命令"})}let ud=rz("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),uc=rz("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),up=rz("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),um=rz("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),uf=new Set(["low","medium","high","xhigh"]);function uh(e){return String(e??"").trim().toLowerCase()}function ug(e,t){let r=uh(t),n=String(e.value??"").trim();if("codex"!==r||!n.includes("/"))return e;let[i,a,...o]=n.split("/");if(!i||!a||o.length||!uf.has(a))return e;let s=String(e.label??"").trim();return{...e,label:s&&s!==n?s:`${i} / ${function(e){switch(e){case"low":return"低";case"medium":return"中";case"high":return"高";case"xhigh":return"极高";default:return e}}(a)}`}}function uv(e,t){return e.length?e.find(e=>e.value===t)?.label||e[0].label:""}let uy=iB.map((e,t)=>({value:e,label:iK[e].label,description:iK[e].enabledInP0?"已验证":"需本地 CLI/登录",order:t}));function ub(e,t){let r=e?.capabilities[t];return r?.options?.filter(e=>e.value).map(e=>({value:e.value,label:e.label||e.value,description:e.description}))??[]}function ux(e,t){let r=e?.capabilities;r?.model?.currentValue&&t.syncModel(r.model.currentValue),r?.mode?.currentValue&&t.syncModeId(r.mode.currentValue),r?.thought_level?.currentValue&&t.syncThoughtLevel(r.thought_level.currentValue)}function u_(){let e=function(){let{provider:e,workspacePath:t,syncModel:r,syncModeId:n,syncThoughtLevel:i}=ax(),a=ij(e=>e.threadListItem.remoteId??e.threads.mainThreadId),[o,s]=(0,ek.useState)(0),[l,u]=(0,ek.useState)(()=>l5(e,t));return(0,ek.useEffect)(()=>{function r(r){let n=r.detail;n?.provider&&n.provider!==e||n?.threadId&&n.threadId!==a||n&&"workspacePath"in n&&(n.workspacePath??null)!==(t??null)||s(e=>e+1)}return window.addEventListener(lq,r),()=>{window.removeEventListener(lq,r)}},[e,a,t]),(0,ek.useEffect)(()=>{let s=!1,l=l5(e,t);if(u(l),ux(l,{syncModeId:n,syncModel:r,syncThoughtLevel:i}),function(e,{force:t=!1,now:r=Date.now()}={}){return t||!function(e,t=Date.now()){if(!e)return!1;let r=Date.parse(e.updatedAt||"");if(!Number.isFinite(r))return!1;let n=Number(e.ttl||18e5);return Number.isFinite(n)&&n>0&&t-r<n}(e,r)}(l,{force:o>0}))return aT.getCapabilities({provider:e,threadId:a,workspacePath:t}).then(a=>{if(s)return;let o=l4(e,t,a?.capabilitySnapshot??null);u(o),ux(o,{syncModeId:n,syncModel:r,syncThoughtLevel:i})}).catch(()=>{s||u(l)}),()=>{s=!0}},[e,o,n,r,i,a,t]),l}(),t=ax(),r=(0,ek.useMemo)(()=>(function({provider:e="codex",acpModelOptions:t=[],runtimeModelOptions:r=[],fallbackModelOptions:n=[],sessionPinnedModel:i=""}={}){let a=uh(e),o=t.length?t:r.length?r:"codex"===a?[]:n,s=String(i??"").trim();return"codex"===a&&0===o.length?[]:!s||o.some(e=>e.value===s)?o.map(t=>ug(t,e)):[{value:s,label:s},...o].map(t=>ug(t,e))})({provider:t.provider,acpModelOptions:ub(e,"model"),sessionPinnedModel:t.model}),[t.model,t.provider,e]),n=(0,ek.useMemo)(()=>ub(e,"mode"),[e]),i=(0,ek.useMemo)(()=>ub(e,"thought_level"),[e]),a=(0,ek.useMemo)(()=>[{key:"provider",label:"供应商",value:t.provider,options:uy,onChange:t.setProvider,icon:up},{key:"model",label:"模型",value:t.model,options:r,onChange:t.setModel,icon:aJ},{key:"mode",label:"模式",value:t.modeId,options:n,onChange:t.setModeId,icon:aJ},{key:"thinking",label:"思考深度",value:t.thoughtLevel,options:i,onChange:t.setThoughtLevel,icon:uc}],[t.modeId,t.model,t.provider,t.setModeId,t.setModel,t.setProvider,t.setThoughtLevel,t.thoughtLevel,r,n,i]);return r.length||n.length||i.length?(0,e_.jsx)(uw,{sections:a}):(0,e_.jsx)(oL,{condition:e=>!e.thread.isEmpty,children:(0,e_.jsx)("div",{className:"flex min-w-0 items-center px-1 text-muted-foreground text-xs",children:"会话开始后会显示供应商能力"})})}function uw({sections:e}){let[t,r]=(0,ek.useState)(!1),n=function(e){let[t,r]=(0,ek.useState)(!1);return(0,ek.useEffect)(()=>{let t=window.matchMedia(e),n=()=>r(t.matches);return n(),t.addEventListener("change",n),()=>{t.removeEventListener("change",n)}},[e]),t}("(min-width: 640px)"),i=(0,ek.useMemo)(()=>e.filter(e=>e.options.length),[e]),[a,o]=(0,ek.useState)(i[0]?.key??null),[s,l]=(0,ek.useState)(null),u=(0,ek.useRef)(null),d=i.find(e=>"provider"===e.key),c=i.find(e=>"model"===e.key),p=i.find(e=>e.key===a)??i[0],m=d?uv(d.options,d.value||d.options[0]?.value||null):"配置",f=c?uv(c.options,c.value||c.options[0]?.value||null):"";return((0,ek.useEffect)(()=>{let e=i.some(e=>e.key===a)?a:i[0]?.key??null;e!==a&&o(e),s&&!i.some(e=>e.key===s)&&l(null)},[a,s,i]),(0,ek.useEffect)(()=>{if(t)return document.addEventListener("pointerdown",i),document.addEventListener("focusin",a),document.addEventListener("keydown",o),()=>{document.removeEventListener("pointerdown",i),document.removeEventListener("focusin",a),document.removeEventListener("keydown",o)};function e(){r(!1),l(null)}function n(e){return e instanceof Node&&u.current?.contains(e)}function i(t){n(t.target)||e()}function a(t){n(t.target)||e()}function o(t){"Escape"===t.key&&e()}},[t]),i.length)?(0,e_.jsxs)("div",{ref:u,className:"relative px-0.5",children:[(0,e_.jsxs)("button",{type:"button",className:"inline-flex h-8 max-w-56 items-center gap-1 rounded-md px-2 text-muted-foreground text-xs hover:bg-accent hover:text-accent-foreground","aria-haspopup":"menu","aria-expanded":t,"data-acp-config-trigger":"",onClick:function(){let e=!t;r(e),o(e=>e??i[0]?.key??null),e||l(null)},children:[(0,e_.jsx)(um,{className:"size-3.5 shrink-0"}),(0,e_.jsx)("span",{className:"truncate",children:f?`${m} \xb7 ${f}`:m}),(0,e_.jsx)(aV,{className:"size-3 shrink-0"})]}),t?(0,e_.jsxs)("div",{className:"absolute bottom-full left-0 z-50 mb-2 w-[min(20rem,calc(100vw-2rem))] rounded-md border bg-popover p-1 text-popover-foreground shadow-md max-sm:w-[calc(100vw-5rem)]",role:"menu","data-acp-config-root-menu":"",children:[(0,e_.jsx)("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"配置"}),(0,e_.jsxs)("div",{className:"relative",children:[i.map(e=>{let t=e.icon,r=e.value||e.options[0]?.value||null,i=uv(e.options,r),a=e.key===p?.key,u=e.key===s;return(0,e_.jsxs)("div",{children:[(0,e_.jsxs)("button",{type:"button",className:(0,rj.cn)("flex min-h-11 w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:outline-none",a&&"sm:bg-accent/70 sm:text-accent-foreground",u&&"max-sm:bg-accent/70 max-sm:text-accent-foreground"),"aria-haspopup":"menu","aria-expanded":n?a:u,"data-acp-config-section":e.key,onPointerEnter:t=>{"mouse"===t.pointerType&&o(e.key)},onFocus:()=>{n&&o(e.key)},onClick:()=>{var t;return t=e.key,void(n?o(t):l(e=>e===t?null:t))},children:[(0,e_.jsx)(t,{className:"size-4 shrink-0 text-muted-foreground"}),(0,e_.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e_.jsx)("span",{className:"block truncate",children:e.label}),(0,e_.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:i||"默认"})]}),(0,e_.jsx)(ud,{className:"hidden size-3.5 shrink-0 text-muted-foreground sm:block"}),(0,e_.jsx)(aV,{className:"size-3.5 shrink-0 text-muted-foreground sm:hidden"})]}),u?(0,e_.jsx)(uk,{section:e,variant:"mobile"}):null]},e.key)}),p?(0,e_.jsx)(uk,{section:p,variant:"desktop"}):null]})]}):null]}):null}function uk({section:e,variant:t}){let r=e.value||e.options[0]?.value||null;return(0,e_.jsxs)("div",{className:(0,rj.cn)("overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground","desktop"===t?"absolute bottom-0 left-[calc(100%+0.5rem)] hidden max-h-80 w-[min(22rem,calc(100vw-2rem))] border shadow-md sm:block":"mt-1 max-h-56 w-full border-x-0 border-b-0 border-t sm:hidden"),role:"menu","data-acp-config-submenu":t,children:[(0,e_.jsx)("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:e.label}),e.options.map(t=>(0,e_.jsxs)("button",{type:"button",className:(0,rj.cn)("flex min-h-10 w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:outline-none",t.value===r&&"bg-accent/60"),role:"menuitemradio","aria-checked":t.value===r,"data-acp-config-option":t.value,onClick:()=>{e.onChange(t.value)},children:[(0,e_.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e_.jsx)("span",{className:"block truncate",children:t.label}),t.description?(0,e_.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:t.description}):null]}),t.value===r?(0,e_.jsx)(aA,{className:"size-4 shrink-0"}):null]},t.value))]})}e.s([],12318),e.i(12318);let uI=(0,ek.forwardRef)((e,t)=>(0,e_.jsx)(oH.div,{...e,ref:t}));uI.displayName="AttachmentPrimitive.Root";let uS=(0,ek.forwardRef)((e,t)=>{let r=ij(e=>{let t=e.attachment.name.split(".");return t.length>1?t.pop():""});return(0,e_.jsxs)(oH.div,{...e,ref:t,children:[".",r]})});uS.displayName="AttachmentPrimitive.unstable_Thumb";let u$=()=>{let e=ij(e=>e.attachment.name);return(0,e_.jsx)(e_.Fragment,{children:e})};u$.displayName="AttachmentPrimitive.Name";let uj=sf("AttachmentPrimitive.Remove",()=>{let e=tU();return(0,ek.useCallback)(()=>{e.attachment().remove()},[e])});e.s(["Name",0,u$,"Remove",0,uj,"Root",0,uI,"unstable_Thumb",0,uS],68871);var uE=e.i(68871),uE=uE,lU=lU;e.s([],92058),e.i(92058);let uC=()=>{let e=tU(),t=ij(()=>e.message());return o2((0,ek.useCallback)(e=>{let r=()=>{t.setIsHovering(!0)},n=()=>{t.setIsHovering(!1)};return e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",n),e.matches(":hover")&&queueMicrotask(()=>t.setIsHovering(!0)),()=>{e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",n),t.setIsHovering(!1)}},[t]))},uT=({forwardedRef:e,...t})=>{let r=uC(),n=(0,rh.useComposedRefs)(e,r),i=ij(e=>e.message.id);return(0,e_.jsx)(oH.div,{...t,ref:n,"data-message-id":i})},uN=({forwardedRef:e,threadViewportStore:t,...r})=>{let n,i,a=uC(),o=(n=ru(e=>e.topAnchorTurn?.anchorId),ij(e=>"user"===e.message.role&&e.message.index>0&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role==="assistant"&&(e.message.id===n||e.thread.isRunning))),s=(i=ru(e=>e.topAnchorTurn?.targetId),ij(e=>e.message.isLast&&"assistant"===e.message.role&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role==="user"&&(e.message.id===i||e.thread.isRunning))),l=o2((0,ek.useCallback)(e=>{if(o)return t.getState().registerAnchorElement(e)},[o,t])),u=(({active:e,threadViewportStore:t})=>o2((0,ek.useCallback)(r=>{if(!e)return;let n=t.getState(),i=n.topAnchorMessageClamp;return n.registerAnchorTargetElement(r,{tallerThan:o9(i.tallerThan,r),visibleHeight:o9(i.visibleHeight,r)})},[e,t])))({active:s,threadViewportStore:t}),d=(0,rh.useComposedRefs)(e,a,l,u),c=ij(e=>e.message.id);return(0,e_.jsx)(oH.div,{...r,ref:d,"data-message-id":c,"data-aui-top-anchor-user":o?"":void 0,"data-aui-top-anchor-target":s?"":void 0})},uA=(0,ek.forwardRef)((e,t)=>{let r=rd();return"top"===r.getState().turnAnchor?(0,e_.jsx)(uN,{...e,forwardedRef:t,threadViewportStore:r}):(0,e_.jsx)(uT,{...e,forwardedRef:t})});uA.displayName="MessagePrimitive.Root";let uR=({index:e,children:t})=>{let r=tU({part:tw({source:"message",query:{type:"index",index:e},get:t=>t.message().part({index:e})})});return(0,e_.jsx)(t_,{value:r,children:t})},uP=eU(({text:e,isRunning:t})=>{let r=eV(()=>({type:"text",text:e,status:t?{type:"running"}:{type:"complete"}}),[e,t]);return{getState:()=>r,addToolResult:()=>{throw Error("Not supported")},resumeToolCall:()=>{throw Error("Not supported")}}}),uO=({text:e,isRunning:t=!1,children:r})=>{let n=tU({part:uP({text:e,isRunning:t})});return(0,e_.jsx)(t_,{value:n,children:r})},uM=Object.freeze({type:"complete"}),uz=eU(({parts:e,getMessagePart:t})=>{let[r,n]=eG(!0),i=eV(()=>{let t=e[e.length-1];return t?.status??uM},[e]),a=eV(()=>({parts:e,collapsed:r,status:i}),[e,r,i]);return{getState:()=>a,setCollapsed:n,part:t}}),uD=({startIndex:e,endIndex:t,children:r})=>{let n=ij(e=>e.message.parts).slice(e,t+1),i=tU(),a=tU({chainOfThought:uz({parts:n,getMessagePart:({index:t})=>{if(t<0||t>=n.length)throw Error(`ChainOfThought part index ${t} is out of bounds (0..${n.length-1})`);return i.message().part({index:e+t})}})});return(0,e_.jsx)(t_,{value:a,children:r})},uU=e=>{let t=e.message.metadata;if(t&&"object"==typeof t)return t.custom?.quote},uL=e=>!!e?.startsWith("ui://"),uZ=(e,t)=>{let r=e instanceof Map?e:new Map(e.entries()),n=t instanceof Map?t:new Map(t.entries());if(r.size!==n.size)return!1;for(let[e,t]of r)if(!n.has(e)||!Object.is(t,n.get(e)))return!1;return!0};function uF(e){let t=ek.default.useRef(void 0);return r=>{let n=e(r);return!function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Symbol.iterator in e&&Symbol.iterator in t){if("entries"in e&&"entries"in t)return uZ(e,t);let r=e[Symbol.iterator](),n=t[Symbol.iterator](),i=r.next(),a=n.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=r.next(),a=n.next()}return!!i.done&&!!a.done}return uZ({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}(t.current,n)?t.current=n:t.current}}let uB=e=>{let t=-1;return{startGroup:e=>{-1===t&&(t=e)},endGroup:(r,n)=>{-1!==t&&(n.push({type:e,startIndex:t,endIndex:r}),t=-1)},finalize:(r,n)=>{-1!==t&&n.push({type:e,startIndex:t,endIndex:r})}}},uV=({Fallback:e,...t})=>{let r=ij(r=>{let n=r.tools.tools[t.toolName]??e;return Array.isArray(n)?n[0]??e:n});return r?(0,e_.jsx)(r,{...t}):null},uq=(e,t,r)=>{let n=e.renderers[t]?.[0];return n||(e.fallbacks[0]??r)},uW=({Fallback:e,...t})=>{let r=ij(r=>uq(r.dataRenderers,t.name,e));return r?(0,e_.jsx)(r,{...t}):null},uJ={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},uH=({components:{Text:e=uJ.Text,Reasoning:t=uJ.Reasoning,Image:r=uJ.Image,Source:n=uJ.Source,File:i=uJ.File,Unstable_Audio:a=uJ.Unstable_Audio,tools:o={},data:s}={}})=>{let l=tU(),u=ij(e=>e.part),d=u.type;if("tool-call"===d){let e=l.part().addToolResult,t=l.part().resumeToolCall;if("Override"in o)return(0,e_.jsx)(o.Override,{...u,addResult:e,resume:t});let r=o.by_name?.[u.toolName]??o.Fallback;return(0,e_.jsx)(uV,{...u,Fallback:r,addResult:e,resume:t})}if(u.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,e_.jsx)(e,{...u});case"reasoning":return(0,e_.jsx)(t,{...u});case"source":return(0,e_.jsx)(n,{...u});case"image":return(0,e_.jsx)(r,{...u});case"file":return(0,e_.jsx)(i,{...u});case"audio":return(0,e_.jsx)(a,{...u});case"data":{let e=s?.by_name?.[u.name]??s?.Fallback;return(0,e_.jsx)(uW,{...u,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},uK=(0,ek.memo)(({index:e,components:t})=>(0,e_.jsx)(uR,{index:e,children:(0,e_.jsx)(uH,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);uK.displayName="MessagePrimitive.PartByIndex";let uG=({status:e,component:t})=>(0,e_.jsx)(uO,{text:"",isRunning:"running"===e.type,children:(0,e_.jsx)(t,{type:"text",text:"",status:e})}),uY=Object.freeze({type:"complete"}),uX=Object.freeze({type:"running"}),uQ=(0,ek.memo)(({components:e})=>{let t=ij(e=>e.message.status??uY);return e?.Empty?(0,e_.jsx)(e.Empty,{status:t}):"running"!==t.type?null:(0,e_.jsx)(uG,{status:t,component:e?.Text??uJ.Text})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),u0=(0,ek.memo)(({components:e,enabled:t})=>ij(e=>{if(!t||0===e.message.parts.length)return!1;let r=e.message.parts[e.message.parts.length-1];return r?.type!=="text"&&r?.type!=="reasoning"})?(0,e_.jsx)(uQ,{components:e}):null,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),u1=(0,ek.memo)(({Quote:e})=>{let t=ij(uU);return t?(0,e_.jsx)(e,{text:t.text,messageId:t.messageId}):null});function u2(e,t){let r=e.tools[t.toolName],n=Array.isArray(r)?r[0]??null:r??null;return n||(uL(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}let u4=()=>{let e=tU(),t=ij(e=>e.part),r=ij(e=>"tool-call"===e.part.type?u2(e.tools,e.part):null);return r&&"tool-call"===t.type?(0,e_.jsx)(r,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall}):null},u6=()=>{let e=ij(e=>e.part),t=ij(e=>"data"===e.part.type?uq(e.dataRenderers,e.part.name,void 0)??null:null);return t&&"data"===e.type?(0,e_.jsx)(t,{...e}):null},u5=()=>{let e=ij(e=>e.part.type);return"tool-call"===e?(0,e_.jsx)(u4,{}):"data"===e?(0,e_.jsx)(u6,{}):null},u3=Object.freeze({type:"text",text:"",status:uX}),u9=({index:e,children:t})=>{let r=tU(),n=ij(e=>e.dataRenderers);return(0,e_.jsx)(uR,{index:e,children:(0,e_.jsx)(si,{getItemState:t=>t.message().part({index:e}).getState(),children:i=>t({get part(){let t=i();if("tool-call"===t.type){let n=null!==u2(r.tools().getState(),t),i=r.message().part({index:e});return{...t,toolUI:n?(0,e_.jsx)(u4,{}):null,addResult:i.addToolResult,resume:i.resumeToolCall}}if("data"===t.type){let e=void 0!==uq(n,t.name,void 0);return{...t,dataRendererUI:e?(0,e_.jsx)(u6,{}):null}}return t}})})})},u8=({children:e})=>{let t=ij(e=>e.message.parts.length),r=ij(e=>(e.message.status?.type??"complete")==="running"),n=0===t&&r;return 0===t?n?(0,e_.jsx)(uO,{text:"",isRunning:!0,children:e({part:u3})}):null:(0,e_.jsx)(e_.Fragment,{children:Array.from({length:t},(t,r)=>(0,e_.jsx)(u9,{index:r,children:t=>e(t)??(0,e_.jsx)(u5,{})},r))})},u7=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:r})=>r?(0,e_.jsx)(u8,{children:r}):(0,e_.jsx)(de,{components:e,unstable_showEmptyOnNonTextEnd:t});u7.displayName="MessagePrimitive.Parts";let de=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{var r;let n,i=ij(e=>e.message.parts.length),a=(r=!!e?.ChainOfThought,n=ij(uF(e=>e.message.parts.map(e=>e.type))),(0,ek.useMemo)(()=>0===n.length?[]:((e,t)=>{let r=[];if(t){let t=uB("chainOfThoughtGroup");for(let n=0;n<e.length;n++){let i=e[n];"tool-call"===i||"reasoning"===i?t.startGroup(n):(t.endGroup(n-1,r),r.push({type:"single",index:n}))}t.finalize(e.length-1,r)}else{let t=uB("toolGroup"),n=uB("reasoningGroup");for(let i=0;i<e.length;i++){let a=e[i];"tool-call"===a?(n.endGroup(i-1,r),t.startGroup(i)):"reasoning"===a?(t.endGroup(i-1,r),n.startGroup(i)):(t.endGroup(i-1,r),n.endGroup(i-1,r),r.push({type:"single",index:i}))}t.finalize(e.length-1,r),n.finalize(e.length-1,r)}return r})(n,r),[n,r])),o=(0,ek.useMemo)(()=>0===i?(0,e_.jsx)(uQ,{components:e}):a.map(t=>{if("single"===t.type)return(0,e_.jsx)(uK,{index:t.index,components:e},t.index);if("chainOfThoughtGroup"===t.type){let r=e?.ChainOfThought;return r?(0,e_.jsx)(uD,{startIndex:t.startIndex,endIndex:t.endIndex,children:(0,e_.jsx)(r,{})},`chainOfThought-${t.startIndex}`):null}if("toolGroup"===t.type){let r=e?.ToolGroup??uJ.ToolGroup;return(0,e_.jsx)(r,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(r,n)=>{let i=t.startIndex+n;return(0,e_.jsx)(uK,{index:i,components:e},`part-${i}`)})},`tool-${t.startIndex}`)}{let r=e?.ReasoningGroup??uJ.ReasoningGroup;return(0,e_.jsx)(r,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(r,n)=>{let i=t.startIndex+n;return(0,e_.jsx)(uK,{index:i,components:e},`part-${i}`)})},`reasoning-${t.startIndex}`)}}),[a,e,i]);return(0,e_.jsxs)(e_.Fragment,{children:[e?.Quote&&(0,e_.jsx)(u1,{Quote:e.Quote}),o,(0,e_.jsx)(u0,{components:e,enabled:t})]})},dt=()=>ij(e=>{if("text"!==e.part.type&&"reasoning"!==e.part.type)throw Error("MessagePartText can only be used inside text or reasoning message parts.");return e.part}),dr=(0,ek.createContext)(null),dn=({children:e})=>{let t=di({optional:!0}),r=tU(),[n]=(0,ek.useState)(()=>{var e;return e=r.part().getState().status,{useSmoothStatus:ra(()=>e)}});return t?e:(0,e_.jsx)(dr.Provider,{value:n,children:e})};function di(e){let t=(0,ek.useContext)(dr);if(!e?.optional&&!t)throw Error("This component must be used within a SmoothContextProvider.");return t}let{useSmoothStatus:da,useSmoothStatusStore:ds}=rs(di,"useSmoothStatus");class dl{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();targetText="";constructor(e,t){this.currentText=e,this.setText=t}start(){null===this.animationFrameId&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,r=this.targetText.length-this.currentText.length,n=Math.min(5,250/r),i=0;for(;t>=n&&i<r;)i++,t-=n;i!==r?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,0!==i&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),this.lastUpdateTime=e-t,this.setText(this.currentText))}}let du=Object.freeze({type:"running"}),dd=(e,t=!1)=>{let{text:r}=e,[n,i]=(0,ek.useState)("running"===e.status.type?"":r),a=tU(),o=ij(()=>a.part()),[s,l]=(0,ek.useState)(o);o===s&&r.startsWith(n)||(l(o),i("running"===e.status.type?"":r));let u=ds({optional:!0}),d=(0,rJ.useCallbackRef)(t=>{if(i(t),u){let r=n!==t||"running"===e.status.type?du:e.status;u.setState(r,!0)}});(0,ek.useEffect)(()=>{if(u){let i=t&&(n!==r||"running"===e.status.type)?du:e.status;u.setState(i,!0)}},[u,t,r,n,e.status]);let[c]=(0,ek.useState)(new dl(n,d)),p=(0,ek.useRef)(o);return(0,ek.useEffect)(()=>{if(!t)return void c.stop();let n=p.current!==o;(p.current=o,n||!r.startsWith(c.targetText))?"running"===e.status.type?(c.currentText="",c.targetText=r,c.start()):(c.currentText=r,c.targetText=r,c.stop()):(c.targetText=r,c.start())},[c,t,r,e.status.type,o]),(0,ek.useEffect)(()=>()=>{c.stop()},[c]),(0,ek.useMemo)(()=>t?{type:"text",text:n,status:r===n?e.status:du}:e,[t,n,e,r])},dc=(0,ek.forwardRef)(({smooth:e=!0,component:t="span",...r},n)=>{let{text:i,status:a}=dd(dt(),e);return(0,e_.jsx)(t,{"data-status":a.type,...r,ref:n,children:i})});dc.displayName="MessagePartPrimitive.Text";let dp=(0,ek.forwardRef)((e,t)=>{let{image:r}=ij(e=>{if("image"!==e.part.type)throw Error("MessagePartImage can only be used inside image message parts.");return e.part});return(0,e_.jsx)(oH.img,{src:r,...e,ref:t})});dp.displayName="MessagePartPrimitive.Image";let dm=({children:e})=>ij(e=>"running"===e.part.status.type)?e:null;dm.displayName="MessagePartPrimitive.InProgress";let df={...uJ,Text:()=>(0,e_.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,e_.jsx)(dc,{}),(0,e_.jsx)(dm,{children:(0,e_.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>(0,e_.jsx)(dp,{})},dh=e=>{if("children"in e)return(0,e_.jsx)(u7,{children:e.children});let{components:t,...r}=e,n=t?{Text:t.Text??df.Text,Image:t.Image??df.Image,Reasoning:t.Reasoning??uJ.Reasoning,Source:t.Source??uJ.Source,File:t.File??uJ.File,Unstable_Audio:t.Unstable_Audio??uJ.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??uJ.ToolGroup,ReasoningGroup:t.ReasoningGroup??uJ.ReasoningGroup},Empty:t.Empty,Quote:t.Quote}:df;return(0,e_.jsx)(u7,{components:n,...r})};dh.displayName="MessagePrimitive.Parts";let dg=({children:e,...t})=>ij(e=>{let{role:r,attachments:n,parts:i,branchCount:a,isLast:o,speech:s,isCopied:l,isHovering:u}=e.message;return!(!0===t.hasBranches&&a<2||t.user&&"user"!==r||t.assistant&&"assistant"!==r||t.system&&"system"!==r||!0===t.lastOrHover&&!u&&!o||void 0!==t.last&&t.last!==o||!0===t.copied&&!l||!1===t.copied&&l||!0===t.speaking&&null==s||!1===t.speaking&&null!=s||!0===t.hasAttachments&&("user"!==r||!n?.length)||!1===t.hasAttachments&&"user"===r&&n?.length)&&(!0!==t.hasContent||0!==i.length)&&(!1!==t.hasContent||!(i.length>0))&&(void 0===t.submittedFeedback||(e.message.metadata.submittedFeedback?.type??null)===t.submittedFeedback)})?e:null;dg.displayName="MessagePrimitive.If";let dv=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},dy=({components:e})=>{let t=ij(e=>e.attachment);if(!t)return null;let r=dv(e,t);return r?(0,e_.jsx)(r,{}):null},db=(0,ek.memo)(({index:e,components:t})=>(0,e_.jsx)(le,{index:e,children:(0,e_.jsx)(dy,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);db.displayName="MessagePrimitive.AttachmentByIndex";let dx=({children:e})=>{let t=ij(e=>"user"!==e.message.role?0:(e.message.attachments??[]).length);return(0,ek.useMemo)(()=>Array.from({length:t},(t,r)=>(0,e_.jsx)(le,{index:r,children:(0,e_.jsx)(si,{getItemState:e=>e.message().attachment({index:r}).getState(),children:t=>e({get attachment(){return t()}})})},r)),[t,e])},d_=({components:e,children:t})=>e?(0,e_.jsx)(dx,{children:({attachment:t})=>{let r=dv(e,t);return r?(0,e_.jsx)(r,{}):null}}):(0,e_.jsx)(dx,{children:t});d_.displayName="MessagePrimitive.Attachments";let dw=(0,ek.memo)(({children:e})=>{let t=ij(uU);return t?(0,e_.jsx)(e_.Fragment,{children:e(t)}):null});dw.displayName="MessagePrimitive.Quote";let dk=()=>ij(e=>e.message.status?.type==="incomplete"&&"error"===e.message.status.reason?e.message.status.error??"An error occurred":void 0),dI=({children:e})=>void 0!==dk()?e:null;dI.displayName="MessagePrimitive.Error";let dS=Object.freeze([]),d$=e=>{let t=e.nextChildIdx++;return""===e.nodeKey?String(t):`${e.nodeKey}.${t}`},dj=Object.freeze({type:"complete"}),dE=()=>{throw Error("MessagePrimitive.GroupedParts: rendered `children` under a leaf part. `children` is only meaningful for `group-…` cases — add a matching case for the part type or return `null` to skip it.")},dC=(e,t,r)=>{if("part"===e.type)return(0,e_.jsx)(u9,{index:e.index,children:({part:e})=>r({part:e,children:(0,e_.jsx)(dE,{})})},`part-${e.index}`);let n=t[e.indices.at(-1)]?.status??dj,i={type:e.key,status:n,indices:e.indices};return(0,e_.jsx)(ek.Fragment,{children:r({part:i,children:(0,e_.jsx)(e_.Fragment,{children:e.children.map(e=>dC(e,t,r))})})},e.nodeKey)},dT=({groupBy:e,children:t})=>{let r=ij(uF(e=>e.message.parts)),n=(0,ek.useMemo)(()=>(e=>{let t={key:"",nodeKey:"",indices:[],children:[],nextChildIdx:0},r=[t],n=()=>{let e=r.pop();r[r.length-1].children.push({type:"group",key:e.key,nodeKey:e.nodeKey,indices:e.indices,children:e.children})};for(let t=0;t<e.length;t++){let i=e[t],a=0;for(;a<r.length-1&&a<i.length&&r[a+1].key===i[a];)a++;for(;r.length-1>a;)n();for(;r.length-1<i.length;){let e=r[r.length-1];r.push({key:i[r.length-1],nodeKey:d$(e),indices:[],children:[],nextChildIdx:0})}let o=r[r.length-1];o.children.push({type:"part",index:t,nodeKey:d$(o)});for(let e=1;e<r.length;e++)r[e].indices.push(t)}for(;r.length>1;)n();return t.children})(r.map((t,n)=>{var i;return null==(i=e(t,n,r))?dS:"string"==typeof i?[i]:i})),[r,e]);return(0,e_.jsx)(e_.Fragment,{children:n.map(e=>dC(e,r,t))})};dT.displayName="MessagePrimitive.GroupedParts";let dN=e=>{let t=new Map;for(let r=0;r<e.length;r++){let n=e[r],i=n?.parentId??`__ungrouped_${r}`,a=t.get(i)??[];a.push(r),t.set(i,a)}let r=[];for(let[e,n]of t){let t=e.startsWith("__ungrouped_")?void 0:e;r.push({groupKey:t,indices:n})}return r},dA=({Fallback:e,...t})=>{let r=ij(r=>{let n=r.tools.tools[t.toolName]??e;return Array.isArray(n)?n[0]??e:n});return r?(0,e_.jsx)(r,{...t}):null},dR=({Fallback:e,...t})=>{let r=ij(r=>{let n=r.dataRenderers.renderers[t.name]??e;return Array.isArray(n)?n[0]??e:n});return r?(0,e_.jsx)(r,{...t}):null},dP=()=>(0,e_.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,e_.jsx)(dc,{}),(0,e_.jsx)(dm,{children:(0,e_.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),dO=()=>null,dM=()=>null,dz=()=>(0,e_.jsx)(dp,{}),dD=()=>null,dU=()=>null,dL=({children:e})=>e,dZ=({components:{Text:e=dP,Reasoning:t=dO,Image:r=dz,Source:n=dM,File:i=dD,Unstable_Audio:a=dU,tools:o={},data:s}={}})=>{let l=tU(),u=ij(e=>e.part),d=u.type;if("tool-call"===d){let e=l.part().addToolResult,t=l.part().resumeToolCall;if("Override"in o)return(0,e_.jsx)(o.Override,{...u,addResult:e,resume:t});let r=o.by_name?.[u.toolName]??o.Fallback;return(0,e_.jsx)(dA,{...u,Fallback:r,addResult:e,resume:t})}if(u.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,e_.jsx)(e,{...u});case"reasoning":return(0,e_.jsx)(t,{...u});case"source":return(0,e_.jsx)(n,{...u});case"image":return(0,e_.jsx)(r,{...u});case"file":return(0,e_.jsx)(i,{...u});case"audio":return(0,e_.jsx)(a,{...u});case"data":{let e=s?.by_name?.[u.name]??s?.Fallback;return(0,e_.jsx)(dR,{...u,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},dF=(0,ek.memo)(({partIndex:e,components:t})=>(0,e_.jsx)(uR,{index:e,children:(0,e_.jsx)(dZ,{components:t})}),(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),dB=({status:e,component:t})=>(0,e_.jsx)(uO,{text:"",isRunning:"running"===e.type,children:(0,e_.jsx)(t,{type:"text",text:"",status:e})}),dV=Object.freeze({type:"complete"}),dq=(0,ek.memo)(({components:e})=>{let t=ij(e=>e.message.status??dV);return e?.Empty?(0,e_.jsx)(e.Empty,{status:t}):(0,e_.jsx)(dB,{status:t,component:e?.Text??dP})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),dW=({groupingFunction:e,components:t})=>{let r,n=ij(e=>e.message.parts.length),i=(r=ij(e=>e.message.parts),(0,ek.useMemo)(()=>0===r.length?[]:e(r),[r,e])),a=(0,ek.useMemo)(()=>0===n?(0,e_.jsx)(dq,{components:t}):i.map((e,r)=>{let n=t?.Group??dL;return(0,e_.jsx)(n,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,e_.jsx)(dF,{partIndex:e,components:t},e))},`group-${r}-${e.groupKey??"ungrouped"}`)}),[i,t,n]);return(0,e_.jsx)(e_.Fragment,{children:a})};dW.displayName="MessagePrimitive.Unstable_PartsGrouped";let dJ=({components:e,...t})=>(0,e_.jsx)(dW,{...t,components:e,groupingFunction:dN});dJ.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId",e.s(["AttachmentByIndex",0,db,"Attachments",0,d_,"Content",0,dh,"Error",0,dI,"GroupedParts",0,dT,"If",0,dg,"PartByIndex",0,uK,"Parts",0,dh,"Quote",0,dw,"Root",0,uA,"Unstable_PartsGrouped",0,dW,"Unstable_PartsGroupedByParentId",0,dJ],7860);var dH=e.i(7860),dH=dH;let dK=rz("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),dG=rz("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var dY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=rg(`Primitive.${t}`),n=ek.forwardRef((e,n)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(i?r:t,{...a,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),dX=e.i(2239);function dQ(){return()=>{}}var d0="Avatar",[d1,d2]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(d0),[d4,d6]=d1(d0),d5=ek.forwardRef((e,t)=>{let{__scopeAvatar:r,...n}=e,[i,a]=ek.useState("idle");return(0,e_.jsx)(d4,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,e_.jsx)(dY.span,{...n,ref:t})})});d5.displayName=d0;var d3="AvatarImage",d9=ek.forwardRef((e,t)=>{let{__scopeAvatar:r,src:n,onLoadingStatusChange:i=()=>{},...a}=e,o=d6(d3,r),s=function(e,{referrerPolicy:t,crossOrigin:r}){let n=(0,dX.useSyncExternalStore)(dQ,()=>!0,()=>!1),i=ek.useRef(null),a=n?(i.current||(i.current=new window.Image),i.current):null,[o,s]=ek.useState(()=>ce(a,e));return(0,aH.useLayoutEffect)(()=>{s(ce(a,e))},[a,e]),(0,aH.useLayoutEffect)(()=>{let e=e=>()=>{s(e)};if(!a)return;let n=e("loaded"),i=e("error");return a.addEventListener("load",n),a.addEventListener("error",i),t&&(a.referrerPolicy=t),"string"==typeof r&&(a.crossOrigin=r),()=>{a.removeEventListener("load",n),a.removeEventListener("error",i)}},[a,r,t]),o}(n,a),l=(0,rJ.useCallbackRef)(e=>{i(e),o.onImageLoadingStatusChange(e)});return(0,aH.useLayoutEffect)(()=>{"idle"!==s&&l(s)},[s,l]),"loaded"===s?(0,e_.jsx)(dY.img,{...a,ref:t,src:n}):null});d9.displayName=d3;var d8="AvatarFallback",d7=ek.forwardRef((e,t)=>{let{__scopeAvatar:r,delayMs:n,...i}=e,a=d6(d8,r),[o,s]=ek.useState(void 0===n);return ek.useEffect(()=>{if(void 0!==n){let e=window.setTimeout(()=>s(!0),n);return()=>window.clearTimeout(e)}},[n]),o&&"loaded"!==a.imageLoadingStatus?(0,e_.jsx)(dY.span,{...i,ref:t}):null});function ce(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}d7.displayName=d8,e.s(["Avatar",0,d5,"AvatarFallback",0,d7,"AvatarImage",0,d9,"Fallback",0,d7,"Image",0,d9,"Root",0,d5,"createAvatarScope",0,d2],60860);var ct=e.i(60860),ct=ct;function cr({className:e,size:t="default",...r}){return(0,e_.jsx)(ct.Root,{"data-slot":"avatar","data-size":t,className:(0,rj.cn)("group/avatar relative flex size-8 shrink-0 select-none overflow-hidden rounded-full data-[size=lg]:size-10 data-[size=sm]:size-6",e),...r})}function cn({className:e,...t}){return(0,e_.jsx)(ct.Image,{"data-slot":"avatar-image",className:(0,rj.cn)("aspect-square size-full",e),...t})}function ci({className:e,...t}){return(0,e_.jsx)(ct.Fallback,{"data-slot":"avatar-fallback",className:(0,rj.cn)("flex size-full items-center justify-center rounded-full bg-muted text-muted-foreground text-sm group-data-[size=sm]/avatar:text-xs",e),...t})}let ca=()=>{let{file:e,src:t}=ij(uF(e=>{if("image"!==e.attachment.type)return{};if(e.attachment.file)return{file:e.attachment.file};let t=e.attachment.content?.filter(e=>"image"===e.type)[0]?.image;return t?{src:t}:{}}));return(e=>{let[t,r]=(0,ek.useState)(void 0);return(0,ek.useEffect)(()=>{if(!e)return void r(void 0);let t=URL.createObjectURL(e);return r(t),()=>{URL.revokeObjectURL(t)}},[e]),t})(e)??t},co=({src:e})=>{let[t,r]=(0,ek.useState)(!1);return(0,e_.jsx)("img",{src:e,alt:"附件预览",className:(0,rj.cn)("block h-auto max-h-[80vh] w-auto max-w-full object-contain",t?"aui-attachment-preview-image-loaded":"aui-attachment-preview-image-loading invisible"),onLoad:()=>r(!0)})},cs=({children:e})=>{let t=ca();return t?(0,e_.jsxs)(aP,{children:[(0,e_.jsx)(aO,{className:"aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50",asChild:!0,children:e}),(0,e_.jsxs)(aU,{className:"aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0! [&_svg]:text-background [&>button]:hover:[&_svg]:text-destructive",children:[(0,e_.jsx)(aF,{className:"aui-sr-only sr-only",children:"图片附件预览"}),(0,e_.jsx)("div",{className:"aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background",children:(0,e_.jsx)(co,{src:t})})]})]}):e},cl=()=>{let e=ca();return(0,e_.jsxs)(cr,{className:"aui-attachment-tile-avatar h-full w-full rounded-none",children:[(0,e_.jsx)(cn,{src:e,alt:"附件预览",className:"aui-attachment-tile-image object-cover"}),(0,e_.jsx)(ci,{children:(0,e_.jsx)(dK,{className:"aui-attachment-tile-fallback-icon size-8 text-muted-foreground"})})]})},cu=()=>{let e="message"!==tU().attachment.source,t=ij(e=>"image"===e.attachment.type),r=ij(e=>{let t=e.attachment.type;switch(t){case"image":return"图片";case"document":return"文档";case"file":return"文件";default:return t}});return(0,e_.jsxs)(rT.Tooltip,{children:[(0,e_.jsxs)(uE.Root,{className:(0,rj.cn)("aui-attachment-root relative",t&&"aui-attachment-root-composer only:*:first:size-24"),children:[(0,e_.jsx)(cs,{children:(0,e_.jsx)(rT.TooltipTrigger,{asChild:!0,children:(0,e_.jsx)("button",{type:"button",className:"aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[calc(var(--composer-radius)-var(--composer-padding))] border bg-muted p-0 transition-opacity hover:opacity-75","aria-label":`${r}附件`,children:(0,e_.jsx)(cl,{})})})}),e&&(0,e_.jsx)(cd,{})]}),(0,e_.jsx)(rT.TooltipContent,{side:"top",children:(0,e_.jsx)(uE.Name,{})})]})},cd=()=>(0,e_.jsx)(uE.Remove,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:"移除文件",className:"aui-attachment-tile-remove absolute end-1.5 top-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:bg-white! [&_svg]:text-black hover:[&_svg]:text-destructive",side:"top",children:(0,e_.jsx)(rD,{className:"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]"})})}),cc=()=>(0,e_.jsx)("div",{className:"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2",children:(0,e_.jsx)(dH.Attachments,{children:()=>(0,e_.jsx)(cu,{})})}),cp=()=>(0,e_.jsx)("div",{className:"aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden",children:(0,e_.jsx)(lU.Attachments,{children:()=>(0,e_.jsx)(cu,{})})}),cm=({label:e="添加附件"})=>(0,e_.jsx)(lU.AddAttachment,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:e,side:"bottom",variant:"ghost",size:"icon",className:"aui-composer-add-attachment size-8 rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30","aria-label":e,children:(0,e_.jsx)(dG,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})}),cf=({addAttachmentLabel:e,ariaLabel:t="消息输入框",leadingActions:r,onPaste:n,placeholder:i="输入 / 使用技能,或直接发送消息...",sendLabel:a,showAttachments:o=!0,showCommandMenu:s=!0,showSelectors:l=!0,trailingActions:u,triggerPopovers:d})=>(0,e_.jsx)(lU.Root,{className:"aui-composer-root relative flex w-full flex-col",children:(0,e_.jsx)(lU.AttachmentDropzone,{asChild:!0,children:(0,e_.jsxs)("div",{"data-slot":"aui_composer-shell",className:"flex w-full flex-col gap-2 rounded-(--composer-radius) border bg-background p-(--composer-padding) transition-shadow focus-within:border-ring/75 focus-within:ring-2 focus-within:ring-ring/20 data-[dragging=true]:border-ring data-[dragging=true]:border-dashed data-[dragging=true]:bg-accent/50",children:[(0,e_.jsxs)(lU.Unstable_TriggerPopoverRoot,{children:[o?(0,e_.jsx)(cp,{}):null,(0,e_.jsx)(lU.Input,{placeholder:i,className:"aui-composer-input max-h-32 min-h-10 w-full resize-none bg-transparent px-1.75 py-1 text-[13px] outline-none placeholder:text-muted-foreground/80 md:text-sm",rows:1,autoFocus:!0,"aria-label":t,onPaste:n}),s?(0,e_.jsx)(ul,{}):null,d]}),(0,e_.jsx)(ch,{addAttachmentLabel:e,leadingActions:r,sendLabel:a,showAddAttachment:o,showSelectors:l,trailingActions:u})]})})}),ch=({addAttachmentLabel:e,leadingActions:t,sendLabel:r="发送消息",showAddAttachment:n=!0,showSelectors:i=!0,trailingActions:a})=>(0,e_.jsxs)("div",{className:"aui-composer-action-wrapper relative flex items-center justify-between text-[13px] md:text-sm",children:[(0,e_.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[n?(0,e_.jsx)(cm,{label:e}):null,i?(0,e_.jsx)(u_,{}):null,t]}),(0,e_.jsxs)("div",{className:"flex items-center gap-1",children:[a,(0,e_.jsx)(oL,{condition:e=>!e.thread.isRunning,children:(0,e_.jsx)(lU.Send,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:r,side:"bottom",type:"button",variant:"default",size:"icon",className:"aui-composer-send size-8 rounded-full","aria-label":r,children:(0,e_.jsx)(lL,{className:"aui-composer-send-icon size-4"})})})}),(0,e_.jsx)(oL,{condition:e=>e.thread.isRunning,children:(0,e_.jsx)(lU.Cancel,{asChild:!0,children:(0,e_.jsx)(rC,{type:"button",variant:"default",size:"icon",className:"aui-composer-cancel size-8 rounded-full","aria-label":"停止生成",children:(0,e_.jsx)(lZ,{className:"aui-composer-cancel-icon size-3 fill-current"})})})})]})]}),cg=rz("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]);function cv(e){return e.title||(e.target.label?e.target.label:"web-element"===e.target.type?e.target.elementId||e.target.selector||e.target.url||"网页":"canvas-element"===e.target.type?e.target.elementId||e.target.elementType||e.target.canvasId||e.target.filePath||"画布":e.target.filePath||e.target.quote||"文本")||e.body}let cy=()=>{let{contextBundle:e,removeContextItems:t,workspacePath:r}=ax();return 0===e.items.length?null:(0,e_.jsx)("div",{className:"flex min-h-11 w-full items-center",children:(0,e_.jsx)("div",{className:"flex w-full flex-wrap items-center gap-1.5 px-1",children:e.items.map(e=>{let n=e.id;if(!n)return null;let i=function(e){if("file"===e.kind)return e.name||e.path.split(/[\\/]/).filter(Boolean).at(-1)||e.path;return cv(e)}(e),a="file"===e.kind?function(e,t){var r;let n=e.path.trim();if(!n||(r=n).startsWith("/")||r.startsWith("\\\\")||/^[A-Za-z]:[\\/]/.test(r)||!t)return n||e.path;let i=t.replace(/[\\/]+$/g,""),a=n.replace(/^[\\/]+/g,""),o=i.includes("\\")&&!i.includes("/")?"\\":"/";return`${i}${o}${a}`}(e,r):cv(e),o="file"===e.kind?dK:cg;return(0,e_.jsxs)(rT.Tooltip,{children:[(0,e_.jsx)(rT.TooltipTrigger,{asChild:!0,children:(0,e_.jsxs)("div",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/50 px-2 py-1 text-muted-foreground text-xs",children:[(0,e_.jsx)(o,{className:"size-3.5 shrink-0"}),(0,e_.jsx)("span",{className:"min-w-0 max-w-48 truncate",children:i}),(0,e_.jsx)(rC,{type:"button",variant:"ghost",size:"icon-xs",className:"-me-1 size-5 rounded-sm text-muted-foreground hover:text-foreground","aria-label":"移除上下文",onClick:()=>t([n]),children:(0,e_.jsx)(rD,{className:"size-3"})})]})}),(0,e_.jsx)(rT.TooltipContent,{side:"top",className:"whitespace-pre-wrap break-normal text-left [overflow-wrap:anywhere]",style:{width:"max-content",maxWidth:"min(28rem, calc(100vw - 2rem))",textWrap:"wrap"},children:"file"===e.kind?(function(e){let t=[],r=0;for(let n=0;n<e.length;n+=1){let i=e[n];("/"===i||"\\"===i)&&(t.push(e.slice(r,n+1)),r=n+1)}if(r<e.length&&t.push(e.slice(r)),0===t.length)return[e];let n=[],i="";for(let e of t){if(i&&i.length+e.length>42&&(n.push(i),i=""),e.length<=42){i+=e;continue}for(let t=0;t<e.length;t+=42){let r=e.slice(t,t+42);i&&(n.push(i),i=""),42===r.length?n.push(r):i=r}}return i&&n.push(i),n})(a).join("\n"):a})]},n)})})})};e.s([],78481),e.i(78481);let cb=(0,ek.forwardRef)((e,t)=>{let r=ij(e=>e.suggestion.title);return(0,e_.jsx)(oH.span,{...e,ref:t,children:e.children??r})});cb.displayName="SuggestionPrimitive.Title";let cx=(0,ek.forwardRef)((e,t)=>{let r=ij(e=>e.suggestion.label);return(0,e_.jsx)(oH.span,{...e,ref:t,children:e.children??r})});cx.displayName="SuggestionPrimitive.Description";let c_=sf("SuggestionPrimitive.Trigger",({send:e,clearComposer:t=!0})=>{let r=tU(),n=ij(e=>e.thread.isDisabled),i=ij(e=>e.suggestion.prompt),a=e??!1,o=(0,ek.useCallback)(()=>{let e=r.thread().getState().isRunning;if(a&&!e)r.thread().append({content:[{type:"text",text:i}],runConfig:r.composer().getState().runConfig}),t&&r.composer().setText("");else if(t)r.composer().setText(i);else{let e=r.composer().getState().text;r.composer().setText(e.trim()?`${e} ${i}`:i)}},[r,a,t,i]);return n?null:o},["send","clearComposer"]);e.s(["Description",0,cx,"Title",0,cb,"Trigger",0,c_],87448);var cw=e.i(87448),cw=cw,sk=sk;let ck=({isHistoryRoute:e})=>e?(0,e_.jsx)(cS,{}):(0,e_.jsx)(cI,{}),cI=()=>(0,e_.jsxs)("div",{className:"aui-thread-welcome-root my-auto flex grow flex-col",children:[(0,e_.jsx)("div",{className:"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center",children:(0,e_.jsxs)("div",{className:"aui-thread-welcome-message flex size-full flex-col justify-center px-4",children:[(0,e_.jsx)("h1",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200",children:"准备好了"}),(0,e_.jsx)("p",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200",children:"发来你的想法,我们一起开始。"})]})}),(0,e_.jsx)(cj,{})]}),cS=()=>(0,e_.jsx)("div",{className:"aui-thread-welcome-root my-auto flex grow flex-col",children:(0,e_.jsx)("div",{className:"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center",children:(0,e_.jsxs)("div",{className:"aui-thread-welcome-message flex size-full flex-col justify-center px-4",children:[(0,e_.jsx)("h1",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200",children:"还没有可显示的回复"}),(0,e_.jsx)("p",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200",children:"你可以继续发送消息,我会接着帮你处理。"})]})})}),c$=()=>(0,e_.jsx)("div",{className:"aui-thread-welcome-root my-auto flex grow flex-col",children:(0,e_.jsx)("div",{className:"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center",children:(0,e_.jsxs)("div",{className:"aui-thread-welcome-message flex size-full flex-col justify-center px-4",children:[(0,e_.jsx)("h1",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200",children:"正在打开对话"}),(0,e_.jsx)("p",{className:"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200",children:"稍等一下,正在整理记录。"})]})})}),cj=()=>(0,e_.jsx)("div",{className:"aui-thread-welcome-suggestions grid w-full @md:grid-cols-2 gap-2 pb-4",children:(0,e_.jsx)(sk.Suggestions,{children:()=>(0,e_.jsx)(cE,{})})}),cE=()=>(0,e_.jsx)("div",{className:"aui-thread-welcome-suggestion-display fade-in slide-in-from-bottom-2 @md:nth-[n+3]:block nth-[n+3]:hidden animate-in fill-mode-both duration-200",children:(0,e_.jsx)(cw.Trigger,{send:!0,asChild:!0,children:(0,e_.jsxs)(rC,{variant:"ghost",className:"aui-thread-welcome-suggestion h-auto w-full @md:flex-col flex-wrap items-start justify-start gap-1 rounded-3xl border bg-background px-4 py-3 text-start text-sm transition-colors hover:bg-muted",children:[(0,e_.jsx)(cw.Title,{className:"aui-thread-welcome-suggestion-text-1 font-medium"}),(0,e_.jsx)(cw.Description,{className:"aui-thread-welcome-suggestion-text-2 text-muted-foreground empty:hidden"})]})})});var sk=sk;e.s([],73503),e.i(73503);var cC=Symbol("radix.slottable");function cT(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cC}var cN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(cT);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{});function cA(e){var t;let r,n=(t=e,(r=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=ek.forwardRef((e,t)=>{let{children:r,...i}=e,a=ek.Children.toArray(r),o=a.find(cP);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(n,{...i,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var cR=Symbol("radix.slottable");function cP(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cR}function cO(e){let t=e+"CollectionProvider",[r,n]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(t),[i,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:r}=e,n=ek.default.useRef(null),a=ek.default.useRef(new Map).current;return(0,e_.jsx)(i,{scope:t,itemMap:a,collectionRef:n,children:r})};o.displayName=t;let s=e+"CollectionSlot",l=cA(s),u=ek.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,i=a(s,r),o=(0,rh.useComposedRefs)(t,i.collectionRef);return(0,e_.jsx)(l,{ref:o,children:n})});u.displayName=s;let d=e+"CollectionItemSlot",c="data-radix-collection-item",p=cA(d),m=ek.default.forwardRef((e,t)=>{let{scope:r,children:n,...i}=e,o=ek.default.useRef(null),s=(0,rh.useComposedRefs)(t,o),l=a(d,r);return ek.default.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,e_.jsx)(p,{...{[c]:""},ref:s,children:n})});return m.displayName=d,[{Provider:o,Slot:u,ItemSlot:m},function(t){let r=a(e+"CollectionConsumer",t);return ek.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${c}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}var cM=new WeakMap;function cz(e,t){var r,n;let i,a,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let s=(r=e,n=t,i=r.length,(o=(a=cD(n))>=0?a:i+a)<0||o>=i?-1:o);return -1===s?void 0:e[s]}function cD(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],cM.set(this,!0)}set(e,t){return cM.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,i=this.has(t),a=this.#e.length,o=cD(e),s=o>=0?o:a+o,l=s<0||s>=a?-1:s;if(l===this.size||i&&l===this.size-1||-1===l)return this.set(t,r),this;let u=this.size+ +!i;o<0&&s++;let d=[...this.#e],c=!1;for(let e=s;e<u;e++)if(s===e){let a=d[e];d[e]===t&&(a=d[e+1]),i&&this.delete(t),n=this.get(a),this.set(t,r)}else{c||d[e-1]!==t||(c=!0);let r=d[c?e:e-1],i=n;n=this.get(r),this.delete(r),this.set(r,i)}return this}with(t,r,n){let i=new e(this);return i.insert(t,r,n),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=cz(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=cz(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return cz(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],i=0;for(let e of this)Reflect.apply(t,r,[e,i,this])&&n.push(e),i++;return new e(n)}map(t,r){let n=[],i=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,i,this])]),i++;return new e(n)}reduce(...e){let[t,r]=e,n=0,i=r??this.at(0);for(let r of this)i=0===n&&1===e.length?r:Reflect.apply(t,this,[i,r,n,this]),n++;return i}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let i=this.at(r);n=r===this.size-1&&1===e.length?i:Reflect.apply(t,this,[n,i,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,i=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(i=r-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});var cU=ek.createContext(void 0);function cL(e){let t=ek.useContext(cU);return e||t||"ltr"}var cZ=e.i(53660);function cF(e){var t;let r,n=(t=e,(r=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=ek.forwardRef((e,t)=>{let{children:r,...i}=e,a=ek.Children.toArray(r),o=a.find(cV);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(n,{...i,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var cB=Symbol("radix.slottable");function cV(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cB}var cq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=cF(`Primitive.${t}`),n=ek.forwardRef((e,n)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(i?r:t,{...a,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),cW=Symbol("radix.slottable");function cJ(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cW}var cH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(cJ);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),cK="rovingFocusGroup.onEntryFocus",cG={bubbles:!1,cancelable:!0},cY="RovingFocusGroup",[cX,cQ,c0]=cO(cY),[c1,c2]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(cY,[c0]),[c4,c6]=c1(cY),c5=ek.forwardRef((e,t)=>(0,e_.jsx)(cX.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,e_.jsx)(cX.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,e_.jsx)(c3,{...e,ref:t})})}));c5.displayName=cY;var c3=ek.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...c}=e,p=ek.useRef(null),m=(0,rh.useComposedRefs)(t,p),f=cL(a),[h,g]=(0,rZ.useControllableState)({prop:o,defaultProp:s??null,onChange:l,caller:cY}),[v,y]=ek.useState(!1),b=(0,rJ.useCallbackRef)(u),x=cQ(r),_=ek.useRef(!1),[w,k]=ek.useState(0);return ek.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(cK,b),()=>e.removeEventListener(cK,b)},[b]),(0,e_.jsx)(c4,{scope:r,orientation:n,dir:f,loop:i,currentTabStopId:h,onItemFocus:ek.useCallback(e=>g(e),[g]),onItemShiftTab:ek.useCallback(()=>y(!0),[]),onFocusableItemAdd:ek.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:ek.useCallback(()=>k(e=>e-1),[]),children:(0,e_.jsx)(cH.div,{tabIndex:v||0===w?-1:0,"data-orientation":n,...c,ref:m,style:{outline:"none",...e.style},onMouseDown:(0,rU.composeEventHandlers)(e.onMouseDown,()=>{_.current=!0}),onFocus:(0,rU.composeEventHandlers)(e.onFocus,e=>{let t=!_.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(cK,cG);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);pe([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),d)}}_.current=!1}),onBlur:(0,rU.composeEventHandlers)(e.onBlur,()=>y(!1))})})}),c9="RovingFocusGroupItem",c8=ek.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:a,children:o,...s}=e,l=(0,rL.useId)(),u=a||l,d=c6(c9,r),c=d.currentTabStopId===u,p=cQ(r),{onFocusableItemAdd:m,onFocusableItemRemove:f,currentTabStopId:h}=d;return ek.useEffect(()=>{if(n)return m(),()=>f()},[n,m,f]),(0,e_.jsx)(cX.ItemSlot,{scope:r,id:u,focusable:n,active:i,children:(0,e_.jsx)(cH.span,{tabIndex:c?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:(0,rU.composeEventHandlers)(e.onMouseDown,e=>{n?d.onItemFocus(u):e.preventDefault()}),onFocus:(0,rU.composeEventHandlers)(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:(0,rU.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let i=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return c7[i]}(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=p().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&i.reverse();let a=i.indexOf(e.currentTarget);i=d.loop?(r=i,n=a+1,r.map((e,t)=>r[(n+t)%r.length])):i.slice(a+1)}setTimeout(()=>pe(i))}}),children:"function"==typeof o?o({isCurrentTabStop:c,hasTabStop:null!=h}):o})})});c8.displayName=c9;var c7={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pe(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var pt=["Enter"," "],pr=["ArrowUp","PageDown","End"],pn=["ArrowDown","PageUp","Home",...pr],pi={ltr:[...pt,"ArrowRight"],rtl:[...pt,"ArrowLeft"]},pa={ltr:["ArrowLeft"],rtl:["ArrowRight"]},po="Menu",[ps,pl,pu]=cO(po),[pd,pc]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(po,[pu,cZ.createPopperScope,c2]),pp=(0,cZ.createPopperScope)(),pm=c2(),[pf,ph]=pd(po),[pg,pv]=pd(po),py=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:a,modal:o=!0}=e,s=pp(t),[l,u]=ek.useState(null),d=ek.useRef(!1),c=(0,rJ.useCallbackRef)(a),p=cL(i);return ek.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,e_.jsx)(cZ.Root,{...s,children:(0,e_.jsx)(pf,{scope:t,open:r,onOpenChange:c,content:l,onContentChange:u,children:(0,e_.jsx)(pg,{scope:t,onClose:ek.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:d,dir:p,modal:o,children:n})})})};py.displayName=po;var pb=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=pp(r);return(0,e_.jsx)(cZ.Anchor,{...i,...n,ref:t})});pb.displayName="MenuAnchor";var px="MenuPortal",[p_,pw]=pd(px,{forceMount:void 0}),pk=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:i}=e,a=ph(px,t);return(0,e_.jsx)(p_,{scope:t,forceMount:r,children:(0,e_.jsx)(r6.Presence,{present:r||a.open,children:(0,e_.jsx)(r4.Portal,{asChild:!0,container:i,children:n})})})};pk.displayName=px;var pI="MenuContent",[pS,p$]=pd(pI),pj=ek.forwardRef((e,t)=>{let r=pw(pI,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,a=ph(pI,e.__scopeMenu),o=pv(pI,e.__scopeMenu);return(0,e_.jsx)(ps.Provider,{scope:e.__scopeMenu,children:(0,e_.jsx)(r6.Presence,{present:n||a.open,children:(0,e_.jsx)(ps.Slot,{scope:e.__scopeMenu,children:o.modal?(0,e_.jsx)(pE,{...i,ref:t}):(0,e_.jsx)(pC,{...i,ref:t})})})})}),pE=ek.forwardRef((e,t)=>{let r=ph(pI,e.__scopeMenu),n=ek.useRef(null),i=(0,rh.useComposedRefs)(t,n);return ek.useEffect(()=>{let e=n.current;if(e)return nJ(e)},[]),(0,e_.jsx)(pN,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,rU.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),pC=ek.forwardRef((e,t)=>{let r=ph(pI,e.__scopeMenu);return(0,e_.jsx)(pN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),pT=cF("MenuContent.ScrollLock"),pN=ek.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:p,onDismiss:m,disableOutsideScroll:f,...h}=e,g=ph(pI,r),v=pv(pI,r),y=pp(r),b=pm(r),x=pl(r),[_,w]=ek.useState(null),k=ek.useRef(null),I=(0,rh.useComposedRefs)(t,k,g.onContentChange),S=ek.useRef(0),$=ek.useRef(""),j=ek.useRef(0),E=ek.useRef(null),C=ek.useRef("right"),T=ek.useRef(0),N=f?nL:ek.Fragment;ek.useEffect(()=>()=>window.clearTimeout(S.current),[]),ne();let A=ek.useCallback(e=>{var t,r;return C.current===E.current?.side&&(t=e,!!(r=E.current?.area)&&function(e,t){let{x:r,y:n}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],l=o.x,u=o.y,d=s.x,c=s.y;u>n!=c>n&&r<(d-l)*(n-u)/(c-u)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},r))},[]);return(0,e_.jsx)(pS,{scope:r,searchRef:$,onItemEnter:ek.useCallback(e=>{A(e)&&e.preventDefault()},[A]),onItemLeave:ek.useCallback(e=>{A(e)||(k.current?.focus(),w(null))},[A]),onTriggerLeave:ek.useCallback(e=>{A(e)&&e.preventDefault()},[A]),pointerGraceTimerRef:j,onPointerGraceIntentChange:ek.useCallback(e=>{E.current=e},[]),children:(0,e_.jsx)(N,{...f?{as:pT,allowPinchZoom:!0}:void 0,children:(0,e_.jsx)(rY,{asChild:!0,trapped:i,onMountAutoFocus:(0,rU.composeEventHandlers)(a,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,e_.jsx)(rF.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:p,onDismiss:m,children:(0,e_.jsx)(c5,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:n,currentTabStopId:_,onCurrentTabStopIdChange:w,onEntryFocus:(0,rU.composeEventHandlers)(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,e_.jsx)(cZ.Content,{role:"menu","aria-orientation":"vertical","data-state":p5(g.open),"data-radix-menu-content":"",dir:v.dir,...y,...h,ref:I,style:{outline:"none",...h.style},onKeyDown:(0,rU.composeEventHandlers)(h.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;if(t){var i;let t,a,o,s,l,u;"Tab"===e.key&&e.preventDefault(),!r&&n&&(i=e.key,t=$.current+i,a=x().filter(e=>!e.disabled),o=document.activeElement,s=a.find(e=>e.ref.current===o)?.textValue,l=function(e,t,r){var n;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1,o=(n=Math.max(a,0),e.map((t,r)=>e[(n+r)%e.length]));1===i.length&&(o=o.filter(e=>e!==r));let s=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==r?s:void 0}(a.map(e=>e.textValue),t,s),u=a.find(e=>e.textValue===l)?.ref.current,function e(t){$.current=t,window.clearTimeout(S.current),""!==t&&(S.current=window.setTimeout(()=>e(""),1e3))}(t),u&&setTimeout(()=>u.focus()))}let a=k.current;if(e.target!==a||!pn.includes(e.key))return;e.preventDefault();let o=x().filter(e=>!e.disabled).map(e=>e.ref.current);pr.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,rU.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(S.current),$.current="")}),onPointerMove:(0,rU.composeEventHandlers)(e.onPointerMove,p8(e=>{let t=e.target,r=T.current!==e.clientX;e.currentTarget.contains(t)&&r&&(C.current=e.clientX>T.current?"right":"left",T.current=e.clientX)}))})})})})})})});pj.displayName=pI;var pA=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,e_.jsx)(cq.div,{role:"group",...n,ref:t})});pA.displayName="MenuGroup";var pR=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,e_.jsx)(cq.div,{...n,ref:t})});pR.displayName="MenuLabel";var pP="MenuItem",pO="menu.itemSelect",pM=ek.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...i}=e,a=ek.useRef(null),o=pv(pP,e.__scopeMenu),s=p$(pP,e.__scopeMenu),l=(0,rh.useComposedRefs)(t,a),u=ek.useRef(!1);return(0,e_.jsx)(pz,{...i,ref:l,disabled:r,onClick:(0,rU.composeEventHandlers)(e.onClick,()=>{let e=a.current;if(!r&&e){let t=new CustomEvent(pO,{bubbles:!0,cancelable:!0});e.addEventListener(pO,e=>n?.(e),{once:!0}),e&&rB.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?u.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:(0,rU.composeEventHandlers)(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:(0,rU.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==s.searchRef.current;r||t&&" "===e.key||pt.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});pM.displayName=pP;var pz=ek.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:i,...a}=e,o=p$(pP,r),s=pm(r),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l),[d,c]=ek.useState(!1),[p,m]=ek.useState("");return ek.useEffect(()=>{let e=l.current;e&&m((e.textContent??"").trim())},[a.children]),(0,e_.jsx)(ps.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:(0,e_.jsx)(c8,{asChild:!0,...s,focusable:!n,children:(0,e_.jsx)(cq.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...a,ref:u,onPointerMove:(0,rU.composeEventHandlers)(e.onPointerMove,p8(e=>{n?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,rU.composeEventHandlers)(e.onPointerLeave,p8(e=>o.onItemLeave(e))),onFocus:(0,rU.composeEventHandlers)(e.onFocus,()=>c(!0)),onBlur:(0,rU.composeEventHandlers)(e.onBlur,()=>c(!1))})})})}),pD=ek.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...i}=e;return(0,e_.jsx)(pW,{scope:e.__scopeMenu,checked:r,children:(0,e_.jsx)(pM,{role:"menuitemcheckbox","aria-checked":p3(r)?"mixed":r,...i,ref:t,"data-state":p9(r),onSelect:(0,rU.composeEventHandlers)(i.onSelect,()=>n?.(!!p3(r)||!r),{checkForDefaultPrevented:!1})})})});pD.displayName="MenuCheckboxItem";var pU="MenuRadioGroup",[pL,pZ]=pd(pU,{value:void 0,onValueChange:()=>{}}),pF=ek.forwardRef((e,t)=>{let{value:r,onValueChange:n,...i}=e,a=(0,rJ.useCallbackRef)(n);return(0,e_.jsx)(pL,{scope:e.__scopeMenu,value:r,onValueChange:a,children:(0,e_.jsx)(pA,{...i,ref:t})})});pF.displayName=pU;var pB="MenuRadioItem",pV=ek.forwardRef((e,t)=>{let{value:r,...n}=e,i=pZ(pB,e.__scopeMenu),a=r===i.value;return(0,e_.jsx)(pW,{scope:e.__scopeMenu,checked:a,children:(0,e_.jsx)(pM,{role:"menuitemradio","aria-checked":a,...n,ref:t,"data-state":p9(a),onSelect:(0,rU.composeEventHandlers)(n.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});pV.displayName=pB;var pq="MenuItemIndicator",[pW,pJ]=pd(pq,{checked:!1}),pH=ek.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...i}=e,a=pJ(pq,r);return(0,e_.jsx)(r6.Presence,{present:n||p3(a.checked)||!0===a.checked,children:(0,e_.jsx)(cq.span,{...i,ref:t,"data-state":p9(a.checked)})})});pH.displayName=pq;var pK=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,e_.jsx)(cq.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});pK.displayName="MenuSeparator";var pG=ek.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=pp(r);return(0,e_.jsx)(cZ.Arrow,{...i,...n,ref:t})});pG.displayName="MenuArrow";var pY="MenuSub",[pX,pQ]=pd(pY),p0=e=>{let{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,a=ph(pY,t),o=pp(t),[s,l]=ek.useState(null),[u,d]=ek.useState(null),c=(0,rJ.useCallbackRef)(i);return ek.useEffect(()=>(!1===a.open&&c(!1),()=>c(!1)),[a.open,c]),(0,e_.jsx)(cZ.Root,{...o,children:(0,e_.jsx)(pf,{scope:t,open:n,onOpenChange:c,content:u,onContentChange:d,children:(0,e_.jsx)(pX,{scope:t,contentId:(0,rL.useId)(),triggerId:(0,rL.useId)(),trigger:s,onTriggerChange:l,children:r})})})};p0.displayName=pY;var p1="MenuSubTrigger",p2=ek.forwardRef((e,t)=>{let r=ph(p1,e.__scopeMenu),n=pv(p1,e.__scopeMenu),i=pQ(p1,e.__scopeMenu),a=p$(p1,e.__scopeMenu),o=ek.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=a,u={__scopeMenu:e.__scopeMenu},d=ek.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return ek.useEffect(()=>d,[d]),ek.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]),(0,e_.jsx)(pb,{asChild:!0,...u,children:(0,e_.jsx)(pz,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":p5(r.open),...e,ref:(0,rh.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,rU.composeEventHandlers)(e.onPointerMove,p8(t=>{a.onItemEnter(t),!t.defaultPrevented&&(e.disabled||r.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100)))})),onPointerLeave:(0,rU.composeEventHandlers)(e.onPointerLeave,p8(e=>{d();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,i="right"===n,o=t[i?"left":"right"],l=t[i?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:n}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:(0,rU.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==a.searchRef.current;e.disabled||i&&" "===t.key||pi[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});p2.displayName=p1;var p4="MenuSubContent",p6=ek.forwardRef((e,t)=>{let r=pw(pI,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,a=ph(pI,e.__scopeMenu),o=pv(pI,e.__scopeMenu),s=pQ(p4,e.__scopeMenu),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l);return(0,e_.jsx)(ps.Provider,{scope:e.__scopeMenu,children:(0,e_.jsx)(r6.Presence,{present:n||a.open,children:(0,e_.jsx)(ps.Slot,{scope:e.__scopeMenu,children:(0,e_.jsx)(pN,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:u,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,rU.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:(0,rU.composeEventHandlers)(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:(0,rU.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=pa[o.dir].includes(e.key);t&&r&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});function p5(e){return e?"open":"closed"}function p3(e){return"indeterminate"===e}function p9(e){return p3(e)?"indeterminate":e?"checked":"unchecked"}function p8(e){return t=>"mouse"===t.pointerType?e(t):void 0}p6.displayName=p4;var p7="DropdownMenu",[me,mt]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(p7,[pc]),mr=pc(),[mn,mi]=me(p7),ma=e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=mr(t),u=ek.useRef(null),[d,c]=(0,rZ.useControllableState)({prop:i,defaultProp:a??!1,onChange:o,caller:p7});return(0,e_.jsx)(mn,{scope:t,triggerId:(0,rL.useId)(),triggerRef:u,contentId:(0,rL.useId)(),open:d,onOpenChange:c,onOpenToggle:ek.useCallback(()=>c(e=>!e),[c]),modal:s,children:(0,e_.jsx)(py,{...l,open:d,onOpenChange:c,dir:n,modal:s,children:r})})};ma.displayName=p7;var mo="DropdownMenuTrigger",ms=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,a=mi(mo,r),o=mr(r);return(0,e_.jsx)(pb,{asChild:!0,...o,children:(0,e_.jsx)(cN.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:(0,rh.composeRefs)(t,a.triggerRef),onPointerDown:(0,rU.composeEventHandlers)(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:(0,rU.composeEventHandlers)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});ms.displayName=mo;var ml=e=>{let{__scopeDropdownMenu:t,...r}=e,n=mr(t);return(0,e_.jsx)(pk,{...n,...r})};ml.displayName="DropdownMenuPortal";var mu="DropdownMenuContent",md=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mi(mu,r),a=mr(r),o=ek.useRef(!1);return(0,e_.jsx)(pj,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...n,ref:t,onCloseAutoFocus:(0,rU.composeEventHandlers)(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:(0,rU.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!i.modal||n)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});md.displayName=mu;var mc=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pA,{...i,...n,ref:t})});mc.displayName="DropdownMenuGroup";var mp=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pR,{...i,...n,ref:t})});mp.displayName="DropdownMenuLabel";var mm=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pM,{...i,...n,ref:t})});mm.displayName="DropdownMenuItem";var mf=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pD,{...i,...n,ref:t})});mf.displayName="DropdownMenuCheckboxItem";var mh=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pF,{...i,...n,ref:t})});mh.displayName="DropdownMenuRadioGroup";var mg=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pV,{...i,...n,ref:t})});mg.displayName="DropdownMenuRadioItem";var mv=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pH,{...i,...n,ref:t})});mv.displayName="DropdownMenuItemIndicator";var my=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pK,{...i,...n,ref:t})});my.displayName="DropdownMenuSeparator";var mb=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(pG,{...i,...n,ref:t})});mb.displayName="DropdownMenuArrow";var mx=e=>{let{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:a}=e,o=mr(t),[s,l]=(0,rZ.useControllableState)({prop:n,defaultProp:a??!1,onChange:i,caller:"DropdownMenuSub"});return(0,e_.jsx)(p0,{...o,open:s,onOpenChange:l,children:r})},m_=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(p2,{...i,...n,ref:t})});m_.displayName="DropdownMenuSubTrigger";var mw=ek.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=mr(r);return(0,e_.jsx)(p6,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mw.displayName="DropdownMenuSubContent",e.s(["Arrow",0,mb,"CheckboxItem",0,mf,"Content",0,md,"DropdownMenu",0,ma,"DropdownMenuArrow",0,mb,"DropdownMenuCheckboxItem",0,mf,"DropdownMenuContent",0,md,"DropdownMenuGroup",0,mc,"DropdownMenuItem",0,mm,"DropdownMenuItemIndicator",0,mv,"DropdownMenuLabel",0,mp,"DropdownMenuPortal",0,ml,"DropdownMenuRadioGroup",0,mh,"DropdownMenuRadioItem",0,mg,"DropdownMenuSeparator",0,my,"DropdownMenuSub",0,mx,"DropdownMenuSubContent",0,mw,"DropdownMenuSubTrigger",0,m_,"DropdownMenuTrigger",0,ms,"Group",0,mc,"Item",0,mm,"ItemIndicator",0,mv,"Label",0,mp,"Portal",0,ml,"RadioGroup",0,mh,"RadioItem",0,mg,"Root",0,ma,"Separator",0,my,"Sub",0,mx,"SubContent",0,mw,"SubTrigger",0,m_,"Trigger",0,ms,"createDropdownMenuScope",0,mt],40666);var mk=e.i(40666),mk=mk,mk=mk;let mI=mk.createDropdownMenuScope(),mS=(0,ek.createContext)(null),m$=({__scopeActionBarMore:e,open:t,onOpenChange:r,...n})=>{let i=mI(e),a=(0,ek.useContext)(mS),o=(0,ek.useRef)(null),s=void 0!==t,l=(0,ek.useCallback)(e=>{if(e){if(o.current)return;o.current=a?.acquireInteractionLock()??null;return}o.current?.(),o.current=null},[a]),u=(0,ek.useCallback)(e=>{s||l(e),r?.(e)},[s,l,r]);return(0,ek.useEffect)(()=>{s&&l(!!t)},[s,t,l]),(0,ek.useEffect)(()=>()=>{o.current?.(),o.current=null},[]),(0,e_.jsx)(mk.Root,{...i,...n,...void 0!==t?{open:t}:null,onOpenChange:u})};m$.displayName="ActionBarMorePrimitive.Root";var mk=mk;let mj=oJ(mk.Trigger),mE=oJ(mk.Content),mC=oJ(mk.Item),mT=oJ(mk.Separator),mN=(0,ek.forwardRef)(({__scopeActionBarMore:e,...t},r)=>{let n=mI(e);return(0,e_.jsx)(mj,{...n,...t,ref:r})});mN.displayName="ActionBarMorePrimitive.Trigger";var mk=mk;let mA=(0,ek.forwardRef)(({__scopeActionBarMore:e,portalProps:t,sideOffset:r=4,...n},i)=>{let a=mI(e);return(0,e_.jsx)(mk.Portal,{...a,...t,children:(0,e_.jsx)(mE,{...a,...n,ref:i,sideOffset:r})})});mA.displayName="ActionBarMorePrimitive.Content";let mR=(0,ek.forwardRef)(({__scopeActionBarMore:e,...t},r)=>{let n=mI(e);return(0,e_.jsx)(mC,{...n,...t,ref:r})});mR.displayName="ActionBarMorePrimitive.Item";let mP=(0,ek.forwardRef)(({__scopeActionBarMore:e,...t},r)=>{let n=mI(e);return(0,e_.jsx)(mT,{...n,...t,ref:r})});mP.displayName="ActionBarMorePrimitive.Separator",e.s(["Content",0,mA,"Item",0,mR,"Root",0,m$,"Separator",0,mP,"Trigger",0,mN],42941);var mO=e.i(42941),mO=mO;e.s([],14331),e.i(14331),(m=w||(w={})).Hidden="hidden",m.Floating="floating",m.Normal="normal";let mM=(0,ek.forwardRef)(({hideWhenRunning:e,autohide:t,autohideFloat:r,...n},i)=>{let[a,o]=(0,ek.useState)(0),s=(0,ek.useCallback)(()=>{let e=!1;return o(e=>e+1),()=>{e||(e=!0,o(e=>Math.max(0,e-1)))}},[]),l=(0,ek.useMemo)(()=>({acquireInteractionLock:s}),[s]),u=(({hideWhenRunning:e,autohide:t,autohideFloat:r,forceVisible:n})=>ij(i=>{if(e&&i.thread.isRunning)return w.Hidden;let a="always"===t||"not-last"===t&&!i.message.isLast,o=n||i.message.isHovering;return a?o?"always"===r||"single-branch"===r&&i.message.branchCount<=1?w.Floating:w.Normal:w.Hidden:w.Normal}))({hideWhenRunning:e,autohide:t,autohideFloat:r,forceVisible:a>0});return u===w.Hidden?null:(0,e_.jsx)(mS.Provider,{value:l,children:(0,e_.jsx)(oH.div,{...u===w.Floating?{"data-floating":"true"}:null,...n,ref:i})})});mM.displayName="ActionBarPrimitive.Root";let mz=(0,ek.forwardRef)(({copiedDuration:e,onClick:t,disabled:r,...n},i)=>{let a=ij(e=>e.message.isCopied),o=(({copiedDuration:e=3e3}={})=>{let{copy:t,disabled:r}=(({copiedDuration:e=3e3,copyToClipboard:t}={})=>{let r=tU(),n=ij(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),i=ij(e=>e.message.isCopied),a=ij(e=>e.composer.isEditing),o=ij(e=>e.composer.text);return{copy:(0,ek.useCallback)(()=>{let n=a?o:r.message().getCopyText();n&&Promise.resolve((t??(()=>{}))(n)).then(()=>{r.message().setIsCopied(!0),setTimeout(()=>r.message().setIsCopied(!1),e)},()=>{})},[r,a,o,e,t]),disabled:n,isCopied:i}})({copiedDuration:e,copyToClipboard:e=>"u"<typeof navigator||!navigator.clipboard?Promise.reject(Error("Clipboard API is unavailable")):navigator.clipboard.writeText(e)});return r?null:t})({copiedDuration:e});return(0,e_.jsx)(oH.button,{type:"button",...a?{"data-copied":"true"}:{},...n,ref:i,disabled:r||!o,onClick:(0,rU.composeEventHandlers)(t,()=>{o?.()})})});mz.displayName="ActionBarPrimitive.Copy";let mD=sf("ActionBarPrimitive.Reload",()=>{let e,t,{disabled:r,reload:n}=(e=tU(),t=ij(e=>e.thread.isRunning||e.thread.isDisabled||"assistant"!==e.message.role),{reload:(0,ek.useCallback)(()=>{e.message().reload()},[e]),disabled:t});return r?null:n}),mU=sf("ActionBarPrimitive.Edit",()=>{let e,t,{disabled:r,edit:n}=(e=tU(),t=ij(e=>e.composer.isEditing),{edit:(0,ek.useCallback)(()=>{e.composer().beginEdit()},[e]),disabled:t});return r?null:n}),mL=sf("ActionBarPrimitive.Speak",()=>{let e,t,{disabled:r,speak:n}=(e=tU(),t=ij(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),{speak:(0,ek.useCallback)(async()=>{e.message().speak()},[e]),disabled:t});return r?null:n}),mZ=(0,ek.forwardRef)((e,t)=>{let r=(()=>{let e,t,{disabled:r,stopSpeaking:n}=(e=tU(),t=ij(e=>null==e.message.speech),{stopSpeaking:(0,ek.useCallback)(()=>{e.message().stopSpeaking()},[e]),disabled:t});return r?null:n})();return(0,sW.useEscapeKeydown)(e=>{r&&(e.preventDefault(),r())}),(0,e_.jsx)(oH.button,{type:"button",disabled:!r,...e,ref:t,onClick:(0,rU.composeEventHandlers)(e.onClick,()=>{r?.()})})});mZ.displayName="ActionBarPrimitive.StopSpeaking";let mF=(0,ek.forwardRef)(({onClick:e,disabled:t,...r},n)=>{let i=ij(e=>e.message.metadata.submittedFeedback?.type==="positive"),a=(()=>{let e,t,{submit:r}=(e=tU(),t=ij(e=>e.message.metadata.submittedFeedback?.type==="positive"),{submit:(0,ek.useCallback)(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t});return r})();return(0,e_.jsx)(oH.button,{type:"button",...i?{"data-submitted":"true"}:{},...r,ref:n,disabled:t||!a,onClick:(0,rU.composeEventHandlers)(e,()=>{a?.()})})});mF.displayName="ActionBarPrimitive.FeedbackPositive";let mB=(0,ek.forwardRef)(({onClick:e,disabled:t,...r},n)=>{let i=ij(e=>e.message.metadata.submittedFeedback?.type==="negative"),a=(()=>{let e,t,{submit:r}=(e=tU(),t=ij(e=>e.message.metadata.submittedFeedback?.type==="negative"),{submit:(0,ek.useCallback)(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t});return r})();return(0,e_.jsx)(oH.button,{type:"button",...i?{"data-submitted":"true"}:{},...r,ref:n,disabled:t||!a,onClick:(0,rU.composeEventHandlers)(e,()=>{a?.()})})});mB.displayName="ActionBarPrimitive.FeedbackNegative";let mV=(0,ek.forwardRef)(({filename:e,onExport:t,onClick:r,disabled:n,...i},a)=>{let o=(({filename:e,onExport:t}={})=>{let r=tU(),n=ij(e=>("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0)),i=(0,ek.useCallback)(async()=>{let n=r.message().getCopyText();if(!n)return;if(t)return void await t(n);let i=new Blob([n],{type:"text/markdown"}),a=URL.createObjectURL(i),o=document.createElement("a");o.href=a,o.download=e??`message-${Date.now()}.md`,o.click(),URL.revokeObjectURL(a)},[r,e,t]);return n?i:null})({filename:e,onExport:t});return(0,e_.jsx)(oH.button,{type:"button",...i,ref:a,disabled:n||!o,onClick:(0,rU.composeEventHandlers)(r,()=>{o?.()})})});mV.displayName="ActionBarPrimitive.ExportMarkdown",e.s(["Copy",0,mz,"Edit",0,mU,"ExportMarkdown",0,mV,"FeedbackNegative",0,mB,"FeedbackPositive",0,mF,"Reload",0,mD,"Root",0,mM,"Speak",0,mL,"StopSpeaking",0,mZ],24895);var mq=e.i(24895),mq=mq;e.s([],29764),e.i(29764);let mW=sf("BranchPickerPrimitive.Next",()=>{let e,t,{disabled:r,next:n}=(e=tU(),t=ij(e=>!!(e.message.branchNumber>=e.message.branchCount)||!!e.thread.isRunning&&!e.thread.capabilities.switchBranchDuringRun),{next:(0,ek.useCallback)(()=>{e.message().switchToBranch({position:"next"})},[e]),disabled:t});return r?null:n}),mJ=sf("BranchPickerPrimitive.Previous",()=>{let e,t,{disabled:r,previous:n}=(e=tU(),t=ij(e=>!!(e.message.branchNumber<=1)||!!e.thread.isRunning&&!e.thread.capabilities.switchBranchDuringRun),{previous:(0,ek.useCallback)(()=>{e.message().switchToBranch({position:"previous"})},[e]),disabled:t});return r?null:n}),mH=()=>{let e=ij(e=>e.message.branchCount);return(0,e_.jsx)(e_.Fragment,{children:e})};mH.displayName="BranchPickerPrimitive.Count";let mK=()=>{let e=ij(e=>e.message.branchNumber);return(0,e_.jsx)(e_.Fragment,{children:e})};mK.displayName="BranchPickerPrimitive.Number";let mG=(0,ek.forwardRef)(({hideWhenSingleBranch:e,...t},r)=>(0,e_.jsx)(dg,{hasBranches:!!e||void 0,children:(0,e_.jsx)(oH.div,{...t,ref:r})}));mG.displayName="BranchPickerPrimitive.Root",e.s(["Count",0,mH,"Next",0,mW,"Number",0,mK,"Previous",0,mJ,"Root",0,mG],18443);var mY=e.i(18443),mY=mY,lU=lU;e.s([],87572),e.i(87572);let mX=(0,ek.forwardRef)((e,t)=>(0,e_.jsx)(oH.div,{role:"alert",...e,ref:t}));mX.displayName="ErrorPrimitive.Root";let mQ=(0,ek.forwardRef)(({children:e,...t},r)=>{let n=dk();return void 0===n?null:(0,e_.jsx)(oH.span,{...t,ref:r,children:e??String(n)})});mQ.displayName="ErrorPrimitive.Message",e.s(["Message",0,mQ,"Root",0,mX],73703);var m0=e.i(73703),m0=m0,dH=dH;let m1=rz("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),m2=rz("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),m4=rz("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),m6=rz("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),m5=rz("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),m3=rz("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function m9({className:e,type:t,...r}){return(0,e_.jsx)("input",{type:t,"data-slot":"input",className:(0,rj.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",e),...r})}let m8="__acp_ui_custom_input__";function m7(e){return Array.isArray(e)?e:e?[e]:[]}function fe(e,t){return"multi"===t?e:e[0]??null}function ft({id:e,options:t,selectionMode:r="multi",value:n,defaultValue:i,choice:a,minSelections:o=1,maxSelections:s,actions:l=[{id:"confirm",label:"确认"},{id:"cancel",label:"取消",variant:"outline"}],onChange:u,onAction:d,onBeforeAction:c,isActionDisabled:p,allowCustomInput:m=!1,customInputLabel:f="自定义",className:h}){let g=void 0!==n,v=void 0!==a,[y,b]=(0,ek.useState)(m7(i)),[x,_]=(0,ek.useState)(""),w=(0,ek.useRef)([]),k=(0,ek.useMemo)(()=>!m||v?t:[...t,{id:m8,label:f}],[m,f,v,t]),I=(0,ek.useMemo)(()=>v?m7(a):g?m7(n):y,[a,y,g,v,n]),S=(0,ek.useMemo)(()=>new Set(I),[I]),$=v?k.filter(e=>S.has(e.id)):k,j=(0,ek.useMemo)(()=>{let e=x.trim(),t=I.filter(e=>e!==m8);return S.has(m8)&&e?"single"===r?e:[...t,e]:fe(t,r)},[x,I,S,r]),E=null===j?0:Array.isArray(j)?j.length:1,C=E>=o&&(void 0===s||E<=s),T=(0,ek.useCallback)(e=>{let t=fe(e,r);g||b(e),u?.(t)},[g,u,r]),N=(0,ek.useCallback)(e=>{if(v||e.disabled)return;if("single"===r)return void T(S.has(e.id)?[]:[e.id]);let t=S.has(e.id)?I.filter(t=>t!==e.id):[...I,e.id];void 0!==s&&t.length>s||T(t)},[T,v,s,I,S,r]),A=(0,ek.useCallback)((e,t)=>{if(0===w.current.length)return;let r=e;for(let e=0;e<w.current.length;e++){r=(r+t+w.current.length)%w.current.length;let e=w.current[r];if(e&&!e.disabled)return void e.focus()}},[]),R=(0,ek.useCallback)((e,t)=>{let r=Number(e.currentTarget.dataset.index??0);"ArrowDown"===e.key||"ArrowRight"===e.key?(e.preventDefault(),A(r,1)):"ArrowUp"===e.key||"ArrowLeft"===e.key?(e.preventDefault(),A(r,-1)):"Home"===e.key?(e.preventDefault(),w.current.find(e=>!e?.disabled)?.focus()):"End"===e.key?(e.preventDefault(),w.current.findLast(e=>!e?.disabled)?.focus()):"Enter"===e.key||" "===e.key?(e.preventDefault(),N(t)):"Escape"===e.key&&e.currentTarget.blur()},[A,N]),P=(0,ek.useCallback)(async e=>{!1!==await c?.(e.id,j)&&await d?.(e.id,j)},[j,d,c]),O=(0,ek.useCallback)(e=>{_(e.currentTarget.value)},[]);return(0,e_.jsxs)("div",{"data-slot":"tool-ui-option-list",className:(0,rj.cn)("my-2.5 w-full rounded-lg border bg-background p-3 shadow-xs",h),children:[(0,e_.jsx)("div",{id:e,role:"listbox","aria-multiselectable":"multi"===r||void 0,className:"flex flex-col gap-1.5",children:$.map((e,t)=>{let r=S.has(e.id),n=!!e.description;return(0,e_.jsxs)("button",{ref:e=>{w.current[t]=e},type:"button",role:"option","aria-selected":r,"data-index":t,disabled:e.disabled||v,onClick:()=>N(e),onKeyDown:t=>R(t,e),className:(0,rj.cn)("flex min-h-11 w-full gap-2.5 rounded-md border px-3 py-2 text-left text-sm transition-colors","focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none",r?"border-primary/40 bg-primary/8":"border-border bg-card hover:bg-muted/60",(e.disabled||v)&&"cursor-default opacity-80 hover:bg-card",n?"items-start":"items-center"),children:[(0,e_.jsx)("span",{className:(0,rj.cn)("flex size-4 shrink-0 items-center justify-center rounded-full border",r?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/30 text-transparent",n&&"mt-0.5"),children:(0,e_.jsx)(aA,{className:"size-3"})}),e.icon&&(0,e_.jsx)("span",{className:(0,rj.cn)("shrink-0 text-muted-foreground",n&&"mt-0.5"),children:e.icon}),(0,e_.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e_.jsx)("span",{className:"block break-words font-medium leading-5",children:e.label}),e.description&&(0,e_.jsx)("span",{className:"mt-0.5 block break-words text-muted-foreground text-xs leading-5",children:e.description}),e.recommended&&(0,e_.jsx)("span",{className:"mt-1 inline-flex rounded-sm bg-primary/10 px-1.5 py-0.5 font-medium text-primary text-xs",children:"推荐"})]})]},e.id)})}),m&&S.has(m8)&&!v&&(0,e_.jsx)(m9,{className:"mt-2",placeholder:f,value:x,onChange:O}),!v&&l.length>0&&(0,e_.jsx)("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:l.map(e=>{let t=fe(I,r);return(0,e_.jsx)(rC,{type:"button",size:"sm",variant:e.variant??"default",disabled:e.disabled||"confirm"===e.id&&!C||p?.(e.id,t),onClick:()=>void P(e),children:e.label},e.id)})})]})}function fr(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function fn(e){return"string"==typeof e?e.trim():""}function fi(e){return Array.isArray(e)?e.map(fn).filter(Boolean):[]}function fa(e){let t=(0,ek.useMemo)(()=>(function(e){if(!fr(e)||"single"!==e.selectionMode&&"multi"!==e.selectionMode)return null;let t=Array.isArray(e.options)?e.options.flatMap(e=>{if(!fr(e))return[];let t=fn(e.id),r=fn(e.label);return t&&r?[{id:t,label:r,...fn(e.description)?{description:fn(e.description)}:{},..."boolean"==typeof e.disabled?{disabled:e.disabled}:{}}]:[]}):[],r=fn(e.fieldName);return r&&0!==t.length?{toolCallId:fn(e.toolCallId),message:fn(e.message)||"Choose an option",fieldName:r,fieldTitle:fn(e.fieldTitle)||r,...fn(e.fieldDescription)?{fieldDescription:fn(e.fieldDescription)}:{},selectionMode:e.selectionMode,options:t,defaultValue:"multi"===e.selectionMode?fi(e.defaultValue):fn(e.defaultValue)||null,minSelections:"number"==typeof e.minSelections?e.minSelections:1,..."number"==typeof e.maxSelections?{maxSelections:e.maxSelections}:{},required:!0===e.required}:null})(e.args),[e.args]),r=(0,ek.useMemo)(()=>{var t;return fr(t=e.result)?"decline"===t.action||"cancel"===t.action?{action:t.action}:"accept"===t.action&&fr(t.content)?{action:"accept",content:t.content}:null:null},[e.result]),[n,i]=(0,ek.useState)(!1),[a,o]=(0,ek.useState)(null),[s,l]=(0,ek.useState)();if(!t)return null;let u=n||!!r||e.status?.type==="complete"||e.status?.type==="incomplete",d=function(e,t){if(!t)return;if("accept"!==t.action)return null;let r=t.content[e.fieldName];return"multi"===e.selectionMode?fi(r):fn(r)||null}(t,r),c=n?s??null:d,p=r?.action??a,m=void 0!==c,f=r?.action==="accept"?"已选择":r?.action==="decline"?"已拒绝":r?.action==="cancel"?"已取消":"等待选择",h=r?.action==="accept"?m6:r?m3:m5,g="accept"===p;return(0,e_.jsxs)("div",{className:"my-2.5 w-full rounded-lg border bg-card p-4 shadow-xs",children:[(0,e_.jsxs)("div",{className:"mb-3 flex items-start gap-3",children:[(0,e_.jsx)(h,{className:(0,rj.cn)("mt-0.5 size-4 shrink-0",r?.action==="accept"?"text-emerald-600 dark:text-emerald-400":r?"text-muted-foreground":"text-primary")}),(0,e_.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e_.jsx)("div",{className:"break-words font-medium text-base leading-snug",children:t.message}),(0,e_.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-muted-foreground text-xs",children:[(0,e_.jsx)("span",{children:t.fieldTitle}),(0,e_.jsx)("span",{"aria-hidden":!0,children:"·"}),(0,e_.jsx)("span",{children:f})]}),t.fieldDescription&&(0,e_.jsx)("div",{className:"mt-2 break-words text-muted-foreground text-sm leading-snug",children:t.fieldDescription})]})]}),m?(0,e_.jsxs)("div",{className:(0,rj.cn)("flex items-center gap-2 rounded-md border px-3 py-2 text-sm",g?"border-emerald-200 bg-emerald-50 text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-200":"border-muted-foreground/20 bg-muted/40 text-muted-foreground"),children:[g?(0,e_.jsx)(aA,{className:"size-4 shrink-0"}):(0,e_.jsx)(m3,{className:"size-4 shrink-0"}),(0,e_.jsx)("span",{className:"min-w-0 break-words",children:function(e,t,r){let n,i;return"decline"===t?"已拒绝":"cancel"===t?"已取消":`已选择 ${n=new Set(Array.isArray(r)?r:r?[r]:[]),(i=e.options.filter(e=>n.has(e.id)).map(e=>e.label)).length>0?i.join("、"):"未选择"}`}(t,p,c)})]}):(0,e_.jsx)(ft,{id:t.toolCallId||e.toolCallId,options:t.options,selectionMode:t.selectionMode,defaultValue:t.defaultValue,minSelections:t.minSelections,maxSelections:t.maxSelections,className:"my-0 border-0 bg-transparent p-0 shadow-none",actions:[{id:"confirm",label:"确认"},{id:"cancel",label:"取消",variant:"outline"}],onAction:(r,n)=>{if(!u){if(i(!0),"cancel"===r){o("cancel"),l(null),e.addResult({action:"cancel"});return}o("accept"),l(n),e.addResult({action:"accept",content:{[t.fieldName]:"multi"===t.selectionMode?fi(n):fn(n)}})}}})]})}let fo=rz("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]),fs=rz("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),fl=rz("music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]),fu=rz("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),fd=r$("aui-file-root inline-flex items-center gap-3 rounded-lg transition-colors",{variants:{variant:{outline:"border-border border hover:bg-muted/50",ghost:"hover:bg-muted/50",muted:"bg-muted/50 hover:bg-muted/70"},size:{sm:"px-2.5 py-1.5 text-xs",default:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"}},defaultVariants:{variant:"outline",size:"default"}});function fc({className:e,variant:t,size:r,children:n,...i}){return(0,e_.jsx)("div",{"data-slot":"file-root","data-variant":t,"data-size":r,className:(0,rj.cn)(fd({variant:t,size:r,className:e})),...i,children:n})}function fp({mimeType:e,className:t,children:r,...n}){let i=e?e.startsWith("image/")?iD:"application/pdf"===e?dK:"application/json"===e?fo:e.startsWith("text/")?dK:e.startsWith("audio/")?fl:e.startsWith("video/")?fu:fs:fs;return(0,e_.jsx)("span",{"data-slot":"file-icon",className:(0,rj.cn)("shrink-0 text-muted-foreground",t),...n,children:r??(0,e_.jsx)(i,{className:"size-5"})})}function fm({className:e,children:t,...r}){return(0,e_.jsx)("span",{"data-slot":"file-name",className:(0,rj.cn)("min-w-0 flex-1 truncate font-medium",e),...r,children:t||"Unnamed file"})}function ff({bytes:e,className:t,...r}){return(0,e_.jsx)("span",{"data-slot":"file-size",className:(0,rj.cn)("shrink-0 text-muted-foreground",t),...r,children:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`})}function fh({data:e,mimeType:t,filename:r,className:n,children:i,...a}){let o=e.startsWith("data:")?e:`data:${t};base64,${e}`;return(0,e_.jsx)("a",{"data-slot":"file-download",href:o,download:r||"download",className:(0,rj.cn)("shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",n),...a,children:i||(0,e_.jsx)(aW,{className:"size-4"})})}let fg=(0,ek.memo)(({filename:e,data:t,mimeType:r})=>{let n,i,a,o=(a=((i=(n=t.indexOf(","))>=0?t.slice(n+1):t).match(/=/g)||[]).length,Math.floor(3*i.length/4)-a);return(0,e_.jsxs)(fc,{children:[(0,e_.jsx)(fp,{mimeType:r}),(0,e_.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,e_.jsx)(fm,{children:e}),(0,e_.jsx)(ff,{bytes:o,className:"text-xs"})]}),(0,e_.jsx)(fh,{data:t,mimeType:r,...void 0!==e&&{filename:e}})]})});fg.displayName="File",fg.Root=fc,fg.Icon=fp,fg.Name=fm,fg.Size=ff,fg.Download=fh;let fv=rz("image-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]),fy=rz("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),fb=e=>{let[t,r]=e.split(","),n=t?.match(/data:([^;]+)/)?.[1]??"application/octet-stream";if(!/;base64/i.test(t??""))return new Blob([decodeURIComponent(r??"")],{type:n});let i=atob(r??""),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:n})},fx=e=>e.match(/^data:([^;,]+)/)?.[1],f_=async e=>{if("u"<typeof navigator||!navigator.clipboard||"u"<typeof ClipboardItem)throw Error("Clipboard API is not available in this environment.");let t=e.image.startsWith("data:")?fb(e.image):await fetch(e.image).then(e=>e.blob()),r=fx(e.image)??t.type??"image/png";await navigator.clipboard.write([new ClipboardItem({[r]:t})])},fw=r$("aui-image-root relative overflow-hidden rounded-lg",{variants:{variant:{outline:"border-border border",ghost:"",muted:"bg-muted/50"},size:{sm:"max-w-64",default:"inline-block max-w-[30vw] max-md:max-w-full",lg:"max-w-[512px]",full:"w-full"}},defaultVariants:{variant:"outline",size:"default"}});function fk({className:e,variant:t,size:r,children:n,...i}){return(0,e_.jsx)("div",{"data-slot":"image-root","data-variant":t,"data-size":r,className:(0,rj.cn)(fw({variant:t,size:r,className:e})),...i,children:n})}function fI({className:e,containerClassName:t,onLoad:r,onError:n,alt:i="Image content",src:a,...o}){let s=(0,ek.useRef)(null),[l,u]=(0,ek.useState)(void 0),[d,c]=(0,ek.useState)(void 0),p=l===a,m=d===a;return(0,ek.useEffect)(()=>{"string"==typeof a&&s.current?.complete&&s.current.naturalWidth>0&&u(a)},[a]),(0,e_.jsxs)("div",{"data-slot":"image-preview",className:(0,rj.cn)("relative min-h-32",t),children:[!p&&!m&&(0,e_.jsx)("div",{"data-slot":"image-preview-loading",className:"absolute inset-0 flex items-center justify-center bg-muted/50",children:(0,e_.jsx)(iD,{className:"size-8 animate-pulse text-muted-foreground"})}),m?(0,e_.jsx)("div",{"data-slot":"image-preview-error",className:"flex min-h-32 items-center justify-center bg-muted/50 p-4",children:(0,e_.jsx)(fv,{className:"size-8 text-muted-foreground"})}):(0,e_.jsx)("img",{ref:s,src:a,alt:i,className:(0,rj.cn)("block h-auto w-auto max-h-[30vh] max-w-[30vw] object-contain max-md:max-w-full",!p&&"invisible",e),onLoad:e=>{"string"==typeof a&&u(a),r?.(e)},onError:e=>{"string"==typeof a&&c(a),n?.(e)},...o})]})}function fS({className:e,children:t,...r}){return t?(0,e_.jsx)("span",{"data-slot":"image-filename",className:(0,rj.cn)("block w-full min-w-0 truncate px-2 py-1.5 text-muted-foreground text-xs [contain:inline-size]",e),...r,children:t}):null}function f$({src:e,alt:t="Image preview",children:r}){let[n,i]=(0,ek.useState)(!1),[a,o]=(0,ek.useState)(!1);(0,ek.useEffect)(()=>{i(!0)},[]);let s=()=>o(!0),l=()=>o(!1);return(0,ek.useEffect)(()=>{if(!a)return;let e=e=>{"Escape"===e.key&&o(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),(0,ek.useEffect)(()=>{if(!a)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[a]),(0,e_.jsxs)(e_.Fragment,{children:[(0,e_.jsx)("button",{type:"button",onClick:s,onKeyDown:e=>"Enter"===e.key&&s(),className:"aui-image-zoom-trigger cursor-zoom-in border-0 bg-transparent p-0 text-left","aria-label":"Click to zoom image",children:r}),n&&a&&(0,rB.createPortal)((0,e_.jsx)("button",{type:"button","data-slot":"image-zoom-overlay",className:"aui-image-zoom-overlay fade-in fixed inset-0 z-50 flex animate-in items-center justify-center bg-black/80 duration-200",onClick:l,onKeyDown:e=>"Enter"===e.key&&l(),"aria-label":"Close zoomed image",children:(0,e_.jsx)("img",{"data-slot":"image-zoom-content",src:e,alt:t,className:"aui-image-zoom-content fade-in zoom-in-95 max-h-[90vh] max-w-[90vw] animate-in cursor-zoom-out object-contain duration-200",onClick:e=>{e.stopPropagation(),l()}})}),document.body)]})}function fj({className:e}){return(0,e_.jsxs)("div",{"data-slot":"image-generating",className:(0,rj.cn)("flex min-h-32 items-center justify-center bg-muted/50 p-4",e),children:[(0,e_.jsx)(iz,{className:"size-8 animate-spin text-muted-foreground"}),(0,e_.jsx)("span",{className:"sr-only",children:"Generating image..."})]})}function fE({className:e,reason:t}){return(0,e_.jsxs)("div",{"data-slot":"image-content-filter-error",className:(0,rj.cn)("flex min-h-32 flex-col items-center justify-center gap-2 bg-muted/50 p-4 text-center",e),children:[(0,e_.jsx)(fy,{className:"size-8 text-muted-foreground"}),(0,e_.jsx)("p",{className:"font-medium text-sm",children:"Image could not be generated"}),t&&(0,e_.jsx)("p",{className:"text-muted-foreground text-xs",children:t})]})}function fC({onRegenerate:e}){let[t,r]=(0,ek.useState)(!1);return(0,e_.jsx)("button",{type:"button",onClick:async()=>{r(!0);try{await e()}finally{r(!1)}},disabled:t,"data-slot":"image-regenerate","aria-label":"Regenerate image",className:"inline-flex size-7 items-center justify-center rounded hover:bg-muted disabled:opacity-50",children:(0,e_.jsx)(iU,{className:(0,rj.cn)("size-4",t&&"animate-spin")})})}let fT=(0,ek.memo)(e=>{let{image:t,filename:r,status:n}=e;return n?.type==="running"?(0,e_.jsxs)(fk,{children:[(0,e_.jsx)(fj,{}),(0,e_.jsx)(fS,{children:r})]}):n?.type==="incomplete"&&"content-filter"===n.reason?(0,e_.jsx)(fk,{children:(0,e_.jsx)(fE,{reason:"The provider blocked this image."})}):(0,e_.jsxs)(fk,{children:[(0,e_.jsx)(f$,{src:t,alt:r||"Image content",children:(0,e_.jsx)(fI,{src:t,alt:r||"Image content"})}),(0,e_.jsx)(fS,{children:r})]})});fT.displayName="Image",fT.Root=fk,fT.Preview=fI,fT.Filename=fS,fT.Zoom=f$,fT.Actions=function({part:e,onRegenerate:t,className:r}){return(0,e_.jsxs)("div",{"data-slot":"image-actions",className:(0,rj.cn)("flex items-center gap-1 p-1",r),children:[(0,e_.jsx)("button",{type:"button",onClick:()=>(e=>{if("u"<typeof document)return;let t=(e=>{switch(e){case"image/png":default:return"png";case"image/jpeg":case"image/jpg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg"}})(fx(e.image)),r=e.filename??`image.${t}`,n=e.image.startsWith("data:")?URL.createObjectURL(fb(e.image)):null,i=n??e.image,a=document.createElement("a");a.href=i,a.download=r,a.rel="noopener",document.body.appendChild(a),a.click(),document.body.removeChild(a),n&&URL.revokeObjectURL(n)})(e),"data-slot":"image-download","aria-label":"Download image",className:"inline-flex size-7 items-center justify-center rounded hover:bg-muted",children:(0,e_.jsx)(aW,{className:"size-4"})}),(0,e_.jsx)("button",{type:"button",onClick:()=>{f_(e).catch(()=>{})},"data-slot":"image-copy","aria-label":"Copy image",className:"inline-flex size-7 items-center justify-center rounded hover:bg-muted",children:(0,e_.jsx)(aq,{className:"size-4"})}),t&&(0,e_.jsx)(fC,{onRegenerate:t})]})},fT.Generating=fj,fT.ContentFilterError=fE,e.s([],6030),e.i(6030);let fN=Symbol("skip-update");class fA{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e)}}}class fR{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(e){for(let t of this._subscriptions)t(e)}_updateConnection(){this._subscriptions.size>0?this._connection||(this._connection=this._connect()):(this._connection?.(),this._connection=void 0)}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}}class fP extends fR{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e;const t=e.getState();if(t===fN)throw Error("Entry not available in the store");this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return!(e===fN||function(e,t){if(void 0===e&&void 0===t)return!0;if(void 0===e||void 0===t)return!1;for(let r of Object.keys(e))if(!Object.is(e[r],t[r]))return!1;return!0}(e,this._previousState))&&(this._previousState=e,!0)}_connect(){let e=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(e)}}class fO extends fR{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==fN&&(this._previousState=e),this._previousStateDirty=!1}if(void 0===this._previousState)throw Error("Entry not available in the store");return this._previousState};_connect(){let e=()=>{this._previousStateDirty=!0,this.notifySubscribers()};return this.binding.subscribe(e)}}class fM extends fR{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),r=t?.subscribe(e),n=()=>{let n=this.binding.getState();n!==t&&(t=n,r?.(),r=n?.subscribe(e),e())},i=this.outerSubscribe(n);return()=>{i?.(),r?.()}}}class fz extends fR{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=e=>{this.notifySubscribers(e)},t=this.config.binding.getState(),r=t?.unstable_on(this.config.event,e),n=()=>{let n=this.config.binding.getState();n!==t&&(t=n,r?.(),r=n?.unstable_on(this.config.event,e))},i=this.outerSubscribe(n);return()=>{i?.(),r?.()}}}let fD=(e,t=21)=>(r=t)=>{let n="",i=0|r;for(;i--;)n+=e[Math.random()*e.length|0];return n},fU=fD("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),fL=()=>`__optimistic__${fU()}`;function fZ(e,t){if("*"===t)return!0;let r=t.split(",").map(e=>e.trim().toLowerCase()),n=`.${e.name.split(".").pop().toLowerCase()}`,i=e.type.toLowerCase();for(let e of r){if(e.startsWith(".")&&e===n||e.includes("/")&&e===i)return!0;if(e.endsWith("/*")){let t=e.split("/")[0];if(i.startsWith(`${t}/`))return!0}}return!1}class fF extends fA{isEditing=!0;get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text="";get text(){return this._text}_role="user";get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){if(this._text!==e){if(this._text=e,this._dictation){this._dictationBaseText=e,this._currentInterimText="";let{status:t,inputDisabled:r}=this._dictation;this._dictation=r?{status:t,inputDisabled:r}:{status:t}}this._notifySubscribers()}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>"complete"!==e.status.type);await Promise.all(t.map(t=>e.remove(t)))}}async reset(){if(0===this._attachments.length&&""===this._text&&"user"===this._role&&0===Object.keys(this._runConfig).length&&void 0===this._quote)return;this._role="user",this._runConfig={},this._quote=void 0;let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(e){if(!this.canSend)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());let t=this.getAttachmentAdapter(),r=this.attachments.length>0?Promise.all(this.attachments.map(async e=>{if("complete"===e.status.type)return e;if(!t)throw Error("Attachments are not supported");return await t.send(e)})):[],n=this.text,i=this._quote;this._quote=void 0,this._emptyTextAndAttachments();let a={createdAt:new Date,role:this.role,content:n?[{type:"text",text:n}]:[],attachments:await r,runConfig:this.runConfig,metadata:{custom:{...i?{quote:i}:{}}}};this.handleSend(a,e),this._notifyEventSubscribers("send",{})}cancel(){this.handleCancel()}async addAttachment(e){let t;if(!(e instanceof File)){let t=this.getAttachmentAdapter();if(t&&!fZ({name:e.name,type:e.contentType??""},t.accept)){let r=`File type ${e.contentType||"unknown"} is not accepted. Accepted types: ${t.accept}`,n=Error(r);throw this._safeEmitAttachmentAddError("not-accepted",r,void 0,n),n}let r={id:e.id??fU(),type:e.type??"document",name:e.name,contentType:e.contentType,content:e.content,status:{type:"complete"}};this._attachments=[...this._attachments,r],this._notifySubscribers(),this._notifyEventSubscribers("attachmentAdd",{});return}let r=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);-1!==t?this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)]:this._attachments=[...this._attachments,e],this._notifySubscribers()},n=this.getAttachmentAdapter();if(!n){let e="Attachments are not supported",t=Error(e);throw this._safeEmitAttachmentAddError("no-adapter",e,void 0,t),t}if(!fZ({name:e.name,type:e.type},n.accept)){let t=`File type ${e.type||"unknown"} is not accepted. Accepted types: ${n.accept}`,r=Error(t);throw this._safeEmitAttachmentAddError("not-accepted",t,void 0,r),r}try{let i=n.add({file:e});if(Symbol.asyncIterator in i)for await(let e of i)t=e,r(e);else t=await i,r(t)}catch(e){throw t&&r({...t,status:{type:"incomplete",reason:"error"}}),this._safeEmitAttachmentAddError("adapter-error",e instanceof Error?e.message:String(e),t?.id,e instanceof Error?e:void 0),e}t?.status.type==="incomplete"&&"error"===t.status.reason?this._safeEmitAttachmentAddError("adapter-error","Attachment upload did not complete successfully.",t?.id):this._notifyEventSubscribers("attachmentAdd",{})}_safeEmitAttachmentAddError(e,t,r,n){try{this._notifyEventSubscribers("attachmentAddError",{reason:e,message:t,...void 0!==r&&{attachmentId:r},...void 0!==n&&{error:n}})}catch(e){console.error("[assistant-ui] attachmentAddError subscriber threw:",e)}}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(-1===t)throw Error("Attachment not found");let r=this._attachments[t];if("complete"!==r.status.type){let e=this.getAttachmentAdapter();if(!e)throw Error("Attachments are not supported");await e.remove(r)}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText="";_currentInterimText="";_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error("Dictation adapter not configured");if(this._dictationSession){for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}let t=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";let r=e.listen();this._dictationSession=r;let n=++this._dictationSessionIdCounter;this._activeDictationSessionId=n,this._dictation={status:r.status,inputDisabled:t},this._notifySubscribers();let i=r.onSpeech(e=>{if(!this._isActiveSession(n,r))return;let t=!1!==e.isFinal,i=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&e.transcript?" ":"";if(t){if(this._dictationBaseText=this._dictationBaseText+i+e.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=i+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:e.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(i);let a=r.onSpeechStart(()=>{this._isActiveSession(n,r)&&(this._dictation={status:{type:"running"},inputDisabled:t,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(a);let o=r.onSpeechEnd(()=>{this._cleanupDictation({sessionId:n})});this._dictationUnsubscribes.push(o);let s=setInterval(()=>{this._isActiveSession(n,r)&&"ended"===r.status.type&&this._cleanupDictation({sessionId:n})},100);this._dictationUnsubscribes.push(()=>clearInterval(s))}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;e.stop().finally(()=>{this._cleanupDictation({sessionId:t})})}_cleanupDictation(e){if((e?.sessionId===void 0||e.sessionId===this._activeDictationSessionId)&&!this._isCleaningDictation){this._isCleaningDictation=!0;try{for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="",this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_eventSubscribers=new Map;_notifyEventSubscribers(e,t){let r=this._eventSubscribers.get(e);if(r)for(let e of r)e(t)}unstable_on(e,t){let r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(t),()=>{this._eventSubscribers.get(e)?.delete(t)}}}class fB extends fF{runtime;_canCancel=!1;get canCancel(){return this._canCancel}get canSend(){return!this.isEmpty&&!this.runtime.isSendDisabled}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}constructor(e){super(),this.runtime=e,this.connect()}connect(){let e=this.runtime.isSendDisabled;return this.runtime.subscribe(()=>{let t=!1;this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,t=!0),e!==this.runtime.isSendDisabled&&(e=this.runtime.isSendDisabled,t=!0),t&&this._notifySubscribers()})}async handleSend(e,t){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null,startRun:t?.startRun})}async handleCancel(){this.runtime.cancelRun()}}let fV=Symbol("autoStatus"),fq=Object.freeze(Object.assign({type:"running"},{[fV]:!0})),fW=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[fV]:!0})),fJ=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[fV]:!0})),fH=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[fV]:!0})),fK=e=>!0===e[fV],fG=(e,t,r,n,i)=>e&&i?Object.assign({type:"incomplete",reason:"error",error:i},{[fV]:!0}):e&&t?fq:r?fH:n?fJ:fW;var fY=e.i(82579);let fX=Symbol("aui.parse-partial-json-object.meta"),fQ=e=>{if(0===e.length)return{[fX]:{state:"partial",partialPath:[]}};try{let t=fY.default.parse(e);if("object"!=typeof t||null===t)throw Error("argsText is expected to be an object");return t[fX]={state:"complete",partialPath:[]},t}catch{try{let[t,r]=function(e){let t,r=["ROOT"],n=-1,i=null,a=[];function o(){void 0!==t&&(a.push(JSON.parse(`"${t}"`)),t=void 0)}function s(e,t,a){switch(e){case'"':n=t,r.pop(),r.push(a),r.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":n=t,i=t,r.pop(),r.push(a),r.push("INSIDE_LITERAL");break;case"-":r.pop(),r.push(a),r.push("INSIDE_NUMBER"),o();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=t,r.pop(),r.push(a),r.push("INSIDE_NUMBER"),o();break;case"{":n=t,r.pop(),r.push(a),r.push("INSIDE_OBJECT_START"),o();break;case"[":n=t,r.pop(),r.push(a),r.push("INSIDE_ARRAY_START"),o()}}function l(e,i){switch(e){case",":r.pop(),r.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=i,r.pop(),t=a.pop()}}function u(e,i){switch(e){case",":r.pop(),r.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":n=i,r.pop(),t=a.pop()}}for(let o=0;o<e.length;o++){let d=e[o];switch(r[r.length-1]){case"ROOT":s(d,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(d){case'"':r.pop(),r.push("INSIDE_OBJECT_KEY"),t="";break;case"}":n=o,r.pop(),t=a.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===d&&(r.pop(),r.push("INSIDE_OBJECT_KEY"),t="");break;case"INSIDE_OBJECT_KEY":switch(d){case'"':r.pop(),r.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":r.push("INSIDE_STRING_ESCAPE"),t+=d;break;default:t+=d}break;case"INSIDE_OBJECT_AFTER_KEY":":"===d&&(r.pop(),r.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":s(d,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(d,o);break;case"INSIDE_STRING":switch(d){case'"':r.pop(),n=o,t=a.pop();break;case"\\":r.push("INSIDE_STRING_ESCAPE");break;default:n=o}break;case"INSIDE_ARRAY_START":"]"===d?(n=o,r.pop(),t=a.pop()):(n=o,t="0",s(d,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(d){case",":r.pop(),r.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":n=o,r.pop(),t=a.pop();break;default:n=o}break;case"INSIDE_ARRAY_AFTER_COMMA":s(d,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":r.pop(),"INSIDE_STRING"===r[r.length-1]?n=o:"INSIDE_OBJECT_KEY"===r[r.length-1]&&(t+=d);break;case"INSIDE_NUMBER":switch(d){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=o;break;case"e":case"E":case"-":case".":break;case",":r.pop(),t=a.pop(),"INSIDE_ARRAY_AFTER_VALUE"===r[r.length-1]&&u(d,o),"INSIDE_OBJECT_AFTER_VALUE"===r[r.length-1]&&l(d,o);break;case"}":r.pop(),t=a.pop(),"INSIDE_OBJECT_AFTER_VALUE"===r[r.length-1]&&l(d,o);break;case"]":r.pop(),t=a.pop(),"INSIDE_ARRAY_AFTER_VALUE"===r[r.length-1]&&u(d,o);break;default:r.pop(),t=a.pop()}break;case"INSIDE_LITERAL":{let t=e.substring(i,o+1);"false".startsWith(t)||"true".startsWith(t)||"null".startsWith(t)?n=o:(r.pop(),"INSIDE_OBJECT_AFTER_VALUE"===r[r.length-1]?l(d,o):"INSIDE_ARRAY_AFTER_VALUE"===r[r.length-1]&&u(d,o))}}}let d=e.slice(0,n+1);for(let t=r.length-1;t>=0;t--)switch(r[t]){case"INSIDE_STRING":d+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":d+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":d+="]";break;case"INSIDE_LITERAL":{let t=e.substring(i,e.length);"true".startsWith(t)?d+="true".slice(t.length):"false".startsWith(t)?d+="false".slice(t.length):"null".startsWith(t)&&(d+="null".slice(t.length))}}return[d,a]}(e),n=fY.default.parse(t);if("object"!=typeof n||null===n)throw Error("argsText is expected to be an object");return n[fX]={state:"partial",partialPath:r},n}catch{return}}},f0=(e,t,r)=>{if("object"!=typeof e||null===e)return t.state;if("complete"===t.state)return"complete";if(0===r.length)return t.state;let[n,...i]=r;if(!Object.hasOwn(e,n))return"partial";let[a,...o]=t.partialPath;return n!==a?"complete":f0(e[n],{state:"partial",partialPath:o},i)},f1=(e,t)=>{let r=e?.[fX];if(!r)throw Error("unable to determine object state");return f0(e,r,t.map(String))},f2=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},f4=(e,t,r)=>{let{role:n,id:i,createdAt:a,attachments:o,status:s,metadata:l}=e,u={id:i??t,createdAt:a??new Date},d="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;if("user"!==n&&o?.length)throw Error("attachments are only supported for user messages");if("assistant"!==n&&s)throw Error("status is only supported for assistant messages");if("assistant"!==n&&l?.steps)throw Error("metadata.steps is only supported for assistant messages");switch(n){case"assistant":return{...u,role:n,content:d.map(e=>{let t=e.type;switch(t){case"text":case"reasoning":if(0===e.text.trim().length)return null;return e;case"file":case"source":case"data":return e;case"image":return(({image:e,...t})=>e.match(/^data:image\/(png|jpeg|jpg|gif|webp);base64,(.*)$/)?{...t,image:e}:(console.warn("Invalid image data format detected"),null))(e);case"tool-call":{let{parentId:t,messages:r,...n}=e,i={...n,toolCallId:e.toolCallId??`tool-${fU()}`,...void 0!==t&&{parentId:t},...void 0!==r&&{messages:r}};if(e.args)return{...i,args:e.args,argsText:e.argsText??JSON.stringify(e.args)};return{...i,args:fQ(e.argsText??"")??{},argsText:e.argsText??""}}default:{let r=f2(t,e.data);if(r)return r;throw Error(`Unsupported assistant message part type: ${t}`)}}}).filter(e=>!!e),status:s??r,metadata:{unstable_state:l?.unstable_state??null,unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[],...l?.timing&&{timing:l.timing},...l?.submittedFeedback&&{submittedFeedback:l.submittedFeedback}}};case"user":return{...u,role:n,content:d.map(e=>{let t=e.type;switch(t){case"text":case"image":case"audio":case"file":case"data":return e;default:{let r=f2(t,e.data);if(r)return r;throw Error(`Unsupported user message part type: ${t}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>f2(e.type,e.data)??e)})),metadata:{custom:l?.custom??{}}};case"system":if(1!==d.length||"text"!==d[0].type)throw Error("System messages must have exactly one text message part.");return{...u,role:n,content:d,metadata:{custom:l?.custom??{}}};default:throw Error(`Unknown message role: ${n}`)}},f6=e=>{let t=e.map(e=>f4(e,fU(),fG(!1,!1,!1,!1,void 0)));return{messages:t.map((e,r)=>({parentId:r>0?t[r-1].id:null,message:e}))}},f5=e=>e.next?f5(e.next):"current"in e?e:null;class f3{func;_value=null;constructor(e){this.func=e}get value(){return null===this._value&&(this._value=this.func()),this._value}dirty(){this._value=null}}class f9{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){for(let r of(e.level=t,e.children)){let e=this.messages.get(r);e&&this.updateLevels(e,t+1)}}performOp(e,t,r){let n=t.prev??this.root,i=e??this.root;if("relink"!==r||n!==i){if("link"!==r&&(n.children=n.children.filter(e=>e!==t.current.id),n.next===t)){let e=n.children.at(-1),t=e?this.messages.get(e):null;if(void 0===t)throw Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");n.next=t}if("cut"!==r){for(let r=e;r;r=r.prev)if(r.current.id===t.current.id)throw Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");i.children=[...i.children,t.current.id],(f5(t)===this.head||null===i.next)&&(i.next=t),t.prev=e;let r=e?e.level+1:0;this.updateLevels(t,r)}}}_messages=new f3(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}getMessages(e){if(void 0===e||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");let r=Array(t.level+1);for(let e=t;e;e=e.prev)r[e.level]=e.current;return r}addOrUpdateMessage(e,t){let r=this.messages.get(t.id),n=e?this.messages.get(e):null;if(void 0===n)throw Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(r){r.current=t,this.performOp(n,r,"relink"),this._messages.dirty();return}let i={prev:n,current:t,next:null,children:[],level:n?n.level+1:0};this.messages.set(t.id,i),this.performOp(n,i,"link"),this.head===n&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}appendOptimisticMessage(e,t){let r;do r=fL();while(this.messages.has(r))return this.addOrUpdateMessage(e,f4(t,r,{type:"running"})),r}deleteMessage(e,t){let r=this.messages.get(e);if(!r)throw Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");let n=void 0===t?r.prev:null===t?null:this.messages.get(t);if(void 0===n)throw Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(let e of r.children){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(n,t,"relink")}this.performOp(null,r,"cut"),this.messages.delete(e),this.head===r&&(this.head=f5(n??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");let{children:r}=t.prev??this.root;return r}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");(t.prev??this.root).next=t,this.head=f5(t),this._messages.dirty()}resetHead(e){if(null===e)return void this.clear();let t=this.messages.get(e);if(!t)throw Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");if(t.children.length>0){let e=t=>{for(let r of t.children){let t=this.messages.get(r);t&&(e(t),this.messages.delete(r))}};e(t),t.children=[],t.next=null}this.head=t;for(let e=t;e;e=e.prev)e.prev?e.prev.next=e:this.root.next=e;this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)e.push({message:t.current,parentId:t.prev?.current.id??null});return{headId:this.head?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:r}of t)this.addOrUpdateMessage(r,e);this.resetHead(e??t.at(-1)?.message.id??null)}}class f8{_contextProvider=new t1;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}}class f7{_core;_threadListBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(){let e=this._core.getState();return this._threadListBinding.switchToThread(e.id)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let r=this._core.getState().isMain,n=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),a=i.isMain,o=i.id;r===a&&n===o||(r=a,n=o,"switchedTo"===e&&!a||"switchedAway"===e&&a||t({}))})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}}let he=Symbol("innerMessage"),ht=Symbol("innerMessages"),hr=[],hn=(e,t)=>{he in e||(e[he]=t)},hi=e=>{let t="messages"in e?e.messages:e,r=t[ht]||t[he];return r?Array.isArray(r)?r:(t[ht]=[r],t[ht]):hr},ha=e=>e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n");class ho{_core;get path(){return this._core.path}constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}}class hs extends ho{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error("Composer is not available");return e.removeAttachment(this.getState().id)}}class hl extends hs{get source(){return"thread-composer"}}class hu extends hs{get source(){return"edit-composer"}}class hd extends ho{get source(){return"message"}remove(){throw Error("Message attachments cannot be removed")}}let hc=Object.freeze([]),hp=Object.freeze({});class hm{_core;get path(){return this._core.path}constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.clearAttachments()}send(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.send(e)}cancel(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.cancel()}setRole(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let r=this._eventSubscriptionSubjects.get(e);return r||(r=new fz({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,r)),r.subscribe(t)}}class hf extends hm{get path(){return this._core.path}get type(){return"thread"}_getState;constructor(e){const t=new fO({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"thread",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,canSend:t?.canSend??!1,isEmpty:t?.isEmpty??!0,attachments:t?.attachments??hc,text:t?.text??"",role:t?.role??"user",runConfig:t?.runConfig??hp,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new hl(new fP({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"thread-composer"}:fN},subscribe:e=>this._core.subscribe(e)}),this._core)}}class hh extends hm{_beginEdit;get path(){return this._core.path}get type(){return"edit"}_getState;constructor(e,t){const r=new fO({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"edit",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,canSend:t?.canSend??!1,isEmpty:t?.isEmpty??!0,text:t?.text??"",role:t?.role??"user",attachments:t?.attachments??hc,runConfig:t?.runConfig??hp,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,parentId:t?.parentId??null,sourceId:t?.sourceId??null,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>r.subscribe(e)}),this._beginEdit=t,this._getState=r.getState.bind(r),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new hu(new fP({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"edit-composer"}:fN},subscribe:e=>this._core.subscribe(e)}),this._core)}}let hg=Symbol.for("aui.tool-response");class hv{get[hg](){return!0}artifact;result;isError;modelContent;messages;constructor(e){void 0!==e.artifact&&(this.artifact=e.artifact),this.result=e.result,this.isError=e.isError??!1,void 0!==e.modelContent&&(this.modelContent=e.modelContent),void 0!==e.messages&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return"object"==typeof e&&null!==e&&hg in e}static toResponse(e){return e instanceof hv?e:new hv({result:void 0===e?"<no result>":e})}}class hy{contentBinding;messageApi;threadApi;get path(){return this.contentBinding.path}constructor(e,t,r){this.contentBinding=e,this.messageApi=t,this.threadApi=r,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw Error("Thread API is not available");let r=this.messageApi.getState();if(!r)throw Error("Message is not available");let n=t.toolName,i=t.toolCallId,a=hv.toResponse(e);this.threadApi.getState().addToolResult({messageId:r.id,toolName:n,toolCallId:i,result:a.result,artifact:a.artifact,isError:a.isError})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw Error("Thread API is not available");let r=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:r,payload:e})}subscribe(e){return this.contentBinding.subscribe(e)}}let hb=Object.freeze({type:"complete"}),hx=(e,t)=>{let r=e.content[t];if(!r)return fN;let n=((e,t,r)=>{if("assistant"!==e.role)return hb;if("tool-call"===r.type)if(!r.result)return e.status;else return hb;let n=t===Math.max(0,e.content.length-1);return"requires-action"===e.status.type?hb:n?e.status:hb})(e,t,r);return Object.freeze({...r,...{[he]:r[he]},status:n})};class h_{_core;_threadBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new hh(new fM({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}reload(e={}){let t=this._getEditComposerRuntimeCore(),r=t??this._threadBinding.getState().composer,{runConfig:n=(t??r).runConfig}=e,i=this._core.getState();if("assistant"!==i.role)throw Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:n})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState(),t=this._threadBinding.getState();if(t.speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error("Message is not being spoken")}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let r=this._core.getState();if(t&&e)throw Error("May not specify both branchId and position");if(!t&&!e)throw Error("Must specify either branchId or position");let n=this._threadBinding.getState().getBranches(r.id),i=t;if("previous"===e?i=n[r.branchNumber-2]:"next"===e&&(i=n[r.branchNumber]),!i)throw Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return ha(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error("Message part index must be >= 0");return new hy(new fP({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>hx(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new hy(new fP({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{let t=this._core.getState(),r=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e);return -1===r?fN:hx(t,r)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new hd(new fP({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{let t=this.getState().attachments,r=t?.[e];return r?{...r,source:"message"}:fN},subscribe:e=>this._core.subscribe(e)}))}}class hw{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){const r=new fP({path:e.path,getState:()=>{var r,n;let i;return r=e.getState(),n=t.getState(),i=r.messages.at(-1),Object.freeze({threadId:n.id,metadata:n,capabilities:r.capabilities,isDisabled:r.isDisabled,isLoading:r.isLoading,isRunning:r.isRunning??(i?.role==="assistant"&&"running"===i.status.type),messages:r.messages,state:r.state,suggestions:r.suggestions,extras:r.extras,speech:r.speech,voice:r.voice})},subscribe:r=>{let n=e.subscribe(r),i=t.subscribe(r);return()=>{n(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>r.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new hf(new fM({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.resumeRun=this.resumeRun.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.connectVoice=this.connectVoice.bind(this),this.disconnectVoice=this.disconnectVoice.bind(this),this.muteVoice=this.muteVoice.bind(this),this.unmuteVoice=this.unmuteVoice.bind(this),this.getVoiceVolume=this.getVoiceVolume.bind(this),this.subscribeVoiceVolume=this.subscribeVoiceVolume.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){var t;this._threadBinding.getState().append((t=this._threadBinding.getState().messages,"string"==typeof e?{createdAt:new Date,parentId:t.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:e}],attachments:[],metadata:{custom:{}}}:{createdAt:e.createdAt??new Date,parentId:e.parentId??t.at(-1)?.id??null,sourceId:e.sourceId??null,role:e.role??"user",content:e.content,attachments:e.attachments??[],metadata:e.metadata??{custom:{}},runConfig:e.runConfig??{},startRun:e.startRun}))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}startRun(e){return this._threadBinding.getState().startRun({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}})}resumeRun(e){return this._threadBinding.getState().resumeRun({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}})}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}connectVoice(){this._threadBinding.getState().connectVoice()}disconnectVoice(){this._threadBinding.getState().disconnectVoice()}getVoiceVolume(){return this._threadBinding.getState().getVoiceVolume()}subscribeVoiceVolume(e){return this._threadBinding.getState().subscribeVoiceVolume(e)}muteVoice(){this._threadBinding.getState().muteVoice()}unmuteVoice(){this._threadBinding.getState().unmuteVoice()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{let t=this._threadBinding.getState().messages,r=t[e];if(r)return{message:r,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new h_(new fP({path:e,getState:()=>{let{message:e,parentId:r,index:n}=t()??{},{messages:i,speech:a}=this._threadBinding.getState();if(!e||void 0===r||void 0===n)return fN;let o=this._threadBinding.getState().getBranches(e.id);return{...e,...{[he]:e[he]},index:n,isLast:i.at(-1)?.id===e.id,parentId:r,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:a?.messageId===e.id?a:void 0}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let r=this._eventSubscriptionSubjects.get(e);return r||(r=new fz({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,r)),r.subscribe(t)}}let hk=Promise.resolve(),hI=(e,t)=>{if(void 0===t)return fN;let r=e.getItemById(t);return r?{id:r.id,remoteId:r.remoteId,externalId:r.externalId,title:r.title,status:r.status,custom:r.custom,isMain:r.id===e.mainThreadId}:fN};class hS{_core;_runtimeFactory;_getState;constructor(e,t=hw){this._core=e,this._runtimeFactory=t;const r=new fO({path:{},getState:()=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,isLoadingMore:e.isLoadingMore??!1,hasMore:e.hasMore??!1,threadItems:e.threadItems}),subscribe:t=>e.subscribe(t)});this._getState=r.getState.bind(r),this._mainThreadListItemRuntime=new f7(new fP({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>hI(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new fM({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getLoadThreadsPromise=this.getLoadThreadsPromise.bind(this),this.reload=this.reload.bind(this),this.loadMore=this.loadMore.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e){return this._core.switchToThread(e)}switchToNewThread(){return this._core.switchToNewThread()}getLoadThreadsPromise(){return this._core.getLoadThreadsPromise()}reload(){return this._core.reload?.()??hk}loadMore(){return this._core.loadMore?.()??hk}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new fM({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new f7(new fP({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>hI(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new f7(new fP({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>hI(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new f7(new fP({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>hI(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}}class h${_core;threads;_thread;constructor(e){this._core=e,this.threads=new hS(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.registerModelContextProvider=this.registerModelContextProvider.bind(this)}get thread(){return this._thread}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}}class hj extends fF{runtime;endEditCallback;get canCancel(){return!0}get canSend(){return!this.isEmpty}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_previousText;_previousAttachments;_nonTextPassthrough;_parentId;_sourceId;constructor(e,t,{parentId:r,message:n}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=r,this._sourceId=n.id,this._previousText=ha(n),this.setText(this._previousText),this.setRole(n.role),"user"===n.role?(this._previousAttachments=[...n.attachments??[],...function(e){let t=[];for(let r of e)"text"!==r.type&&t.push(function(e){let t=fU();return"image"===e.type?{id:t,type:"image",name:e.filename??"image",content:[e],status:{type:"complete"}}:"file"===e.type?{id:t,type:"document",name:e.filename??"document",contentType:e.mimeType,content:[e],status:{type:"complete"}}:"audio"===e.type?{id:t,type:"audio",name:`audio.${e.audio.format}`,contentType:`audio/${e.audio.format}`,content:[e],status:{type:"complete"}}:{id:t,type:"data",name:e.name,content:[e],status:{type:"complete"}}}(r));return t}(n.content)],this._nonTextPassthrough=[]):(this._previousAttachments=n.attachments??[],this._nonTextPassthrough=n.content.filter(e=>"text"!==e.type)),this.setAttachments(this._previousAttachments),this.setRunConfig({...e.composer.runConfig})}get parentId(){return this._parentId}get sourceId(){return this._sourceId}async handleSend(e,t){var r,n;let i=ha(e),a=(r=e.attachments??[],n=this._previousAttachments,!(r.length===n.length&&r.every((e,t)=>e.id===n[t].id)));if(i!==this._previousText||a||t?.startRun){let r=this._nonTextPassthrough.length>0?[...e.content,...this._nonTextPassthrough]:e.content;this.runtime.append({...e,content:r,parentId:this._parentId,sourceId:this._sourceId,startRun:t?.startRun})}this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}}class hE{_contextProvider;_subscriptions=new Set;_isInitialized=!1;repository=new f9;_voiceMessages=[];_voiceGeneration=0;_cachedMergedMessages=null;_cachedVoiceGeneration=-1;_cachedMergedBase=null;_markVoiceMessagesDirty(){this._voiceGeneration++,this._cachedMergedMessages=null}_getBaseMessages(){return this.repository.getMessages()}get messages(){if(0===this._voiceMessages.length)return this._getBaseMessages();let e=this._getBaseMessages();return(this._cachedVoiceGeneration!==this._voiceGeneration||this._cachedMergedBase!==e)&&(this._cachedMergedMessages=[...e,...this._voiceMessages],this._cachedVoiceGeneration=this._voiceGeneration,this._cachedMergedBase=e),this._cachedMergedMessages}get state(){let e;for(let t of this.messages)"assistant"===t.role&&(e=t);return e?.metadata.unstable_state??null}composer=new fB(this);constructor(e){this._contextProvider=e}getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error("Edit already in progress");this._editComposers.set(e,new hj(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{let t=this.repository.getMessages(),r=this._voiceMessages.findIndex(t=>t.id===e);if(-1!==r)return{parentId:r>0?this._voiceMessages[r-1].id:t.at(-1)?.id??null,message:this._voiceMessages[r],index:t.length+r};return}}getBranches(e){return this._voiceMessages.some(t=>t.id===e)?[]:this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e,t){let r=this._eventSubscribers.get(e);if(r)for(let e of r)e(t)}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){let r=this.adapters?.feedback;if(!r)throw Error("Feedback adapter not configured");let{message:n,parentId:i}=this.repository.getMessage(e);if(r.submit({message:n,type:t}),"assistant"===n.role){let e={...n,metadata:{...n.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,e)}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error("Speech adapter not configured");let{message:r}=this.repository.getMessage(e);this._stopSpeaking?.();let n=t.speak(ha(r)),i=n.subscribe(()=>{"ended"===n.status.type?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:n.status},this._notifySubscribers()});this.speech={messageId:e,status:n.status},this._notifySubscribers(),this._stopSpeaking=()=>{n.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}_voiceSession;_voiceUnsubs=[];voice;_voiceVolume=0;_voiceVolumeSubscribers=new Set;getVoiceVolume=()=>this._voiceVolume;subscribeVoiceVolume=e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e));connectVoice(){let e=this.adapters?.voice;if(!e)throw Error("Voice adapter not configured");this.disconnectVoice();let t=e.connect({});this._voiceSession=t;let r=[],n="listening";this.voice={status:t.status,isMuted:t.isMuted,mode:n},this._voiceVolume=0,this._notifySubscribers(),r.push(t.onStatusChange(e=>{"ended"===e.type?(this._finishVoiceAssistantMessage(),this._voiceSession=void 0,this.voice=void 0):this.voice={status:e,isMuted:t.isMuted,mode:n},this._notifySubscribers()})),r.push(t.onModeChange(e=>{n=e,this.voice&&(this.voice={...this.voice,mode:e},this._notifySubscribers())})),r.push(t.onVolumeChange(e=>{for(let t of(this._voiceVolume=e,this._voiceVolumeSubscribers))t()})),r.push(t.onTranscript(e=>{this._handleVoiceTranscript(e)})),this._voiceUnsubs=r}_currentAssistantMsg=null;_handleVoiceTranscript(e){if(this.ensureInitialized(),"user"===e.role)this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,e.isFinal&&(this._voiceMessages.push({id:fU(),role:"user",content:[{type:"text",text:e.text}],metadata:{custom:{}},createdAt:new Date,status:{type:"complete",reason:"unknown"},attachments:[]}),this._markVoiceMessagesDirty(),this._notifySubscribers());else{if(this._currentAssistantMsg){let t=this._voiceMessages.indexOf(this._currentAssistantMsg);if(-1===t)return;let r={...this._currentAssistantMsg,content:[{type:"text",text:e.text}],...e.isFinal?{status:{type:"complete",reason:"stop"}}:{}};this._voiceMessages[t]=r,this._currentAssistantMsg=r}else this._currentAssistantMsg={id:fU(),role:"assistant",content:[{type:"text",text:e.text}],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],custom:{}},status:{type:"running"},createdAt:new Date},this._voiceMessages.push(this._currentAssistantMsg);e.isFinal&&(this._currentAssistantMsg=null),this._markVoiceMessagesDirty(),this._notifySubscribers()}}_finishVoiceAssistantMessage(){let e=this._voiceMessages.at(-1);if(e?.role==="assistant"&&"running"===e.status.type){let t=this._voiceMessages.length-1;this._voiceMessages[t]={...e,status:{type:"complete",reason:"stop"}},this._markVoiceMessagesDirty(),this._notifySubscribers()}}disconnectVoice(){for(let e of(this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,this._voiceUnsubs))e();for(let e of(this._voiceUnsubs=[],this._voiceSession?.disconnect(),this._voiceSession=void 0,this.voice=void 0,this._voiceVolume=0,this._voiceVolumeSubscribers))e();this._voiceMessages=[],this._markVoiceMessagesDirty(),this._notifySubscribers()}muteVoice(){if(!this._voiceSession)throw Error("No active voice session");this._voiceSession.mute(),this.voice={...this.voice,isMuted:!0},this._notifySubscribers()}unmuteVoice(){if(!this._voiceSession)throw Error("No active voice session");this._voiceSession.unmute(),this.voice={...this.voice,isMuted:!1},this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize",{}))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(f6(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){if("modelContextUpdate"===e)return this._contextProvider.subscribe?.(()=>t({}))??(()=>{});let r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(t),()=>{this._eventSubscribers.get(e)?.delete(t)}}}Object.freeze([]);let hC="__DEFAULT_ID__";Object.freeze({[hC]:{id:hC,remoteId:void 0,externalId:void 0,status:"regular",title:void 0}});let hT=(e,t,r)=>r.reduce((e,r)=>r?.(e,t)??e,e);class hN extends fA{_pendingTransforms=[];_completedOptimistics=[];_baseValue;_cachedValue;constructor(e){super(),this._baseValue=e,this._cachedValue=e}_updateState(){this._cachedValue=this._pendingTransforms.reduce((e,t)=>hT(e,t.task,[t.loading,t.optimistic]),this._baseValue),this._notifySubscribers()}get baseValue(){return this._baseValue}get value(){return this._cachedValue}update(e){this._baseValue=e,this._updateState()}async optimisticUpdate(e){let t=e.execute(),r={...e,task:t};try{this._pendingTransforms.push(r),this._updateState();let n=await t;for(let t of(this._baseValue=hT(this._baseValue,n,[e.optimistic,e.then]),this._completedOptimistics))this._baseValue=t(this._baseValue);return e.optimistic&&this._completedOptimistics.push(e.optimistic),n}finally{let e=this._pendingTransforms.indexOf(r);e>-1&&this._pendingTransforms.splice(e,1),0===this._pendingTransforms.length&&(this._completedOptimistics.length=0),this._updateState()}}}let hA=Error("This is the empty thread, a placeholder for the main thread. You cannot perform any actions on this thread instance. This error is probably because you tried to call a thread method in your render function. Call the method inside a `useEffect` hook instead."),hR={getMessageById(){},getBranches:()=>[],switchToBranch(){throw hA},append(){throw hA},startRun(){throw hA},resumeRun(){throw hA},cancelRun(){throw hA},addToolResult(){throw hA},resumeToolCall(){throw hA},speak(){throw hA},stopSpeaking(){throw hA},connectVoice(){throw hA},disconnectVoice(){throw hA},getVoiceVolume:()=>0,subscribeVoiceVolume:()=>()=>{},muteVoice(){throw hA},unmuteVoice(){throw hA},submitFeedback(){throw hA},getModelContext:()=>({}),exportExternalState(){throw hA},importExternalState(){throw hA},composer:{attachments:[],attachmentAccept:"*",async addAttachment(){throw hA},async removeAttachment(){throw hA},isEditing:!0,canCancel:!1,canSend:!1,isEmpty:!0,text:"",setText(){throw hA},role:"user",setRole(){throw hA},runConfig:{},setRunConfig(){throw hA},async reset(){},async clearAttachments(){},send(){throw hA},cancel(){},dictation:void 0,startDictation(){throw hA},stopDictation(){},quote:void 0,setQuote(){throw hA},subscribe:()=>()=>{},unstable_on:()=>()=>{}},getEditComposer(){},beginEdit(){throw hA},speech:void 0,voice:void 0,capabilities:{switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1},isDisabled:!1,isSendDisabled:!1,isLoading:!0,messages:[],state:null,suggestions:[],extras:void 0,subscribe:()=>()=>{},import(){throw hA},export:()=>({messages:[]}),reset(){throw hA},unstable_on:()=>()=>{}},hP=(e,t)=>{for(let r of e){if(void 0!==t.threadIdMap[r.remoteId])continue;switch(r.status){case"regular":t.threadIds.push(r.remoteId);break;case"archived":t.archivedThreadIds.push(r.remoteId);break;default:{let e=r.status;throw Error(`Unsupported state: ${e}`)}}let e=r.remoteId;t.threadIdMap[r.remoteId]=e,t.threadData[e]={id:r.remoteId,remoteId:r.remoteId,externalId:r.externalId,status:r.status,title:r.title,custom:r.custom,initializeTask:Promise.resolve({remoteId:r.remoteId,externalId:r.externalId})}}return t},hO=(e,t)=>{let r=e.threadIdMap[t];if(void 0!==r)return e.threadData[r]},hM=(e,t,r)=>{let n=hO(e,t);if(!n)return e;let{id:i,remoteId:a,status:o}=n;if(o===r)return e;let s={...e};switch(o){case"new":s.newThreadId=void 0;break;case"regular":s.threadIds=s.threadIds.filter(e=>e!==i);break;case"archived":s.archivedThreadIds=s.archivedThreadIds.filter(e=>e!==i);break;default:throw Error(`Unsupported state: ${o}`)}switch(r){case"regular":s.threadIds=[i,...s.threadIds];break;case"archived":s.archivedThreadIds=[i,...s.archivedThreadIds];break;case"deleted":s.threadData=Object.fromEntries(Object.entries(s.threadData).filter(([e])=>e!==i)),s.threadIdMap=Object.fromEntries(Object.entries(s.threadIdMap).filter(([e])=>e!==i&&e!==a));break;default:throw Error(`Unsupported state: ${r}`)}return"deleted"!==r&&(s.threadData={...s.threadData,[i]:{...n,status:r}}),s},hz=({runtime:e,children:t})=>{let r=tU({threadListItem:tB({runtime:e})});return(0,e_.jsx)(t_,{value:r,children:t})},hD=({detectorRef:e})=>((0,ek.useLayoutEffect)(()=>{e.current=!0},[e]),null);class hU extends fA{useRuntimeHook;instances=new Map;useAliveThreadsKeysChanged=ra(()=>({}));parent;constructor(e,t){super(),this.parent=t,this.useRuntimeHook=ra(()=>({useRuntime:e}))}startThreadRuntime(e){return this.instances.has(e)||(this.instances.set(e,{}),this.useAliveThreadsKeysChanged.setState({},!0)),new Promise((t,r)=>{let n=()=>{let n=this.instances.get(e);if(n){if(!n.runtime)return;i(),t(n.runtime)}else i(),r(Error("Thread was deleted before runtime was started"))},i=this.subscribe(n);n()})}getThreadRuntimeCore(e){let t=this.instances.get(e);if(t)return t.runtime}stopThreadRuntime(e){this.instances.delete(e),this.useAliveThreadsKeysChanged.setState({},!0)}setRuntimeHook(e){this.useRuntimeHook.getState().useRuntime!==e&&this.useRuntimeHook.setState({useRuntime:e},!0)}_RuntimeBinder=({threadId:e,children:t})=>{let{useRuntime:r}=this.useRuntimeHook(),n=r(),i=n.thread.__internal_threadBinding,a=(0,ek.useCallback)(()=>{let t=this.instances.get(e);if(!t)throw Error("Thread not found. This is a bug in assistant-ui.");t.runtime=i.getState(),this._notifySubscribers()},[e,i]),o=(0,ek.useRef)(!1);o.current||a(),(0,ek.useEffect)(()=>(o.current=!0,a(),i.outerSubscribe(a)),[i,a]);let s=tU(),l=(0,ek.useRef)(void 0);return(0,ek.useEffect)(()=>{let e=i.getState(),t=e.__internal_setGetInitializePromise;"function"==typeof t&&t.call(e,()=>l.current)},[i]),(0,ek.useEffect)(()=>n.threads.main.unstable_on("initialize",()=>{if("new"===s.threadListItem().getState().status){l.current=s.threadListItem().initialize();let e=n.thread.unstable_on("runEnd",()=>{e(),s.threadListItem().generateTitle()})}}),[n,s]),(0,e_.jsx)(e_.Fragment,{children:t})};_OuterActiveThreadProvider=(0,ek.memo)(({threadId:e,provider:t})=>{let r=(0,ek.useMemo)(()=>new hS(this.parent).getItemById(e),[e]),n=(0,ek.useRef)(!1);return(0,ek.useEffect)(()=>{},[t]),(0,e_.jsx)(hz,{runtime:r,children:(0,e_.jsx)(t,{children:(0,e_.jsx)(this._RuntimeBinder,{threadId:e,children:(0,e_.jsx)(hD,{detectorRef:n})})})})});__internal_RenderThreadRuntimes=({provider:e})=>(this.useAliveThreadsKeysChanged(),Array.from(this.instances.keys()).map(t=>(0,e_.jsx)(this._OuterActiveThreadProvider,{threadId:t,provider:e},t)))}let hL=fD("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);class hZ{_state;constructor(e=null){this._state=e}get state(){return this._state}append(e){this._state=e.reduce((e,t)=>hZ.apply(e,t),this._state)}static apply(e,t){let r=t.type;switch(r){case"set":return hZ.updatePath(e,t.path,()=>t.value);case"append-text":return hZ.updatePath(e,t.path,e=>{if("string"!=typeof e)throw Error(`Expected string at path [${t.path.join(", ")}]`);return e+t.value});default:throw Error(`Invalid operation type: ${r}`)}}static updatePath(e,t,r){if(0===t.length)return r(e);if("object"!=typeof(e??={}))throw Error(`Invalid path: [${t.join(", ")}]`);let[n,...i]=t;if(Array.isArray(e)){let a=Number(n);if(Number.isNaN(a))throw Error(`Expected array index at [${t.join(", ")}]`);if(a>e.length||a<0)throw Error("Insert array index out of bounds");let o=[...e];return o[a]=hZ.updatePath(o[a],i,r),o}let a={...e};return a[n]=hZ.updatePath(a[n],i,r),a}}class hF{_streamStartTime;_firstTokenTime;_totalChunks=0;_toolCallIds=new Set;constructor(){this._streamStartTime=Date.now()}recordChunk(){this._totalChunks++}recordFirstToken(){void 0===this._firstTokenTime&&(this._firstTokenTime=Date.now())}recordToolCallStart(e){this._toolCallIds.add(e)}getTiming(e,t){let r=Date.now()-this._streamStartTime,n=e&&e>0?e:t?Math.ceil(t.length/4):void 0,i=n&&r>0?n/r*1e3:void 0;return{streamStartTime:this._streamStartTime,...void 0!==this._firstTokenTime?{firstTokenTime:this._firstTokenTime-this._streamStartTime}:void 0,totalStreamTime:r,...void 0!==n?{tokenCount:n}:void 0,...void 0!==i?{tokensPerSecond:i}:void 0,totalChunks:this._totalChunks,toolCallCount:this._toolCallIds.size}}}let hB=(e,t,r)=>{if(0===e.parts.length)throw Error("No parts available to update.");if(1!==t.path.length)throw Error("Nested paths are not supported yet.");let n=t.path[0],i=r(e.parts[n]);return{...e,parts:[...e.parts.slice(0,n),i,...e.parts.slice(n+1)],get content(){return this.parts}}},hV=(e,t)=>{if(e.status?.type==="incomplete"&&e.status?.reason==="error")return e;let r=hq(t);return{...e,status:r}},hq=e=>"tool-calls"===e.finishReason?{type:"requires-action",reason:"tool-calls"}:"stop"===e.finishReason||"unknown"===e.finishReason?{type:"complete",reason:e.finishReason}:{type:"incomplete",reason:e.finishReason},hW=(e,t)=>{let r=0;for(let e of t.metadata.steps)"finished"===e.state&&e.usage&&(r+=e.usage.outputTokens);let n="";for(let e of t.parts)("text"===e.type||"reasoning"===e.type)&&(n+=e.text);return e.getTiming(r>0?r:void 0,n||void 0)};class hJ extends TransformStream{constructor({initialMessage:e,throttle:t,onError:r}={}){let n,i=e??(({unstable_state:e=null}={})=>({role:"assistant",status:{type:"running"},parts:[],get content(){return this.parts},metadata:{unstable_state:e,unstable_data:[],unstable_annotations:[],steps:[],custom:{}}}))();const a=new hF,o=t?(e=>{let t=!1;return()=>{t||(t=!0,queueMicrotask(()=>{t=!1,e()}))}})(()=>{n?.enqueue(i)}):()=>{n?.enqueue(i)};super({start(e){n=e},transform(e){var t,n;a.recordChunk();let s=e.type;switch(s){case"part-start":i=((e,t)=>{let r=t.part;if("text"===r.type||"reasoning"===r.type){let t={type:r.type,text:"",status:{type:"running"},...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}if("tool-call"===r.type){let t={type:"tool-call",state:"partial-call",status:{type:"running",isArgsComplete:!1},toolCallId:r.toolCallId,toolName:r.toolName,argsText:"",args:{},...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}if("source"===r.type){let t={type:"source",sourceType:r.sourceType,id:r.id,url:r.url,...r.title?{title:r.title}:void 0,...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}if("file"===r.type){let t={type:"file",mimeType:r.mimeType,data:r.data,...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}if("data"===r.type){let t={type:"data",name:r.name,data:r.data,...r.parentId&&{parentId:r.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}else throw Error(`Unsupported part type: ${r.type}`)})(i,e),"tool-call"===e.part.type&&a.recordToolCallStart(e.part.toolCallId);break;case"tool-call-args-text-finish":i=hB(i,e,e=>{if("tool-call"!==e.type)throw Error("Last is not a tool call");return"partial-call"!==e.state?e:{...e,state:"call"}});break;case"part-finish":i=hB(i,e,e=>({...e,status:{type:"complete",reason:"unknown"}}));break;case"text-delta":i=hB(i,e,t=>{if("text"===t.type||"reasoning"===t.type)return{...t,text:t.text+e.textDelta};if("tool-call"===t.type){let r=t.argsText+e.textDelta,n=fQ(r)??t.args;return{...t,argsText:r,args:n}}throw Error("text-delta received but part is neither text nor tool-call")}),a.recordFirstToken();break;case"result":i=hB(i,e,t=>{if("tool-call"===t.type)return{...t,state:"result",...void 0!==e.artifact?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1,...void 0!==e.modelContent?{modelContent:e.modelContent}:{},...void 0!==e.messages?{messages:e.messages}:{},status:{type:"complete",reason:"stop"}};throw Error("Result chunk received but part is not a tool-call")});break;case"message-finish":i=hV(i,e);break;case"annotations":let l;i={...l=i,metadata:{...l.metadata,unstable_annotations:[...l.metadata.unstable_annotations,...e.annotations]}};break;case"data":let u;i={...u=i,metadata:{...u.metadata,unstable_data:[...u.metadata.unstable_data,...e.data]}};break;case"step-start":let d;i={...d=i,metadata:{...d.metadata,steps:[...d.metadata.steps,{state:"started",messageId:e.messageId}]}};break;case"step-finish":let c,p;p=(c=(t=i).metadata.steps.slice()).length-1,c.length>0&&c[p]?.state==="started"?c[p]={...c[p],state:"finished",finishReason:e.finishReason,usage:e.usage,isContinued:e.isContinued}:c.push({state:"finished",messageId:hL(),finishReason:e.finishReason,usage:e.usage,isContinued:e.isContinued}),i={...t,metadata:{...t.metadata,steps:c}};break;case"error":i={...i,status:{type:"incomplete",reason:"error",error:e.error}},r?.(e.error);break;case"update-state":let m;(m=new hZ((n=i).metadata.unstable_state)).append(e.operations),i={...n,metadata:{...n.metadata,unstable_state:m.state}};break;default:throw Error(`Unsupported chunk type: ${s}`)}"running"!==i.status.type&&(i={...i,metadata:{...i.metadata,timing:hW(a,i)}}),o()},flush(e){if(i.status?.type==="running"){let t=i.parts?.some(e=>"tool-call"===e.type&&("call"===e.state||"partial-call"===e.state)&&void 0===e.result)??!1;i={...i=hV(i,{type:"message-finish",path:[],finishReason:t?"tool-calls":"unknown",usage:{inputTokens:0,outputTokens:0}}),metadata:{...i.metadata,timing:hW(a,i)}},e.enqueue(i)}}})}}class hH{readable;constructor(e){this.readable=e,this.readable=e}static fromAssistantStream(e){return new hH(e.pipeThrough(new hJ))}async unstable_result(){let e;for await(let t of this)e=t;return e||{role:"assistant",status:{type:"complete",reason:"unknown"},parts:[],content:[],metadata:{unstable_state:null,unstable_data:[],unstable_annotations:[],steps:[],custom:{}}}}[Symbol.asyncIterator](){let e=this.readable.getReader();return{async next(){let{done:t,value:r}=await e.read();return t?{done:!0,value:void 0}:{done:!1,value:r}}}}tee(){let[e,t]=this.readable.tee();return[new hH(e),new hH(t)]}}let hK=(0,ek.createContext)(null),hG=({adapters:e,children:t})=>{let r=(0,ek.useContext)(hK);return(0,e_.jsx)(hK.Provider,{value:{...r,...e},children:t})},hY=()=>(0,ek.useContext)(hK);class hX extends fA{_options;_hookManager;_loadThreadsPromise;_loadMorePromise;_loadGeneration=0;_mainThreadId;_state=new hN({isLoading:!0,isLoadingMore:!1,cursor:void 0,newThreadId:void 0,threadIds:[],archivedThreadIds:[],threadIdMap:{},threadData:{}});get threadItems(){return this._state.value.threadData}getLoadThreadsPromise(){if(!this._loadThreadsPromise){let e=this._loadGeneration;this._loadThreadsPromise=this._state.optimisticUpdate({execute:()=>this._options.adapter.list(),loading:e=>({...e,isLoading:!0}),then:(t,r)=>{if(e!==this._loadGeneration)return t;let n=hP(r.threads,{threadIds:[],archivedThreadIds:[],threadIdMap:{},threadData:{}});return{...t,isLoading:!1,cursor:r.nextCursor||void 0,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadIdMap:{...t.threadIdMap,...n.threadIdMap},threadData:{...t.threadData,...n.threadData}}}}).catch(t=>{e===this._loadGeneration&&(console.error("[assistant-ui] thread list load failed:",t),this._loadThreadsPromise=void 0,this._state.update({...this._state.baseValue,isLoading:!1}))}).then(()=>{})}return this._loadThreadsPromise}loadMore(){if(this._loadMorePromise)return this._loadMorePromise;let e=this._state.value;if(void 0===e.cursor||e.isLoading)return Promise.resolve();let t=this._loadGeneration,r=this._options.adapter,n=e.cursor,i=this._state.optimisticUpdate({execute:()=>r.list({after:n}),loading:e=>({...e,isLoadingMore:!0}),then:(e,n)=>{if(t!==this._loadGeneration||r!==this._options.adapter)return e;let i=hP(n.threads,{threadIds:[...e.threadIds],archivedThreadIds:[...e.archivedThreadIds],threadIdMap:{...e.threadIdMap},threadData:{...e.threadData}});return{...e,isLoadingMore:!1,cursor:n.nextCursor||void 0,threadIds:i.threadIds,archivedThreadIds:i.archivedThreadIds,threadIdMap:i.threadIdMap,threadData:i.threadData}}}).catch(e=>{console.error("[assistant-ui] thread list loadMore failed:",e)}).then(()=>{this._loadMorePromise===i&&(this._loadMorePromise=void 0)});return this._loadMorePromise=i,i}contextProvider;constructor(e,t){super(),this.contextProvider=t,this._state.subscribe(()=>this._notifySubscribers()),this._hookManager=new hU(e.runtimeHook,this),this.useProvider=ra(()=>({Provider:e.adapter.unstable_Provider??ek.Fragment})),this.__internal_setOptions(e),this.switchToNewThread()}_initialThreadLoaded=!1;useProvider;__internal_setOptions(e){if(this._options===e)return;let t=void 0!==this._options&&this._options.adapter!==e.adapter;this._options=e;let r=e.adapter.unstable_Provider??ek.Fragment;r!==this.useProvider.getState().Provider&&this.useProvider.setState({Provider:r},!0),this._hookManager.setRuntimeHook(e.runtimeHook),t&&(this._loadGeneration++,this._loadThreadsPromise=void 0,this._loadMorePromise=void 0,this._state.update({...this._state.baseValue,cursor:void 0}))}__internal_load(){this.getLoadThreadsPromise();let e=this._options.threadId??this._options.initialThreadId;!this._initialThreadLoaded&&e&&(this._initialThreadLoaded=!0,this.switchToThread(e).catch(()=>{}))}reload(){return this._loadGeneration++,this._loadThreadsPromise=void 0,this._loadMorePromise=void 0,this._state.update({...this._state.baseValue,cursor:void 0}),this.getLoadThreadsPromise()}get isLoading(){return this._state.value.isLoading}get isLoadingMore(){return this._state.value.isLoadingMore}get hasMore(){return void 0!==this._state.value.cursor}get threadIds(){return this._state.value.threadIds}get archivedThreadIds(){return this._state.value.archivedThreadIds}get newThreadId(){return this._state.value.newThreadId}get mainThreadId(){return this._mainThreadId}getMainThreadRuntimeCore(){let e=this._hookManager.getThreadRuntimeCore(this._mainThreadId);return e||hR}getThreadRuntimeCore(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");let r=this._hookManager.getThreadRuntimeCore(t.id);if(!r)throw Error("Thread not found");return r}getItemById(e){return hO(this._state.value,e)}async switchToThread(e){let t=this.getItemById(e);if(!t){let r=await this._options.adapter.fetch(e),n=this._state.value,i=r.remoteId,a={...n.threadData,[i]:{id:i,initializeTask:Promise.resolve({remoteId:r.remoteId,externalId:r.externalId}),remoteId:r.remoteId,externalId:r.externalId,status:r.status,title:r.title,custom:r.custom}},o={...n.threadIdMap,[r.remoteId]:i},s=n.threadIds.filter(e=>e!==r.remoteId),l=n.archivedThreadIds.filter(e=>e!==r.remoteId),u="regular"===r.status?[...s,r.remoteId]:s,d="archived"===r.status?[...l,r.remoteId]:l;this._state.update({...n,threadIds:u,archivedThreadIds:d,threadIdMap:o,threadData:a}),t=this.getItemById(e)}if(!t)throw Error("Thread not found");if(this._mainThreadId===t.id)return;let r=this._hookManager.startThreadRuntime(t.id);void 0!==this.mainThreadId?await r:r.then(()=>this._notifySubscribers()),"archived"===t.status&&await this.unarchive(t.id),this._mainThreadId=t.id,this._notifySubscribers()}async switchToNewThread(){for(;void 0!==this._state.baseValue.newThreadId&&void 0===this._state.value.newThreadId;)await this._state.waitForUpdate();let e=this._state.value,t=this._state.value.newThreadId;if(void 0===t){do t=`__LOCALID_${fU()}`;while(e.threadIdMap[t])let r=t;this._state.update({...e,newThreadId:t,threadIdMap:{...e.threadIdMap,[t]:r},threadData:{...e.threadData,[r]:{status:"new",id:t,remoteId:void 0,externalId:void 0,title:void 0,custom:void 0}}})}return this.switchToThread(t)}initialize=async e=>{if(this._state.value.newThreadId!==e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("new"===t.status)throw Error("Unexpected new state");return t.initializeTask}return this._state.optimisticUpdate({execute:()=>this._options.adapter.initialize(e),optimistic:t=>hM(t,e,"regular"),loading:(t,r)=>({...t,threadData:{...t.threadData,[e]:{...t.threadData[e],initializeTask:r}}}),then:(t,{remoteId:r,externalId:n})=>{let i=hO(t,e);return i?{...t,threadIdMap:{...t.threadIdMap,[r]:e},threadData:{...t.threadData,[e]:{...i,initializeTask:Promise.resolve({remoteId:r,externalId:n}),remoteId:r,externalId:n}}}:t}})};generateTitle=async e=>{let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("new"===t.status)throw Error("Thread is not yet initialized");let{remoteId:r}=await t.initializeTask,n=this._hookManager.getThreadRuntimeCore(t.id);if(!n)return;let i=n.messages,a=await this._options.adapter.generateTitle(r,i);for await(let e of hH.fromAssistantStream(a)){let r=e.parts.filter(e=>"text"===e.type)[0]?.text,n=this._state.baseValue,i=hO(n,t.id);i&&this._state.update({...n,threadData:{...n.threadData,[i.id]:{...i,title:r}}})}};rename(e,t){let r=this.getItemById(e);if(!r)throw Error("Thread not found");if("new"===r.status)throw Error("Thread is not yet initialized");return this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await r.initializeTask;return this._options.adapter.rename(e,t)},optimistic:r=>{let n=hO(r,e);return n?{...r,threadData:{...r.threadData,[n.id]:{...n,title:t}}}:r}})}async _ensureThreadIsNotMain(e){if(e===this.newThreadId)throw Error("Cannot ensure new thread is not main");e===this._mainThreadId&&await this.switchToNewThread()}async archive(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("regular"!==t.status)throw Error("Thread is not yet initialized or already archived");return await this._ensureThreadIsNotMain(t.id),this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await t.initializeTask;return this._options.adapter.archive(e)},optimistic:e=>hM(e,t.id,"archived")})}unarchive(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("archived"!==t.status)throw Error("Thread is not archived");return this._state.optimisticUpdate({execute:async()=>{try{let{remoteId:e}=await t.initializeTask;return await this._options.adapter.unarchive(e)}catch(e){throw await this._ensureThreadIsNotMain(t.id),e}},optimistic:e=>hM(e,t.id,"regular")})}async delete(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("regular"!==t.status&&"archived"!==t.status)throw Error("Thread is not yet initialized");return await this._ensureThreadIsNotMain(t.id),this._hookManager.stopThreadRuntime(t.id),this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await t.initializeTask;return await this._options.adapter.delete(e)},optimistic:e=>hM(e,t.id,"deleted")})}async detach(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("regular"!==t.status&&"archived"!==t.status)throw Error("Thread is not yet initialized");await this._ensureThreadIsNotMain(t.id),this._hookManager.stopThreadRuntime(t.id)}useBoundIds=ra(()=>[]);__internal_RenderComponent=()=>{let e=(0,ek.useId)();(0,ek.useEffect)(()=>(this.useBoundIds.setState(t=>[...t,e],!0),()=>{this.useBoundIds.setState(t=>t.filter(t=>t!==e),!0)}),[e]);let t=this.useBoundIds(),{Provider:r}=this.useProvider(),n={modelContext:this.contextProvider};return(0===t.length||t[0]===e)&&(0,e_.jsx)(hG,{adapters:n,children:(0,e_.jsx)(this._hookManager.__internal_RenderThreadRuntimes,{provider:r})})}}class hQ extends f8{threads;constructor(e){super(),this.threads=new hX(e,this._contextProvider)}get RenderComponent(){return this.threads.__internal_RenderComponent}}let h0=e=>{let t=(0,ek.useRef)(e.runtimeHook);t.current=e.runtimeHook;let r=(0,ek.useRef)(e.threadId??e.initialThreadId),n=(0,ek.useCallback)(()=>t.current(),[]),i=(0,ek.useMemo)(()=>({adapter:e.adapter,allowNesting:e.allowNesting,initialThreadId:r.current,runtimeHook:n}),[e.adapter,e.allowNesting,n]);if(null!==tU().threadListItem.source){if(!i.allowNesting)throw Error("useRemoteThreadListRuntime cannot be nested inside another RemoteThreadListRuntime. Set allowNesting: true to allow nesting (the inner runtime will become a no-op).");return n()}let a=(e=>{let[t]=(0,ek.useState)(()=>new hQ(e));return(0,ek.useEffect)(()=>{t.threads.__internal_setOptions(e),t.threads.__internal_load()},[t,e]),(0,ek.useMemo)(()=>new h$(t),[t])})(i),o=(0,ek.useRef)(e.threadId);return(0,ek.useEffect)(()=>{e.threadId!==o.current&&(o.current=e.threadId,e.threadId?a.threads.switchToThread(e.threadId).catch(()=>{}):a.threads.switchToNewThread().catch(()=>{}))},[a,e.threadId]),a},h1=e=>{try{let t=e.split(".")[1];if(!t)throw Error("Invalid JWT format");let r=t.replace(/-/g,"+").replace(/_/g,"/");for(;r.length%4!=0;)r+="=";let n=atob(r),i=JSON.parse(n).exp;if(!i||"number"!=typeof i)throw Error('JWT does not contain a valid "exp" field');return 1e3*i}catch(e){throw Error(`Unable to determine the token expiry: ${e}`)}};class h2{strategy="jwt";cachedToken=null;tokenExpiry=null;#t;constructor(e){this.#t=e}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>3e4)return{Authorization:`Bearer ${this.cachedToken}`};let t=await this.#t();return!!t&&(this.cachedToken=t,this.tokenExpiry=h1(t),{Authorization:`Bearer ${t}`})}readAuthHeaders(e){let t=e.get("Authorization");if(!t)return;let[r,n]=t.split(" ");if("Bearer"!==r||!n)throw Error("Invalid auth header received");this.cachedToken=n,this.tokenExpiry=h1(n)}}class h4{strategy="api-key";#r;#n;#i;constructor(e,t,r){this.#r=e,this.#n=t,this.#i=r}async getAuthHeaders(){return{Authorization:`Bearer ${this.#r}`,"Aui-User-Id":this.#n,"Aui-Workspace-Id":this.#i}}readAuthHeaders(){}}let h6="aui:refresh_token";class h5{strategy="anon";baseUrl;jwtStrategy;constructor(e){this.baseUrl=e,this.jwtStrategy=new h2(async()=>{let e=Date.now(),t=localStorage.getItem(h6),r=t?JSON.parse(t):void 0;if(r)if(new Date(r.expires_at).getTime()-e>3e4){let e=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:r.token})});if(e.ok){let{access_token:t,refresh_token:r}=await e.json();return r&&localStorage.setItem(h6,JSON.stringify(r)),t}}else localStorage.removeItem(h6);let n=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!n.ok)return null;let{access_token:i,refresh_token:a}=await n.json();return i&&a?(localStorage.setItem(h6,JSON.stringify(a)),i):null})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}}class h3 extends Error{constructor(e){super(e),this.name="APIError"}}class h9{_auth;_baseUrl;constructor(e){if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new h2(e.authToken);else if("apiKey"in e)this._baseUrl=(e.baseUrl??"https://backend.assistant-api.com").replace(/\/$/,""),this._auth=new h4(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new h5(e.baseUrl);else throw Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,t={}){let r=await this._auth.getAuthHeaders();if(!r)throw Error("Authorization failed");let n={...r,...t.headers,"Content-Type":"application/json"},i=new URLSearchParams;if(t.query)for(let[e,r]of Object.entries(t.query))!1!==r&&(!0===r?i.set(e,"true"):i.set(e,r.toString()));let a=new URL(`${this._baseUrl}/v1${e}`);a.search=i.toString();let o=await fetch(a,{method:t.method??"GET",headers:n,body:t.body?JSON.stringify(t.body):null});if(this._auth.readAuthHeaders(o.headers),!o.ok){let e=await o.text();try{let t=JSON.parse(e);throw new h3(t.message)}catch(t){if(t instanceof h3)throw t;throw Error(`Request failed with status ${o.status}, ${e}`)}}return o}async makeRequest(e,t={}){return(await this.makeRawRequest(e,t)).json()}}class h8{cloud;constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}}let h7={toResponse:(e,t)=>new Response(h7.toByteStream(e,t),{headers:t.headers??{}}),fromResponse:(e,t)=>h7.fromByteStream(e.body,t),toByteStream:(e,t)=>e.pipeThrough(t),fromByteStream:(e,t)=>e.pipeThrough(t)},ge=()=>{let e,t,r=new Promise((r,n)=>{e=r,t=n});if(!e||!t)throw Error("Failed to create promise");return{promise:r,resolve:e,reject:t}};class gt{_controller;_isClosed=!1;constructor(e){this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}}let gr=e=>new ReadableStream({start:t=>e.start?.(new gt(t)),pull:t=>e.pull?.(new gt(t)),cancel:t=>e.cancel?.(t)}),gn=()=>{let e;return[gr({start(t){e=t}}),e]};class gi{_controller;_isClosed=!1;_mergeTask;constructor(e){this._controller=e;const t=gr({start:e=>{this._argsTextController=e}});let r=!1;this._mergeTask=t.pipeTo(new WritableStream({write:e=>{switch(e.type){case"text-delta":r=!0,this._controller.enqueue(e);break;case"part-finish":r||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw Error(`Unexpected chunk type: ${e.type}`)}}}))}get argsText(){return this._argsTextController}_argsTextController;async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...void 0!==e.artifact?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1,...void 0!==e.modelContent?{modelContent:e.modelContent}:{},...void 0!==e.messages?{messages:e.messages}:{}})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}}class ga{value=-1;up(){return++this.value}}class go extends TransformStream{constructor(e){super({transform(t,r){r.enqueue({...t,path:[e,...t.path]})}})}}TransformStream;class gs extends TransformStream{constructor(e){const t=new ga,r=new Map;super({transform(n,i){"part-start"===n.type&&0===n.path.length&&r.set(t.up(),e.up());let[a,...o]=n.path;if(void 0===a)return void i.enqueue(n);let s=r.get(a);if(void 0===s)throw Error("Path not found");i.enqueue({...n,path:[s,...o]})}})}}class gl{_state;_parentId;constructor(e){this._state=e||{merger:(()=>{let e,t,r=[],n=!1,i=i=>{i.promise||(i.promise=i.reader.read().then(({done:a,value:o})=>{i.promise=void 0,a?(r.splice(r.indexOf(i),1),n&&0===r.length&&e.close()):e.enqueue(o),t?.resolve(),t=void 0}).catch(n=>{console.error(n),r.forEach(e=>{e.reader.cancel()}),r.length=0,e.error(n),t?.reject(n),t=void 0}))};return{readable:new ReadableStream({start(t){e=t},pull:()=>(t=ge(),r.forEach(e=>{i(e)}),t.promise),cancel(){r.forEach(e=>{e.reader.cancel()}),r.length=0}}),isSealed:()=>n,seal(){n=!0,0===r.length&&e.close()},addStream(e){if(n)throw Error("Cannot add streams after the run callback has settled.");let t={reader:e.getReader()};r.push(t),i(t)},enqueue(e){this.addStream(new ReadableStream({start(t){t.enqueue(e),t.close()}}))}}})(),contentCounter:new ga}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,t){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(t.pipeThrough(new go(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new gs(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,t]=gn();return this._addPart({type:"text"},e),t}addReasoningPart(){let[e,t]=gn();return this._addPart({type:"reasoning"},e),t}addToolCallPart(e){let t,r,n="string"==typeof e?{toolName:e}:e,i=n.toolName,a=n.toolCallId??hL(),[o,s]=[(r={start(e){t=e}},new ReadableStream({start:e=>r.start?.(new gi(e)),pull:e=>r.pull?.(new gi(e)),cancel:e=>r.cancel?.(e)})),t];return this._addPart({type:"tool-call",toolName:i,toolCallId:a,...this._parentId&&{parentId:this._parentId}},o),void 0!==n.argsText&&(s.argsText.append(n.argsText),s.argsText.close()),void 0!==n.args&&(s.argsText.append(JSON.stringify(n.args)),s.argsText.close()),void 0!==n.response&&s.setResponse(n.response),s}_finishedPartStream(){return new ReadableStream({start(e){e.enqueue({type:"part-finish",path:[]}),e.close()}})}_withParentIdOption(e){return this._parentId?{...e,parentId:this._parentId}:e}appendSource(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendFile(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendData(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}enqueue(e){this._state.merger.enqueue(e),"part-start"===e.type&&0===e.path.length&&this._state.contentCounter.up()}withParentId(e){let t=new gl(this._state);return t._parentId=e,t}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}}function gu(e){let t=new gl;return(async()=>{try{await e(t)}catch(e){throw t.__internal_isClosed||t.enqueue({type:"error",path:[],error:String(e)}),e}finally{t.__internal_isClosed||t.close()}})(),t.__internal_getReadable()}function gd(){let e,{resolve:t,promise:r}=ge();return[gu(n=>((e=n).__internal_subscribeToClose(t),r)),e]}class gc extends TransformStream{constructor(e,t,r){let n;const[i,a]=gd();super({start:t=>(n=i.pipeTo(new WritableStream({write(e){t.enqueue(e)},abort(e){t.error(e)},close(){t.terminate()}})).catch(e=>{t.error(e)}),e.start?.(a)),transform:t=>e.transform?.(t,a),async flush(){await e.flush?.(a),a.close(),await n}},t,r)}}class gp extends TransformStream{constructor(e){super(),Object.defineProperty(this,"readable",{value:e(super.readable),writable:!1})}}class gm extends gp{constructor(){super(e=>{let t=new gc({transform(e,t){t.appendText(e)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(t)})}}class gf{cloud;constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:`${this.cloud._baseUrl}/v1/runs/stream`,headers:async()=>{let e=await this.cloud._auth.getAuthHeaders();if(!e)throw Error("Authorization failed");return{...e,Accept:"text/plain"}},body:{assistant_id:e,response_format:"vercel-ai-data-stream/v1",thread_id:"unstable_todo"}}}async stream(e){let t=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return h7.fromResponse(t,new gm)}async report(e){return this.cloud.makeRequest("/runs",{method:"POST",body:e})}}class gh{cloud;constructor(e){this.cloud=e}async list(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:t})}async create(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:t})}async update(e,t,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages/${encodeURIComponent(t)}`,{method:"PUT",body:r})}}class gg{cloud;messages;constructor(e){this.cloud=e,this.messages=new gh(e)}async list(e){return this.cloud.makeRequest("/threads",{query:e})}async get(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`)}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:t})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}}class gv{cloud;constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest("/files/pdf-to-images",{method:"POST",body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest("/files/attachments/generate-presigned-upload-url",{method:"POST",body:e})}}class gy{list(){return Promise.resolve({threads:[]})}rename(){return Promise.resolve()}archive(){return Promise.resolve()}unarchive(){return Promise.resolve()}delete(){return Promise.resolve()}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){return Promise.resolve(new ReadableStream)}fetch(e){return Promise.reject(Error("Thread not found"))}}class gb{cloud;idMapping={};constructor(e){this.cloud=e}async append(e,t,r,n,i){let a=r?await this.idMapping[r]??r:null,o=this.cloud.threads.messages.create(e,{parent_id:a,format:n,content:i}).then(({message_id:e})=>(this.idMapping[t]=e,e)).catch(e=>{throw this.idMapping[t]===o&&delete this.idMapping[t],e});return this.idMapping[t]=o,o.then(()=>{})}async update(e,t,r,n){let i=await this.getRemoteId(t);i&&await this.cloud.threads.messages.update(e,i,{content:n})}isPersisted(e){return e in this.idMapping}async getRemoteId(e){let t=this.idMapping[e];if(t)return t}async load(e,t){let{messages:r}=await this.cloud.threads.messages.list(e,t?{format:t}:void 0);for(let e of r)this.idMapping[e.id]=e.id;return r}reset(){this.idMapping={}}}function gx(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function g_(e,t=0){return!(t>100)&&(null===e||"string"==typeof e||"boolean"==typeof e||("number"==typeof e?!Number.isNaN(e)&&Number.isFinite(e):Array.isArray(e)?e.every(e=>g_(e,t+1)):!!gx(e)&&Object.entries(e).every(([e,r])=>"string"==typeof e&&g_(r,t+1))))}function gw(e){let t=e.content,r=f4({id:e.id,createdAt:e.created_at,...t},e.id,{type:"complete",reason:"unknown"});return{parentId:e.parent_id,message:r}}let gk=new WeakMap;class gI{cloudRef;aui;constructor(e,t){this.cloudRef=e,this.aui=t}get _persistence(){let e=this.aui.threadListItem();return gk.has(e)||gk.set(e,new gb(this.cloudRef.current)),gk.get(e)}withFormat(e){let t,r=this,n=(t=this._persistence,{append:async(r,n)=>{let i=e.getId(n.message),a=e.encode(n);return t.append(r,i,n.parentId,e.format,a)},update:t.update?async(r,n,i)=>{let a=e.encode(n);return t.update(r,i,e.format,a)}:void 0,load:async r=>({messages:(await t.load(r,e.format)).filter(t=>t.format===e.format).map(t=>e.decode({id:t.id,parent_id:t.parent_id,format:t.format,content:t.content})).reverse()}),isPersisted:e=>t.isPersisted(e)});return{async append(e){let{remoteId:t}=await r.aui.threadListItem().initialize();await n.append(t,e)},async update(e,t){let i=r.aui.threadListItem().getState().remoteId;i&&await n.update?.(i,e,t)},reportTelemetry(t,n){let i=t.map(t=>e.encode(t));r._reportRunTelemetry(e.format,i,n)},async load(){let e=r.aui.threadListItem().getState().remoteId;return e?n.load(e):{messages:[]}}}}async append({parentId:e,message:t}){let r,{remoteId:n}=await this.aui.threadListItem().initialize(),i=(r=t.status?.type==="running"?{type:"incomplete",reason:"cancelled"}:t.status,{role:t.role,content:t.content.map(e=>{let t=e.type;switch(t){case"text":return{type:"text",text:e.text};case"reasoning":return{type:"reasoning",text:e.text};case"source":if("url"===e.sourceType)return{type:"source",sourceType:"url",id:e.id,url:e.url,...null!=e.title?{title:e.title}:void 0,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:void 0};return{type:"source",sourceType:"document",id:e.id,title:e.title,mediaType:e.mediaType,...null!=e.filename?{filename:e.filename}:void 0,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:void 0};case"tool-call":return g_(e.result)||console.warn(`tool-call result is not JSON! ${JSON.stringify(e)}`),{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,...JSON.stringify(e.args)===e.argsText?{args:e.args}:{argsText:e.argsText},...e.result?{result:e.result}:void 0,...e.isError?{isError:!0}:void 0};case"image":return{type:"image",image:e.image};case"file":return{type:"file",data:e.data,mimeType:e.mimeType,...e.filename?{filename:e.filename}:void 0};default:throw Error(`Message part type not supported by aui/v0: ${t}`)}}),metadata:t.metadata,...r?{status:r}:void 0});await this._persistence.append(n,t.id,e,"aui/v0",i),this.cloudRef.current.telemetry.enabled&&this._maybeReportRun(n,"aui/v0",i)}async load(){let e=this.aui.threadListItem().getState().remoteId;return e?{messages:(await this._persistence.load(e,"aui/v0")).filter(e=>"aui/v0"===e.format).map(gw).reverse()}:{messages:[]}}_reportRunTelemetry(e,t,r){if(!this.cloudRef.current.telemetry.enabled)return;let n=this.aui.threadListItem().getState().remoteId;if(!n)return;let i=function(e,t){if("ai-sdk/v6"===e)return function(e){let t,r=[],n=[],i=[],a=!1,o=0,s=0,l=0,u=0,d=!1,c=!1,p=!1,m=!1;for(let f of e){if("assistant"!==f.role)continue;a=!0;let{textParts:e,toolCalls:h,stepsData:g}=gN(f.parts??[]);r.push(...e),n.push(...h),i.push(...g),f.metadata&&(t=f.metadata);let v=gP(f.metadata);v&&(null!=v.inputTokens&&(o+=v.inputTokens,d=!0),null!=v.outputTokens&&(s+=v.outputTokens,c=!0),null!=v.reasoningTokens&&(l+=v.reasoningTokens,p=!0),null!=v.cachedInputTokens&&(u+=v.cachedInputTokens,m=!0))}return a?gA(r,n,i.length,t,i,{...d?{inputTokens:o}:void 0,...c?{outputTokens:s}:void 0,...p?{reasoningTokens:l}:void 0,...m?{cachedInputTokens:u}:void 0}):null}(t);for(let r=t.length-1;r>=0;r--){let n=gC(e,t[r]);if(n)return n}return null}(e,t);i&&this._sendReport(n,i,r?.durationMs,r?.stepTimestamps)}_maybeReportRun(e,t,r){let n=gC(t,r);n&&this._sendReport(e,n)}_sendReport(e,t,r,n){let i=function(e,t){if(!t)return e;if(!e)return t.map(e=>({...e}));let r=Math.min(e.length,t.length);return e.map((e,n)=>({...e,...n<r?t[n]:void 0}))}(t.steps,n),a={thread_id:e,status:t.status,...null!=t.totalSteps?{total_steps:t.totalSteps}:void 0,...t.toolCalls?{tool_calls:t.toolCalls}:void 0,...i?{steps:i}:void 0,...null!=t.inputTokens?{input_tokens:t.inputTokens}:void 0,...null!=t.outputTokens?{output_tokens:t.outputTokens}:void 0,...null!=t.reasoningTokens?{reasoning_tokens:t.reasoningTokens}:void 0,...null!=t.cachedInputTokens?{cached_input_tokens:t.cachedInputTokens}:void 0,...null!=r?{duration_ms:r}:void 0,...null!=t.outputText?{output_text:t.outputText}:void 0,...t.metadata?{metadata:t.metadata}:void 0,...t.modelId?{model_id:t.modelId}:void 0},{beforeReport:o}=this.cloudRef.current.telemetry,s=o?o(a):a;s&&this.cloudRef.current.runs.report(s).catch(()=>{})}}function gS(e){return e.length<=5e4?e:e.slice(0,5e4)}function g$(e){if(null!=e)try{return gS(JSON.stringify(e))}catch{return}}let gj=/^[A-Za-z0-9+/]{100,}={0,2}$/;function gE(e,t,r,n,i,a){let o={tool_name:e,tool_call_id:t},s=i??g$(r);void 0!==s&&(o.tool_args=s);let l="mcp"===a?function(e){if(null!=e){try{let t="string"==typeof e?JSON.parse(e):e;if(Array.isArray(t)){let e=t.map(e=>{if(e&&"object"==typeof e&&e.type&&("image"===e.type||"audio"===e.type)&&"string"==typeof e.data&&gj.test(e.data.slice(0,200))){let t=(3*e.data.length/4/1024).toFixed(1);return{...e,data:`[${e.type}: ${t}KB]`}}return e});return gS(JSON.stringify(e))}}catch{}return g$(e)}}(n):g$(n);return void 0!==l&&(o.tool_result=l),a&&(o.tool_source=a),o}function gC(e,t){switch(e){case"aui/v0":return function(e){let t,r,n,i;if("assistant"!==e.role)return null;let a=e.content?.filter(e=>"tool-call"===e.type&&e.toolName&&e.toolCallId).map(e=>gE(e.toolName,e.toolCallId,e.args,e.result,e.argsText)),o=e.content?.filter(e=>"text"===e.type&&e.text),s=o&&o.length>0?gS(o.map(e=>e.text).join("")):void 0,l=e.metadata?.steps;if(l&&l.length>0){let e=0,a=0,o=0,s=0,u=!1,d=!1,c=!1,p=!1;for(let t of l)t.usage?.inputTokens!=null&&(e+=t.usage.inputTokens,u=!0),t.usage?.outputTokens!=null&&(a+=t.usage.outputTokens,d=!0),t.usage?.reasoningTokens!=null&&(o+=t.usage.reasoningTokens,c=!0),t.usage?.cachedInputTokens!=null&&(s+=t.usage.cachedInputTokens,p=!0);t=u?e:void 0,r=d?a:void 0,n=c?o:void 0,i=p?s:void 0}let u=e.status?.type,d=u&&gT[u]||"completed",c=e.metadata?.custom,p=e.metadata?.modelId??("string"==typeof e.metadata?.custom?.modelId?e.metadata.custom.modelId:void 0),m=l&&l.length>1?l.map(e=>({...e.usage?.inputTokens!=null?{input_tokens:e.usage.inputTokens}:void 0,...e.usage?.outputTokens!=null?{output_tokens:e.usage.outputTokens}:void 0,...e.usage?.reasoningTokens!=null?{reasoning_tokens:e.usage.reasoningTokens}:void 0,...e.usage?.cachedInputTokens!=null?{cached_input_tokens:e.usage.cachedInputTokens}:void 0})):void 0;return{status:d,...a&&a.length>0?{toolCalls:a}:void 0,...l?.length?{totalSteps:l.length}:void 0,...null!=t?{inputTokens:t}:void 0,...null!=r?{outputTokens:r}:void 0,...null!=n?{reasoningTokens:n}:void 0,...null!=i?{cachedInputTokens:i}:void 0,...null!=s?{outputText:s}:void 0,...c?{metadata:c}:void 0,...m?{steps:m}:void 0,...p?{modelId:p}:void 0}}(t);case"ai-sdk/v6":return function(e){if("assistant"!==e.role)return null;let{textParts:t,toolCalls:r,stepsData:n}=gN(e.parts??[]);return gA(t,r,n.length,e.metadata,n,gP(e.metadata))}(t);default:return null}}let gT={error:"error",incomplete:"incomplete"};function gN(e){let t=[],r=[],n=[],i=null;for(let a of e)if("step-start"===a.type)null!==i&&n.push({tool_calls:i}),i=[];else if("text"===a.type&&a.text)t.push(a.text);else if(a.toolCallId&&("tool-call"===a.type||"dynamic-tool"===a.type?!!a.toolName:a.type.startsWith("tool-")||a.type.startsWith("dynamic-tool-"))){let e=function(e){let t="dynamic-tool"===e.type||e.type.startsWith("dynamic-tool-")?"mcp":void 0;return gE(e.toolName??e.type.slice(5),e.toolCallId,e.args??e.input,e.result??e.output,void 0,t)}(a);r.push(e),null!==i&&i.push(e)}return null!==i&&n.push({tool_calls:i}),{textParts:t,toolCalls:r,stepsData:n}}function gA(e,t,r,n,i,a){let o=e.length>0,s=o?gS(e.join("")):void 0,l=function(e){if(!e)return;if("string"==typeof e.modelId)return e.modelId;let t=e.custom;if("string"==typeof t?.modelId)return t.modelId}(n),u=i&&i.length>1?i.map(e=>({...e.tool_calls.length>0?{tool_calls:e.tool_calls}:void 0})):void 0;return{status:o?"completed":"incomplete",...t.length>0?{toolCalls:t}:void 0,...r>0?{totalSteps:r}:void 0,...a?.inputTokens!=null?{inputTokens:a.inputTokens}:void 0,...a?.outputTokens!=null?{outputTokens:a.outputTokens}:void 0,...a?.reasoningTokens!=null?{reasoningTokens:a.reasoningTokens}:void 0,...a?.cachedInputTokens!=null?{cachedInputTokens:a.cachedInputTokens}:void 0,...null!=s?{outputText:s}:void 0,...n?{metadata:n}:void 0,...u?{steps:u}:void 0,...l?{modelId:l}:void 0}}function gR(e){let t=e.inputTokens??e.promptTokens,r=e.outputTokens??e.completionTokens;if(null!=t||null!=r||null!=e.reasoningTokens||null!=e.cachedInputTokens)return{...null!=t?{inputTokens:t}:void 0,...null!=r?{outputTokens:r}:void 0,...null!=e.reasoningTokens?{reasoningTokens:e.reasoningTokens}:void 0,...null!=e.cachedInputTokens?{cachedInputTokens:e.cachedInputTokens}:void 0}}function gP(e){let t=e?.usage;if(t){let e=gR(t);if(e)return e}let r=e?.steps;if(r&&r.length>0){let e=0,t=0,n=0,i=0,a=!1,o=!1,s=!1,l=!1,u=!1;for(let d of r){if(!d.usage)continue;let r=gR(d.usage);r&&(null!=r.inputTokens&&(e+=r.inputTokens,a=!0),null!=r.outputTokens&&(t+=r.outputTokens,o=!0),null!=r.reasoningTokens&&(n+=r.reasoningTokens,s=!0),null!=r.cachedInputTokens&&(i+=r.cachedInputTokens,l=!0),u=!0)}if(u)return{...a?{inputTokens:e}:void 0,...o?{outputTokens:t}:void 0,...s?{reasoningTokens:n}:void 0,...l?{cachedInputTokens:i}:void 0}}}class gO{cloud;accept="*";constructor(e){this.cloud=e}uploadedUrls=new Map;async *add({file:e}){var t;let r=crypto.randomUUID(),n={id:r,type:(t=e.type).startsWith("image/")?"image":t.startsWith("text/")?"document":"file",name:e.name,contentType:e.type,file:e,status:{type:"running",reason:"uploading",progress:0}};yield n;try{let{signedUrl:t,publicUrl:i}=await this.cloud.files.generatePresignedUploadUrl({filename:e.name});await fetch(t,{method:"PUT",body:e,headers:{"Content-Type":e.type},mode:"cors"}),this.uploadedUrls.set(r,i),n={...n,status:{type:"requires-action",reason:"composer-send"}},yield n}catch{n={...n,status:{type:"incomplete",reason:"error"}},yield n}}async remove(e){this.uploadedUrls.delete(e.id)}async send(e){let t,r=this.uploadedUrls.get(e.id);if(!r)throw Error("Attachment not uploaded");return this.uploadedUrls.delete(e.id),t="image"===e.type?[{type:"image",image:r,filename:e.name}]:[{type:"file",data:r,mimeType:e.contentType??"",filename:e.name}],{...e,status:{type:"complete"},content:t}}}let gM=void 0!==ew.default&&ew.default?.env?.NEXT_PUBLIC_ASSISTANT_BASE_URL,gz=gM?new class{threads;auth;runs;files;telemetry;constructor(e){const t=new h9(e);this.threads=new gg(t),this.auth={tokens:new h8(t)},this.runs=new gf(t),this.files=new gv(t);const r=e.telemetry;this.telemetry=!1===r?{enabled:!1}:!0===r||void 0===r?{enabled:!0}:{enabled:!1!==r.enabled,...r}}}({baseUrl:gM,anonymous:!0}):void 0;class gD extends TransformStream{constructor(){const e=[];super({transform(t,r){if("part-start"===t.type)return 0!==t.path.length?void r.error(Error("Nested parts are not supported")):(e.push(t.part),void r.enqueue(t));if("text-delta"===t.type||"result"===t.type||"part-finish"===t.type||"tool-call-args-text-finish"===t.type){if(1!==t.path.length)return void r.error(Error(`${t.type} chunks must have a path of length 1`));let n=t.path[0];if(n<0||n>=e.length)return void r.error(Error(`Invalid path index: ${n}`));let i=e[n];return void r.enqueue({...t,meta:i})}r.enqueue(t)}})}}async function*gU(){let e=this.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}finally{e.releaseLock()}}function gL(e){return e[Symbol.asyncIterator]??=gU,e}function gZ(e,t){let r=e;for(let e of t){if(null==r)return;r=r[e]}return r}class gF{resolve;reject;disposed=!1;fieldPath;constructor(e,t,r){this.resolve=e,this.reject=t,this.fieldPath=r}update(e){if(!this.disposed)try{if("complete"===f1(e,this.fieldPath)){let t=gZ(e,this.fieldPath);void 0!==t&&(this.resolve(t),this.dispose())}}catch(e){this.reject(e),this.dispose()}}dispose(){this.disposed=!0}}class gB{controller;disposed=!1;fieldPath;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=gZ(e,this.fieldPath);void 0!==t&&this.controller.enqueue(t),"complete"===f1(e,this.fieldPath)&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}dispose(){this.disposed=!0}}class gV{controller;disposed=!1;fieldPath;lastValue=void 0;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=gZ(e,this.fieldPath);if(void 0!==t&&"string"==typeof t){let e=t.substring(this.lastValue?.length||0);this.lastValue=t,this.controller.enqueue(e)}"complete"===f1(e,this.fieldPath)&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}dispose(){this.disposed=!0}}class gq{controller;disposed=!1;fieldPath;processedIndexes=new Set;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=gZ(e,this.fieldPath);if(!Array.isArray(t))return;for(let r=0;r<t.length;r++)if(!this.processedIndexes.has(r)){let n=[...this.fieldPath,r];"complete"===f1(e,n)&&(this.controller.enqueue(t[r]),this.processedIndexes.add(r))}"complete"===f1(e,this.fieldPath)&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}dispose(){this.disposed=!0}}class gW{argTextDeltas;handles=new Set;args=fQ("");constructor(e){this.argTextDeltas=e,this.processStream()}async processStream(){try{let e="",t=this.argTextDeltas.getReader();for(;;){let{value:r,done:n}=await t.read();if(n)break;e+=r;let i=fQ(e);if(void 0!==i)for(let e of(this.args=i,this.handles))e.update(i)}}catch(e){for(let t of(console.error("Error processing argument stream:",e),this.handles))t.dispose()}}get(...e){return new Promise((t,r)=>{let n=new gF(t,r,e);if(this.args&&"complete"===f1(this.args,e)){let r=gZ(this.args,e);if(void 0!==r)return void t(r)}this.handles.add(n),n.update(this.args)})}streamValues(...e){return gL(new ReadableStream({start:t=>{let r=new gB(t,e);this.handles.add(r),r.update(this.args)},cancel:()=>{for(let e of this.handles)if(e instanceof gB){e.dispose(),this.handles.delete(e);break}}}))}streamText(...e){return gL(new ReadableStream({start:t=>{let r=new gV(t,e);this.handles.add(r),r.update(this.args)},cancel:()=>{for(let e of this.handles)if(e instanceof gV){e.dispose(),this.handles.delete(e);break}}}))}forEach(...e){return gL(new ReadableStream({start:t=>{let r=new gq(t,e);this.handles.add(r),r.update(this.args)},cancel:()=>{for(let e of this.handles)if(e instanceof gq){e.dispose(),this.handles.delete(e);break}}}))}}class gJ{promise;constructor(e){this.promise=e}get(){return this.promise}}class gH{args;response;writable;resolve;argsText="";constructor(){const e=new TransformStream;this.writable=e.writable,this.args=new gW(e.readable);const{promise:t,resolve:r}=ge();this.resolve=r,this.response=new gJ(t)}async appendArgsTextDelta(e){let t=this.writable.getWriter();try{await t.write(e)}catch(e){console.warn(e)}finally{t.releaseLock()}this.argsText+=e}setResponse(e){this.resolve(e)}result={get:async()=>(await this.response.get()).result}}class gK extends gp{constructor(e){const t=new Map,r=new Map;super(n=>{let i=new TransformStream({transform(n,i){switch(("part-finish"!==n.type||"tool-call"!==n.meta.type)&&i.enqueue(n),n.type){case"part-start":if("tool-call"===n.part.type){let t=new gH;r.set(n.part.toolCallId,t),e.streamCall({reader:t,toolCallId:n.part.toolCallId,toolName:n.part.toolName})}break;case"text-delta":if("tool-call"===n.meta.type){let e=n.meta.toolCallId,t=r.get(e);if(!t)throw Error("No controller found for tool call");t.appendArgsTextDelta(n.textDelta)}break;case"result":{if("tool-call"!==n.meta.type)break;let{toolCallId:e}=n.meta,t=r.get(e);if(!t)throw Error("No controller found for tool call");t.setResponse(new hv({result:n.result,artifact:n.artifact,isError:n.isError,modelContent:n.modelContent}));break}case"tool-call-args-text-finish":{if("tool-call"!==n.meta.type)break;let{toolCallId:a,toolName:o}=n.meta,s=r.get(a);if(!s)throw Error("No controller found for tool call");let l=!1,u=function(e,t,r){try{let n=e();if("object"==typeof n&&null!==n&&"then"in n)return n.then(t,r);t(n)}catch(e){r(e)}}(()=>{let t;try{t=fY.default.parse(s.argsText)}catch(e){throw Error(`Function parameter parsing failed. ${JSON.stringify(e.message)}`)}let r=e.execute({toolCallId:a,toolName:o,args:t});return void 0!==r&&(l=!0,e.onExecutionStart?.(a,o)),r},t=>{if(l&&e.onExecutionEnd?.(a,o),void 0===t)return;let r=new hv({artifact:t.artifact,result:t.result,isError:t.isError,messages:t.messages,modelContent:t.modelContent});s.setResponse(r),i.enqueue({type:"result",path:n.path,...r})},t=>{l&&e.onExecutionEnd?.(a,o);let r=new hv({result:String(t),isError:!0});s.setResponse(r),i.enqueue({type:"result",path:n.path,...r})});u&&t.set(a,u);break}case"part-finish":{if("tool-call"!==n.meta.type)break;let{toolCallId:e}=n.meta,a=t.get(e);a?a.then(()=>{t.delete(e),r.delete(e),i.enqueue(n)}):i.enqueue(n)}}},async flush(){await Promise.all(t.values())}});return n.pipeThrough(new gD).pipeThrough(i)})}}let gG=(e,t,r)=>{if(e===t)return!0;if(r>100||null==e||null==t)return!1;if(Array.isArray(e))return!!Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>gG(e,t[n],r+1));if(Array.isArray(t)||!gx(e)||!gx(t))return!1;let n=Object.keys(e),i=Object.keys(t);return n.length===i.length&&n.every(n=>Object.hasOwn(t,n)&&gG(e[n],t[n],r+1))},gY=e=>{try{return JSON.parse(e),!0}catch{return!1}},gX=e=>{try{return JSON.parse(e)}catch{return}},gQ=(e,t)=>{let r=gX(e),n=gX(t);return void 0!==r&&void 0!==n&&!!g_(r)&&!!g_(n)&&gG(r,n,0)};function g0({state:e,getTools:t,onResult:r,setToolStatuses:n}){let i=(0,ek.useRef)(new Map),a=(0,ek.useRef)(new Map),o=(0,ek.useRef)(new Set),s=(0,ek.useRef)(new Set),l=(0,ek.useRef)(new Map),u=(0,ek.useRef)(new Map),d=(0,ek.useRef)(new AbortController),c=(0,ek.useRef)(0),p=(0,ek.useRef)([]),m=(0,ek.useRef)(0),f=(0,ek.useRef)(!0),h=e=>a.current.get(e)??e,g=()=>{let e=t();if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>{let r=t.execute,n=t.streamCall,i=t.toModelOutput;return[e,{...t,...void 0!==r&&{execute:(...[e,t])=>s.current.has(t.toolCallId)?new Promise(()=>{}):r(e,{...t,toolCallId:h(t.toolCallId)})},...void 0!==n&&{streamCall:(...[e,t])=>n(e,{...t,toolCallId:h(t.toolCallId)})},...void 0!==i&&{toModelOutput:e=>i({...e,toolCallId:h(e.toolCallId)})}}]}))},[v]=(0,ek.useState)(()=>{var e,t,m;let f,v,[y,b]=gd(),x=(e=()=>d.current?.signal??new AbortController().signal,t=(e,t)=>{let r=h(e);return new Promise((e,i)=>{let a=l.current.get(r);a&&a.reject(Error("Human input request was superseded by a new request")),l.current.set(r,{resolve:e,reject:i}),n(e=>({...e,[r]:{type:"interrupt",payload:{type:"human",payload:t}}}))})},m={onExecutionStart:e=>{if(s.current.has(e))return;let t=h(e),r=o.current.has(e);u.current.set(e,{logicalToolCallId:t,abandoned:r}),c.current++,r||n(e=>({...e,[t]:{type:"executing"}}))},onExecutionEnd:e=>{let t=u.current.get(e);if(t){let r;u.current.delete(e),c.current--,t.abandoned||n(e=>{let r={...e};return delete r[t.logicalToolCallId],r}),0===c.current&&(r=p.current,p.current=[],r.forEach(e=>e()))}}},f=g,v=e,new gK({execute:e=>(function(e,t,r,n){let i=e?.[r.toolName];if(i?.execute)return(async e=>{let a;if(t.aborted)return new hv({result:"Tool execution was cancelled.",isError:!0});let o=e;if("object"==typeof(a=i.parameters)&&null!==a&&"~standard"in a&&1===a["~standard"].version){let e=i.parameters["~standard"].validate(r.args);e instanceof Promise&&(e=await e),e.issues&&(o=i.experimental_onSchemaValidationError??(()=>{throw Error(`Function parameter validation failed. ${JSON.stringify(e.issues)}`)}))}let s=new Promise(e=>{let r=()=>{queueMicrotask(()=>{queueMicrotask(()=>{e(new hv({result:"Tool execution was cancelled.",isError:!0}))})})};t.aborted?r():t.addEventListener("abort",r,{once:!0})});return Promise.race([(async()=>{let e=await o(r.args,{toolCallId:r.toolCallId,abortSignal:t,human:e=>n(r.toolCallId,e)}),a=hv.toResponse(e);if(i.toModelOutput&&!a.isError&&void 0===a.modelContent)try{let e=await i.toModelOutput({toolCallId:r.toolCallId,input:r.args,output:a.result});return new hv({result:a.result,artifact:a.artifact,isError:a.isError,messages:a.messages,modelContent:e})}catch(e){console.warn(`[assistant-stream] tool "${r.toolName}" toModelOutput threw; falling back to default projection.`,e)}return a})(),s])})(i.execute)})(f(),v(),e,t),streamCall:({reader:e,...r})=>{var n,i;return n=f(),i=v(),void n?.[r.toolName]?.streamCall?.(e,{toolCallId:r.toolCallId,abortSignal:i,human:e=>t(r.toolCallId,e)})},onExecutionStart:m?.onExecutionStart,onExecutionEnd:m?.onExecutionEnd}));return y.pipeThrough(x).pipeThrough(new gD).pipeTo(new WritableStream({write(e){if("result"!==e.type)return;let t=e.meta.toolCallId,n=h(t),l=i.current.get(n);o.current.delete(t)?a.current.delete(t):!l&&s.current.has(t)||l?.hasResult||(t!==n&&a.current.delete(t),r({type:"add-tool-result",toolCallId:n,toolName:e.meta.toolName,result:e.result,isError:e.isError,...void 0!==e.artifact&&{artifact:e.artifact},...void 0!==e.modelContent&&{modelContent:e.modelContent}}))}})),b});(0,ek.useEffect)(()=>{let r=({toolName:r,argsText:n,hasResult:i})=>{let a;return!!i||((a=t()?.[r],a?.execute===void 0&&a?.streamCall===void 0)?!e.isRunning&&gY(n):gY(n))},n=(e,t)=>{if(!e.controller)return;o.current.add(e.streamId);let r=s.current.has(e.streamId);e.controller.argsText.close();let n=`${t}:rewrite:${m.current++}`;a.current.set(n,t);let i=v.addToolCallPart({toolName:e.toolName,toolCallId:n});r&&s.current.add(n),e.controller=i,e.streamId=n,e.argsText="",e.argsComplete=!1},l=e=>{let t=f.current;e.forEach(e=>{e.content.forEach(e=>{var a,o,d;let c,p;if("tool-call"!==e.type)return;let m=i.current.get(e.toolCallId);if(t){m?.controller||i.current.set(e.toolCallId,{toolName:e.toolName,argsText:e.argsText,hasResult:void 0!==e.result}),e.messages&&l(e.messages);return}let f=m;if(f&&!f.controller){if(e.argsText===f.argsText&&void 0!==e.result===f.hasResult){e.messages&&l(e.messages);return}i.current.delete(e.toolCallId),f=void 0}if(f||(a=e.toolCallId,o=e.toolName,d=void 0!==e.result,c=v.addToolCallPart({toolName:o,toolCallId:a}),d&&s.current.add(a),p={toolName:o,controller:c,streamId:a,argsText:"",hasResult:!1,argsComplete:!1},i.current.set(a,p),f=p),((e,t)=>{if(!e.controller)return;let i=void 0!==t.result;if(t.argsText!==e.argsText){let a=!0;if(e.argsComplete)gQ(e.argsText,t.argsText)?(e.argsText=t.argsText,a=!1):e.hasResult||u.current.has(e.streamId)?(e.argsText=t.argsText,a=!1):n(e,t.toolCallId);else if(!t.argsText.startsWith(e.argsText))if(gY(e.argsText)&&gY(t.argsText)&&gQ(e.argsText,t.argsText)){let n=r({toolName:t.toolName,argsText:t.argsText,hasResult:i});n&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=n,a=!1}else n(e,t.toolCallId);if(a){let n=t.argsText.slice(e.argsText.length);e.controller.argsText.append(n);let a=r({toolName:t.toolName,argsText:t.argsText,hasResult:i});a&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=a}}!e.argsComplete&&r({toolName:t.toolName,argsText:t.argsText,hasResult:i})&&(e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=!0)})(f,e),void 0!==e.result&&!f.hasResult){let{controller:t}=f;if(!t)return;f.hasResult=!0,f.argsComplete=!0,t.setResponse(new hv({result:e.result,artifact:e.artifact,isError:e.isError,...void 0!==e.modelContent?{modelContent:e.modelContent}:{}})),t.close()}e.messages&&l(e.messages)})})};l(e.messages),f.current=!1},[e,v,t]);let y=()=>(l.current.forEach(({reject:e})=>{e(Error("Tool execution aborted"))}),l.current.clear(),d.current.abort(),d.current=new AbortController,0===c.current)?Promise.resolve():new Promise(e=>{p.current.push(e)});return{reset:()=>{f.current=!0,i.current.clear(),y().finally(()=>{u.current.clear(),a.current.clear(),m.current=0})},abort:y,resume:(e,t)=>{let r=l.current.get(e);if(r)l.current.delete(e),n(t=>({...t,[e]:{type:"executing"}})),r.resolve(t);else throw Error(`Tool call ${e} is not waiting for human input`)}}}e.s(["AssistantRuntimeImpl",0,h$,"BaseAssistantRuntimeCore",0,f8,"CompositeContextProvider",0,t1,"DefaultThreadComposerRuntimeCore",0,fB,"MessageRepository",0,f9,"ThreadRuntimeImpl",0,hw,"fromThreadMessageLike",0,f4,"generateId",0,fU,"getAutoStatus",0,fG,"splitLocalRuntimeOptions",0,e=>{let{cloud:t,initialMessages:r,maxSteps:n,adapters:i,unstable_humanToolNames:a,...o}=e;return{localRuntimeOptions:{cloud:t,initialMessages:r,maxSteps:n,adapters:i,unstable_humanToolNames:a},otherOptions:o}},"useComposerInputPluginRegistryOptional",0,sH,"useSmooth",0,dd,"useSmoothStatus",0,da,"useToolInvocations",0,g0,"withSmoothContextProvider",0,e=>{let t=(0,ek.forwardRef)((t,r)=>(0,e_.jsx)(dn,{children:(0,e_.jsx)(e,{...t,ref:r})}));return t.displayName=e.displayName,t}],31116);var g1=e.i(31116),g1=g1;function g2(){}function g4(){}let g6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,g5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,g3={};function g9(e,t){return((t||g3).jsx?g5:g6).test(e)}let g8=/[ \t\n\f\r]/g;function g7(e){return""===e.replace(g8,"")}class ve{constructor(e,t){this.attribute=t,this.property=e}}ve.prototype.attribute="",ve.prototype.booleanish=!1,ve.prototype.boolean=!1,ve.prototype.commaOrSpaceSeparated=!1,ve.prototype.commaSeparated=!1,ve.prototype.defined=!1,ve.prototype.mustUseProperty=!1,ve.prototype.number=!1,ve.prototype.overloadedBoolean=!1,ve.prototype.property="",ve.prototype.spaceSeparated=!1,ve.prototype.space=void 0;let vt=0,vr=vu(),vn=vu(),vi=vu(),va=vu(),vo=vu(),vs=vu(),vl=vu();function vu(){return 2**++vt}e.s(["boolean",0,vr,"booleanish",0,vn,"commaOrSpaceSeparated",0,vl,"commaSeparated",0,vs,"number",0,va,"overloadedBoolean",0,vi,"spaceSeparated",0,vo],744);var vd=e.i(744);let vc=Object.keys(vd);class vp extends ve{constructor(e,t,r,n){let i=-1;if(super(e,t),function(e,t,r){r&&(e[t]=r)}(this,"space",n),"number"==typeof r)for(;++i<vc.length;){const e=vc[i];!function(e,t,r){r&&(e[t]=r)}(this,vc[i],(r&vd[e])===vd[e])}}}function vm(e){return e.toLowerCase()}vp.prototype.defined=!0;let vf=/[A-Z]/g,vh=/-[a-z]/g,vg=/^data[-\w.:]+$/i;function vv(e){return"-"+e.toLowerCase()}function vy(e){return e.charAt(1).toUpperCase()}let vb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class vx{constructor(e,t,r){this.normal=t,this.property=e,r&&(this.space=r)}}function v_(e,t){let r={},n={};for(let t of e)Object.assign(r,t.property),Object.assign(n,t.normal);return new vx(r,n,t)}function vw(e){let t={},r={};for(let[n,i]of Object.entries(e.properties)){let a=new vp(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(a.mustUseProperty=!0),t[n]=a,r[vm(n)]=n,r[vm(a.attribute)]=n}return new vx(t,r,e.space)}vx.prototype.normal={},vx.prototype.property={},vx.prototype.space=void 0;let vk=vw({properties:{ariaActiveDescendant:null,ariaAtomic:vn,ariaAutoComplete:null,ariaBusy:vn,ariaChecked:vn,ariaColCount:va,ariaColIndex:va,ariaColSpan:va,ariaControls:vo,ariaCurrent:null,ariaDescribedBy:vo,ariaDetails:null,ariaDisabled:vn,ariaDropEffect:vo,ariaErrorMessage:null,ariaExpanded:vn,ariaFlowTo:vo,ariaGrabbed:vn,ariaHasPopup:null,ariaHidden:vn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vo,ariaLevel:va,ariaLive:null,ariaModal:vn,ariaMultiLine:vn,ariaMultiSelectable:vn,ariaOrientation:null,ariaOwns:vo,ariaPlaceholder:null,ariaPosInSet:va,ariaPressed:vn,ariaReadOnly:vn,ariaRelevant:null,ariaRequired:vn,ariaRoleDescription:vo,ariaRowCount:va,ariaRowIndex:va,ariaRowSpan:va,ariaSelected:vn,ariaSetSize:va,ariaSort:null,ariaValueMax:va,ariaValueMin:va,ariaValueNow:va,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function vI(e,t){return t in e?e[t]:t}function vS(e,t){return vI(e,t.toLowerCase())}let v$=vw({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:vs,acceptCharset:vo,accessKey:vo,action:null,allow:null,allowFullScreen:vr,allowPaymentRequest:vr,allowUserMedia:vr,alt:null,as:null,async:vr,autoCapitalize:null,autoComplete:vo,autoFocus:vr,autoPlay:vr,blocking:vo,capture:null,charSet:null,checked:vr,cite:null,className:vo,cols:va,colSpan:null,content:null,contentEditable:vn,controls:vr,controlsList:vo,coords:va|vs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:vr,defer:vr,dir:null,dirName:null,disabled:vr,download:vi,draggable:vn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:vr,formTarget:null,headers:vo,height:va,hidden:vi,high:va,href:null,hrefLang:null,htmlFor:vo,httpEquiv:vo,id:null,imageSizes:null,imageSrcSet:null,inert:vr,inputMode:null,integrity:null,is:null,isMap:vr,itemId:null,itemProp:vo,itemRef:vo,itemScope:vr,itemType:vo,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:vr,low:va,manifest:null,max:null,maxLength:va,media:null,method:null,min:null,minLength:va,multiple:vr,muted:vr,name:null,nonce:null,noModule:vr,noValidate:vr,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:vr,optimum:va,pattern:null,ping:vo,placeholder:null,playsInline:vr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:vr,referrerPolicy:null,rel:vo,required:vr,reversed:vr,rows:va,rowSpan:va,sandbox:vo,scope:null,scoped:vr,seamless:vr,selected:vr,shadowRootClonable:vr,shadowRootDelegatesFocus:vr,shadowRootMode:null,shape:null,size:va,sizes:null,slot:null,span:va,spellCheck:vn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:va,step:null,style:null,tabIndex:va,target:null,title:null,translate:null,type:null,typeMustMatch:vr,useMap:null,value:vn,width:va,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vo,axis:null,background:null,bgColor:null,border:va,borderColor:null,bottomMargin:va,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:vr,declare:vr,event:null,face:null,frame:null,frameBorder:null,hSpace:va,leftMargin:va,link:null,longDesc:null,lowSrc:null,marginHeight:va,marginWidth:va,noResize:vr,noHref:vr,noShade:vr,noWrap:vr,object:null,profile:null,prompt:null,rev:null,rightMargin:va,rules:null,scheme:null,scrolling:vn,standby:null,summary:null,text:null,topMargin:va,valueType:null,version:null,vAlign:null,vLink:null,vSpace:va,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:vr,disableRemotePlayback:vr,prefix:null,property:null,results:va,security:null,unselectable:null},space:"html",transform:vS}),vj=vw({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vl,accentHeight:va,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:va,amplitude:va,arabicForm:null,ascent:va,attributeName:null,attributeType:null,azimuth:va,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:va,by:null,calcMode:null,capHeight:va,className:vo,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:va,diffuseConstant:va,direction:null,display:null,dur:null,divisor:va,dominantBaseline:null,download:vr,dx:null,dy:null,edgeMode:null,editable:null,elevation:va,enableBackground:null,end:null,event:null,exponent:va,externalResourcesRequired:null,fill:null,fillOpacity:va,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:vs,g2:vs,glyphName:vs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:va,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:va,horizOriginX:va,horizOriginY:va,id:null,ideographic:va,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:va,k:va,k1:va,k2:va,k3:va,k4:va,kernelMatrix:vl,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:va,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:va,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:va,overlineThickness:va,paintOrder:null,panose1:null,path:null,pathLength:va,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:vo,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:va,pointsAtY:va,pointsAtZ:va,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vl,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vl,rev:vl,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vl,requiredFeatures:vl,requiredFonts:vl,requiredFormats:vl,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:va,specularExponent:va,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:va,strikethroughThickness:va,string:null,stroke:null,strokeDashArray:vl,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:va,strokeOpacity:va,strokeWidth:null,style:null,surfaceScale:va,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vl,tabIndex:va,tableValues:null,target:null,targetX:va,targetY:va,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vl,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:va,underlineThickness:va,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:va,values:null,vAlphabetic:va,vMathematical:va,vectorEffect:null,vHanging:va,vIdeographic:va,version:null,vertAdvY:va,vertOriginX:va,vertOriginY:va,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:va,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vI}),vE=vw({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),vC=vw({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vS}),vT=vw({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),vN=v_([vk,v$,vE,vC,vT],"html"),vA=v_([vk,vj,vE,vC,vT],"svg");var vR=e.i(15511);let vP=vM("end"),vO=vM("start");function vM(e){return function(t){let r=t&&t.position&&t.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function vz(e){return e&&"object"==typeof e?"position"in e||"type"in e?vU(e.position):"start"in e||"end"in e?vU(e):"line"in e||"column"in e?vD(e):"":""}function vD(e){return vL(e&&e.line)+":"+vL(e&&e.column)}function vU(e){return vD(e&&e.start)+"-"+vD(e&&e.end)}function vL(e){return e&&"number"==typeof e?e:1}class vZ extends Error{constructor(e,t,r){super(),"string"==typeof t&&(r=t,t=void 0);let n="",i={},a=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!i.cause&&e&&(a=!0,n=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof r){const e=r.indexOf(":");-1===e?i.ruleId=r:(i.source=r.slice(0,e),i.ruleId=r.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=o?o.line:void 0,this.name=vz(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vZ.prototype.file="",vZ.prototype.name="",vZ.prototype.reason="",vZ.prototype.message="",vZ.prototype.stack="",vZ.prototype.column=void 0,vZ.prototype.line=void 0,vZ.prototype.ancestors=void 0,vZ.prototype.cause=void 0,vZ.prototype.fatal=void 0,vZ.prototype.place=void 0,vZ.prototype.ruleId=void 0,vZ.prototype.source=void 0;let vF={}.hasOwnProperty,vB=new Map,vV=/[A-Z]/g,vq=new Set(["table","tbody","thead","tfoot","tr"]),vW=new Set(["td","th"]),vJ="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vH(e,t,r){var n,i,a,o,s,l,u,d,c;let p,m,f,h,g,v,y,b,x,_,w;return"element"===t.type?(n=e,i=t,a=r,m=p=n.schema,"svg"===i.tagName.toLowerCase()&&"html"===p.space&&(n.schema=vA),n.ancestors.push(i),f=vX(n,i.tagName,!1),h=function(e,t){let r,n,i={};for(n in t.properties)if("children"!==n&&vF.call(t.properties,n)){let a=function(e,t,r){let n=function(e,t){let r=vm(t),n=t,i=ve;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&"data"===r.slice(0,4)&&vg.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(vh,vy);n="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!vh.test(e)){let r=e.replace(vf,vv);"-"!==r.charAt(0)&&(r="-"+r),t="data"+r}}i=vp}return new i(n,t)}(e.schema,t);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){var i;let t;if(Array.isArray(r)&&(r=n.commaSeparated?(t={},(""===(i=r)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):r.join(" ").trim()),"style"===n.property){let t="object"==typeof r?r:function(e,t){try{return(0,vR.default)(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};let t=new vZ("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=vJ+"#cannot-parse-style-attribute",t}}(e,String(r));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,r={};for(t in e)vF.call(e,t)&&(r[function(e){let t=e.replace(vV,v0);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return r}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&n.space?vb[n.property]||n.property:n.attribute,r]}}(e,n,t.properties[n]);if(a){let[n,o]=a;e.tableCellAlignToStyle&&"align"===n&&"string"==typeof o&&vW.has(t.tagName)?r=o:i[n]=o}}return r&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),i}(n,i),g=vY(n,i),vq.has(i.tagName)&&(g=g.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&g7(e.value):g7(e))})),vK(n,h,f,i),vG(h,g),n.ancestors.pop(),n.schema=p,n.create(i,f,h,a)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return g2("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}vQ(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=r,y=v=o.schema,"svg"===s.name&&"html"===v.space&&(o.schema=vA),o.ancestors.push(s),b=null===s.name?o.Fragment:vX(o,s.name,!0),x=function(e,t){let r={};for(let n of t.attributes)if("mdxJsxExpressionAttribute"===n.type)if(n.data&&n.data.estree&&e.evaluater){let t=n.data.estree.body[0];g2("ExpressionStatement"===t.type);let i=t.expression;g2("ObjectExpression"===i.type);let a=i.properties[0];g2("SpreadElement"===a.type),Object.assign(r,e.evaluater.evaluateExpression(a.argument))}else vQ(e,t.position);else{let i,a=n.name;if(n.value&&"object"==typeof n.value)if(n.value.data&&n.value.data.estree&&e.evaluater){let t=n.value.data.estree.body[0];g2("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else vQ(e,t.position);else i=null===n.value||n.value;r[a]=i}return r}(o,s),_=vY(o,s),vK(o,x,b,s),vG(x,_),o.ancestors.pop(),o.schema=v,o.create(s,b,x,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vQ(e,t.position)}(e,t):"root"===t.type?(u=e,d=t,c=r,vG(w={},vY(u,d)),u.create(d,u.Fragment,w,c)):"text"===t.type?t.value:void 0}function vK(e,t,r,n){"string"!=typeof r&&r!==e.Fragment&&e.passNode&&(t.node=n)}function vG(e,t){if(t.length>0){let r=t.length>1?t:t[0];r&&(e.children=r)}}function vY(e,t){let r=[],n=-1,i=e.passKeys?new Map:vB;for(;++n<t.children.length;){let a,o=t.children[n];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}let s=vH(e,o,a);void 0!==s&&r.push(s)}return r}function vX(e,t,r){let n;if(r)if(t.includes(".")){let e,r=t.split("."),i=-1;for(;++i<r.length;){let t=g9(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}g2(e,"always a result"),n=e}else n=g9(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else n={type:"Literal",value:t};if("Literal"===n.type){let t=n.value;return vF.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(n);vQ(e)}function vQ(e,t){let r=new vZ("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=vJ+"#cannot-handle-mdx-estrees-without-createevaluater",r}function v0(e){return"-"+e.toLowerCase()}let v1={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},v2={};function v4(e,t){let r=t||v2;return v6(e,"boolean"!=typeof r.includeImageAlt||r.includeImageAlt,"boolean"!=typeof r.includeHtml||r.includeHtml)}function v6(e,t,r){var n;if((n=e)&&"object"==typeof n){if("value"in e)return"html"!==e.type||r?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return v5(e.children,t,r)}return Array.isArray(e)?v5(e,t,r):""}function v5(e,t,r){let n=[],i=-1;for(;++i<e.length;)n[i]=v6(e[i],t,r);return n.join("")}function v3(e,t,r,n){let i,a=e.length,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,r=r>0?r:0,n.length<1e4)(i=Array.from(n)).unshift(t,r),e.splice(...i);else for(r&&e.splice(t,r);o<n.length;)(i=n.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function v9(e,t){return e.length>0?(v3(e,e.length,0,t),e):t}let v8={}.hasOwnProperty;function v7(e){let t={},r=-1;for(;++r<e.length;)!function(e,t){let r;for(r in t){let n,i=(v8.call(e,r)?e[r]:void 0)||(e[r]={}),a=t[r];if(a)for(n in a){v8.call(i,n)||(i[n]=[]);let e=a[n];!function(e,t){let r=-1,n=[];for(;++r<t.length;)("after"===t[r].add?e:n).push(t[r]);v3(e,0,0,n)}(i[n],Array.isArray(e)?e:e?[e]:[])}}}(t,e[r]);return t}let ye=yp(/[A-Za-z]/),yt=yp(/[\dA-Za-z]/),yr=yp(/[#-'*+\--9=?A-Z^-~]/);function yn(e){return null!==e&&(e<32||127===e)}let yi=yp(/\d/),ya=yp(/[\dA-Fa-f]/),yo=yp(/[!-/:-@[-`{-~]/);function ys(e){return null!==e&&e<-2}function yl(e){return null!==e&&(e<0||32===e)}function yu(e){return -2===e||-1===e||32===e}let yd=yp(/\p{P}|\p{S}/u),yc=yp(/\s/);function yp(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function ym(e,t,r,n){let i=n?n-1:1/0,a=0;return function(n){return yu(n)?(e.enter(r),function n(o){return yu(o)&&a++<i?(e.consume(o),n):(e.exit(r),t(o))}(n)):t(n)}}let yf={tokenize:function(e){let t,r=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),ym(e,r,"linePrefix"))},function(r){return e.enter("paragraph"),function r(n){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(n){if(null===n){e.exit("chunkText"),e.exit("paragraph"),e.consume(n);return}return ys(n)?(e.consume(n),e.exit("chunkText"),r):(e.consume(n),t)}(n)}(r)});return r}},yh={tokenize:function(e){let t,r,n,i=this,a=[],o=0;return s;function s(t){if(o<a.length){let r=a[o];return i.containerState=r[1],e.attempt(r[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,i.containerState._closeFlow){let r;i.containerState._closeFlow=void 0,t&&v();let n=i.events.length,a=n;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){r=i.events[a][1].end;break}g(o);let s=n;for(;s<i.events.length;)i.events[s][1].end={...r},s++;return v3(i.events,a+1,0,i.events.slice(n)),i.events.length=s,u(e)}return s(e)}function u(r){if(o===a.length){if(!t)return p(r);if(t.currentConstruct&&t.currentConstruct.concrete)return f(r);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(yg,d,c)(r)}function d(e){return t&&v(),g(o),p(e)}function c(e){return i.parser.lazy[i.now().line]=o!==a.length,n=i.now().offset,f(e)}function p(t){return i.containerState={},e.attempt(yg,m,f)(t)}function m(e){return o++,a.push([i.currentConstruct,i.containerState]),p(e)}function f(n){if(null===n){t&&v(),g(0),e.consume(n);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:r}),function t(r){if(null===r){h(e.exit("chunkFlow"),!0),g(0),e.consume(r);return}return ys(r)?(e.consume(r),h(e.exit("chunkFlow")),o=0,i.interrupt=void 0,s):(e.consume(r),t)}(n)}function h(e,a){let s=i.sliceStream(e);if(a&&s.push(null),e.previous=r,r&&(r.next=e),r=e,t.defineSkip(e.start),t.write(s),i.parser.lazy[e.start.line]){let e,r,a=t.events.length;for(;a--;)if(t.events[a][1].start.offset<n&&(!t.events[a][1].end||t.events[a][1].end.offset>n))return;let s=i.events.length,l=s;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){r=i.events[l][1].end;break}e=!0}for(g(o),a=s;a<i.events.length;)i.events[a][1].end={...r},a++;v3(i.events,l+1,0,i.events.slice(s)),i.events.length=a}}function g(t){let r=a.length;for(;r-- >t;){let t=a[r];i.containerState=t[1],t[0].exit.call(i,e)}a.length=t}function v(){t.write([null]),r=void 0,t=void 0,i.containerState._closeFlow=void 0}}},yg={tokenize:function(e,t,r){return ym(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},yv={partial:!0,tokenize:function(e,t,r){return function(t){return yu(t)?ym(e,n,"linePrefix")(t):n(t)};function n(e){return null===e||ys(e)?t(e):r(e)}}};class yy{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let r=null==t?1/0:t;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){this.setCursor(Math.trunc(e));let n=this.right.splice(this.right.length-(t||0),1/0);return r&&yb(this.left,r),n.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),yb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),yb(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);yb(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);yb(this.left,t.reverse())}}}function yb(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function yx(e){let t,r,n,i,a,o,s,l={},u=-1,d=new yy(e);for(;++u<d.length;){for(;u in l;)u=l[u];if(t=d.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===d.get(u-1)[1].type&&((n=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[n][1].type&&(n+=2),n<o.length&&"content"===o[n][1].type))for(;++n<o.length&&"content"!==o[n][1].type;)"chunkText"===o[n][1].type&&(o[n][1]._isInFirstContentOfListItem=!0,n++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let r,n,i=e.get(t)[1],a=e.get(t)[2],o=t-1,s=[],l=i._tokenizer;!l&&(l=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,d=[],c={},p=-1,m=i,f=0,h=0,g=[0];for(;m;){for(;e.get(++o)[1]!==m;);s.push(o),!m._tokenizer&&(r=a.sliceStream(m),m.next||r.push(null),n&&l.defineSkip(m.start),m._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(r),m._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),n=m,m=m.next}for(m=i;++p<u.length;)"exit"===u[p][0]&&"enter"===u[p-1][0]&&u[p][1].type===u[p-1][1].type&&u[p][1].start.line!==u[p][1].end.line&&(h=p+1,g.push(h),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(l.events=[],m?(m._tokenizer=void 0,m.previous=void 0):g.pop(),p=g.length;p--;){let t=u.slice(g[p],g[p+1]),r=s.pop();d.push([r,r+t.length-1]),e.splice(r,2,t)}for(d.reverse(),p=-1;++p<d.length;)c[f+d[p][0]]=f+d[p][1],f+=d[p][1]-d[p][0]-1;return c}(d,u)),u=l[u],s=!0);else if(t[1]._container){for(n=u,r=void 0;n--;)if("lineEnding"===(i=d.get(n))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(r&&(d.get(r)[1].type="lineEndingBlank"),i[1].type="lineEnding",r=n);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;r&&(t[1].end={...d.get(r)[1].start},(a=d.slice(r,u)).unshift(t),d.splice(r,u-r+1,a))}}return v3(e,0,1/0,d.slice(0)),!s}let y_={resolve:function(e){return yx(e),e},tokenize:function(e,t){let r;return function(t){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?i(t):ys(t)?e.check(yw,a,i)(t):(e.consume(t),n)}function i(r){return e.exit("chunkContent"),e.exit("content"),t(r)}function a(t){return e.consume(t),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}},yw={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),ym(e,i,"linePrefix")};function i(i){if(null===i||ys(i))return r(i);let a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(n.parser.constructs.flow,r,t)(i)}}},yk={tokenize:function(e){let t=this,r=e.attempt(yv,function(n){return null===n?void e.consume(n):(e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r)},e.attempt(this.parser.constructs.flowInitial,n,ym(e,e.attempt(this.parser.constructs.flow,n,e.attempt(y_,n)),"linePrefix")));return r;function n(n){return null===n?void e.consume(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,r)}}},yI={resolveAll:yE()},yS=yj("string"),y$=yj("text");function yj(e){return{resolveAll:yE("text"===e?yC:void 0),tokenize:function(t){let r=this,n=this.parser.constructs[e],i=t.attempt(n,a,o);return a;function a(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=n[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(r,r.previous))return!0}return!1}}}}function yE(e){return function(t,r){let n,i=-1;for(;++i<=t.length;)void 0===n?t[i]&&"data"===t[i][1].type&&(n=i,i++):t[i]&&"data"===t[i][1].type||(i!==n+2&&(t[n][1].end=t[i-1][1].end,t.splice(n+2,i-n-2),i=n+2),n=void 0);return e?e(t,r):t}}function yC(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||"lineEnding"===e[r][1].type)&&"data"===e[r-1][1].type){let n,i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,l=0;for(;o--;){let e=a[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)n=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){let a={type:r===e.length||n||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):(e.splice(r,0,["enter",a,t],["exit",a,t]),r+=2)}r++}return e}function yT(e){return null===e||yl(e)||yc(e)?1:yd(e)?2:void 0}function yN(e,t,r){let n=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!n.includes(a)&&(t=a(t,r),n.push(a))}return t}let yA={name:"attention",resolveAll:function(e,t){let r,n,i,a,o,s,l,u,d=-1;for(;++d<e.length;)if("enter"===e[d][0]&&"attentionSequence"===e[d][1].type&&e[d][1]._close){for(r=d;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[d][1]).charCodeAt(0)){if((e[r][1]._close||e[d][1]._open)&&(e[d][1].end.offset-e[d][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[d][1].end.offset-e[d][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[d][1].end.offset-e[d][1].start.offset>1?2:1;let c={...e[r][1].end},p={...e[d][1].start};yR(c,-s),yR(p,s),a={type:s>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[d][1].start},end:p},i={type:s>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[d][1].start}},n={type:s>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[d][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=v9(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=v9(l,[["enter",n,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=v9(l,yN(t.parser.constructs.insideSpan.null,e.slice(r+1,d),t)),l=v9(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",n,t]]),e[d][1].end.offset-e[d][1].start.offset?(u=2,l=v9(l,[["enter",e[d][1],t],["exit",e[d][1],t]])):u=0,v3(e,r-1,d-r+3,l),d=r+l.length-u-2;break}}for(d=-1;++d<e.length;)"attentionSequence"===e[d][1].type&&(e[d][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=yT(i);return function(o){return r=o,e.enter("attentionSequence"),function o(s){if(s===r)return e.consume(s),o;let l=e.exit("attentionSequence"),u=yT(s),d=!u||2===u&&a||n.includes(s),c=!a||2===a&&u||n.includes(i);return l._open=!!(42===r?d:d&&(a||!c)),l._close=!!(42===r?c:c&&(u||!d)),t(s)}(o)}}};function yR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let yP={continuation:{tokenize:function(e,t,r){let n=this;return function(t){return yu(t)?ym(e,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(n){return e.attempt(yP,t,r)(n)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,r){let n=this;return function(t){if(62===t){let r=n.containerState;return r.open||(e.enter("blockQuote",{_container:!0}),r.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return r(t)};function i(r){return yu(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(r))}}},yO={name:"characterEscape",tokenize:function(e,t,r){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),n};function n(n){return yo(n)?(e.enter("characterEscapeValue"),e.consume(n),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(n)}}},yM=document.createElement("i");function yz(e){let t="&"+e+";";yM.innerHTML=t;let r=yM.textContent;return(59!==r.charCodeAt(r.length-1)||"semi"===e)&&r!==t&&r}let yD={name:"characterReference",tokenize:function(e,t,r){let n,i,a=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),n=31,i=yt,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),n=6,i=ya,u):(e.enter("characterReferenceValue"),n=7,i=yi,u(t))}function u(s){if(59===s&&o){let n=e.exit("characterReferenceValue");return i!==yt||yz(a.sliceSerialize(n))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):r(s)}return i(s)&&o++<n?(e.consume(s),u):r(s)}}},yU={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return null===t?r(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},yL={concrete:!0,name:"codeFenced",tokenize:function(e,t,r){let n,i=this,a={partial:!0,tokenize:function(e,t,r){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),yu(t)?ym(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===n?(e.enter("codeFencedFenceSequence"),function t(i){return i===n?(a++,e.consume(i),t):a>=s?(e.exit("codeFencedFenceSequence"),yu(i)?ym(e,u,"whitespace")(i):u(i)):r(i)}(t)):r(t)}function u(n){return null===n||ys(n)?(e.exit("codeFencedFence"),t(n)):r(n)}}},o=0,s=0;return function(t){var a;let u;return a=t,o=(u=i.events[i.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,n=a,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===n?(s++,e.consume(i),t):s<3?r(i):(e.exit("codeFencedFenceSequence"),yu(i)?ym(e,l,"whitespace")(i):l(i))}(a)};function l(a){return null===a||ys(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(yU,d,f)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||ys(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):yu(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ym(e,u,"whitespace")(i)):96===i&&i===n?r(i):(e.consume(i),t)}(a))}function u(t){return null===t||ys(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||ys(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===n?r(i):(e.consume(i),t)}(t))}function d(t){return e.attempt(a,f,c)(t)}function c(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return o>0&&yu(t)?ym(e,m,"linePrefix",o+1)(t):m(t)}function m(t){return null===t||ys(t)?e.check(yU,d,f)(t):(e.enter("codeFlowValue"),function t(r){return null===r||ys(r)?(e.exit("codeFlowValue"),m(r)):(e.consume(r),t)}(t))}function f(r){return e.exit("codeFenced"),t(r)}}},yZ={name:"codeIndented",tokenize:function(e,t,r){let n=this;return function(t){return e.enter("codeIndented"),ym(e,i,"linePrefix",5)(t)};function i(t){let i=n.events[n.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(r){return null===r?a(r):ys(r)?e.attempt(yF,t,a)(r):(e.enter("codeFlowValue"),function r(n){return null===n||ys(n)?(e.exit("codeFlowValue"),t(n)):(e.consume(n),r)}(r))}(t):r(t)}function a(r){return e.exit("codeIndented"),t(r)}}},yF={partial:!0,tokenize:function(e,t,r){let n=this;return i;function i(t){return n.parser.lazy[n.now().line]?r(t):ys(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):ym(e,a,"linePrefix",5)(t)}function a(e){let a=n.events[n.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):ys(e)?i(e):r(e)}}};function yB(e,t,r,n,i,a,o,s,l){let u=l||1/0,d=0;return function(t){return 60===t?(e.enter(n),e.enter(i),e.enter(a),e.consume(t),e.exit(a),c):null===t||32===t||41===t||yn(t)?r(t):(e.enter(n),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),f(t))};function c(r){return 62===r?(e.enter(a),e.consume(r),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(r))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(s),c(t)):null===t||60===t||ys(t)?r(t):(e.consume(t),92===t?m:p)}function m(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function f(i){return!d&&(null===i||41===i||yl(i))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(n),t(i)):d<u&&40===i?(e.consume(i),d++,f):41===i?(e.consume(i),d--,f):null===i||32===i||40===i||yn(i)?r(i):(e.consume(i),92===i?h:f)}function h(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function yV(e,t,r,n,i,a){let o,s=this,l=0;return function(t){return e.enter(n),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u};function u(c){return l>999||null===c||91===c||93===c&&!o||94===c&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):93===c?(e.exit(a),e.enter(i),e.consume(c),e.exit(i),e.exit(n),t):ys(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(c))}function d(t){return null===t||91===t||93===t||ys(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!yu(t)),92===t?c:d)}function c(t){return 91===t||92===t||93===t?(e.consume(t),l++,d):d(t)}}function yq(e,t,r,n,i,a){let o;return function(t){return 34===t||39===t||40===t?(e.enter(n),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,s):r(t)};function s(r){return r===o?(e.enter(i),e.consume(r),e.exit(i),e.exit(n),t):(e.enter(a),l(r))}function l(t){return t===o?(e.exit(a),s(o)):null===t?r(t):ys(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),ym(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||ys(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?d:u)}function d(t){return t===o||92===t?(e.consume(t),u):u(t)}}function yW(e,t){let r;return function n(i){return ys(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):yu(i)?ym(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}function yJ(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let yH={partial:!0,tokenize:function(e,t,r){return function(t){return yl(t)?yW(e,n)(t):r(t)};function n(t){return yq(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return yu(t)?ym(e,a,"whitespace")(t):a(t)}function a(e){return null===e||ys(e)?t(e):r(e)}}},yK=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],yG=["pre","script","style","textarea"],yY={partial:!0,tokenize:function(e,t,r){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(yv,t,r)}}},yX={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return ys(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):r(t)};function i(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},yQ={name:"labelEnd",resolveAll:function(e){let t=-1,r=[];for(;++t<e.length;){let n=e[t][1];if(r.push(e[t]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){let e="labelImage"===n.type?4:2;n.type="data",t+=e}}return e.length!==r.length&&v3(e,0,e.length,r),e},resolveTo:function(e,t){let r,n,i,a,o=e.length,s=0;for(;o--;)if(r=e[o][1],n){if("link"===r.type||"labelLink"===r.type&&r._inactive)break;"enter"===e[o][0]&&"labelLink"===r.type&&(r._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===r.type||"labelLink"===r.type)&&!r._balanced&&(n=o,"labelLink"!==r.type)){s=2;break}}else"labelEnd"===r.type&&(i=o);let l={type:"labelLink"===e[n][1].type?"link":"image",start:{...e[n][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[n][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[n+s+2][1].end},end:{...e[i-2][1].start}};return a=v9(a=[["enter",l,t],["enter",u,t]],e.slice(n+1,n+s+3)),a=v9(a,[["enter",d,t]]),a=v9(a,yN(t.parser.constructs.insideSpan.null,e.slice(n+s+4,i-3),t)),a=v9(a,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),a=v9(a,e.slice(i+1)),a=v9(a,[["exit",l,t]]),v3(e,n,e.length,a),e},tokenize:function(e,t,r){let n,i,a=this,o=a.events.length;for(;o--;)if(("labelImage"===a.events[o][1].type||"labelLink"===a.events[o][1].type)&&!a.events[o][1]._balanced){n=a.events[o][1];break}return function(t){return n?n._inactive?d(t):(i=a.parser.defined.includes(yJ(a.sliceSerialize({start:n.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):r(t)};function s(t){return 40===t?e.attempt(y0,u,i?u:d)(t):91===t?e.attempt(y1,u,i?l:d)(t):i?u(t):d(t)}function l(t){return e.attempt(y2,u,d)(t)}function u(e){return t(e)}function d(e){return n._balanced=!0,r(e)}}},y0={tokenize:function(e,t,r){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),n};function n(t){return yl(t)?yW(e,i)(t):i(t)}function i(t){return 41===t?u(t):yB(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return yl(t)?yW(e,s)(t):u(t)}function o(e){return r(e)}function s(t){return 34===t||39===t||40===t?yq(e,l,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return yl(t)?yW(e,u)(t):u(t)}function u(n){return 41===n?(e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),e.exit("resource"),t):r(n)}}},y1={tokenize:function(e,t,r){let n=this;return function(t){return yV.call(n,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return n.parser.defined.includes(yJ(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(e):r(e)}function a(e){return r(e)}}},y2={tokenize:function(e,t,r){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),n};function n(n){return 93===n?(e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),e.exit("reference"),t):r(n)}}},y4={name:"labelStartImage",resolveAll:yQ.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):r(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},y6={name:"labelStartLink",resolveAll:yQ.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},y5={name:"lineEnding",tokenize:function(e,t){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ym(e,t,"linePrefix")}}},y3={name:"thematicBreak",tokenize:function(e,t,r){let n,i=0;return function(a){var o;return e.enter("thematicBreak"),n=o=a,function a(o){return o===n?(e.enter("thematicBreakSequence"),function t(r){return r===n?(e.consume(r),i++,t):(e.exit("thematicBreakSequence"),yu(r)?ym(e,a,"whitespace")(r):a(r))}(o)):i>=3&&(null===o||ys(o))?(e.exit("thematicBreak"),t(o)):r(o)}(o)}}},y9={continuation:{tokenize:function(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(yv,function(r){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ym(e,t,"listItemIndent",n.containerState.size+1)(r)},function(r){return n.containerState.furtherBlankLines||!yu(r)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,i(r)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(y7,t,i)(r))});function i(i){return n.containerState._closeFlow=!0,n.interrupt=void 0,ym(e,e.attempt(y9,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,r){let n=this,i=n.events[n.events.length-1],a=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!n.containerState.marker||t===n.containerState.marker:yi(t)){if(n.containerState.type||(n.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(y3,r,s)(t):s(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return yi(i)&&++o<10?(e.consume(i),t):(!n.interrupt||o<2)&&(n.containerState.marker?i===n.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),s(i)):r(i)}(t)}return r(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(yv,n.interrupt?r:l,e.attempt(y8,d,u))}function l(e){return n.containerState.initialBlankLine=!0,a++,d(e)}function u(t){return yu(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):r(t)}function d(r){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(r)}}},y8={partial:!0,tokenize:function(e,t,r){let n=this;return ym(e,function(e){let i=n.events[n.events.length-1];return!yu(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):r(e)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},y7={partial:!0,tokenize:function(e,t,r){let n=this;return ym(e,function(e){let i=n.events[n.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===n.containerState.size?t(e):r(e)},"listItemIndent",n.containerState.size+1)}},be={name:"setextUnderline",resolveTo:function(e,t){let r,n,i,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){r=a;break}"paragraph"===e[a][1].type&&(n=a)}else"content"===e[a][1].type&&e.splice(a,1),i||"definition"!==e[a][1].type||(i=a);let o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",i?(e.splice(n,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,r){let n,i=this;return function(t){var o;let s,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){s="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||s)?(e.enter("setextHeadingLine"),n=t,o=t,e.enter("setextHeadingLineSequence"),function t(r){return r===n?(e.consume(r),t):(e.exit("setextHeadingLineSequence"),yu(r)?ym(e,a,"lineSuffix")(r):a(r))}(o)):r(t)};function a(n){return null===n||ys(n)?(e.exit("setextHeadingLine"),t(n)):r(n)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,r){let n,i=this;return function(t){var n;return e.enter("definition"),n=t,yV.call(i,e,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function a(t){return(n=yJ(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):r(t)}function o(t){return yl(t)?yW(e,s)(t):s(t)}function s(t){return yB(e,l,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(yH,u,u)(t)}function u(t){return yu(t)?ym(e,d,"whitespace")(t):d(t)}function d(a){return null===a||ys(a)?(e.exit("definition"),i.parser.defined.push(n),t(a)):r(a)}}}},"disable",0,{null:[]},"document",0,{42:y9,43:y9,45:y9,48:y9,49:y9,50:y9,51:y9,52:y9,53:y9,54:y9,55:y9,56:y9,57:y9,62:yP},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let r,n,i=e.length-2,a=3;return"whitespace"===e[3][1].type&&(a+=2),i-2>a&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(a===i-1||i-4>a&&"whitespace"===e[i-2][1].type)&&(i-=a+1===i?2:4),i>a&&(r={type:"atxHeadingText",start:e[a][1].start,end:e[i][1].end},n={type:"chunkText",start:e[a][1].start,end:e[i][1].end,contentType:"text"},v3(e,a,i-a+1,[["enter",r,t],["enter",n,t],["exit",n,t],["exit",r,t]])),e},tokenize:function(e,t,r){let n=0;return function(i){var a;return e.enter("atxHeading"),a=i,e.enter("atxHeadingSequence"),function i(a){return 35===a&&n++<6?(e.consume(a),i):null===a||yl(a)?(e.exit("atxHeadingSequence"),function r(n){return 35===n?(e.enter("atxHeadingSequence"),function t(n){return 35===n?(e.consume(n),t):(e.exit("atxHeadingSequence"),r(n))}(n)):null===n||ys(n)?(e.exit("atxHeading"),t(n)):yu(n)?ym(e,r,"whitespace")(n):(e.enter("atxHeadingText"),function t(n){return null===n||35===n||yl(n)?(e.exit("atxHeadingText"),r(n)):(e.consume(n),t)}(n))}(a)):r(a)}(a)}}},42:y3,45:[be,y3],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,r){let n,i,a,o,s,l=this;return function(t){var r;return r=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(r),u};function u(o){return 33===o?(e.consume(o),d):47===o?(e.consume(o),i=!0,m):63===o?(e.consume(o),n=3,l.interrupt?t:A):ye(o)?(e.consume(o),a=String.fromCharCode(o),f):r(o)}function d(i){return 45===i?(e.consume(i),n=2,c):91===i?(e.consume(i),n=5,o=0,p):ye(i)?(e.consume(i),n=4,l.interrupt?t:A):r(i)}function c(n){return 45===n?(e.consume(n),l.interrupt?t:A):r(n)}function p(n){let i="CDATA[";return n===i.charCodeAt(o++)?(e.consume(n),o===i.length)?l.interrupt?t:I:p:r(n)}function m(t){return ye(t)?(e.consume(t),a=String.fromCharCode(t),f):r(t)}function f(o){if(null===o||47===o||62===o||yl(o)){let s=47===o,u=a.toLowerCase();return!s&&!i&&yG.includes(u)?(n=1,l.interrupt?t(o):I(o)):yK.includes(a.toLowerCase())?(n=6,s)?(e.consume(o),h):l.interrupt?t(o):I(o):(n=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(o):i?function t(r){return yu(r)?(e.consume(r),t):w(r)}(o):g(o))}return 45===o||yt(o)?(e.consume(o),a+=String.fromCharCode(o),f):r(o)}function h(n){return 62===n?(e.consume(n),l.interrupt?t:I):r(n)}function g(t){return 47===t?(e.consume(t),w):58===t||95===t||ye(t)?(e.consume(t),v):yu(t)?(e.consume(t),g):w(t)}function v(t){return 45===t||46===t||58===t||95===t||yt(t)?(e.consume(t),v):y(t)}function y(t){return 61===t?(e.consume(t),b):yu(t)?(e.consume(t),y):g(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),s=t,x):yu(t)?(e.consume(t),b):function t(r){return null===r||34===r||39===r||47===r||60===r||61===r||62===r||96===r||yl(r)?y(r):(e.consume(r),t)}(t)}function x(t){return t===s?(e.consume(t),s=null,_):null===t||ys(t)?r(t):(e.consume(t),x)}function _(e){return 47===e||62===e||yu(e)?g(e):r(e)}function w(t){return 62===t?(e.consume(t),k):r(t)}function k(t){return null===t||ys(t)?I(t):yu(t)?(e.consume(t),k):r(t)}function I(t){return 45===t&&2===n?(e.consume(t),E):60===t&&1===n?(e.consume(t),C):62===t&&4===n?(e.consume(t),R):63===t&&3===n?(e.consume(t),A):93===t&&5===n?(e.consume(t),N):ys(t)&&(6===n||7===n)?(e.exit("htmlFlowData"),e.check(yY,P,S)(t)):null===t||ys(t)?(e.exit("htmlFlowData"),S(t)):(e.consume(t),I)}function S(t){return e.check(yX,$,P)(t)}function $(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),j}function j(t){return null===t||ys(t)?S(t):(e.enter("htmlFlowData"),I(t))}function E(t){return 45===t?(e.consume(t),A):I(t)}function C(t){return 47===t?(e.consume(t),a="",T):I(t)}function T(t){if(62===t){let r=a.toLowerCase();return yG.includes(r)?(e.consume(t),R):I(t)}return ye(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),T):I(t)}function N(t){return 93===t?(e.consume(t),A):I(t)}function A(t){return 62===t?(e.consume(t),R):45===t&&2===n?(e.consume(t),A):I(t)}function R(t){return null===t||ys(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),R)}function P(r){return e.exit("htmlFlow"),t(r)}}},61:be,95:y3,96:yL,126:yL},"flowInitial",0,{[-2]:yZ,[-1]:yZ,32:yZ},"insideSpan",0,{null:[yA,yI]},"string",0,{38:yD,92:yO},"text",0,{[-5]:y5,[-4]:y5,[-3]:y5,33:y4,38:yD,42:yA,60:[{name:"autolink",tokenize:function(e,t,r){let n=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return ye(t)?(e.consume(t),a):64===t?r(t):s(t)}function a(t){return 43===t||45===t||46===t||yt(t)?(n=1,function t(r){return 58===r?(e.consume(r),n=0,o):(43===r||45===r||46===r||yt(r))&&n++<32?(e.consume(r),t):(n=0,s(r))}(t)):s(t)}function o(n){return 62===n?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):null===n||32===n||60===n||yn(n)?r(n):(e.consume(n),o)}function s(t){return 64===t?(e.consume(t),l):yr(t)?(e.consume(t),s):r(t)}function l(i){return yt(i)?function i(a){return 46===a?(e.consume(a),n=0,l):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||yt(a))&&n++<63){let r=45===a?t:i;return e.consume(a),r}return r(a)}(a)}(i):r(i)}}},{name:"htmlText",tokenize:function(e,t,r){let n,i,a,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),x):63===t?(e.consume(t),y):ye(t)?(e.consume(t),w):r(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),i=0,m):ye(t)?(e.consume(t),v):r(t)}function u(t){return 45===t?(e.consume(t),p):r(t)}function d(t){return null===t?r(t):45===t?(e.consume(t),c):ys(t)?(a=d,T(t)):(e.consume(t),d)}function c(t){return 45===t?(e.consume(t),p):d(t)}function p(e){return 62===e?C(e):45===e?c(e):d(e)}function m(t){let n="CDATA[";return t===n.charCodeAt(i++)?(e.consume(t),i===n.length?f:m):r(t)}function f(t){return null===t?r(t):93===t?(e.consume(t),h):ys(t)?(a=f,T(t)):(e.consume(t),f)}function h(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?C(t):93===t?(e.consume(t),g):f(t)}function v(t){return null===t||62===t?C(t):ys(t)?(a=v,T(t)):(e.consume(t),v)}function y(t){return null===t?r(t):63===t?(e.consume(t),b):ys(t)?(a=y,T(t)):(e.consume(t),y)}function b(e){return 62===e?C(e):y(e)}function x(t){return ye(t)?(e.consume(t),_):r(t)}function _(t){return 45===t||yt(t)?(e.consume(t),_):function t(r){return ys(r)?(a=t,T(r)):yu(r)?(e.consume(r),t):C(r)}(t)}function w(t){return 45===t||yt(t)?(e.consume(t),w):47===t||62===t||yl(t)?k(t):r(t)}function k(t){return 47===t?(e.consume(t),C):58===t||95===t||ye(t)?(e.consume(t),I):ys(t)?(a=k,T(t)):yu(t)?(e.consume(t),k):C(t)}function I(t){return 45===t||46===t||58===t||95===t||yt(t)?(e.consume(t),I):function t(r){return 61===r?(e.consume(r),S):ys(r)?(a=t,T(r)):yu(r)?(e.consume(r),t):k(r)}(t)}function S(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),n=t,$):ys(t)?(a=S,T(t)):yu(t)?(e.consume(t),S):(e.consume(t),j)}function $(t){return t===n?(e.consume(t),n=void 0,E):null===t?r(t):ys(t)?(a=$,T(t)):(e.consume(t),$)}function j(t){return null===t||34===t||39===t||60===t||61===t||96===t?r(t):47===t||62===t||yl(t)?k(t):(e.consume(t),j)}function E(e){return 47===e||62===e||yl(e)?k(e):r(e)}function C(n){return 62===n?(e.consume(n),e.exit("htmlTextData"),e.exit("htmlText"),t):r(n)}function T(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return yu(t)?ym(e,A,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):A(t)}function A(t){return e.enter("htmlTextData"),a(t)}}}],91:y6,92:[{name:"hardBreakEscape",tokenize:function(e,t,r){return function(t){return e.enter("hardBreakEscape"),e.consume(t),n};function n(n){return ys(n)?(e.exit("hardBreakEscape"),t(n)):r(n)}}},yO],93:yQ,95:yA,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,r,n=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=i;++t<n;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[n][1].type="codeTextPadding",i+=2,n-=2;break}}for(t=i-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="codeTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e},tokenize:function(e,t,r){let n,i,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(r){return 96===r?(e.consume(r),a++,t):(e.exit("codeTextSequence"),o(r))}(t)};function o(l){return null===l?r(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),n=0,function r(o){return 96===o?(e.consume(o),n++,r):n===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",s(o))}(l)):ys(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||ys(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var bt=e.i(4127);let br=/[\0\t\n\r]/g;function bn(e,t){let r=Number.parseInt(e,t);return r<9||11===r||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(65535&r)==65535||(65535&r)==65534||r>1114111?"�":String.fromCodePoint(r)}let bi=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ba(e,t,r){if(t)return t;if(35===r.charCodeAt(0)){let e=r.charCodeAt(1),t=120===e||88===e;return bn(r.slice(t?2:1),t?16:10)}return yz(r)||e}let bo={}.hasOwnProperty;function bs(e){return{line:e.line,column:e.column,offset:e.offset}}function bl(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+vz({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vz({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+vz({start:t.start,end:t.end})+") is still open")}function bu(e){let t=this;t.parser=function(r){var n,i;let a,o,s,l;return"object"==typeof(n={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=n,n=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(v),autolinkProtocol:u,autolinkEmail:u,atxHeading:n(f),blockQuote:n(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:n(m),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:n(m,i),codeText:n(function(){return{type:"inlineCode",value:""}},i),codeTextData:u,data:u,codeFlowValue:u,definition:n(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:n(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:n(h),hardBreakTrailing:n(h),htmlFlow:n(g,i),htmlFlowData:u,htmlText:n(g,i),htmlTextData:u,image:n(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:n(v),listItem:n(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:n(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:n(y),paragraph:n(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:n(f),strong:n(function(){return{type:"strong",children:[]}}),thematicBreak:n(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){d.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){d.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:d,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let t,r=this.sliceSerialize(e),n=this.data.characterReferenceType;n?(t=bn(r,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):t=yz(r);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=bs(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:d,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:d,data:d,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=yJ(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(c),hardBreakTrailing:o(c),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:d,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:d,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),r=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===r.type?r.children=e.children:r.alt=t},labelText:function(e){let t=this.sliceSerialize(e),r=this.stack[this.stack.length-2];r.label=t.replace(bi,ba),r.identifier=yJ(t).toLowerCase()},lineEnding:function(e){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){r.children[r.children.length-1].position.end=bs(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(r.type)&&(u.call(this,e),d.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=yJ(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,r){let n=-1;for(;++n<r.length;){let i=r[n];Array.isArray(i)?e(t,i):function(e,t){let r;for(r in t)if(bo.call(t,r))switch(r){case"canContainEols":{let n=t[r];n&&e[r].push(...n);break}case"transforms":{let n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{let n=t[r];n&&Object.assign(e[r],n)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let r={};return function(e){let n={type:"root",children:[]},o={stack:[n],tokenStack:[],config:t,enter:a,exit:s,buffer:i,resume:l,data:r},u=[],d=-1;for(;++d<e.length;)("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)&&("enter"===e[d][0]?u.push(d):d=function(e,t,r){let n,i,a,o,s=t-1,l=-1,u=!1;for(;++s<=r;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!n||o||l||a||(a=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(n){let o=s;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}a&&(!i||a<i)&&(n._spread=!0),n.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||s,0,["exit",n,t[2]]),s++,r++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};n=i,e.splice(s,0,["enter",i,t[2]]),s++,r++,a=void 0,o=!0}}}return e[t][1]._spread=u,r}(e,u.pop(),d));for(d=-1;++d<e.length;){let r=t[e[d][0]];bo.call(r,e[d][1].type)&&r[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},o),e[d][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||bl).call(o,void 0,e[0])}for(n.position={start:bs(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:bs(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)n=t.transforms[d](n)||n;return n};function n(e,t){return function(r){a.call(this,e(r),r),t&&t.call(this,r)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(e,t,r){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,r||void 0]),e.position={start:bs(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let r=this.stack.pop(),n=this.tokenStack.pop();if(n)n[0].type!==e.type&&(t?t.call(this,e,n[0]):(n[1]||bl).call(this,e,n[0]));else throw Error("Cannot close `"+e.type+"` ("+vz({start:e.start,end:e.end})+"): it’s not open");r.position.end=bs(e.end)}function l(){return v4(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,r=t[t.length-1];r&&"text"===r.type||((r={type:"text",value:""}).position={start:bs(e.start),end:void 0},t.push(r)),this.stack.push(r)}function d(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=bs(e.end)}function c(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function m(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function h(){return{type:"break"}}function g(){return{type:"html",value:""}}function v(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!yx(e););return e}((function(e){let t={constructs:v7([bt,...(e||{}).extensions||[]]),content:r(yf),defined:[],document:r(yh),flow:r(yk),lazy:{},string:r(yS),text:r(y$)};return t;function r(e){return function(r){return function(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},i={},a=[],o=[],s=[],l={attempt:f(function(e,t){h(e,t.from)}),check:f(m),consume:function(e){ys(e)?(n.line++,n.column=1,n.offset+=-3===e?2:1,g()):-1!==e&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=e},enter:function(e,t){let r=t||{};return r.type=e,r.start=p(),u.events.push(["enter",r,u]),s.push(r),r},exit:function(e){let t=s.pop();return t.end=p(),u.events.push(["exit",t,u]),t},interrupt:f(m,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let r,n=-1,i=[];for(;++n<e.length;){let a,o=e[n];if("string"==typeof o)a=o;else switch(o){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":" ";break;case -1:if(!t&&r)continue;a=" ";break;default:a=String.fromCharCode(o)}r=-2===o,i.push(a)}return i.join("")}(c(e),t)},sliceStream:c,write:function(e){return(o=v9(o,e),function(){let e;for(;n._index<o.length;){let r=o[n._index];if("string"==typeof r)for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<r.length;){var t;t=r.charCodeAt(n._bufferIndex),d=d(t)}else d=d(r)}}(),null!==o[o.length-1])?[]:(h(t,0),u.events=yN(a,u.events,u),u.events)}},d=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function c(e){return function(e,t){let r,n=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;if(n===a)r=[e[n].slice(i,o)];else{if(r=e.slice(n,a),i>-1){let e=r[0];"string"==typeof e?r[0]=e.slice(i):r.shift()}o>0&&r.push(e[a].slice(0,o))}return r}(o,e)}function p(){let{_bufferIndex:e,_index:t,line:r,column:i,offset:a}=n;return{_bufferIndex:e,_index:t,line:r,column:i,offset:a}}function m(e,t){t.restore()}function f(e,t){return function(r,i,a){var o;let d,c,m,f;return Array.isArray(r)?h(r):"tokenize"in r?h([r]):(o=r,function(e){let t=null!==e&&o[e],r=null!==e&&o.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]])(e)});function h(e){return(d=e,c=0,0===e.length)?a:v(e[c])}function v(e){return function(r){let i,a,o,d,c;return(i=p(),a=u.previous,o=u.currentConstruct,d=u.events.length,c=Array.from(s),f={from:d,restore:function(){n=i,u.previous=a,u.currentConstruct=o,u.events.length=d,s=c,g()}},m=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?b(r):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,y,b)(r)}}function y(t){return e(m,f),i}function b(e){return(f.restore(),++c<d.length)?v(d[c]):a}}}function h(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&v3(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}(t,e,r)}}})(i).document().write((o=1,s="",l=!0,function(e,t,r){let n,i,u,d,c,p=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,s="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(br.lastIndex=u,d=(n=br.exec(e))&&void 0!==n.index?n.index:e.length,c=e.charCodeAt(d),!n){s=e.slice(u);break}if(10===c&&u===d&&a)p.push(-3),a=void 0;else switch(a&&(p.push(-5),a=void 0),u<d&&(p.push(e.slice(u,d)),o+=d-u),c){case 0:p.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),p.push(-2);o++<i;)p.push(-1);break;case 10:p.push(-4),o=1;break;default:a=!0,o=1}u=d+1}return r&&(a&&p.push(-5),s&&p.push(s),p.push(null)),p})(r,n,!0))))}}let bd="object"==typeof self?self:globalThis,bc=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+e)}return new bd[e](t)},bp=e=>{var t;let r,n;return(t=new Map,r=(e,r)=>(t.set(r,e),e),n=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case -1:return r(o,i);case 1:{let e=r([],i);for(let t of o)e.push(n(t));return e}case 2:{let e=r({},i);for(let[t,r]of o)e[n(t)]=n(r);return e}case 3:return r(new Date(o),i);case 4:{let{source:e,flags:t}=o;return r(new RegExp(e,t),i)}case 5:{let e=r(new Map,i);for(let[t,r]of o)e.set(n(t),n(r));return e}case 6:{let e=r(new Set,i);for(let t of o)e.add(n(t));return e}case 7:{let{name:e,message:t}=o;return r(bc(e,t),i)}case 8:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return r(new DataView(e),o)}}return r(bc(a,o),i)})(0)},{toString:bm}={},{keys:bf}=Object,bh=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let r=bm.call(e).slice(8,-1);switch(r){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,r]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},bg=([e,t])=>0===e&&("function"===t||"symbol"===t),bv=(e,{json:t,lossy:r}={})=>{var n,i,a;let o,s,l=[];return(n=!(t||r),i=!!t,a=new Map,o=(e,t)=>{let r=l.push(e)-1;return a.set(t,r),r},s=e=>{if(a.has(e))return a.get(e);let[t,r]=bh(e);switch(t){case 0:{let i=e;switch(r){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(n)throw TypeError("unable to serialize "+r);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(r){let t=e;return"DataView"===r?t=new Uint8Array(e.buffer):"ArrayBuffer"===r&&(t=new Uint8Array(e)),o([r,[...t]],e)}let n=[],i=o([t,n],e);for(let t of e)n.push(s(t));return i}case 2:{if(r)switch(r){case"BigInt":return o([r,e.toString()],e);case"Boolean":case"Number":case"String":return o([r,e.valueOf()],e)}if(i&&"toJSON"in e)return s(e.toJSON());let a=[],l=o([t,a],e);for(let t of bf(e))(n||!bg(bh(e[t])))&&a.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:r,flags:n}=e;return o([t,{source:r,flags:n}],e)}case 5:{let r=[],i=o([t,r],e);for(let[t,i]of e)(n||!(bg(bh(t))||bg(bh(i))))&&r.push([s(t),s(i)]);return i}case 6:{let r=[],i=o([t,r],e);for(let t of e)(n||!bg(bh(t)))&&r.push(s(t));return i}}let{message:l}=e;return o([t,{name:r,message:l}],e)})(e),l},by="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?bp(bv(e,t)):structuredClone(e):(e,t)=>bp(bv(e,t));function bb(e){let t=[],r=-1,n=0,i=0;for(;++r<e.length;){let a=e.charCodeAt(r),o="";if(37===a&&yt(e.charCodeAt(r+1))&&yt(e.charCodeAt(r+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(r+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function bx(e,t){let r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function b_(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let bw=function(e){var t,r;if(null==e)return bI;if("function"==typeof e)return bk(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],r=-1;for(;++r<e.length;)t[r]=bw(e[r]);return bk(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}(e):(t=e,bk(function(e){let r;for(r in t)if(e[r]!==t[r])return!1;return!0}))}if("string"==typeof e){return r=e,bk(function(e){return e&&e.type===r})}throw Error("Expected function, string, or object as test")};function bk(e){return function(t,r,n){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function bI(){return!0}let bS=[];function b$(e,t,r,n){let i;"function"==typeof t&&"function"!=typeof r?(n=r,r=t):i=t;let a=bw(i),o=n?-1:1;(function e(i,s,l){let u=i&&"object"==typeof i?i:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(d,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return d;function d(){var u;let d,c,p,m=bS;if((!t||a(i,s,l[l.length-1]||void 0))&&!1===(m=Array.isArray(u=r(i,l))?u:"number"==typeof u?[!0,u]:null==u?bS:[u])[0])return m;if("children"in i&&i.children&&i.children&&"skip"!==m[0])for(c=(n?i.children.length:-1)+o,p=l.concat(i);c>-1&&c<i.children.length;){if(!1===(d=e(i.children[c],c,p)())[0])return d;c="number"==typeof d[1]?d[1]:c+o}return m}})(e,void 0,[])()}function bj(e,t,r,n){let i,a,o;"function"==typeof t&&"function"!=typeof r?(a=void 0,o=t,i=r):(a=t,o=r,i=n),b$(e,a,function(e,t){let r=t[t.length-1],n=r?r.children.indexOf(e):void 0;return o(e,n,r)},i)}function bE(e,t){let r=t.referenceType,n="]";if("collapsed"===r?n+="[]":"full"===r&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+n}];let i=e.all(t),a=i[0];a&&"text"===a.type?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=n:i.push({type:"text",value:n}),i}function bC(e){let t=e.spread;return null==t?e.children.length>1:t}function bT(e,t,r){let n=0,i=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n)}if(r){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}let bN={blockquote:function(e,t){let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)},break:function(e,t){let r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:"\n"}]},code:function(e,t){let r=t.value?t.value+"\n":"",n={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},emphasis:function(e,t){let r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},footnoteReference:function(e,t){let r,n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=bb(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),s=e.footnoteCounts.get(i);void 0===s?(s=0,e.footnoteOrder.push(i),r=e.footnoteOrder.length):r=o+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},html:function(e,t){if(e.options.allowDangerousHtml){let r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}},imageReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return bE(e,t);let i={src:bb(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(i.title=n.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){let r={src:bb(t.url)};null!==t.alt&&void 0!==t.alt&&(r.alt=t.alt),null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){let r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return bE(e,t);let i={href:bb(n.url||"")};null!==n.title&&void 0!==n.title&&(i.title=n.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){let r={href:bb(t.url)};null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,r){let n=e.all(t),i=r?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let r=e.children,n=-1;for(;!t&&++n<r.length;)t=bC(r[n])}return t}(r):bC(t),a={},o=[];if("boolean"==typeof t.checked){let e,r=n[0];r&&"element"===r.type&&"p"===r.tagName?e=r:(e={type:"element",tagName:"p",properties:{},children:[]},n.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<n.length;){let e=n[s];(i||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=n[n.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let r={},n=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(r.start=t.start);++i<n.length;){let e=n[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let a={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){let r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},root:function(e,t){let r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)},strong:function(e,t){let r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},table:function(e,t){let r=e.all(t),n=r.shift(),i=[];if(n){let r={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],r),i.push(r)}if(r.length>0){let n={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},a=vO(t.children[1]),o=vP(t.children[t.children.length-1]);a&&o&&(n.position={start:a,end:o}),i.push(n)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},tableRow:function(e,t,r){let n=r?r.children:void 0,i=0===(n?n.indexOf(t):1)?"th":"td",a=r&&"table"===r.type?r.align:void 0,o=a?a.length:t.children.length,s=-1,l=[];for(;++s<o;){let r=t.children[s],n={},o=a?a[s]:void 0;o&&(n.align=o);let u={type:"element",tagName:i,properties:n,children:[]};r&&(u.children=e.all(r),e.patch(r,u),u=e.applyData(r,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let r={type:"text",value:function(e){let t=String(e),r=/\r?\n|\r/g,n=r.exec(t),i=0,a=[];for(;n;)a.push(bT(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return a.push(bT(t.slice(i),i>0,!1)),a.join("")}(String(t.value))};return e.patch(t,r),e.applyData(t,r)},thematicBreak:function(e,t){let r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)},toml:bA,yaml:bA,definition:bA,footnoteDefinition:bA};function bA(){}let bR={}.hasOwnProperty,bP={};function bO(e,t){e.position&&(t.position=function(e){let t=vO(e),r=vP(e);if(t&&r)return{start:t,end:r}}(e))}function bM(e,t){let r=t;if(e&&e.data){let t=e.data.hName,n=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===r.type?r.tagName=t:r={type:"element",tagName:t,properties:{},children:"children"in r?r.children:[r]}),"element"===r.type&&i&&Object.assign(r.properties,by(i)),"children"in r&&r.children&&null!=n&&(r.children=n)}return r}function bz(e,t){let r=[],n=-1;for(t&&r.push({type:"text",value:"\n"});++n<e.length;)n&&r.push({type:"text",value:"\n"}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:"\n"}),r}function bD(e){let t=0,r=e.charCodeAt(t);for(;9===r||32===r;)t++,r=e.charCodeAt(t);return e.slice(t)}function bU(e,t){let r,n,i,a,o=(r=t||bP,n=new Map,i=new Map,a={all:function(e){let t=[];if("children"in e){let r=e.children,n=-1;for(;++n<r.length;){let i=a.one(r[n],e);if(i){if(n&&"break"===r[n-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=bD(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=bD(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:bM,definitionById:n,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...bN,...r.handlers},one:function(e,t){let r=e.type,n=a.handlers[r];if(bR.call(a.handlers,r)&&n)return n(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(r)){if("children"in e){let{children:t,...r}=e,n=by(r);return n.children=a.all(e),n}return by(e)}return(a.options.unknownHandler||function(e,t){let r=t.data||{},n="value"in t&&!(bR.call(r,"hProperties")||bR.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)})(a,e,t)},options:r,patch:bO,wrap:bz},bj(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?n:i,r=String(e.identifier).toUpperCase();t.has(r)||t.set(r,e)}}),a),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||bx,n=e.options.footnoteBackLabel||b_,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),u=bb(o.toLowerCase()),d=0,c=[],p=e.footnoteCounts.get(o);for(;void 0!==p&&++d<=p;){c.length>0&&c.push({type:"text",value:" "});let e="string"==typeof r?r:r(l,d);"string"==typeof e&&(e={type:"text",value:e}),c.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,d),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let m=a[a.length-1];if(m&&"element"===m.type&&"p"===m.tagName){let e=m.children[m.children.length-1];e&&"text"===e.type?e.value+=" ":m.children.push({type:"text",value:" "}),m.children.push(...c)}else a.push(...c);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(a,!0)};e.patch(i,f),s.push(f)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...by(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(g2("children"in u),u.children.push({type:"text",value:"\n"},l)),u}function bL(e,t){return e&&"run"in e?async function(r,n){let i=bU(r,{file:n,...t});await e.run(i,n)}:function(r,n){return bU(r,{file:n,...e||t})}}function bZ(e){if(e)throw e}var bF=e.i(4100);function bB(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let bV=function(e,t){let r;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');bH(e);let n=0,i=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(r){n=a+1;break}}else i<0&&(r=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let o=-1,s=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(r){n=a+1;break}}else o<0&&(r=!0,o=a+1),s>-1&&(e.codePointAt(a)===t.codePointAt(s--)?s<0&&(i=a):(s=-1,i=o));return n===i?i=o:i<0&&(i=e.length),e.slice(n,i)},bq=function(e){let t;if(bH(e),0===e.length)return".";let r=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){r=n;break}}else t||(t=!0);return r<0?47===e.codePointAt(0)?"/":".":1===r&&47===e.codePointAt(0)?"//":e.slice(0,r)},bW=function(e){let t;bH(e);let r=e.length,n=-1,i=0,a=-1,o=0;for(;r--;){let s=e.codePointAt(r);if(47===s){if(t){i=r+1;break}continue}n<0&&(t=!0,n=r+1),46===s?a<0?a=r:1!==o&&(o=1):a>-1&&(o=-1)}return a<0||n<0||0===o||1===o&&a===n-1&&a===i+1?"":e.slice(a,n)},bJ=function(...e){var t;let r,n,i,a=-1;for(;++a<e.length;)bH(e[a]),e[a]&&(i=void 0===i?e[a]:i+"/"+e[a]);return void 0===i?".":(bH(t=i),r=47===t.codePointAt(0),0!==(n=function(e,t){let r,n,i="",a=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)r=e.codePointAt(l);else if(47===r)break;else r=47;if(47===r){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(i.length<2||2!==a||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((n=i.lastIndexOf("/"))!==i.length-1){n<0?(i="",a=0):a=(i=i.slice(0,n)).length-1-i.lastIndexOf("/"),o=l,s=0;continue}}else if(i.length>0){i="",a=0,o=l,s=0;continue}}t&&(i=i.length>0?i+"/..":"..",a=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else 46===r&&s>-1?s++:s=-1}return i}(t,!r)).length||r||(n="."),n.length>0&&47===t.codePointAt(t.length-1)&&(n+="/"),r?"/"+n:n)};function bH(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function bK(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let bG=["history","path","basename","stem","extname","dirname"];class bY{constructor(e){let t,r;t=e?bK(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<bG.length;){const e=bG[n];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)bG.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?bV(this.path):void 0}set basename(e){bQ(e,"basename"),bX(e,"basename"),this.path=bJ(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?bq(this.path):void 0}set dirname(e){b0(this.basename,"dirname"),this.path=bJ(e||"",this.basename)}get extname(){return"string"==typeof this.path?bW(this.path):void 0}set extname(e){if(bX(e,"extname"),b0(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=bJ(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){bK(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!bK(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,r=-1;for(;++r<t.length;)if(37===t.codePointAt(r)&&50===t.codePointAt(r+1)){let e=t.codePointAt(r+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),bQ(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?bV(this.path,this.extname):void 0}set stem(e){bQ(e,"stem"),bX(e,"stem"),this.path=bJ(this.dirname||"",e+(this.extname||""))}fail(e,t,r){let n=this.message(e,t,r);throw n.fatal=!0,n}info(e,t,r){let n=this.message(e,t,r);return n.fatal=void 0,n}message(e,t,r){let n=new vZ(e,t,r);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function bX(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function bQ(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function b0(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let b1=function(e){let t=this.constructor.prototype,r=t[e],n=function(){return r.apply(n,arguments)};return Object.setPrototypeOf(n,t),n},b2={}.hasOwnProperty;class b4 extends b1{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let r=-1,n=t.pop();if("function"!=typeof n)throw TypeError("Expected function as last argument, not "+n);!function i(a,...o){let s=e[++r],l=-1;if(a)return void n(a);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let r;return function(...t){let a,o=e.length>t.length;o&&t.push(n);try{a=e.apply(this,t)}catch(e){if(o&&r)throw e;return n(e)}o||(a&&a.then&&"function"==typeof a.then?a.then(i,n):a instanceof Error?n(a):i(a))};function n(e,...i){r||(r=!0,t(e,...i))}function i(e){n(null,e)}})(s,i)(...o):n(null,...o)}(null,...t)},use:function(r){if("function"!=typeof r)throw TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}};return t}()}copy(){let e=new b4,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];e.use(...r)}return e.data((0,bF.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(b9("data",this.frozen),this.namespace[e]=t,this):b2.call(this.namespace,e)&&this.namespace[e]||void 0:e?(b9("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let r=e.call(this,...t);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=xe(e),r=this.parser||this.Parser;return b5("parse",r),r(String(t),t)}process(e,t){let r=this;return this.freeze(),b5("process",this.parser||this.Parser),b3("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(n,i){let a=xe(e),o=r.parse(a);function s(e,r){e||!r?i(e):n?n(r):(g2(t,"`done` is defined if `resolve` is not"),t(void 0,r))}r.run(o,a,function(e,t,n){var i,a;if(e||!t||!n)return s(e);let o=r.stringify(t,n);"string"==typeof(i=o)||(a=i)&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a?n.value=o:n.result=o,s(e,n)})}}processSync(e){let t,r=!1;return this.freeze(),b5("processSync",this.parser||this.Parser),b3("processSync",this.compiler||this.Compiler),this.process(e,function(e,n){r=!0,bZ(e),t=n}),b7("processSync","process",r),g2(t,"we either bailed on an error or have a tree"),t}run(e,t,r){b8(e),this.freeze();let n=this.transformers;return r||"function"!=typeof t||(r=t,t=void 0),r?i(void 0,r):new Promise(i);function i(i,a){g2("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=xe(t);n.run(e,o,function(t,n,o){let s=n||e;t?a(t):i?i(s):(g2(r,"`done` is defined if `resolve` is not"),r(void 0,s,o))})}}runSync(e,t){let r,n=!1;return this.run(e,t,function(e,t){bZ(e),r=t,n=!0}),b7("runSync","run",n),g2(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let r=xe(t),n=this.compiler||this.Compiler;return b3("stringify",n),b8(e),n(e,r)}use(e,...t){let r=this.attachers,n=this.namespace;if(b9("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?a(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(e.plugins),e.settings&&(n.settings=(0,bF.default)(!0,n.settings,e.settings))}function a(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...r]=e;o(t,r)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let n=-1,i=-1;for(;++n<r.length;)if(r[n][0]===e){i=n;break}if(-1===i)r.push([e,...t]);else if(t.length>0){let[n,...a]=t,o=r[i][1];bB(o)&&bB(n)&&(n=(0,bF.default)(!0,o,n)),r[i]=[e,n,...a]}}}}let b6=new b4().freeze();function b5(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function b3(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function b9(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function b8(e){if(!bB(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function b7(e,t,r){if(!r)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xe(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new bY(e)}let xt=[],xr={allowDangerousHtml:!0},xn=/^(https?|ircs?|mailto|xmpp)$/i,xi=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function xa(e){var t;let r,n,i,a,o,s=(r=(t=e).rehypePlugins||xt,n=t.remarkPlugins||xt,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...xr}:xr,b6().use(bu).use(n).use(bL,i).use(r)),l=(a=e.children||"",o=new bY,"string"==typeof a?o.value=a:g4("Unexpected value `"+a+"` for `children` prop, expected `string`"),o);return function(e,t){let r=t.allowedElements,n=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||xo;for(let e of xi)Object.hasOwn(t,e.from)&&g4("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&a&&g4("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),bj(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return o?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in v1)if(Object.hasOwn(v1,t)&&Object.hasOwn(e.properties,t)){let r=e.properties[t],n=v1[t];(null===n||n.includes(e.tagName))&&(e.properties[t]=l(String(r||""),t,e))}}if("element"===e.type){let o=r?!r.includes(e.tagName):!!a&&a.includes(e.tagName);if(!o&&n&&"number"==typeof t&&(o=!n(e,t,i)),o&&i&&"number"==typeof t)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var r,n,i,a;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=s,n=t.jsxDEV,o=function(e,t,i,a){let o=Array.isArray(i.children),s=vO(e);return n(t,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:r,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,a=t.jsxs,o=function(e,t,r,n){let o=Array.isArray(r.children)?a:i;return n?o(t,r,n):o(t,r)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?vA:vN,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=vH(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:e_.Fragment,components:i,ignoreInvalidStyle:!0,jsx:e_.jsx,jsxs:e_.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function xo(e){let t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==r&&t>r||-1!==n&&t>n||xn.test(e.slice(0,t))?e:""}let xs=(e,t)=>((e,t)=>{var r,n;if(!e||!t)return!1;let i=e=>{let{position:t,data:r,...n}=e||{};return n};return JSON.stringify(i(e.properties))===JSON.stringify(i(t.properties))&&(r=e.children,n=t.children,"string"==typeof r?r===n:JSON.stringify(r)===JSON.stringify(n))})(e.node,t.node),xl=(0,ek.createContext)(null),xu=()=>null!==(0,ek.useContext)(xl),xd=(0,ek.memo)(({children:e,...t})=>(0,e_.jsx)(xl.Provider,{value:t,children:e}),xs),xc=({node:e,...t})=>(0,e_.jsx)("pre",{...t}),xp=({node:e,...t})=>(0,e_.jsx)("code",{...t}),xm=({node:e,components:{Pre:t,Code:r},code:n})=>(0,e_.jsx)(t,{children:(0,e_.jsx)(r,{node:e,children:n})}),xf=()=>null,xh=({node:e,components:{Pre:t,Code:r,SyntaxHighlighter:n,CodeHeader:i},language:a,code:o})=>{let s=(0,ek.useMemo)(()=>({Pre:t,Code:r}),[t,r]),l=a?n:xm;return(0,e_.jsxs)(e_.Fragment,{children:[(0,e_.jsx)(i,{node:e,language:a,code:o}),(0,e_.jsx)(l,{node:e,components:s,language:a??"unknown",code:o})]})};var xg=e.i(43794);let xv=({className:e,...t})=>({className:r,...n})=>({className:(0,xg.default)(e,r),...t,...n}),xy=({node:e,components:{Pre:t,Code:r,SyntaxHighlighter:n,CodeHeader:i},componentsByLanguage:a={},children:o,...s})=>{let l=xv((0,ek.useContext)(xl)),u=(0,rJ.useCallbackRef)(e=>(0,e_.jsx)(t,{...l(e)})),d=xv(s),c=(0,rJ.useCallbackRef)(e=>(0,e_.jsx)(r,{...d(e)})),p=/language-(\w+)/.exec(s.className||"")?.[1]??"";if("string"!=typeof o)return(0,e_.jsx)(xm,{node:e,components:{Pre:u,Code:c},code:o});let m=a[p]?.SyntaxHighlighter??n,f=a[p]?.CodeHeader??i;return(0,e_.jsx)(xh,{node:e,components:{Pre:u,Code:c,SyntaxHighlighter:m,CodeHeader:f},language:p||"unknown",code:o})},xb=(0,ek.memo)(({node:e,components:t,componentsByLanguage:r,...n})=>xu()?(0,e_.jsx)(xy,{node:e,components:t,componentsByLanguage:r,...n}):(0,e_.jsx)(t.Code,{...n}),(e,t)=>e.components===t.components&&e.componentsByLanguage===t.componentsByLanguage&&xs(e,t)),{useSmooth:xx,useSmoothStatus:x_,withSmoothContextProvider:xw}=g1,xk=({components:e,componentsByLanguage:t,smooth:r=!0,preprocess:n,...i})=>{let a=dt(),{text:o}=xx((0,ek.useMemo)(()=>n?{...a,text:n(a.text)}:a,[a,n]),r),{pre:s=xc,code:l=xp,SyntaxHighlighter:u=xm,CodeHeader:d=xf}=e??{},c=(0,ek.useMemo)(()=>({Pre:s,Code:l,SyntaxHighlighter:u,CodeHeader:d}),[s,l,u,d]),p=(0,rJ.useCallbackRef)(e=>(0,e_.jsx)(xb,{components:c,componentsByLanguage:t,...e})),m=(0,ek.useMemo)(()=>{let{pre:t,code:r,SyntaxHighlighter:n,CodeHeader:i,...a}=e??{};return{...a,pre:xd,code:p}},[p,e]);return(0,e_.jsx)(xa,{components:m,...i,children:o})},xI=(0,ek.forwardRef)(({className:e,containerProps:t,containerComponent:r="div",...n},i)=>{let a=x_();return(0,e_.jsx)(r,{"data-status":a.type,...t,className:(0,xg.default)(e,t?.className),ref:i,children:(0,e_.jsx)(xk,{...n})})});xI.displayName="MarkdownTextPrimitive";let xS=xw(xI);function x$(e,t){let r=String(e);if("string"!=typeof t)throw TypeError("Expected character");let n=0,i=r.indexOf(t);for(;-1!==i;)n++,i=r.indexOf(t,i+t.length);return n}let xj="phrasing",xE=["autolink","link","image","label"];function xC(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xT(e){this.config.enter.autolinkProtocol.call(this,e)}function xN(e){this.config.exit.autolinkProtocol.call(this,e)}function xA(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];g2("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function xR(e){this.config.exit.autolinkEmail.call(this,e)}function xP(e){this.exit(e)}function xO(e){!function(e,t,r){let n=bw((r||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){var i;let e=r[n];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<i.length;)b$(e,"text",o);function o(e,t){let r,o=-1;for(;++o<t.length;){let e=t[o],i=r?r.children:void 0;if(n(e,i?i.indexOf(e):void 0,r))return;r=e}if(r)return function(e,t){let r=t[t.length-1],n=i[a][0],o=i[a][1],s=0,l=r.children.indexOf(e),u=!1,d=[];n.lastIndex=0;let c=n.exec(e.value);for(;c;){let r=c.index,i={index:c.index,input:c.input,stack:[...t,e]},a=o(...c,i);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?n.lastIndex=r+1:(s!==r&&d.push({type:"text",value:e.value.slice(s,r)}),Array.isArray(a)?d.push(...a):a&&d.push(a),s=r+c[0].length,u=!0),!n.global)break;c=n.exec(e.value)}return u?(s<e.value.length&&d.push({type:"text",value:e.value.slice(s)}),r.children.splice(l,1,...d)):d=[e],l+d.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xM],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,xz]],{ignore:["link","linkReference"]})}function xM(e,t,r,n,i){let a,o="";if(!xD(i))return!1;if(/^w/i.test(t)&&(r=t+r,t="",o="http://"),(a=r.split(".")).length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),i=x$(e,"("),a=x$(e,")");for(;-1!==n&&i>a;)e+=r.slice(0,n+1),n=(r=r.slice(n+1)).indexOf(")"),a++;return[e,r]}(r+n);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function xz(e,t,r,n){return!(!xD(n,!0)||/[-\d_]$/.test(r))&&{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function xD(e,t){let r=e.input.charCodeAt(e.index-1);return(0===e.index||yc(r)||yd(r))&&(!t||47!==r)}function xU(){this.buffer()}function xL(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xZ(){this.buffer()}function xF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xB(e){let t=this.resume(),r=this.stack[this.stack.length-1];g2("footnoteReference"===r.type),r.identifier=yJ(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xV(e){this.exit(e)}function xq(e){let t=this.resume(),r=this.stack[this.stack.length-1];g2("footnoteDefinition"===r.type),r.identifier=yJ(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xW(e){this.exit(e)}function xJ(e,t,r,n){let i=r.createTracker(n),a=i.move("[^"),o=r.enter("footnoteReference"),s=r.enter("reference");return a+=i.move(r.safe(r.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]")}function xH(e,t,r){return 0===t?e:xK(e,t,r)}function xK(e,t,r){return(r?"":" ")+e}xJ.peek=function(){return"["};let xG=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function xY(e){this.enter({type:"delete",children:[]},e)}function xX(e){this.exit(e)}function xQ(e,t,r,n){let i=r.createTracker(n),a=r.enter("strikethrough"),o=i.move("~~");return o+=r.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function x0(e){return e.length}function x1(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}xQ.peek=function(){return"~"};function x2(e,t,r){let n=e.value||"",i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++a<r.unsafe.length;){let e,t=r.unsafe[a],i=r.compilePattern(t);if(t.atBreak)for(;e=i.exec(n);){let t=e.index;10===n.charCodeAt(t)&&13===n.charCodeAt(t-1)&&t--,n=n.slice(0,t)+" "+n.slice(e.index+1)}}return i+n+i}x2.peek=function(){return"`"};bw(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let x4=function(e,t,r,n){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(r),a=r.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(r);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===r.options.incrementListMarker?0:t.children.indexOf(e))+a);let o=a.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=r.createTracker(n);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,s.current()),function(e,t,r){return t?(r?"":" ".repeat(o))+e:(r?a:a+" ".repeat(o-a.length))+e});return l(),u};function x6(e){let t=e._align;g2(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function x5(e){this.exit(e),this.data.inTable=void 0}function x3(e){this.enter({type:"tableRow",children:[]},e)}function x9(e){this.exit(e)}function x8(e){this.enter({type:"tableCell",children:[]},e)}function x7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,_e));let r=this.stack[this.stack.length-1];g2("inlineCode"===r.type),r.value=t,this.exit(e)}function _e(e,t){return"|"===t?t:e}function _t(e){let t=this.stack[this.stack.length-2];g2("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function _r(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];g2("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,i=t.children,a=-1;for(;++a<i.length;){let e=i[a];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function _n(e,t,r,n){let i=e.children[0],a="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",s=r.createTracker(n);a&&s.move(o);let l=x4(e,t,r,{...n,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let _i={tokenize:function(e,t,r){let n=0;return function t(a){return(87===a||119===a)&&n<3?(n++,e.consume(a),t):46===a&&3===n?(e.consume(a),i):r(a)};function i(e){return null===e?r(e):t(e)}},partial:!0},_a={tokenize:function(e,t,r){let n,i,a;return o;function o(t){return 46===t||95===t?e.check(_s,l,s)(t):null===t||yl(t)||yc(t)||45!==t&&yd(t)?l(t):(a=!0,e.consume(t),o)}function s(t){return 95===t?n=!0:(i=n,n=void 0),e.consume(t),o}function l(e){return i||n||!a?r(e):t(e)}},partial:!0},_o={tokenize:function(e,t){let r=0,n=0;return i;function i(o){return 40===o?(r++,e.consume(o),i):41===o&&n<r?a(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(_s,t,a)(o):null===o||yl(o)||yc(o)?t(o):(e.consume(o),i)}function a(t){return 41===t&&n++,e.consume(t),i}},partial:!0},_s={tokenize:function(e,t,r){return n;function n(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),n):38===o?(e.consume(o),a):93===o?(e.consume(o),i):60===o||null===o||yl(o)||yc(o)?t(o):r(o)}function i(e){return null===e||40===e||91===e||yl(e)||yc(e)?t(e):n(e)}function a(t){return ye(t)?function t(i){return 59===i?(e.consume(i),n):ye(i)?(e.consume(i),t):r(i)}(t):r(t)}},partial:!0},_l={tokenize:function(e,t,r){return function(t){return e.consume(t),n};function n(e){return yt(e)?r(e):t(e)}},partial:!0},_u={name:"wwwAutolink",tokenize:function(e,t,r){let n=this;return function(t){return 87!==t&&119!==t||!_f.call(n,n.previous)||_y(n.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(_i,e.attempt(_a,e.attempt(_o,i),r),r)(t))};function i(r){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(r)}},previous:_f},_d={name:"protocolAutolink",tokenize:function(e,t,r){let n=this,i="",a=!1;return function(t){return(72===t||104===t)&&_h.call(n,n.previous)&&!_y(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):r(t)};function o(t){if(ye(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let r=i.toLowerCase();if("http"===r||"https"===r)return e.consume(t),s}return r(t)}function s(t){return 47===t?(e.consume(t),a)?l:(a=!0,s):r(t)}function l(t){return null===t||yn(t)||yl(t)||yc(t)||yd(t)?r(t):e.attempt(_a,e.attempt(_o,u),r)(t)}function u(r){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(r)}},previous:_h},_c={name:"emailAutolink",tokenize:function(e,t,r){let n,i,a=this;return function(t){return!_v(t)||!_g.call(a,a.previous)||_y(a.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(n){return _v(n)?(e.consume(n),t):64===n?(e.consume(n),o):r(n)}(t))};function o(t){return 46===t?e.check(_l,l,s)(t):45===t||95===t||yt(t)?(i=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),n=!0,o}function l(o){return i&&n&&ye(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):r(o)}},previous:_g},_p={},_m=48;for(;_m<123;)_p[_m]=_c,58==++_m?_m=65:91===_m&&(_m=97);function _f(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||yl(e)}function _h(e){return!ye(e)}function _g(e){return!(47===e||_v(e))}function _v(e){return 43===e||45===e||46===e||95===e||yt(e)}function _y(e){let t=e.length,r=!1;for(;t--;){let n=e[t][1];if(("labelLink"===n.type||"labelImage"===n.type)&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}_p[43]=_c,_p[45]=_c,_p[46]=_c,_p[95]=_c,_p[72]=[_c,_d],_p[104]=[_c,_d],_p[87]=[_c,_u],_p[119]=[_c,_u];let _b={tokenize:function(e,t,r){let n=this;return ym(e,function(e){let i=n.events[n.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):r(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function _x(e,t,r){let n,i=this,a=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;a--;){let e=i.events[a][1];if("labelImage"===e.type){n=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!n||!n._balanced)return r(a);let s=yJ(i.sliceSerialize({start:n.end,end:i.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):r(a)}}function __(e,t){let r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...s),e}function _w(e,t,r){let n,i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?r(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!n||null===s||91===s||yl(s))return r(s);if(93===s){e.exit("chunkString");let n=e.exit("gfmFootnoteCallString");return a.includes(yJ(i.sliceSerialize(n)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(s)}return yl(s)||(n=!0),o++,e.consume(s),92===s?u:l}function u(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function _k(e,t,r){let n,i,a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(t)}function u(t){if(s>999||93===t&&!i||null===t||91===t||yl(t))return r(t);if(93===t){e.exit("chunkString");let r=e.exit("gfmFootnoteDefinitionLabelString");return n=yJ(a.sliceSerialize(r)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),c}return yl(t)||(i=!0),s++,e.consume(t),92===t?d:u}function d(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}function c(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(n)||o.push(n),ym(e,p,"gfmFootnoteDefinitionWhitespace")):r(t)}function p(e){return t(e)}}function _I(e,t,r){return e.check(yv,t,e.attempt(_b,t,r))}function _S(e){e.exit("gfmFootnoteDefinition")}class _${constructor(){this.map=[]}add(e,t,r){!function(e,t,r,n){let i=0;if(0!==r||0!==n.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}(this,e,t,r)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,r=[];for(;t>0;)t-=1,r.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];r.push(e.slice()),e.length=0;let n=r.pop();for(;n;){for(let t of n)e.push(t);n=r.pop()}this.map.length=0}}function _j(e,t,r){let n,i=this,a=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let n=t>-1?i.events[t][1].type:null,a="tableHead"===n||"tableRow"===n?y:s;return a===y&&i.parser.lazy[i.now().line]?r(e):a(e)};function s(t){var r;return e.enter("tableHead"),e.enter("tableRow"),124===(r=t)||(n=!0,o+=1),l(r)}function l(t){return null===t?r(t):ys(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),c):r(t):yu(t)?ym(e,l,"whitespace")(t):(o+=1,n&&(n=!1,a+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),n=!0,l):(e.enter("data"),u(t))}function u(t){return null===t||124===t||yl(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?d:u)}function d(t){return 92===t||124===t?(e.consume(t),u):u(t)}function c(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?r(t):(e.enter("tableDelimiterRow"),n=!1,yu(t))?ym(e,p,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?f(t):124===t?(n=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),m):r(t)}function m(t){return yu(t)?ym(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(o+=1,n=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(o+=1,h(t)):null===t||ys(t)?v(t):r(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(r){return 45===r?(e.consume(r),t):58===r?(n=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(r),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(r))}(t)):r(t)}function g(t){return yu(t)?ym(e,v,"whitespace")(t):v(t)}function v(i){if(124===i)return p(i);if(null===i||ys(i))return n&&a===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):r(i);return r(i)}function y(t){return e.enter("tableRow"),b(t)}function b(r){return 124===r?(e.enter("tableCellDivider"),e.consume(r),e.exit("tableCellDivider"),b):null===r||ys(r)?(e.exit("tableRow"),t(r)):yu(r)?ym(e,b,"whitespace")(r):(e.enter("data"),x(r))}function x(t){return null===t||124===t||yl(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?_:x)}function _(t){return 92===t||124===t?(e.consume(t),x):x(t)}}function _E(e,t){let r,n,i,a=-1,o=!0,s=0,l=[0,0,0,0],u=[0,0,0,0],d=!1,c=0,p=new _$;for(;++a<e.length;){let m=e[a],f=m[1];"enter"===m[0]?"tableHead"===f.type?(d=!1,0!==c&&(_T(p,t,c,r,n),n=void 0,c=0),r={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(a,0,[["enter",r,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(o=!0,i=void 0,l=[0,0,0,0],u=[0,a+1,0,0],d&&(d=!1,n={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(a,0,[["enter",n,t]])),s="tableDelimiterRow"===f.type?2:n?3:1):s&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],i=_C(p,t,l,s,void 0,i),l=[0,0,0,0]),u[2]=a)):"tableCellDivider"===f.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],i=_C(p,t,l,s,void 0,i)),u=[(l=u)[1],a,0,0])):"tableHead"===f.type?(d=!0,c=a):"tableRow"===f.type||"tableDelimiterRow"===f.type?(c=a,0!==l[1]?(u[0]=u[1],i=_C(p,t,l,s,a,i)):0!==u[1]&&(i=_C(p,t,u,s,a,i)),s=0):s&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)&&(u[3]=a)}for(0!==c&&_T(p,t,c,r,n),p.consume(t.events),a=-1;++a<t.events.length;){let e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let r=!1,n=[];for(;t<e.length;){let i=e[t];if(r){if("enter"===i[0])"tableContent"===i[1].type&&n.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=n.length-1;n[e]="left"===n[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(r=!0);t+=1}return n}(t.events,a))}return e}function _C(e,t,r,n,i,a){0!==r[0]&&(a.end=Object.assign({},_N(t.events,r[0])),e.add(r[0],0,[["exit",a,t]]));let o=_N(t.events,r[1]);if(a={type:1===n?"tableHeader":2===n?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(r[1],0,[["enter",a,t]]),0!==r[2]){let i=_N(t.events,r[2]),a=_N(t.events,r[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},a)};if(e.add(r[2],0,[["enter",o,t]]),2!==n){let n=t.events[r[2]],i=t.events[r[3]];if(n[1].end=Object.assign({},i[1].end),n[1].type="chunkText",n[1].contentType="text",r[3]>r[2]+1){let t=r[2]+1,n=r[3]-r[2]-1;e.add(t,n,[])}}e.add(r[3]+1,0,[["exit",o,t]])}return void 0!==i&&(a.end=Object.assign({},_N(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function _T(e,t,r,n,i){let a=[],o=_N(t.events,r);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),n.end=Object.assign({},o),a.push(["exit",n,t]),e.add(r+1,0,a)}function _N(e,t){let r=e[t],n="enter"===r[0]?"start":"end";return r[1][n]}let _A={name:"tasklistCheck",tokenize:function(e,t,r){let n=this;return function(t){return null===n.previous&&n._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):r(t)};function i(t){return yl(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),a):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),a):r(t)}function a(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(t)}function o(n){return ys(n)?t(n):yu(n)?e.check({tokenize:_R},t,r)(n):r(n)}}};function _R(e,t,r){return ym(e,function(e){return null===e?r(e):t(e)},"whitespace")}let _P={};function _O(e){let t,r,n,i=e||_P,a=this.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),s=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(v7([{text:_p},{document:{91:{name:"gfmFootnoteDefinition",tokenize:_k,continuation:{tokenize:_I},exit:_S}},text:{91:{name:"gfmFootnoteCall",tokenize:_w},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_x,resolveTo:__}}},(t=(i||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,r,n){let i=this.previous,a=this.events,o=0;return function(s){return 126===i&&"characterEscape"!==a[a.length-1][1].type?n(s):(e.enter("strikethroughSequenceTemporary"),function a(s){let l=yT(i);if(126===s)return o>1?n(s):(e.consume(s),o++,a);if(o<2&&!t)return n(s);let u=e.exit("strikethroughSequenceTemporary"),d=yT(s);return u._open=!d||2===d&&!!l,u._close=!l||2===l&&!!d,r(s)}(s))}},resolveAll:function(e,t){let r=-1;for(;++r<e.length;)if("enter"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._close){let n=r;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[r][1].end.offset-e[r][1].start.offset==e[n][1].end.offset-e[n][1].start.offset){e[r][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[r][1].end)},a={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},o=[["enter",i,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",a,t]],s=t.parser.constructs.insideSpan.null;s&&v3(o,o.length,0,yN(s,e.slice(n+1,r),t)),v3(o,o.length,0,[["exit",a,t],["enter",e[r][1],t],["exit",e[r][1],t],["exit",i,t]]),v3(e,n-1,r-n+3,o),r=n+o.length-2;break}}for(r=-1;++r<e.length;)"strikethroughSequenceTemporary"===e[r][1].type&&(e[r][1].type="data");return e}},null==t&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:_j,resolveAll:_E}}},{text:{91:_A}}])),s.push([{transforms:[xO],enter:{literalAutolink:xC,literalAutolinkEmail:xT,literalAutolinkHttp:xT,literalAutolinkWww:xT},exit:{literalAutolink:xP,literalAutolinkEmail:xR,literalAutolinkHttp:xN,literalAutolinkWww:xA}},{enter:{gfmFootnoteCallString:xU,gfmFootnoteCall:xL,gfmFootnoteDefinitionLabelString:xZ,gfmFootnoteDefinition:xF},exit:{gfmFootnoteCallString:xB,gfmFootnoteCall:xV,gfmFootnoteDefinitionLabelString:xq,gfmFootnoteDefinition:xW}},{canContainEols:["delete"],enter:{strikethrough:xY},exit:{strikethrough:xX}},{enter:{table:x6,tableData:x8,tableHeader:x8,tableRow:x3},exit:{codeText:x7,table:x5,tableData:x9,tableHeader:x9,tableRow:x9}},{exit:{taskListCheckValueChecked:_t,taskListCheckValueUnchecked:_t,paragraph:_r}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xj,notInConstruct:xE},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xj,notInConstruct:xE},{character:":",before:"[ps]",after:"\\/",inConstruct:xj,notInConstruct:xE}]},(n=!1,i&&i.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:function(e,t,r,i){let a=r.createTracker(i),o=a.move("[^"),s=r.enter("footnoteDefinition"),l=r.enter("label");return o+=a.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((n?"\n":" ")+r.indentLines(r.containerFlow(e,a.current()),n?xK:xH))),s(),o},footnoteReference:xJ},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xG}],handlers:{delete:xQ}},function(e){let t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,a=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,r){let n=x2(e,t,r);return r.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&")),n},table:function(e,t,r,n){return s(function(e,t,r){let n=e.children,i=-1,a=[],o=t.enter("table");for(;++i<n.length;)a[i]=l(n[i],t,r);return o(),a}(e,r,n),e.align)},tableCell:o,tableRow:function(e,t,r,n){let i=s([l(e,r,n)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,r,n){let i=r.enter("tableCell"),o=r.enter("phrasing"),s=r.containerPhrasing(e,{...n,before:a,after:a});return o(),i(),s}function s(e,t){return function(e,t){let r=t||{},n=(r.align||[]).concat(),i=r.stringLength||x0,a=[],o=[],s=[],l=[],u=0,d=-1;for(;++d<e.length;){let t=[],n=[],a=-1;for(e[d].length>u&&(u=e[d].length);++a<e[d].length;){var c;let o=null==(c=e[d][a])?"":String(c);if(!1!==r.alignDelimiters){let e=i(o);n[a]=e,(void 0===l[a]||e>l[a])&&(l[a]=e)}t.push(o)}o[d]=t,s[d]=n}let p=-1;if("object"==typeof n&&"length"in n)for(;++p<u;)a[p]=x1(n[p]);else{let e=x1(n);for(;++p<u;)a[p]=e}p=-1;let m=[],f=[];for(;++p<u;){let e=a[p],t="",n="";99===e?(t=":",n=":"):108===e?t=":":114===e&&(n=":");let i=!1===r.alignDelimiters?1:Math.max(1,l[p]-t.length-n.length),o=t+"-".repeat(i)+n;!1!==r.alignDelimiters&&((i=t.length+i+n.length)>l[p]&&(l[p]=i),f[p]=i),m[p]=o}o.splice(1,0,m),s.splice(1,0,f),d=-1;let h=[];for(;++d<o.length;){let e=o[d],t=s[d];p=-1;let n=[];for(;++p<u;){let i=e[p]||"",o="",s="";if(!1!==r.alignDelimiters){let e=l[p]-(t[p]||0),r=a[p];114===r?o=" ".repeat(e):99===r?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===r.delimiterStart||p||n.push("|"),!1!==r.padding&&(!1!==r.alignDelimiters||""!==i)&&(!1!==r.delimiterStart||p)&&n.push(" "),!1!==r.alignDelimiters&&n.push(o),n.push(i),!1!==r.alignDelimiters&&n.push(s),!1!==r.padding&&n.push(" "),(!1!==r.delimiterEnd||p!==u-1)&&n.push("|")}h.push(!1===r.delimiterEnd?n.join("").replace(/ +$/,""):n.join(""))}return h.join("\n")}(e,{align:t,alignDelimiters:n,padding:r,stringLength:i})}function l(e,t,r){let n=e.children,i=-1,a=[],s=t.enter("tableRow");for(;++i<n.length;)a[i]=o(n[i],e,t,r);return s(),a}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_n}}]})}let _M=/\.(?:png|jpe?g|webp|gif|svg)(?:[?#].*)?$/i,_z=/\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#].*)?$/,_D=new Set(["localhost","127.0.0.1","::1"]),_U=/^\/(?:Users|home|tmp|var|private|Volumes|mnt|media|opt)\//i,_L=/^(?:[A-Za-z]:[\\/]|\/[A-Za-z]:[\\/])/,_Z=/^\\\\[^\\/]+[\\/][^\\/]+[\\/]/;function _F(e){let t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1).trim():t}function _B(e){return _M.test(e.split(/\s+/,1)[0])}function _V(e){return _U.test(e)||_L.test(e)||_Z.test(e)}function _q(e){let t=_F(e);if(!_z.test(t.split(/\s+/,1)[0]))return!1;if(t.startsWith("file://"))return!0;if(/^https?:\/\//i.test(t))try{let e=new URL(t);if(!_D.has(e.hostname))return!1;return _V(decodeURIComponent(e.pathname))}catch{return!1}return _V(t)}function _W(e){let t=_F(e);if(!_B(t))return!1;if(t.startsWith("file://"))return!0;if(/^https?:\/\//i.test(t))try{let e=new URL(t);if(!_D.has(e.hostname))return!1;return _V(decodeURIComponent(e.pathname))}catch{return!1}return _V(t)}function _J(e){let t=_F(e),r=t;if(t.startsWith("file://")||function(e){try{let t=new URL(e);return _D.has(t.hostname)}catch{return!1}}(t))try{r=decodeURIComponent(new URL(t).pathname)}catch{r=t}return r.split(/[?#]/,1)[0].replace(/\\/g,"/").split("/").filter(Boolean).at(-1)||"本地文件"}function _H(e){return _J(e)||"本地图片"}let _K=/(file:\/\/[^\s<>"']+\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#][^\s<>"']*)?|https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?\/[^\s<>"']+\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#][^\s<>"']*)?|\/(?:Users|home|tmp|var|private|Volumes|mnt|media|opt)\/[^\s<>"']+\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#][^\s<>"']*)?|(?:[A-Za-z]:[\\/]|\\\\)[^\s<>"']+\.[A-Za-z0-9][A-Za-z0-9_-]{0,15}(?:[?#][^\s<>"']*)?)/gi;function _G(e){return e.replace(_K,(e,t,r,n)=>{let i;if(!_q(e)||(i=n.slice(Math.max(0,r-3),r)).endsWith("](")||i.endsWith("](<")||"<"===i)return e;let a=_W(e)?_H(e):_J(e),o=_F(e).replaceAll(">","%3E");return`[${a}](<${o}>)`})}function _Y(e){let t;return!_W(t=_F(e))&&(/^data:image\//i.test(t)||(/^https?:\/\//i.test(t)||t.startsWith("/")&&!t.startsWith("//"))&&_B(t))?e:null}let _X=(0,ek.memo)(()=>(0,e_.jsx)(xS,{remarkPlugins:[_O],smooth:!1,className:"aui-md",components:_Q,preprocess:_G})),_Q=((e={})=>Object.fromEntries(Object.entries(e??{}).map(([e,t])=>t?[e,(0,ek.memo)(({node:e,...r})=>(0,e_.jsx)(t,{...r}),xs)]:[e,t])))({h1:({className:e,...t})=>(0,e_.jsx)("h1",{className:(0,rj.cn)("aui-md-h1 mb-2 scroll-m-20 font-semibold text-base first:mt-0 last:mb-0",e),...t}),h2:({className:e,...t})=>(0,e_.jsx)("h2",{className:(0,rj.cn)("aui-md-h2 mt-3 mb-1.5 scroll-m-20 font-semibold text-sm first:mt-0 last:mb-0",e),...t}),h3:({className:e,...t})=>(0,e_.jsx)("h3",{className:(0,rj.cn)("aui-md-h3 mt-2.5 mb-1 scroll-m-20 font-semibold text-sm first:mt-0 last:mb-0",e),...t}),h4:({className:e,...t})=>(0,e_.jsx)("h4",{className:(0,rj.cn)("aui-md-h4 mt-2 mb-1 scroll-m-20 font-medium text-sm first:mt-0 last:mb-0",e),...t}),h5:({className:e,...t})=>(0,e_.jsx)("h5",{className:(0,rj.cn)("aui-md-h5 mt-2 mb-1 font-medium text-sm first:mt-0 last:mb-0",e),...t}),h6:({className:e,...t})=>(0,e_.jsx)("h6",{className:(0,rj.cn)("aui-md-h6 mt-2 mb-1 font-medium text-sm first:mt-0 last:mb-0",e),...t}),p:({className:e,...t})=>(0,e_.jsx)("div",{className:(0,rj.cn)("aui-md-p my-2.5 leading-[1.7] first:mt-0 last:mb-0",e),...t}),a:({className:e,href:t,children:r,...n})=>{let i="string"==typeof t?t:"";if(_W(i))return(0,e_.jsx)(_2,{path:i,className:e});if(_q(i))return(0,e_.jsx)(_4,{path:i,className:e});let a=_Y(i);return a?(0,e_.jsx)(_0,{href:a,className:e}):(0,e_.jsx)("a",{href:t,className:(0,rj.cn)("aui-md-a text-primary underline underline-offset-2 hover:text-primary/80",e),...n,children:r})},img:({className:e,src:t,alt:r,...n})=>{let i="string"==typeof t?t:"";if(_W(i))return(0,e_.jsx)(_2,{path:i,className:e});let a=_Y(i);return a?(0,e_.jsx)(_1,{src:a,alt:r,className:e,...n}):null},blockquote:({className:e,...t})=>(0,e_.jsx)("blockquote",{className:(0,rj.cn)("aui-md-blockquote my-2.5 border-muted-foreground/30 border-s-2 ps-3 text-muted-foreground italic",e),...t}),ul:({className:e,...t})=>(0,e_.jsx)("ul",{className:(0,rj.cn)("aui-md-ul my-2 ms-4 list-disc marker:text-muted-foreground [&>li]:mt-1",e),...t}),ol:({className:e,...t})=>(0,e_.jsx)("ol",{className:(0,rj.cn)("aui-md-ol my-2 ms-4 list-decimal marker:text-muted-foreground [&>li]:mt-1",e),...t}),hr:({className:e,...t})=>(0,e_.jsx)("hr",{className:(0,rj.cn)("aui-md-hr my-2 border-muted-foreground/20",e),...t}),table:({className:e,...t})=>(0,e_.jsx)("table",{className:(0,rj.cn)("aui-md-table my-2 w-full border-separate border-spacing-0 overflow-y-auto",e),...t}),th:({className:e,...t})=>(0,e_.jsx)("th",{className:(0,rj.cn)("aui-md-th bg-muted px-2 py-1 text-start font-medium first:rounded-ss-lg last:rounded-se-lg [[align=center]]:text-center [[align=right]]:text-right",e),...t}),td:({className:e,...t})=>(0,e_.jsx)("td",{className:(0,rj.cn)("aui-md-td border-muted-foreground/20 border-s border-b px-2 py-1 text-start last:border-e [[align=center]]:text-center [[align=right]]:text-right",e),...t}),tr:({className:e,...t})=>(0,e_.jsx)("tr",{className:(0,rj.cn)("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-es-lg [&:last-child>td:last-child]:rounded-ee-lg",e),...t}),li:({className:e,...t})=>(0,e_.jsx)("li",{className:(0,rj.cn)("aui-md-li leading-[1.7]",e),...t}),sup:({className:e,...t})=>(0,e_.jsx)("sup",{className:(0,rj.cn)("aui-md-sup [&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>(0,e_.jsx)("pre",{className:(0,rj.cn)("aui-md-pre overflow-x-auto rounded-t-none rounded-b-lg border border-border/50 border-t-0 bg-muted/30 p-3 text-xs leading-relaxed",e),...t}),code:function({className:e,...t}){let r=xu();return(0,e_.jsx)("code",{className:(0,rj.cn)(!r&&"aui-md-inline-code rounded-md border border-border/50 bg-muted/50 px-1.5 py-0.5 font-mono text-[0.85em]",e),...t})},CodeHeader:({language:e,code:t})=>{let{isCopied:r,copyToClipboard:n}=(({copiedDuration:e=3e3}={})=>{let[t,r]=(0,ek.useState)(!1);return{isCopied:t,copyToClipboard:t=>{t&&"u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),e)},()=>{})}}})();return(0,e_.jsxs)("div",{className:"aui-code-header-root mt-2.5 flex items-center justify-between rounded-t-lg border border-border/50 border-b-0 bg-muted/50 px-3 py-1.5 text-xs",children:[(0,e_.jsx)("span",{className:"aui-code-header-language font-medium text-muted-foreground lowercase",children:e}),(0,e_.jsxs)(rN,{tooltip:"复制",onClick:()=>{t&&!r&&n(t)},children:[!r&&(0,e_.jsx)(aq,{}),r&&(0,e_.jsx)(aA,{})]})]})}});function _0({href:e,className:t}){return(0,e_.jsx)(_1,{src:e,alt:"图片",className:t})}function _1({src:e,alt:t,className:r}){return"string"!=typeof e?null:(0,e_.jsx)(fT.Root,{className:(0,rj.cn)("my-2",r),children:(0,e_.jsx)(fT.Zoom,{src:e,alt:t||"Image content",children:(0,e_.jsx)(fT.Preview,{src:e,alt:t||"Image content"})})})}function _2({path:e,className:t}){let r=_H(e),n=`/api/local-files/image?path=${encodeURIComponent(_F(e))}`;return(0,e_.jsxs)(fT.Root,{className:(0,rj.cn)("my-2",t),children:[(0,e_.jsx)(fT.Zoom,{src:n,alt:r,children:(0,e_.jsx)(fT.Preview,{src:n,alt:r})}),(0,e_.jsx)(fT.Filename,{children:r})]})}function _4({path:e,className:t}){let r=_J(e),n=()=>{fetch("/api/local-files/open",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e})}).catch(()=>{})};return(0,e_.jsxs)(fg.Root,{role:"button",tabIndex:0,className:(0,rj.cn)("my-2 cursor-pointer",t),onClick:n,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),n())},children:[(0,e_.jsx)(fg.Icon,{}),(0,e_.jsx)(fg.Name,{children:r})]})}let _6=rz("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),_5=rz("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function _3(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function _9(e){return"string"==typeof e?e.trim():""}function _8(e){return _3(e)?Object.values(e).filter(e=>_3(e)).sort((e,t)=>(Number(e.updatedAt)||0)-(Number(t.updatedAt)||0)):[]}function _7(e){if(null===e)return"null";if("string"==typeof e)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function we({icon:e,title:t,subtitle:r,children:n}){return(0,e_.jsxs)("section",{className:"rounded-md border border-border/70 bg-muted/20",children:[(0,e_.jsxs)("header",{className:"flex min-w-0 items-center gap-2 border-b px-3 py-2",children:[(0,e_.jsx)(e,{className:"size-4 shrink-0 text-muted-foreground"}),(0,e_.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e_.jsx)("p",{className:"truncate font-medium text-xs",children:t}),r?(0,e_.jsx)("p",{className:"truncate text-muted-foreground text-[11px]",children:r}):null]})]}),(0,e_.jsx)("div",{className:"min-w-0 p-3",children:n})]})}function wt({label:e,value:t,className:r}){return(0,e_.jsxs)("div",{className:"min-w-0",children:[(0,e_.jsx)("p",{className:"mb-1 font-medium text-muted-foreground text-[11px]",children:e}),(0,e_.jsx)("pre",{className:(0,rj.cn)("max-h-56 overflow-auto rounded-sm bg-background px-3 py-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words",r),children:t||" "})]})}function wr({diff:e}){let t=_9(e.path)||"diff",r=_9(e.oldText),n=_9(e.newText);return(0,e_.jsx)(we,{icon:oS,title:"Diff",subtitle:t,children:r||n?(0,e_.jsxs)("div",{className:"grid min-w-0 gap-2 md:grid-cols-2",children:[(0,e_.jsx)(wt,{label:"Before",value:r,className:"bg-red-500/5"}),(0,e_.jsx)(wt,{label:"After",value:n,className:"bg-green-500/5"})]}):(0,e_.jsx)(wt,{label:"Raw",value:_7(e)})})}function wn({terminal:e}){let t=_9(e.terminalId)||"terminal",r=_9(e.output)||_9(e.stdout)||_9(e.stderr)||_9(e.text);return(0,e_.jsx)(we,{icon:_5,title:"Terminal",subtitle:t,children:(0,e_.jsx)(wt,{label:"Output",value:r||_7(e)})})}function wi({resource:e,kind:t}){let r,n,i=(r=_3(e.resource)?e.resource:{},_9(e.uri)||_9(r.uri)||_9(e.name)),a=_9(e.title)||_9(e.name)||("resource"===t?"Resource":"Resource link"),o=_9(e.mimeType)||(_3(e.resource)?_9(e.resource.mimeType):""),s="resource"===t?(n=_3(e.resource)?e.resource:{},_9(e.text)||_9(n.text)):"";return(0,e_.jsx)(we,{icon:"resource"===t?dK:_6,title:a,subtitle:i,children:(0,e_.jsxs)("div",{className:"flex flex-col gap-2 text-xs",children:[o?(0,e_.jsx)("p",{className:"text-muted-foreground",children:o}):null,i?(0,e_.jsx)("code",{className:"rounded-sm bg-background px-2 py-1 font-mono text-[11px] break-all",children:i}):null,s?(0,e_.jsx)(wt,{label:"Preview",value:s}):null,i||s?null:(0,e_.jsx)(wt,{label:"Raw",value:_7(e)})]})})}function wa({item:e}){return(0,e_.jsx)(we,{icon:dK,title:"ACP block",subtitle:"unknown",children:(0,e_.jsx)(wt,{label:"Raw",value:_7(e)})})}function wo({toolCallId:e,className:t}){let r=ij(e=>e.message.metadata?.custom),n=(0,ek.useMemo)(()=>e?function(e,t){let r={diffs:[],terminals:[],resources:[],resourceLinks:[],unknown:[]},n=e?.acpToolContent;if(!_3(n))return r;let i=n.byToolCallId;if(!_3(i))return r;let a=i[t];return _3(a)?{diffs:_8(a.diffs),terminals:_8(a.terminals),resources:_8(a.resources),resourceLinks:_8(a.resourceLinks),unknown:_8(a.unknown)}:r}(r,e):{diffs:[],terminals:[],resources:[],resourceLinks:[],unknown:[]},[r,e]);return e&&(n.diffs.length>0||n.terminals.length>0||n.resources.length>0||n.resourceLinks.length>0||n.unknown.length>0)?(0,e_.jsxs)("div",{className:(0,rj.cn)("flex flex-col gap-2 px-4",t),children:[n.diffs.map(e=>(0,e_.jsx)(wr,{diff:e},`diff-${_7(e)}`)),n.terminals.map(e=>(0,e_.jsx)(wn,{terminal:e},`terminal-${_7(e)}`)),n.resources.map(e=>(0,e_.jsx)(wi,{resource:e,kind:"resource"},`resource-${_7(e)}`)),n.resourceLinks.map(e=>(0,e_.jsx)(wi,{resource:e,kind:"resource_link"},`resource-link-${_7(e)}`)),n.unknown.map(e=>(0,e_.jsx)(wa,{item:e},`unknown-${_7(e)}`))]}):null}function ws({className:e,open:t,onOpenChange:r,defaultOpen:n=!1,children:i,...a}){let o,s,l=(0,ek.useRef)(null),[u,d]=(0,ek.useState)(n),c=(o=(0,ek.useRef)(null),s=(0,ek.useRef)(null),(0,ek.useEffect)(()=>()=>{s.current?.()},[]),(0,ek.useCallback)(()=>{s.current?.(),function(){if(o.current||!l.current)return;let e=l.current;for(;e;){let{overflowY:t}=getComputedStyle(e);if("scroll"===t||"auto"===t){o.current=e;break}e=e.parentElement}}();let e=o.current;if(!e)return;let t=e.scrollTop,r=e.style.scrollbarWidth;e.style.scrollbarWidth="none";let n=()=>e.scrollTop=t;e.addEventListener("scroll",n);let i=setTimeout(()=>{e.removeEventListener("scroll",n),e.style.scrollbarWidth=r,s.current=null},200);s.current=()=>{clearTimeout(i),e.removeEventListener("scroll",n),e.style.scrollbarWidth=r}},[200,l])),p=void 0!==t,m=p?t:u,f=(0,ek.useCallback)(e=>{e||c(),p||d(e),r?.(e)},[c,p,r]);return(0,e_.jsx)(ot,{ref:l,"data-slot":"tool-fallback-root",open:m,onOpenChange:f,className:(0,rj.cn)("aui-tool-fallback-root group/tool-fallback-root my-2.5 w-full rounded-lg border py-3 first:mt-0 last:mb-0",e),style:{"--animation-duration":"200ms"},...a,children:i})}let wl={running:aR,complete:aA,incomplete:m3,"requires-action":aN};function wu({toolName:e,status:t,className:r,...n}){let i=t?.type??"complete",a="running"===i,o=t?.type==="incomplete"&&"cancelled"===t.reason,s=wl[i],l=o?"已取消工具":"已使用工具",u=(0,e_.jsx)("b",{children:e});return(0,e_.jsxs)(or,{"data-slot":"tool-fallback-trigger","aria-label":`${l}: ${e}`,className:(0,rj.cn)("aui-tool-fallback-trigger group/trigger flex w-full items-center gap-2 px-4 text-sm transition-colors",r),...n,children:[(0,e_.jsx)(s,{"data-slot":"tool-fallback-trigger-icon",className:(0,rj.cn)("aui-tool-fallback-trigger-icon size-4 shrink-0",o&&"text-muted-foreground",a&&"animate-spin")}),(0,e_.jsxs)("span",{"data-slot":"tool-fallback-trigger-label",className:(0,rj.cn)("aui-tool-fallback-trigger-label-wrapper relative min-w-0 flex-1 text-start leading-snug",o&&"text-muted-foreground line-through"),title:e,children:[(0,e_.jsx)("span",{className:"aui-tool-fallback-trigger-label line-clamp-2 break-words",children:u}),a&&(0,e_.jsx)("span",{"aria-hidden":!0,"data-slot":"tool-fallback-trigger-shimmer",className:"aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 line-clamp-2 break-words motion-reduce:animate-none",children:u})]}),(0,e_.jsx)(aV,{"data-slot":"tool-fallback-trigger-chevron",className:(0,rj.cn)("aui-tool-fallback-trigger-chevron size-4 shrink-0","transition-transform duration-(--animation-duration) ease-out","group-data-[state=closed]/trigger:-rotate-90","group-data-[state=open]/trigger:rotate-0")})]})}function wd({className:e,children:t,...r}){return(0,e_.jsx)(on,{"data-slot":"tool-fallback-content",className:(0,rj.cn)("aui-tool-fallback-content relative overflow-hidden text-sm outline-none","group/collapsible-content ease-out","data-[state=closed]:animate-collapsible-up","data-[state=open]:animate-collapsible-down","data-[state=closed]:fill-mode-forwards","data-[state=closed]:pointer-events-none","data-[state=open]:duration-(--animation-duration)","data-[state=closed]:duration-(--animation-duration)",e),...r,children:(0,e_.jsx)("div",{className:"mt-3 flex flex-col gap-2 border-t pt-2",children:t})})}function wc({argsText:e,className:t,...r}){return e?(0,e_.jsx)("div",{"data-slot":"tool-fallback-args",className:(0,rj.cn)("aui-tool-fallback-args px-4",t),...r,children:(0,e_.jsx)("pre",{className:"aui-tool-fallback-args-value max-h-40 overflow-auto rounded-md bg-muted/30 px-3 py-2 font-mono text-xs leading-relaxed whitespace-pre-wrap break-words",children:e})}):null}function wp({result:e,className:t,...r}){return void 0===e?null:(0,e_.jsxs)("div",{"data-slot":"tool-fallback-result",className:(0,rj.cn)("aui-tool-fallback-result border-t border-dashed px-4 pt-2",t),...r,children:[(0,e_.jsx)("p",{className:"aui-tool-fallback-result-header font-semibold",children:"结果:"}),(0,e_.jsx)("pre",{className:"aui-tool-fallback-result-content max-h-56 overflow-auto rounded-md bg-muted/30 px-3 py-2 font-mono text-xs leading-relaxed whitespace-pre-wrap break-words",children:null===e?"无结构化结果":"string"==typeof e?e:JSON.stringify(e,null,2)})]})}function wm({status:e,className:t,...r}){if(e?.type!=="incomplete")return null;let n=e.error,i=n?"string"==typeof n?n:JSON.stringify(n):null;if(!i)return null;let a="cancelled"===e.reason;return(0,e_.jsxs)("div",{"data-slot":"tool-fallback-error",className:(0,rj.cn)("aui-tool-fallback-error px-4",t),...r,children:[(0,e_.jsx)("p",{className:"aui-tool-fallback-error-header font-semibold text-muted-foreground",children:a?"取消原因:":"错误:"}),(0,e_.jsx)("p",{className:"aui-tool-fallback-error-reason text-muted-foreground",children:i})]})}let wf=(0,ek.memo)(({toolName:e,argsText:t,result:r,status:n,toolCallId:i})=>{let a=n?.type==="running"&&void 0!==r?{type:"complete"}:n,o=a?.type==="incomplete"&&"cancelled"===a.reason;return(0,e_.jsxs)(ws,{className:(0,rj.cn)(o&&"border-muted-foreground/30 bg-muted/30"),children:[(0,e_.jsx)(wu,{toolName:e,status:a}),(0,e_.jsxs)(wd,{children:[(0,e_.jsx)(wm,{status:a}),(0,e_.jsx)(wc,{argsText:t,className:(0,rj.cn)(o&&"opacity-60")}),(0,e_.jsx)(wo,{toolCallId:i,className:(0,rj.cn)(o&&"opacity-60")}),!o&&(0,e_.jsx)(wp,{result:r})]})]})});function wh(e){return"string"==typeof e?e.trim():""}wf.displayName="ToolFallback",wf.Root=ws,wf.Trigger=wu,wf.Content=wd,wf.Args=wc,wf.Result=wp,wf.Error=wm;function wg(e){return e.flatMap(e=>{if(!ai(e))return[];let t=wh(e.fieldName);if(!t)return[];let r=Array.isArray(e.options)?e.options.flatMap(e=>{if(!ai(e))return[];let t=wh(e.id);return t?[{id:t,label:wh(e.label)||wh(e.title)||t,...wh(e.description)?{description:wh(e.description)}:{},...!0===e.disabled?{disabled:!0}:{},...!0===e.recommended?{recommended:!0}:{}}]:[]}):[];return 0===r.length?[]:[{fieldName:t,fieldTitle:wh(e.fieldTitle)||wh(e.title)||t,...wh(e.fieldDescription)?{fieldDescription:wh(e.fieldDescription)}:{},selectionMode:"single"===e.selectionMode?"single":"multi",options:r,defaultValue:Array.isArray(e.defaultValue)||"string"==typeof e.defaultValue||null===e.defaultValue?e.defaultValue:null,minSelections:"number"==typeof e.minSelections?e.minSelections:void 0,maxSelections:"number"==typeof e.maxSelections?e.maxSelections:void 0,required:!1!==e.required,allowCustomInput:!1!==e.allowCustomInput,customInputLabel:wh(e.customInputLabel)||"自定义"}]})}function wv({request:e,question:t,stepIndex:r,stepCount:n,onSubmit:i}){let[a,o]=(0,ek.useState)(t.defaultValue??null),s=t.minSelections??+(!1!==t.required),l="single"===t.selectionMode?1:t.maxSelections,u=null===a?0:Array.isArray(a)?a.length:1,d=u>=s&&(void 0===l||u<=l);return(0,e_.jsxs)("div",{children:[n>1&&(0,e_.jsxs)("div",{className:"mb-2 text-muted-foreground text-xs",children:[r+1," / ",n]}),(0,e_.jsxs)("div",{className:"mb-2",children:[(0,e_.jsx)("div",{className:"font-medium text-sm",children:t.fieldTitle}),t.fieldDescription&&(0,e_.jsx)("div",{className:"mt-1 text-muted-foreground text-xs",children:t.fieldDescription})]}),(0,e_.jsx)(ft,{id:`${e.requestId}-${t.fieldName}`,options:t.options,selectionMode:t.selectionMode,value:a,defaultValue:t.defaultValue,minSelections:s,maxSelections:l,allowCustomInput:!1!==t.allowCustomInput,customInputLabel:t.customInputLabel??"自定义",className:"my-0 border-0 bg-transparent p-0 shadow-none",actions:[],onChange:o},`${e.requestId}-${t.fieldName}`),(0,e_.jsx)("div",{className:"mt-3 flex justify-end",children:(0,e_.jsx)(rC,{type:"button",size:"sm",disabled:!d,onClick:()=>i(a),children:"确认"})})]})}function wy(e){let t=tU(),r=ij(e=>e.threadListItem.remoteId),{workspacePath:n}=ax(),i=(0,ek.useMemo)(()=>(function(e){if(!ai(e))return null;let t=ai(e.structuredContent)?e.structuredContent:e;return"answered"===t.status&&"string"==typeof t.requestId&&"accept"===t.action&&ai(t.content)?{status:"answered",requestId:t.requestId,action:"accept",content:t.content}:"cancelled"===t.status&&"string"==typeof t.requestId?{status:"cancelled",requestId:t.requestId,action:"cancel"}:"user_no_response"===t.status&&"string"==typeof t.requestId?{status:"user_no_response",requestId:t.requestId,instruction:wh(t.instruction)}:null})(e.result),[e.result]),a=(0,ek.useMemo)(()=>{var t;return(t=e).toolName===at?t.args:i4(t.args)?.args},[e]),o=(0,ek.useMemo)(()=>(function e(t){return ai(t)?Array.isArray(t.questions)?wg(t.questions):ai(t.question)?wg([t.question]):ai(t.arguments)?e(t.arguments):ai(t.args)?e(t.args):[]:[]})(a),[a]),s=(0,ek.useMemo)(()=>(function e(t){return ai(t)&&(wh(t.message)||(ai(t.arguments)?e(t.arguments):"")||(ai(t.args)?e(t.args):""))||"请选择"})(a),[a]),l=(0,ek.useMemo)(()=>(function e(t){return!!ai(t)&&(!0===t.__acpUiDevReviewLocalRequest||(ai(t.arguments)?e(t.arguments):!!ai(t.args)&&e(t.args)))})(a),[a]),u=(0,ek.useMemo)(()=>Math.min(function e(t){if(!ai(t))return 0;let r=t.__acpUiDevReviewInitialStepIndex;return"number"==typeof r&&Number.isFinite(r)?Math.max(0,Math.floor(r)):ai(t.arguments)?e(t.arguments):ai(t.args)?e(t.args):0}(a),Math.max(o.length-1,0)),[a,o.length]),[d,c]=(0,ek.useState)(null),[p,m]=(0,ek.useState)({}),[f,h]=(0,ek.useState)(0),[g,v]=(0,ek.useState)(!1),[y,b]=(0,ek.useState)(null),x=(0,ek.useRef)(null);(0,ek.useEffect)(()=>{if(l&&o.length>0)return;if(i?.requestId)return void aT.getUserChoiceRequest({workspacePath:n,requestId:i.requestId}).then(({request:e})=>c(e)).catch(()=>{});let t=window.setInterval(()=>{aT.getUserChoiceRequest({workspacePath:n,threadId:r,toolCallId:e.toolCallId}).then(({request:e})=>{if(e){c(e),window.clearInterval(t);return}return aT.getUserChoiceRequest({workspacePath:n,threadId:r}).then(({request:e})=>{e&&(c(e),window.clearInterval(t))})}).catch(()=>{})},500);return()=>window.clearInterval(t)},[o.length,l,e.toolCallId,i?.requestId,r,n]);let _=(0,ek.useMemo)(()=>l&&0!==o.length?{requestId:`dev-review-${e.toolCallId}`,workspacePath:n??"",threadId:r??null,toolCallId:e.toolCallId,message:s,questions:o,waitTimeoutMs:12e4,status:"pending",createdAt:"",updatedAt:"",expiresAt:""}:null,[s,o,l,e.toolCallId,r,n]),w=d??_,k=w?.requestId??null;(0,ek.useEffect)(()=>{x.current!==k&&(x.current=k,b(null),m({}),h(u))},[u,k]);let I=w?.questions&&w.questions.length>0?w.questions:o,S=w?.message||s,$=I[f],j=i?.status==="user_no_response"?y:i??y,E=i?j?.status==="answered"?"answered":j?.status==="cancelled"?"cancelled":w?"pending":"expired":j?"answered"===j.status?"answered":"cancelled"===j.status?"cancelled":"expired":w?"pending":"loading",C="answered"===E?m6:"cancelled"===E||"expired"===E?m3:m5,T=async e=>{v(!0);try{if(w===_)return void b(e);if(await aT.answerUserChoiceRequest({workspacePath:n,requestId:e.requestId,answer:e}),b(e),i?.status==="user_no_response"){let r;t.thread().getState().isRunning&&t.thread().cancelRun(),t.thread().append({role:"user",content:[{type:"text",text:(r="action"in e?e.action:e.status,[an,`requestId: ${e.requestId}`,`action: ${r}`,"content:",JSON.stringify(e,null,2)].join("\n"))}],startRun:!0})}}finally{v(!1)}},N=j?.status==="answered"?Object.entries(j.content).map(([e,t])=>{let r=I.find(t=>t.fieldName===e);return`${r?.fieldTitle??e}: ${Array.isArray(t)?t.join("、")||"未选择":t||"未选择"}`}).join(";"):j?.status==="cancelled"?"已取消":"";return(0,e_.jsxs)("div",{"data-slot":"tool-ui-user-choice",className:"my-2.5 w-full rounded-lg border bg-card p-4 shadow-xs",children:[(0,e_.jsxs)("div",{className:"mb-3 flex items-start gap-3",children:[(0,e_.jsx)(C,{className:(0,rj.cn)("mt-0.5 size-4 shrink-0","answered"===E?"text-emerald-600 dark:text-emerald-400":"pending"===E?"text-primary":"text-muted-foreground")}),(0,e_.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e_.jsx)("div",{className:"break-words font-medium text-base leading-snug",children:S}),(0,e_.jsx)("div",{className:"mt-1 text-muted-foreground text-xs",children:"loading"===E?"准备选项":"pending"===E?"等待选择":N})]})]}),j&&N?(0,e_.jsx)("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-sm",children:N}):$&&w?(0,e_.jsx)(wv,{request:w,question:$,stepIndex:f,stepCount:I.length,onSubmit:e=>{if(!$||!w)return;let t={...p,[$.fieldName]:"multi"===$.selectionMode?Array.isArray(e)?e:e?[e]:[]:Array.isArray(e)?e[0]??null:e};(m(t),f<I.length-1)?h(e=>e+1):T({status:"answered",requestId:w.requestId,action:"accept",content:t})}},`${w.requestId}-${$.fieldName}-${f}`):(0,e_.jsx)("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-muted-foreground text-sm",children:"正在准备选项..."}),w&&!j&&(0,e_.jsx)("div",{className:"mt-3 flex justify-end gap-2",children:(0,e_.jsx)(rC,{type:"button",variant:"outline",size:"sm",disabled:g,onClick:()=>void T({status:"cancelled",requestId:w.requestId,action:"cancel"}),children:"取消"})})]})}let wb=[{id:"image-generation",canRender:function(e){var t;if(e.toolName===i0)return!0;let r=i4(e.args);return e.toolName===i1&&(r?.toolName===iQ||r?.toolName===i0||i2(t=r?.args)&&t.server===iX&&t.tool===iQ)},render:e=>(0,e_.jsx)(ow,{...e})},{id:"user-choice",canRender:function(e){var t;if(e.toolName===at)return!0;let r=i4(e.args);return e.toolName===i1&&(r?.toolName===ae||r?.toolName===at||ai(t=r?.args)&&t.server===i7&&t.tool===ae)},render:e=>(0,e_.jsx)(wy,{...e})}],wx=()=>(0,e_.jsx)(dH.Error,{children:(0,e_.jsx)(m0.Root,{className:"aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm dark:bg-destructive/5 dark:text-red-200",children:(0,e_.jsx)(m0.Message,{className:"aui-message-error-message line-clamp-2"})})}),w_=()=>(0,e_.jsxs)(dH.Root,{"data-slot":"aui_assistant-message-root","data-role":"assistant",className:"fade-in slide-in-from-bottom-1 relative animate-in duration-150 [contain-intrinsic-size:auto_300px] [content-visibility:auto]",children:[(0,e_.jsxs)("div",{"data-slot":"aui_assistant-message-content",className:"wrap-break-word px-2 text-[15px] text-foreground leading-relaxed md:text-base",children:[(0,e_.jsx)(dH.Parts,{children:({part:e})=>{if("text"===e.type)return(0,e_.jsx)(_X,{});if("image"===e.type)return(0,e_.jsx)(fT,{...e});if("file"===e.type)return(0,e_.jsx)(fg,{...e});if("tool-call"===e.type){let t;if("acp.elicitation.option_list"===e.toolName)return(0,e_.jsx)(fa,{...e});let r=(t=wb.find(t=>t.canRender(e)))?t.render(e):null;return r||(e.toolUI??(0,e_.jsx)(wf,{...e}))}return null}}),(0,e_.jsx)(wx,{})]}),(0,e_.jsxs)("div",{"data-slot":"aui_assistant-message-footer",className:(0,rj.cn)("ms-2 flex items-center","-mb-7.5 min-h-7.5 pt-1.5"),children:[(0,e_.jsx)(w$,{}),(0,e_.jsx)(ww,{})]})]}),ww=()=>(0,e_.jsxs)(mq.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-assistant-action-bar-root col-start-3 row-start-2 -ms-1 flex gap-1 text-muted-foreground",children:[(0,e_.jsx)(mq.Copy,{asChild:!0,children:(0,e_.jsxs)(rN,{tooltip:"复制",children:[(0,e_.jsx)(oL,{condition:e=>e.message.isCopied,children:(0,e_.jsx)(aA,{})}),(0,e_.jsx)(oL,{condition:e=>!e.message.isCopied,children:(0,e_.jsx)(aq,{})})]})}),(0,e_.jsx)(mq.Reload,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:"重新生成",children:(0,e_.jsx)(iU,{})})}),(0,e_.jsxs)(mO.Root,{children:[(0,e_.jsx)(mO.Trigger,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:"更多",className:"data-[state=open]:bg-accent",children:(0,e_.jsx)(m2,{})})}),(0,e_.jsx)(mO.Content,{side:"bottom",align:"start",className:"aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",children:(0,e_.jsx)(mq.ExportMarkdown,{asChild:!0,children:(0,e_.jsxs)(mO.Item,{className:"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",children:[(0,e_.jsx)(aW,{className:"size-4"}),"导出为 Markdown"]})})})]})]}),wk=()=>ij(e=>e.message.content.some(e=>{var t;return"text"===e.type&&"string"==typeof(t=e.text)&&t.trimStart().startsWith(an)}))?null:(0,e_.jsxs)(dH.Root,{"data-slot":"aui_user-message-root",className:"fade-in slide-in-from-bottom-1 grid animate-in auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 duration-150 [contain-intrinsic-size:auto_60px] [content-visibility:auto] [&:where(>*)]:col-start-2","data-role":"user",children:[(0,e_.jsx)(cc,{}),(0,e_.jsxs)("div",{className:"aui-user-message-content-wrapper relative col-start-2 min-w-0",children:[(0,e_.jsx)("div",{className:"aui-user-message-content wrap-break-word peer rounded-2xl bg-muted px-4 py-2.5 text-[15px] text-foreground md:text-base empty:hidden",children:(0,e_.jsx)(dH.Parts,{components:{Image:fT,File:fg}})}),(0,e_.jsx)("div",{className:"aui-user-action-bar-wrapper absolute start-0 top-1/2 -translate-x-full -translate-y-1/2 pe-2 peer-empty:hidden rtl:translate-x-full",children:(0,e_.jsx)(wI,{})})]}),(0,e_.jsx)(w$,{"data-slot":"aui_user-branch-picker",className:"col-span-full col-start-1 row-start-3 -me-1 justify-end"})]}),wI=()=>(0,e_.jsx)(mq.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-user-action-bar-root flex flex-col items-end",children:(0,e_.jsx)(mq.Edit,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:"编辑",className:"aui-user-action-edit p-4",children:(0,e_.jsx)(m4,{})})})}),wS=()=>(0,e_.jsx)(dH.Root,{"data-slot":"aui_edit-composer-wrapper",className:"flex flex-col px-2",children:(0,e_.jsxs)(lU.Root,{className:"aui-edit-composer-root ms-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted",children:[(0,e_.jsx)(lU.Input,{className:"aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm outline-none",autoFocus:!0}),(0,e_.jsxs)("div",{className:"aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end",children:[(0,e_.jsx)(lU.Cancel,{asChild:!0,children:(0,e_.jsx)(rC,{variant:"ghost",size:"sm",children:"取消"})}),(0,e_.jsx)(lU.Send,{asChild:!0,children:(0,e_.jsx)(rC,{size:"sm",children:"更新"})})]})]})}),w$=({className:e,...t})=>(0,e_.jsxs)(mY.Root,{hideWhenSingleBranch:!0,className:(0,rj.cn)("aui-branch-picker-root -ms-2 me-2 inline-flex items-center text-muted-foreground text-xs",e),...t,children:[(0,e_.jsx)(mY.Previous,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:"上一个版本",children:(0,e_.jsx)(m1,{})})}),(0,e_.jsxs)("span",{className:"aui-branch-picker-state font-medium",children:[(0,e_.jsx)(mY.Number,{})," / ",(0,e_.jsx)(mY.Count,{})]}),(0,e_.jsx)(mY.Next,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:"下一个版本",children:(0,e_.jsx)(ud,{})})})]}),wj=()=>(0,e_.jsx)("div",{"data-slot":"aui_message-group",className:"mb-10 flex flex-col gap-y-8 empty:hidden",children:(0,e_.jsx)(sk.Messages,{children:()=>(0,e_.jsx)(wE,{})})}),wE=()=>{let e=ij(e=>e.message.role);return ij(e=>e.message.composer.isEditing)?(0,e_.jsx)(wS,{}):"user"===e?(0,e_.jsx)(wk,{}):(0,e_.jsx)(w_,{})};var sk=sk;let wC=rz("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),wT=()=>(0,e_.jsx)(sk.ScrollToBottom,{asChild:!0,children:(0,e_.jsx)(rN,{tooltip:"滚动到底部",variant:"outline",className:"aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:border-border dark:bg-background dark:hover:bg-accent",children:(0,e_.jsx)(wC,{})})}),wN=({isHistoryRoute:e=!1})=>{let t=ij(e=>e.thread.messages.length),r=ij(e=>e.thread.isLoading),n=function({isHistoryRoute:e,isLoading:t,messageCount:r}){let[n,i]=(0,ek.useState)(!1);return(0,ek.useEffect)(()=>{if(!e||t||r>0)return void i(!1);let n=window.setTimeout(()=>i(!0),450);return()=>window.clearTimeout(n)},[e,t,r]),n}({isHistoryRoute:e,isLoading:r,messageCount:t}),i=e&&0===t&&(r||!n);return(0,e_.jsx)(sk.Root,{className:"aui-root aui-thread-root @container flex h-full flex-col bg-background",style:{"--thread-max-width":"44rem","--composer-radius":"24px","--composer-padding":"10px"},children:(0,e_.jsx)(sk.Viewport,{turnAnchor:"top","data-slot":"aui_thread-viewport",className:"relative flex flex-1 flex-col overflow-x-auto overflow-y-auto scroll-smooth",children:(0,e_.jsxs)("div",{className:"mx-auto flex w-full max-w-(--thread-max-width) flex-1 flex-col px-4 pt-4",children:[(0,e_.jsx)(oL,{condition:()=>i,children:(0,e_.jsx)(c$,{})}),(0,e_.jsx)(oL,{condition:()=>0===t&&(!e||n),children:(0,e_.jsx)(ck,{isHistoryRoute:e})}),(0,e_.jsx)(wj,{}),(0,e_.jsxs)(sk.ViewportFooter,{className:"aui-thread-viewport-footer sticky bottom-0 mt-auto flex flex-col gap-0 overflow-visible rounded-t-(--composer-radius) bg-background pb-4 md:pb-6",children:[(0,e_.jsx)(wT,{}),(0,e_.jsx)(cy,{}),(0,e_.jsx)(cf,{})]})]})})})},wA=rz("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s([],77208),e.i(77208);var mk=mk,mk=mk;let wR=mk.createDropdownMenuScope(),wP=({__scopeThreadListItemMore:e,...t})=>{let r=wR(e);return(0,e_.jsx)(mk.Root,{...r,...t})};wP.displayName="ThreadListItemMorePrimitive.Root";let wO=(0,ek.forwardRef)(({__scopeThreadListItemMore:e,...t},r)=>{let n=wR(e);return(0,e_.jsx)(mj,{...n,...t,ref:r})});wO.displayName="ThreadListItemMorePrimitive.Trigger";var mk=mk;let wM=(0,ek.forwardRef)(({__scopeThreadListItemMore:e,portalProps:t,sideOffset:r=4,...n},i)=>{let a=wR(e);return(0,e_.jsx)(mk.Portal,{...a,...t,children:(0,e_.jsx)(mE,{...a,...n,ref:i,sideOffset:r})})});wM.displayName="ThreadListItemMorePrimitive.Content";let wz=(0,ek.forwardRef)(({__scopeThreadListItemMore:e,...t},r)=>{let n=wR(e);return(0,e_.jsx)(mC,{...n,...t,ref:r})});wz.displayName="ThreadListItemMorePrimitive.Item";let wD=(0,ek.forwardRef)(({__scopeThreadListItemMore:e,...t},r)=>{let n=wR(e);return(0,e_.jsx)(mT,{...n,...t,ref:r})});wD.displayName="ThreadListItemMorePrimitive.Separator",e.s(["Content",0,wM,"Item",0,wz,"Root",0,wP,"Separator",0,wD,"Trigger",0,wO],19358);var wU=e.i(19358),wU=wU;e.s([],78036),e.i(78036);let wL=(0,ek.forwardRef)((e,t)=>{let r=ij(e=>e.threads.mainThreadId===e.threadListItem.id);return(0,e_.jsx)(oH.div,{...r?{"data-active":"true","aria-current":"true"}:null,...e,ref:t})});wL.displayName="ThreadListItemPrimitive.Root";let wZ=sf("ThreadListItemPrimitive.Archive",()=>{let e,{archive:t}=(e=tU(),{archive:(0,ek.useCallback)(()=>{e.threadListItem().archive()},[e])});return t}),wF=sf("ThreadListItemPrimitive.Unarchive",()=>{let e,{unarchive:t}=(e=tU(),{unarchive:(0,ek.useCallback)(()=>{e.threadListItem().unarchive()},[e])});return t}),wB=sf("ThreadListItemPrimitive.Delete",()=>{let e,{delete:t}=(e=tU(),{delete:(0,ek.useCallback)(()=>{e.threadListItem().delete()},[e])});return t}),wV=sf("ThreadListItemPrimitive.Trigger",()=>{let e,{switchTo:t}=(e=tU(),{switchTo:(0,ek.useCallback)(()=>{e.threadListItem().switchTo()},[e])});return t}),wq=({fallback:e})=>{let t=ij(e=>e.threadListItem.title);return(0,e_.jsx)(e_.Fragment,{children:t||e})};wq.displayName="ThreadListItemPrimitive.Title",e.s(["Archive",0,wZ,"Delete",0,wB,"Root",0,wL,"Title",0,wq,"Trigger",0,wV,"Unarchive",0,wF],48995);var wW=e.i(48995),wW=wW;e.s([],24380),e.i(24380);let wJ=(0,ek.forwardRef)(({onClick:e,disabled:t,...r},n)=>{let i,a=ij(e=>e.threads.newThreadId===e.threads.mainThreadId),{switchToNewThread:o}=(i=tU(),{switchToNewThread:(0,ek.useCallback)(()=>{i.threads().switchToNewThread()},[i])});return(0,e_.jsx)(oH.button,{type:"button",...a?{"data-active":"true","aria-current":"true"}:null,...r,ref:n,disabled:t,onClick:(0,rU.composeEventHandlers)(e,o)})});wJ.displayName="ThreadListPrimitive.New";let wH=({index:e,archived:t,children:r})=>{let n=tU({threadListItem:tw({source:"threads",query:{type:"index",index:e,archived:t},get:r=>r.threads().item({index:e,archived:t})})});return(0,e_.jsx)(t_,{value:n,children:r})},wK=(0,ek.memo)(({index:e,archived:t=!1,components:r})=>{let n=r.ThreadListItem;return(0,e_.jsx)(wH,{index:e,archived:t,children:(0,e_.jsx)(n,{})})},(e,t)=>e.index===t.index&&e.archived===t.archived&&e.components.ThreadListItem===t.components.ThreadListItem);wK.displayName="ThreadListPrimitive.ItemByIndex";let wG=({archived:e,children:t})=>{let r=ij(t=>e?t.threads.archivedThreadIds.length:t.threads.threadIds.length);return(0,ek.useMemo)(()=>Array.from({length:r},(r,n)=>(0,e_.jsx)(wH,{index:n,archived:e,children:(0,e_.jsx)(si,{getItemState:t=>t.threads().item({index:n,archived:e}).getState(),children:e=>t({get threadListItem(){return e()}})})},n)),[r,e,t])},wY=({archived:e=!1,components:t,children:r})=>{if(t){let r=t.ThreadListItem;return(0,e_.jsx)(wG,{archived:e,children:()=>(0,e_.jsx)(r,{})})}return(0,e_.jsx)(wG,{archived:e,children:r})};wY.displayName="ThreadListPrimitive.Items";let wX=sf("ThreadListPrimitive.LoadMore",()=>{let e,t,{loadMore:r,disabled:n}=(e=tU(),t=ij(e=>!e.threads.hasMore||e.threads.isLoading||e.threads.isLoadingMore),{loadMore:(0,ek.useCallback)(()=>{e.threads().loadMore()},[e]),disabled:t});return n?null:r}),wQ=(0,ek.forwardRef)((e,t)=>(0,e_.jsx)(oH.div,{...e,ref:t}));wQ.displayName="ThreadListPrimitive.Root",e.s(["ItemByIndex",0,wK,"Items",0,wY,"LoadMore",0,wX,"New",0,wJ,"Root",0,wQ],48376);var w0=e.i(48376),w0=w0;let w1=rz("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),w2=rz("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),w4=rz("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var w6=Symbol("radix.slottable");function w5(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===w6}var w3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(w5);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),w9=ek.forwardRef((e,t)=>(0,e_.jsx)(w3.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));w9.displayName="Label",e.s(["Label",0,w9,"Root",0,w9],73741);var w8=e.i(73741),w8=w8;function w7({className:e,...t}){return(0,e_.jsx)(w8.Root,{"data-slot":"label",className:(0,rj.cn)("flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",e),...t})}var ke=e.i(35804),kt=Symbol("radix.slottable");function kr(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===kt}var kn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(kr);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),ki="Switch",[ka,ko]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(ki),[ks,kl]=ka(ki),ku=ek.forwardRef((e,t)=>{let{__scopeSwitch:r,name:n,checked:i,defaultChecked:a,required:o,disabled:s,value:l="on",onCheckedChange:u,form:d,...c}=e,[p,m]=ek.useState(null),f=(0,rh.useComposedRefs)(t,e=>m(e)),h=ek.useRef(!1),g=!p||d||!!p.closest("form"),[v,y]=(0,rZ.useControllableState)({prop:i,defaultProp:a??!1,onChange:u,caller:ki});return(0,e_.jsxs)(ks,{scope:r,checked:v,disabled:s,children:[(0,e_.jsx)(kn.button,{type:"button",role:"switch","aria-checked":v,"aria-required":o,"data-state":km(v),"data-disabled":s?"":void 0,disabled:s,value:l,...c,ref:f,onClick:(0,rU.composeEventHandlers)(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,e_.jsx)(kp,{control:p,bubbles:!h.current,name:n,value:l,checked:v,required:o,disabled:s,form:d,style:{transform:"translateX(-100%)"}})]})});ku.displayName=ki;var kd="SwitchThumb",kc=ek.forwardRef((e,t)=>{let{__scopeSwitch:r,...n}=e,i=kl(kd,r);return(0,e_.jsx)(kn.span,{"data-state":km(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});kc.displayName=kd;var kp=ek.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},a)=>{let o,s=ek.useRef(null),l=(0,rh.useComposedRefs)(s,a),u=(o=ek.useRef({value:r,previous:r}),ek.useMemo(()=>(o.current.value!==r&&(o.current.previous=o.current.value,o.current.value=r),o.current.previous),[r])),d=(0,ke.useSize)(t);return ek.useEffect(()=>{let e=s.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(u!==r&&t){let i=new Event("click",{bubbles:n});t.call(e,r),e.dispatchEvent(i)}},[u,r,n]),(0,e_.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:l,style:{...i.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function km(e){return e?"checked":"unchecked"}kp.displayName="SwitchBubbleInput",e.s(["Root",0,ku,"Switch",0,ku,"SwitchThumb",0,kc,"Thumb",0,kc,"createSwitchScope",0,ko],57287);var kf=e.i(57287),kf=kf;function kh({className:e,...t}){return(0,e_.jsx)(kf.Root,{"data-slot":"switch",className:(0,rj.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",e),...t,children:(0,e_.jsx)(kf.Thumb,{"data-slot":"switch-thumb",className:(0,rj.cn)("pointer-events-none block size-4 rounded-full bg-background ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground")})})}var kg=Symbol("radix.slottable");function kv(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===kg}var ky=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(kv);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),kb="Tabs",[kx,k_]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(kb,[c2]),kw=c2(),[kk,kI]=kx(kb),kS=ek.forwardRef((e,t)=>{let{__scopeTabs:r,value:n,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:l="automatic",...u}=e,d=cL(s),[c,p]=(0,rZ.useControllableState)({prop:n,onChange:i,defaultProp:a??"",caller:kb});return(0,e_.jsx)(kk,{scope:r,baseId:(0,rL.useId)(),value:c,onValueChange:p,orientation:o,dir:d,activationMode:l,children:(0,e_.jsx)(ky.div,{dir:d,"data-orientation":o,...u,ref:t})})});kS.displayName=kb;var k$="TabsList",kj=ek.forwardRef((e,t)=>{let{__scopeTabs:r,loop:n=!0,...i}=e,a=kI(k$,r),o=kw(r);return(0,e_.jsx)(c5,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:(0,e_.jsx)(ky.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});kj.displayName=k$;var kE="TabsTrigger",kC=ek.forwardRef((e,t)=>{let{__scopeTabs:r,value:n,disabled:i=!1,...a}=e,o=kI(kE,r),s=kw(r),l=kA(o.baseId,n),u=kR(o.baseId,n),d=n===o.value;return(0,e_.jsx)(c8,{asChild:!0,...s,focusable:!i,active:d,children:(0,e_.jsx)(ky.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...a,ref:t,onMouseDown:(0,rU.composeEventHandlers)(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():o.onValueChange(n)}),onKeyDown:(0,rU.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&o.onValueChange(n)}),onFocus:(0,rU.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==o.activationMode;d||i||!e||o.onValueChange(n)})})})});kC.displayName=kE;var kT="TabsContent",kN=ek.forwardRef((e,t)=>{let{__scopeTabs:r,value:n,forceMount:i,children:a,...o}=e,s=kI(kT,r),l=kA(s.baseId,n),u=kR(s.baseId,n),d=n===s.value,c=ek.useRef(d);return ek.useEffect(()=>{let e=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,e_.jsx)(r6.Presence,{present:i||d,children:({present:r})=>(0,e_.jsx)(ky.div,{"data-state":d?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!r,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:c.current?"0s":void 0},children:r&&a})})});function kA(e,t){return`${e}-trigger-${t}`}function kR(e,t){return`${e}-content-${t}`}kN.displayName=kT,e.s(["Content",0,kN,"List",0,kj,"Root",0,kS,"Tabs",0,kS,"TabsContent",0,kN,"TabsList",0,kj,"TabsTrigger",0,kC,"Trigger",0,kC,"createTabsScope",0,k_],26209);var kP=e.i(26209),kP=kP;function kO({className:e,...t}){return(0,e_.jsx)(kP.Root,{"data-slot":"tabs",className:(0,rj.cn)("flex flex-col gap-4",e),...t})}function kM({className:e,...t}){return(0,e_.jsx)(kP.List,{"data-slot":"tabs-list",className:(0,rj.cn)("inline-flex h-9 w-fit items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t})}function kz({className:e,...t}){return(0,e_.jsx)(kP.Trigger,{"data-slot":"tabs-trigger",className:(0,rj.cn)("inline-flex h-7 min-w-0 flex-1 items-center justify-center whitespace-nowrap rounded-sm px-3 font-medium text-sm outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs",e),...t})}function kD({className:e,...t}){return(0,e_.jsx)(kP.Content,{"data-slot":"tabs-content",className:(0,rj.cn)("outline-none",e),...t})}function kU({trigger:e}){let{builtinToolSettings:t,setBuiltinToolSettings:r}=ax(),n=i9(t[iY]),i=ao(t[i8]),a=(e,t)=>{r(iY,r=>({...i9(r),[e]:t}))},o=(e,t)=>{r(i8,r=>({...ao(r),[e]:t}))};return(0,e_.jsxs)(aP,{children:[(0,e_.jsx)(aO,{asChild:!0,children:e}),(0,e_.jsxs)(aU,{className:"sm:max-w-xl",children:[(0,e_.jsxs)(aL,{children:[(0,e_.jsx)(aF,{children:"工具设置"}),(0,e_.jsx)(aB,{children:"配置内置工具的连接信息和交互行为。"})]}),(0,e_.jsxs)(kO,{defaultValue:"image-generation",children:[(0,e_.jsxs)(kM,{className:"grid w-full grid-cols-2",children:[(0,e_.jsx)(kz,{value:"image-generation",children:"图片生成"}),(0,e_.jsx)(kz,{value:"user-choice",children:"用户选择"})]}),(0,e_.jsxs)(kD,{value:"image-generation",className:"grid gap-4",children:[(0,e_.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[(0,e_.jsxs)("div",{className:"min-w-0",children:[(0,e_.jsx)(w7,{htmlFor:"image-generation-enabled",children:"图片生成工具"}),(0,e_.jsx)("p",{className:"mt-1 text-muted-foreground text-xs",children:"允许模型通过 MCP 调用图片生成。"})]}),(0,e_.jsx)(kh,{id:"image-generation-enabled",checked:n.enabled,onCheckedChange:e=>a("enabled",e)})]}),(0,e_.jsx)(kL,{id:"image-generation-base-url",label:"API Base URL",placeholder:"https://api.openai.com/v1",value:n.baseUrl??"",onValueChange:e=>a("baseUrl",e)}),(0,e_.jsx)(kL,{id:"image-generation-api-key",label:"API Key",placeholder:"sk-...",type:"password",value:n.apiKey??"",onValueChange:e=>a("apiKey",e)}),(0,e_.jsx)(kL,{id:"image-generation-model",label:"模型",placeholder:"gpt-image-1",value:n.model??"",onValueChange:e=>a("model",e)}),(0,e_.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[(0,e_.jsxs)("div",{className:"min-w-0",children:[(0,e_.jsx)(w7,{htmlFor:"image-generation-preserve-prompt",children:"保留原始提示词"}),(0,e_.jsx)("p",{className:"mt-1 text-muted-foreground text-xs",children:"请求图片 API 时在 prompt 前加入不要改写提示,记录仍显示原始提示词。"})]}),(0,e_.jsx)(kh,{id:"image-generation-preserve-prompt",checked:n.preservePrompt,onCheckedChange:e=>a("preservePrompt",e)})]})]}),(0,e_.jsxs)(kD,{value:"user-choice",className:"grid gap-4",children:[(0,e_.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[(0,e_.jsxs)("div",{className:"min-w-0",children:[(0,e_.jsx)(w7,{htmlFor:"user-choice-enabled",children:"用户选择工具"}),(0,e_.jsx)("p",{className:"mt-1 text-muted-foreground text-xs",children:"允许模型通过 MCP 发起单选、多选或多题选择。"})]}),(0,e_.jsx)(kh,{id:"user-choice-enabled",checked:i.enabled,onCheckedChange:e=>o("enabled",e)})]}),(0,e_.jsx)(kL,{id:"user-choice-timeout-ms",label:"等待超时(毫秒)",type:"number",value:String(i.waitTimeoutMs),onValueChange:e=>o("waitTimeoutMs",Number.parseInt(e,10))}),(0,e_.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e_.jsx)(w7,{htmlFor:"user-choice-custom-input",children:"允许自定义输入"}),(0,e_.jsx)(kh,{id:"user-choice-custom-input",checked:i.allowCustomInput,onCheckedChange:e=>o("allowCustomInput",e)})]}),(0,e_.jsx)(kL,{id:"user-choice-custom-input-label",label:"自定义选项文案",value:i.customInputLabel,onValueChange:e=>o("customInputLabel",e)})]})]}),(0,e_.jsx)(aZ,{showCloseButton:!0})]})]})}function kL({id:e,label:t,value:r,onValueChange:n,placeholder:i,type:a="text"}){return(0,e_.jsxs)("div",{className:"grid gap-2",children:[(0,e_.jsx)(w7,{htmlFor:e,children:t}),(0,e_.jsx)(m9,{id:e,type:a,value:r,placeholder:i,onChange:e=>n(e.currentTarget.value)})]})}function kZ({className:e,...t}){return(0,e_.jsx)("div",{"data-slot":"skeleton",className:(0,rj.cn)("animate-pulse rounded-md bg-accent",e),...t})}let kF=["thread-list-skeleton-1","thread-list-skeleton-2","thread-list-skeleton-3","thread-list-skeleton-4","thread-list-skeleton-5"],kB=()=>(0,e_.jsxs)(w0.Root,{className:"aui-root aui-thread-list-root flex w-full min-w-0 flex-col gap-1",children:[(0,e_.jsx)(kV,{}),(0,e_.jsx)(oL,{condition:e=>e.threads.isLoading&&0===e.threads.threadIds.length,children:(0,e_.jsx)(kq,{})}),(0,e_.jsxs)(oL,{condition:e=>!e.threads.isLoading||e.threads.threadIds.length>0,children:[(0,e_.jsx)(w0.Items,{children:()=>(0,e_.jsx)(kJ,{})}),(0,e_.jsx)(oL,{condition:e=>e.threads.hasMore,children:(0,e_.jsx)(kW,{})})]})]}),kV=()=>(0,e_.jsxs)("div",{className:"aui-thread-list-top-actions mb-2 flex flex-col gap-1",children:[(0,e_.jsx)(kU,{trigger:(0,e_.jsxs)(rC,{type:"button",variant:"ghost",className:"aui-thread-list-settings h-9 w-full min-w-0 justify-start gap-2 rounded-lg px-3 text-sm hover:bg-muted data-[state=open]:bg-muted",children:[(0,e_.jsx)(w2,{className:"size-4"}),(0,e_.jsx)("span",{className:"truncate",children:"设置"})]})}),(0,e_.jsx)(w0.New,{asChild:!0,children:(0,e_.jsxs)(rC,{variant:"ghost",className:"aui-thread-list-new h-9 w-full min-w-0 justify-start gap-2 rounded-lg px-3 text-sm hover:bg-muted",children:[(0,e_.jsx)(dG,{className:"size-4"}),(0,e_.jsx)("span",{className:"truncate",children:"新建对话"})]})})]}),kq=()=>(0,e_.jsx)("div",{className:"flex flex-col gap-1",children:kF.map(e=>(0,e_.jsx)("div",{role:"status","aria-label":"正在加载对话",className:"aui-thread-list-skeleton-wrapper flex h-9 items-center px-3",children:(0,e_.jsx)(kZ,{className:"aui-thread-list-skeleton h-4 w-full"})},e))}),kW=()=>(0,e_.jsx)(w0.LoadMore,{asChild:!0,children:(0,e_.jsxs)(rC,{variant:"ghost",className:"aui-thread-list-load-more h-9 justify-center rounded-lg px-3 text-muted-foreground text-sm hover:bg-muted hover:text-foreground",children:[(0,e_.jsx)(oL,{condition:e=>!e.threads.isLoadingMore,children:"加载更多"}),(0,e_.jsx)(oL,{condition:e=>e.threads.isLoadingMore,children:"正在加载..."})]})}),kJ=()=>(0,e_.jsxs)(wW.Root,{className:"aui-thread-list-item group/thread-list-item flex h-9 w-full min-w-0 items-center rounded-lg transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:outline-none data-active:bg-muted",children:[(0,e_.jsx)(wW.Trigger,{className:"aui-thread-list-item-trigger flex h-full min-w-0 flex-1 items-center px-3 text-start text-sm",children:(0,e_.jsx)("span",{className:"aui-thread-list-item-title min-w-0 flex-1 truncate",children:(0,e_.jsx)(wW.Title,{fallback:"新对话"})})}),(0,e_.jsx)(kH,{})]}),kH=()=>(0,e_.jsxs)(wU.Root,{children:[(0,e_.jsx)(wU.Trigger,{asChild:!0,children:(0,e_.jsxs)(rC,{variant:"ghost",size:"icon",className:"aui-thread-list-item-more me-0 h-7 w-0 overflow-hidden p-0 opacity-0 transition-[width,margin,opacity,background-color,color] group-hover/thread-list-item:me-2 group-hover/thread-list-item:w-7 group-hover/thread-list-item:opacity-100 group-focus-within/thread-list-item:me-2 group-focus-within/thread-list-item:w-7 group-focus-within/thread-list-item:opacity-100 data-[state=open]:me-2 data-[state=open]:w-7 data-[state=open]:bg-accent data-[state=open]:opacity-100",children:[(0,e_.jsx)(m2,{className:"size-4"}),(0,e_.jsx)("span",{className:"sr-only",children:"更多选项"})]})}),(0,e_.jsxs)(wU.Content,{side:"bottom",align:"start",className:"aui-thread-list-item-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",children:[(0,e_.jsx)(wW.Archive,{asChild:!0,children:(0,e_.jsxs)(wU.Item,{className:"aui-thread-list-item-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",children:[(0,e_.jsx)(w1,{className:"size-4"}),"归档"]})}),(0,e_.jsx)(wW.Delete,{asChild:!0,children:(0,e_.jsxs)(wU.Item,{className:"aui-thread-list-item-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-destructive text-sm outline-none hover:bg-destructive/10 hover:text-destructive focus:bg-destructive/10 focus:text-destructive",children:[(0,e_.jsx)(w4,{className:"size-4"}),"删除"]})})]})]}),kK=rz("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),kG=rz("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),kY="acp-ui-theme";function kX(e){document.documentElement.classList.toggle("dark","dark"===e),document.documentElement.style.colorScheme=e}function kQ(){let[e,t]=(0,ek.useState)("light");(0,ek.useEffect)(()=>{let e="dark"===window.localStorage.getItem(kY)?"dark":"light";t(e),kX(e)},[]);let r="dark"===e?"light":"dark";return(0,e_.jsx)(rN,{type:"button",tooltip:"dark"===e?"切换到浅色主题":"切换到深色主题","aria-label":"dark"===e?"切换到浅色主题":"切换到深色主题",className:"size-8 text-muted-foreground hover:text-foreground",onClick:()=>{t(r),window.localStorage.setItem(kY,r),kX(r)},children:(0,e_.jsx)("dark"===e?kG:kK,{className:"size-4"})})}var k0=Symbol("radix.slottable");function k1(e){return ek.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===k0}var k2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,a,o,s=(n=r=`Primitive.${t}`,(i=ek.forwardRef((e,t)=>{let{children:r,...n}=e;if(ek.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==ek.Fragment&&(s.ref=t?(0,rh.composeRefs)(t,o):o),ek.cloneElement(r,s)}return ek.Children.count(r)>1?ek.Children.only(null):null})).displayName=`${n}.SlotClone`,a=i,(o=ek.forwardRef((e,t)=>{let{children:r,...n}=e,i=ek.Children.toArray(r),o=i.find(k1);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:ek.Children.count(e)>1?ek.Children.only(null):ek.isValidElement(e)?e.props.children:null);return(0,e_.jsx)(a,{...n,ref:t,children:ek.isValidElement(e)?ek.cloneElement(e,void 0,r):null})}return(0,e_.jsx)(a,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=ek.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,e_.jsx)(n?s:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),k4="ScrollArea",[k6,k5]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>ek.createContext(e));return function(r){let n=r?.[e]||t;return ek.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=ek.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=ek.useMemo(()=>o,Object.values(o));return(0,e_.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=ek.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return ek.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(k4),[k3,k9]=k6(k4),k8=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:a=600,...o}=e,[s,l]=ek.useState(null),[u,d]=ek.useState(null),[c,p]=ek.useState(null),[m,f]=ek.useState(null),[h,g]=ek.useState(null),[v,y]=ek.useState(0),[b,x]=ek.useState(0),[_,w]=ek.useState(!1),[k,I]=ek.useState(!1),S=(0,rh.useComposedRefs)(t,e=>l(e)),$=cL(i);return(0,e_.jsx)(k3,{scope:r,type:n,dir:$,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:d,content:c,onContentChange:p,scrollbarX:m,onScrollbarXChange:f,scrollbarXEnabled:_,onScrollbarXEnabledChange:w,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:k,onScrollbarYEnabledChange:I,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,e_.jsx)(k2.div,{dir:$,...o,ref:S,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":b+"px",...e.style}})})});k8.displayName=k4;var k7="ScrollAreaViewport",Ie=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:i,...a}=e,o=k9(k7,r),s=ek.useRef(null),l=(0,rh.useComposedRefs)(t,s,o.onViewportChange);return(0,e_.jsxs)(e_.Fragment,{children:[(0,e_.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),(0,e_.jsx)(k2.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,e_.jsx)("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Ie.displayName=k7;var It="ScrollAreaScrollbar",Ir=ek.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=k9(It,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s="horizontal"===e.orientation;return ek.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),"hover"===i.type?(0,e_.jsx)(In,{...n,ref:t,forceMount:r}):"scroll"===i.type?(0,e_.jsx)(Ii,{...n,ref:t,forceMount:r}):"auto"===i.type?(0,e_.jsx)(Ia,{...n,ref:t,forceMount:r}):"always"===i.type?(0,e_.jsx)(Io,{...n,ref:t}):null});Ir.displayName=It;var In=ek.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=k9(It,e.__scopeScrollArea),[a,o]=ek.useState(!1);return ek.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),o(!0)},n=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),(0,e_.jsx)(r6.Presence,{present:r||a,children:(0,e_.jsx)(Ia,{"data-state":a?"visible":"hidden",...n,ref:t})})}),Ii=ek.forwardRef((e,t)=>{var r;let{forceMount:n,...i}=e,a=k9(It,e.__scopeScrollArea),o="horizontal"===e.orientation,s=II(()=>u("SCROLL_END"),100),[l,u]=(r={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},ek.useReducer((e,t)=>r[e][t]??e,"hidden"));return ek.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>u("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,a.scrollHideDelay,u]),ek.useEffect(()=>{let e=a.viewport,t=o?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(u("SCROLL"),s()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[a.viewport,o,u,s]),(0,e_.jsx)(r6.Presence,{present:n||"hidden"!==l,children:(0,e_.jsx)(Io,{"data-state":"hidden"===l?"hidden":"visible",...i,ref:t,onPointerEnter:(0,rU.composeEventHandlers)(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:(0,rU.composeEventHandlers)(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),Ia=ek.forwardRef((e,t)=>{let r=k9(It,e.__scopeScrollArea),{forceMount:n,...i}=e,[a,o]=ek.useState(!1),s="horizontal"===e.orientation,l=II(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;o(s?e:t)}},10);return IS(r.viewport,l),IS(r.content,l),(0,e_.jsx)(r6.Presence,{present:n||a,children:(0,e_.jsx)(Io,{"data-state":a?"visible":"hidden",...i,ref:t})})}),Io=ek.forwardRef((e,t)=>{let{orientation:r="vertical",...n}=e,i=k9(It,e.__scopeScrollArea),a=ek.useRef(null),o=ek.useRef(0),[s,l]=ek.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Ib(s.viewport,s.content),d={...n,sizes:s,onSizesChange:l,hasThumb:!!(u>0&&u<1),onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function c(e,t){return function(e,t,r,n="ltr"){let i=Ix(r),a=t||i/2,o=r.scrollbar.paddingStart+a,s=r.scrollbar.size-r.scrollbar.paddingEnd-(i-a),l=r.content-r.viewport;return Iw([o,s],"ltr"===n?[0,l]:[-1*l,0])(e)}(e,o.current,s,t)}return"horizontal"===r?(0,e_.jsx)(Is,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=I_(i.viewport.scrollLeft,s,i.dir);a.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=c(e,i.dir))}}):"vertical"===r?(0,e_.jsx)(Il,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=I_(i.viewport.scrollTop,s);a.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=c(e))}}):null}),Is=ek.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...i}=e,a=k9(It,e.__scopeScrollArea),[o,s]=ek.useState(),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l,a.onScrollbarXChange);return ek.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,e_.jsx)(Ic,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:"rtl"===a.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===a.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ix(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(a.viewport){var n,i;let o=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(o),n=o,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&n({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Iy(o.paddingLeft),paddingEnd:Iy(o.paddingRight)}})}})}),Il=ek.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...i}=e,a=k9(It,e.__scopeScrollArea),[o,s]=ek.useState(),l=ek.useRef(null),u=(0,rh.useComposedRefs)(t,l,a.onScrollbarYChange);return ek.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,e_.jsx)(Ic,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ix(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(a.viewport){var n,i;let o=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(o),n=o,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&n({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Iy(o.paddingTop),paddingEnd:Iy(o.paddingBottom)}})}})}),[Iu,Id]=k6(It),Ic=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:c,...p}=e,m=k9(It,r),[f,h]=ek.useState(null),g=(0,rh.useComposedRefs)(t,e=>h(e)),v=ek.useRef(null),y=ek.useRef(""),b=m.viewport,x=n.content-n.viewport,_=(0,rJ.useCallbackRef)(d),w=(0,rJ.useCallbackRef)(l),k=II(c,10);function I(e){v.current&&u({x:e.clientX-v.current.left,y:e.clientY-v.current.top})}return ek.useEffect(()=>{let e=e=>{let t=e.target;f?.contains(t)&&_(e,x)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[b,f,x,_]),ek.useEffect(w,[n,w]),IS(f,k),IS(m.content,k),(0,e_.jsx)(Iu,{scope:r,scrollbar:f,hasThumb:i,onThumbChange:(0,rJ.useCallbackRef)(a),onThumbPointerUp:(0,rJ.useCallbackRef)(o),onThumbPositionChange:w,onThumbPointerDown:(0,rJ.useCallbackRef)(s),children:(0,e_.jsx)(k2.div,{...p,ref:g,style:{position:"absolute",...p.style},onPointerDown:(0,rU.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),v.current=f.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),I(e))}),onPointerMove:(0,rU.composeEventHandlers)(e.onPointerMove,I),onPointerUp:(0,rU.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),v.current=null})})})}),Ip="ScrollAreaThumb",Im=ek.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=Id(Ip,e.__scopeScrollArea);return(0,e_.jsx)(r6.Presence,{present:r||i.hasThumb,children:(0,e_.jsx)(If,{ref:t,...n})})}),If=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...i}=e,a=k9(Ip,r),o=Id(Ip,r),{onThumbPositionChange:s}=o,l=(0,rh.useComposedRefs)(t,e=>o.onThumbChange(e)),u=ek.useRef(void 0),d=II(()=>{u.current&&(u.current(),u.current=void 0)},100);return ek.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{d(),u.current||(u.current=Ik(e,s),s())};return s(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[a.viewport,d,s]),(0,e_.jsx)(k2.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:(0,rU.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;o.onThumbPointerDown({x:r,y:n})}),onPointerUp:(0,rU.composeEventHandlers)(e.onPointerUp,o.onThumbPointerUp)})});Im.displayName=Ip;var Ih="ScrollAreaCorner",Ig=ek.forwardRef((e,t)=>{let r=k9(Ih,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,e_.jsx)(Iv,{...e,ref:t}):null});Ig.displayName=Ih;var Iv=ek.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,i=k9(Ih,r),[a,o]=ek.useState(0),[s,l]=ek.useState(0),u=!!(a&&s);return IS(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),l(e)}),IS(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),u?(0,e_.jsx)(k2.div,{...n,ref:t,style:{width:a,height:s,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function Iy(e){return e?parseInt(e,10):0}function Ib(e,t){let r=e/t;return isNaN(r)?0:r}function Ix(e){let t=Ib(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function I_(e,t,r="ltr"){let n=Ix(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=function(e,[t,r]){return Math.min(r,Math.max(t,e))}(e,"ltr"===r?[0,o]:[-1*o,0]);return Iw([0,o],[0,a-n])(s)}function Iw(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var Ik=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return!function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=r.left!==a.left,s=r.top!==a.top;(o||s)&&t(),r=a,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function II(e,t){let r=(0,rJ.useCallbackRef)(e),n=ek.useRef(0);return ek.useEffect(()=>()=>window.clearTimeout(n.current),[]),ek.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function IS(e,t){let r=(0,rJ.useCallbackRef)(t);(0,aH.useLayoutEffect)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}e.s(["Corner",0,Ig,"Root",0,k8,"ScrollArea",0,k8,"ScrollAreaCorner",0,Ig,"ScrollAreaScrollbar",0,Ir,"ScrollAreaThumb",0,Im,"ScrollAreaViewport",0,Ie,"Scrollbar",0,Ir,"Thumb",0,Im,"Viewport",0,Ie,"createScrollAreaScope",0,k5],60805);var I$=e.i(60805),I$=I$;function Ij({className:e,children:t,...r}){return(0,e_.jsxs)(I$.Root,{"data-slot":"scroll-area",className:(0,rj.cn)("relative overflow-hidden",e),...r,children:[(0,e_.jsx)(I$.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] [&>div]:!block",children:t}),(0,e_.jsx)(IE,{}),(0,e_.jsx)(I$.Corner,{})]})}function IE({className:e,orientation:t="vertical",...r}){return(0,e_.jsx)(I$.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,rj.cn)("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2 border-l border-l-transparent","horizontal"===t&&"h-2 flex-col border-t border-t-transparent",e),...r,children:(0,e_.jsx)(I$.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}let IC=rz("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),IT=rz("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);var rw=rw;let IN=ek.createContext(null);function IA(){let e=ek.useContext(IN);if(!e)throw Error("useSidebar must be used within a SidebarProvider.");return e}function IR({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:i,children:a,...o}){let s=function(){let[e,t]=ek.useState(void 0);return ek.useEffect(()=>{let e=window.matchMedia("(max-width: 767px)"),r=()=>{t(window.innerWidth<768)};return e.addEventListener("change",r),t(window.innerWidth<768),()=>e.removeEventListener("change",r)},[]),!!e}(),[l,u]=ek.useState(!1),[d,c]=ek.useState(e),p=t??d,m=ek.useCallback(e=>{let t="function"==typeof e?e(p):e;r?r(t):c(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[r,p]),f=ek.useCallback(()=>s?u(e=>!e):m(e=>!e),[s,m]);ek.useEffect(()=>{let e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);let h=p?"expanded":"collapsed",g=ek.useMemo(()=>({state:h,open:p,setOpen:m,isMobile:s,openMobile:l,setOpenMobile:u,toggleSidebar:f}),[h,p,m,s,l,f]);return(0,e_.jsx)(IN.Provider,{value:g,children:(0,e_.jsx)(rT.TooltipProvider,{delayDuration:0,children:(0,e_.jsx)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3rem",...i},className:(0,rj.cn)("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",n),...o,children:a})})})}function IP({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:i,...a}){let{isMobile:o,state:s,openMobile:l,setOpenMobile:u}=IA();return"none"===r?(0,e_.jsx)("div",{"data-slot":"sidebar",className:(0,rj.cn)("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",n),...a,children:i}):o?(0,e_.jsx)(ix,{open:l,onOpenChange:u,...a,children:(0,e_.jsxs)(ik,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:e,children:[(0,e_.jsxs)(iI,{className:"sr-only",children:[(0,e_.jsx)(iS,{children:"侧边栏"}),(0,e_.jsx)(i$,{children:"显示移动端侧边栏。"})]}),(0,e_.jsx)("div",{className:"flex h-full w-full flex-col",children:i})]})}):(0,e_.jsxs)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":s,"data-collapsible":"collapsed"===s?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[(0,e_.jsx)("div",{"data-slot":"sidebar-gap",className:(0,rj.cn)("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),(0,e_.jsx)("div",{"data-slot":"sidebar-container",className:(0,rj.cn)("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...a,children:(0,e_.jsx)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",children:i})})]})}function IO({className:e,onClick:t,...r}){let{open:n,toggleSidebar:i}=IA(),a=n?"收起侧边栏":"展开侧边栏";return(0,e_.jsxs)(rC,{"data-sidebar":"trigger","data-slot":"sidebar-trigger","aria-label":a,variant:"ghost",size:"icon",className:(0,rj.cn)("size-7",e),onClick:e=>{t?.(e),i()},...r,children:[(0,e_.jsx)(n?IC:IT,{}),(0,e_.jsx)("span",{className:"sr-only",children:a})]})}function IM({className:e,...t}){let{toggleSidebar:r}=IA();return(0,e_.jsx)("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"切换侧边栏",tabIndex:-1,onClick:r,title:"切换侧边栏",className:(0,rj.cn)("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function Iz({className:e,...t}){return(0,e_.jsx)("main",{"data-slot":"sidebar-inset",className:(0,rj.cn)("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function ID({className:e,...t}){return(0,e_.jsx)("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:(0,rj.cn)("flex flex-col gap-2 p-2",e),...t})}function IU({className:e,...t}){return(0,e_.jsx)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:(0,rj.cn)("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function IL({className:e,...t}){return(0,e_.jsx)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:(0,rj.cn)("flex w-full min-w-0 flex-col gap-1",e),...t})}function IZ({className:e,...t}){return(0,e_.jsx)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:(0,rj.cn)("group/menu-item relative",e),...t})}let IF=r$("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function IB({asChild:e=!1,isActive:t=!1,variant:r="default",size:n="default",tooltip:i,className:a,...o}){let s=e?rw.Root:"button",{isMobile:l,state:u}=IA(),d=(0,e_.jsx)(s,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":t,className:(0,rj.cn)(IF({variant:r,size:n}),a),...o});return i?("string"==typeof i&&(i={children:i}),(0,e_.jsxs)(rT.Tooltip,{children:[(0,e_.jsx)(rT.TooltipTrigger,{asChild:!0,children:d}),(0,e_.jsx)(rT.TooltipContent,{side:"right",align:"center",hidden:"collapsed"!==u||l,...i})]})):d}function IV({workspacePath:e,workspaceTitle:t,...r}){let n=e?.trim()||"当前项目",i=t?.trim()||function(e){let t=e.replace(/\\/g,"/").replace(/\/+$/g,"");if(!t||"/"===t)return t||"当前项目";let r=t.split("/").filter(Boolean);return r[r.length-1]??t}(n);return(0,e_.jsxs)(IP,{...r,children:[(0,e_.jsx)(ID,{className:"aui-sidebar-header mb-2 border-b",children:(0,e_.jsxs)("div",{className:"aui-sidebar-header-content flex items-center justify-between",children:[(0,e_.jsx)(IL,{className:"min-w-0 flex-1",children:(0,e_.jsx)(IZ,{children:(0,e_.jsx)(IB,{size:"lg",asChild:!0,children:(0,e_.jsxs)("div",{children:[(0,e_.jsx)(wA,{className:"aui-sidebar-header-icon size-4"}),(0,e_.jsxs)("div",{className:"aui-sidebar-header-heading me-2 min-w-0 space-y-1 leading-none",children:[(0,e_.jsx)("span",{className:"aui-sidebar-header-title block min-w-0 truncate font-semibold",title:i,children:i}),(0,e_.jsx)("span",{className:"aui-sidebar-header-description block min-w-0 truncate text-sidebar-foreground/60 text-xs",title:n,children:n})]})]})})})}),(0,e_.jsx)(kQ,{})]})}),(0,e_.jsx)(IU,{className:"aui-sidebar-content overflow-hidden px-0",children:(0,e_.jsx)(Ij,{className:"aui-thread-list-scroll-area min-h-0 flex-1",children:(0,e_.jsx)("div",{className:"aui-thread-list-scroll-content w-full min-w-0 px-2",children:(0,e_.jsx)(kB,{})})})}),(0,e_.jsx)(IM,{})]})}var Iq=e.i(67034),IW="vercel.ai.error",IJ=Symbol.for(IW),IH=class e extends(I=Error,k=IJ,I){constructor({name:e,message:t,cause:r}){super(t),this[k]=!0,this.name=e,this.cause=r}static isInstance(t){return e.hasMarker(t,IW)}static hasMarker(e,t){let r=Symbol.for(t);return null!=e&&"object"==typeof e&&r in e&&"boolean"==typeof e[r]&&!0===e[r]}},IK="AI_APICallError",IG=`vercel.ai.error.${IK}`,IY=Symbol.for(IG),IX=class extends($=IH,S=IY,$){constructor({message:e,url:t,requestBodyValues:r,statusCode:n,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=null!=n&&(408===n||409===n||429===n||n>=500),data:l}){super({name:IK,message:e,cause:o}),this[S]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=n,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=l}static isInstance(e){return IH.hasMarker(e,IG)}},IQ="AI_EmptyResponseBodyError",I0=`vercel.ai.error.${IQ}`,I1=Symbol.for(I0),I2=class extends(E=IH,j=I1,E){constructor({message:e="Empty response body"}={}){super({name:IQ,message:e}),this[j]=!0}static isInstance(e){return IH.hasMarker(e,I0)}};function I4(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}var I6="AI_InvalidArgumentError",I5=`vercel.ai.error.${I6}`,I3=Symbol.for(I5),I9=class extends(T=IH,C=I3,T){constructor({message:e,cause:t,argument:r}){super({name:I6,message:e,cause:t}),this[C]=!0,this.argument=r}static isInstance(e){return IH.hasMarker(e,I5)}},I8=Symbol.for("vercel.ai.error.AI_InvalidPromptError");Symbol.for("vercel.ai.error.AI_InvalidResponseDataError");var I7="AI_JSONParseError",Se=`vercel.ai.error.${I7}`,St=Symbol.for(Se),Sr=class extends(A=IH,N=St,A){constructor({text:e,cause:t}){super({name:I7,message:`JSON parsing failed: Text: ${e}.
8
+ Error message: ${I4(t)}`,cause:t}),this[N]=!0,this.text=e}static isInstance(e){return IH.hasMarker(e,Se)}},Sn=Symbol.for("vercel.ai.error.AI_LoadAPIKeyError");Symbol.for("vercel.ai.error.AI_LoadSettingError");Symbol.for("vercel.ai.error.AI_NoContentGeneratedError");Symbol.for("vercel.ai.error.AI_NoSuchModelError");Symbol.for("vercel.ai.error.AI_TooManyEmbeddingValuesForCallError");var Si="AI_TypeValidationError",Sa=`vercel.ai.error.${Si}`,So=Symbol.for(Sa),Ss=class e extends(P=IH,R=So,P){constructor({value:e,cause:t,context:r}){let n="Type validation failed";if((null==r?void 0:r.field)&&(n+=` for ${r.field}`),(null==r?void 0:r.entityName)||(null==r?void 0:r.entityId)){n+=" (";const e=[];r.entityName&&e.push(r.entityName),r.entityId&&e.push(`id: "${r.entityId}"`),n+=e.join(", "),n+=")"}super({name:Si,message:`${n}: Value: ${JSON.stringify(e)}.
9
+ Error message: ${I4(t)}`,cause:t}),this[R]=!0,this.value=e,this.context=r}static isInstance(e){return IH.hasMarker(e,Sa)}static wrap({value:t,cause:r,context:n}){var i,a,o;return e.isInstance(r)&&r.value===t&&(null==(i=r.context)?void 0:i.field)===(null==n?void 0:n.field)&&(null==(a=r.context)?void 0:a.entityName)===(null==n?void 0:n.entityName)&&(null==(o=r.context)?void 0:o.entityId)===(null==n?void 0:n.entityId)?r:new e({value:t,cause:r,context:n})}},Sl=Symbol.for("vercel.ai.error.AI_UnsupportedFunctionalityError");let Su=Object.freeze({status:"aborted"});function Sd(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function o(e){var t;let i=r?.Parent?new a:this;for(let r of(n(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}let Sc=Symbol("zod_brand");class Sp extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Sm extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(O=globalThis).__zod_globalConfig??(O.__zod_globalConfig={});let Sf=globalThis.__zod_globalConfig;function Sh(e){return e&&Object.assign(Sf,e),Sf}function Sg(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function Sv(e,t="|"){return e.map(e=>SU(e)).join(t)}function Sy(e,t){return"bigint"==typeof t?t.toString():t}function Sb(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Sx(e){return null==e}function S_(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Sw(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}e.s(["$ZodAsyncError",0,Sp,"$ZodEncodeError",0,Sm,"$brand",0,Sc,"$constructor",0,Sd,"NEVER",0,Su,"config",0,Sh,"globalConfig",0,Sf],97753);let Sk=Symbol("evaluating");function SI(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Sk)return void 0===n&&(n=Sk,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function SS(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function S$(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function Sj(e){return JSON.stringify(e)}function SE(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let SC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ST(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let SN=Sb(()=>{if(Sf.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function SA(e){if(!1===ST(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==ST(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function SR(e){return SA(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let SP=new Set(["string","number","symbol"]),SO=new Set(["string","number","bigint","boolean","symbol","undefined"]);function SM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sz(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function SD(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function SU(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function SL(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let SZ={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]},SF={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function SB(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function SV(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Sq(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function SW(e){return"string"==typeof e?e:e?.message}function SJ(e,t,r){let n=e.message?e.message:SW(e.inst?._zod.def?.error?.(e))??SW(t?.error?.(e))??SW(r.customError?.(e))??SW(r.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}function SH(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function SK(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function SG(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t}function SY(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function SX(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function SQ(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}e.s(["BIGINT_FORMAT_RANGES",0,SF,"Class",0,class{constructor(...e){}},"NUMBER_FORMAT_RANGES",0,SZ,"aborted",0,SB,"allowsEval",0,SN,"assert",0,function(e){},"assertEqual",0,function(e){return e},"assertIs",0,function(e){},"assertNever",0,function(e){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(e){return e},"assignProp",0,SS,"base64ToUint8Array",0,SX,"base64urlToUint8Array",0,function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return SX(t+r)},"cached",0,Sb,"captureStackTrace",0,SC,"cleanEnum",0,function(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])},"cleanRegex",0,S_,"clone",0,Sz,"cloneDef",0,function(e){return S$(e._zod.def)},"createTransparentProxy",0,function(e){let t;return new Proxy({},{get:(r,n,i)=>(t??(t=e()),Reflect.get(t,n,i)),set:(r,n,i,a)=>(t??(t=e()),Reflect.set(t,n,i,a)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,i)=>(t??(t=e()),Reflect.defineProperty(t,n,i))})},"defineLazy",0,SI,"esc",0,Sj,"escapeRegex",0,SM,"explicitlyAborted",0,SV,"extend",0,function(e,t){if(!SA(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=S$(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return SS(this,"shape",r),r}});return Sz(e,n)},"finalizeIssue",0,SJ,"floatSafeRemainder",0,Sw,"getElementAtPath",0,function(e,t){return t?t.reduce((e,t)=>e?.[t],e):e},"getEnumValues",0,Sg,"getLengthableOrigin",0,SK,"getParsedType",0,e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},"getSizableOrigin",0,SH,"hexToUint8Array",0,function(e){let t=e.replace(/^0x/,"");if(t.length%2!=0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)r[e/2]=Number.parseInt(t.slice(e,e+2),16);return r},"isObject",0,ST,"isPlainObject",0,SA,"issue",0,SY,"joinValues",0,Sv,"jsonStringifyReplacer",0,Sy,"merge",0,function(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=S$(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return SS(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Sz(e,r)},"mergeDefs",0,S$,"normalizeParams",0,SD,"nullish",0,Sx,"numKeys",0,function(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t},"objectClone",0,function(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))},"omit",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=S$(e._zod.def,{get shape(){let n={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return SS(this,"shape",n),n},checks:[]});return Sz(e,i)},"optionalKeys",0,SL,"parsedType",0,SG,"partial",0,function(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=S$(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return SS(this,"shape",i),i},checks:[]});return Sz(t,i)},"pick",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=S$(e._zod.def,{get shape(){let e={};for(let n in t){if(!(n in r.shape))throw Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return SS(this,"shape",e),e},checks:[]});return Sz(e,i)},"prefixIssues",0,Sq,"primitiveTypes",0,SO,"promiseAllObject",0,function(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})},"propertyKeyTypes",0,SP,"randomString",0,function(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r},"required",0,function(e,t,r){let n=S$(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return SS(this,"shape",i),i}});return Sz(t,n)},"safeExtend",0,function(e,t){if(!SA(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=S$(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return SS(this,"shape",r),r}});return Sz(e,r)},"shallowClone",0,SR,"slugify",0,SE,"stringifyPrimitive",0,SU,"uint8ArrayToBase64",0,SQ,"uint8ArrayToBase64url",0,function(e){return SQ(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(e){return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,SW],22143);let S0=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Sy,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},S1=Sd("$ZodError",S0),S2=Sd("$ZodError",S0,{Parent:Error});function S4(e,t=e=>e.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function S6(e,t=e=>e.message){let r={_errors:[]},n=(e,i=[])=>{for(let a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e},[...i,...a.path]));else if("invalid_key"===a.code)n({issues:a.issues},[...i,...a.path]);else if("invalid_element"===a.code)n({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(0===e.length)r._errors.push(t(a));else{let n=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(a))):n[r]=n[r]||{_errors:[]},n=n[r],i++}}}};return n(e),r}function S5(e,t=e=>e.message){let r={errors:[]},n=(e,i=[])=>{var a,o;for(let s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>n({issues:e},[...i,...s.path]));else if("invalid_key"===s.code)n({issues:s.issues},[...i,...s.path]);else if("invalid_element"===s.code)n({issues:s.issues},[...i,...s.path]);else{let e=[...i,...s.path];if(0===e.length){r.errors.push(t(s));continue}let n=r,l=0;for(;l<e.length;){let r=e[l],i=l===e.length-1;"string"==typeof r?(n.properties??(n.properties={}),(a=n.properties)[r]??(a[r]={errors:[]}),n=n.properties[r]):(n.items??(n.items=[]),(o=n.items)[r]??(o[r]={errors:[]}),n=n.items[r]),i&&n.errors.push(t(s)),l++}}};return n(e),r}function S3(e){let t=[];for(let r of e.map(e=>"object"==typeof e?e.key:e))"number"==typeof r?t.push(`[${r}]`):"symbol"==typeof r?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function S9(e){let t=[];for(let r of[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length))t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${S3(r.path)}`);return t.join("\n")}e.s(["$ZodError",0,S1,"$ZodRealError",0,S2,"flattenError",0,S4,"formatError",0,S6,"prettifyError",0,S9,"toDotPath",0,S3,"treeifyError",0,S5],74969);let S8=e=>(t,r,n,i)=>{let a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new Sp;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>SJ(e,a,Sh())));throw SC(t,i?.callee),t}return o.value},S7=S8(S2),$e=e=>async(t,r,n,i)=>{let a=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>SJ(e,a,Sh())));throw SC(t,i?.callee),t}return o.value},$t=$e(S2),$r=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Sp;return a.issues.length?{success:!1,error:new(e??S1)(a.issues.map(e=>SJ(e,i,Sh())))}:{success:!0,data:a.value}},$n=$r(S2),$i=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>SJ(e,i,Sh())))}:{success:!0,data:a.value}},$a=$i(S2),$o=e=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return S8(e)(t,r,i)},$s=$o(S2),$l=e=>(t,r,n)=>S8(e)(t,r,n),$u=$l(S2),$d=e=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return $e(e)(t,r,i)},$c=$d(S2),$p=e=>async(t,r,n)=>$e(e)(t,r,n),$m=$p(S2),$f=e=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return $r(e)(t,r,i)},$h=$f(S2),$g=e=>(t,r,n)=>$r(e)(t,r,n),$v=$g(S2),$y=e=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return $i(e)(t,r,i)},$b=$y(S2),$x=e=>async(t,r,n)=>$i(e)(t,r,n),$_=$x(S2);e.s(["_decode",0,$l,"_decodeAsync",0,$p,"_encode",0,$o,"_encodeAsync",0,$d,"_parse",0,S8,"_parseAsync",0,$e,"_safeDecode",0,$g,"_safeDecodeAsync",0,$x,"_safeEncode",0,$f,"_safeEncodeAsync",0,$y,"_safeParse",0,$r,"_safeParseAsync",0,$i,"decode",0,$u,"decodeAsync",0,$m,"encode",0,$s,"encodeAsync",0,$c,"parse",0,S7,"parseAsync",0,$t,"safeDecode",0,$v,"safeDecodeAsync",0,$_,"safeEncode",0,$h,"safeEncodeAsync",0,$b,"safeParse",0,$n,"safeParseAsync",0,$a],3108);let $w=(e,t)=>{S1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>S6(e,t)},flatten:{value:t=>S4(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Sy,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Sy,2)}},isEmpty:{get:()=>0===e.issues.length}})},$k=Sd("ZodError",$w),$I=Sd("ZodError",$w,{Parent:Error});e.s(["ZodError",0,$k,"ZodRealError",0,$I],89282);let $S=S8($I),$$=$e($I),$j=$r($I),$E=$i($I),$C=$o($I),$T=$l($I),$N=$d($I),$A=$p($I),$R=$f($I),$P=$g($I),$O=$y($I),$M=$x($I);e.s(["decode",0,$T,"decodeAsync",0,$A,"encode",0,$C,"encodeAsync",0,$N,"parse",0,$S,"parseAsync",0,$$,"safeDecode",0,$P,"safeDecodeAsync",0,$M,"safeEncode",0,$R,"safeEncodeAsync",0,$O,"safeParse",0,$j,"safeParseAsync",0,$E],364);let $z=Symbol("ZodOutput"),$D=Symbol("ZodInput");class $U{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function $L(){return new $U}(M=globalThis).__zod_globalRegistry??(M.__zod_globalRegistry=$L());let $Z=globalThis.__zod_globalRegistry;function $F(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??$Z,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function $B(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{let r=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,r,n)}let a=e._zod.parent;a&&(o.ref||(o.ref=a),$B(a,t,n),t.seen.get(a).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),"input"===t.io&&function e(t,r){let n=r??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,n);if("set"===i.type)return e(i.valueType,n);if("lazy"===i.type)return e(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,n);if("intersection"===i.type)return e(i.left,n)||e(i.right,n);if("record"===i.type||"map"===i.type)return e(i.keyType,n)||e(i.valueType,n);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,n)||e(i.out,n);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],n))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,n))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,n))return!0;if(i.rest&&e(i.rest,n))return!0}return!1}(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function $V(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=n.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let n=t[1],{ref:i,defId:a}=(t=>{let n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i("__shared")}#/${n}/${a}`}}if(t[1]===r)return{ref:"#"};let i=`#/${n}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}})(t);n.def={...n.schema},a&&(n.defId=a);let o=n.schema;for(let e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
10
+
11
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let n=r[1];if(t===r[0]){i(r);continue}if(e.external){let n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||n.cycle||n.count>1&&"ref"===e.reused){i(r);continue}}}function $q(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,a={...i},o=r.ref;if(r.ref=null,o){n(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){n(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())n(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;void 0!==a&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:$J(t,"input",e.processors),output:$J(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}e.s(["$ZodRegistry",0,$U,"$input",0,$D,"$output",0,$z,"globalRegistry",0,$Z,"registry",0,$L],25527);let $W=(e,t={})=>r=>{let n=$F({...r,processors:t});return $B(e,n),$V(n,e),$q(n,e)},$J=(e,t,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=$F({...i??{},target:a,io:t,processors:r});return $B(e,o),$V(o,e),$q(o,e)};e.s(["createStandardJSONSchemaMethod",0,$J,"createToJSONSchemaMethod",0,$W,"extractDefs",0,$V,"finalize",0,$q,"initializeContext",0,$F,"process",0,$B],34966);let $H={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},$K=(e,t,r,n)=>{r.type="string";let{minimum:i,maximum:a,format:o,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof a&&(r.maxLength=a),o&&(r.format=$H[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),l&&(r.contentEncoding=l),s&&s.size>0){let e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},$G=(e,t,r,n)=>{let{minimum:i,maximum:a,format:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let d="number"==typeof u&&u>=(i??-1/0),c="number"==typeof l&&l<=(a??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=u,r.exclusiveMinimum=!0):r.exclusiveMinimum=u:"number"==typeof i&&(r.minimum=i),c?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof a&&(r.maximum=a),"number"==typeof s&&(r.multipleOf=s)},$Y=(e,t,r,n)=>{r.type="boolean"},$X=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},$Q=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},$0=(e,t,r,n)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},$1=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},$2=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},$4=(e,t,r,n)=>{r.not={}},$6=(e,t,r,n)=>{},$5=(e,t,r,n)=>{},$3=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},$9=(e,t,r,n)=>{let i=Sg(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},$8=(e,t,r,n)=>{let i=e._zod.def,a=[];for(let e of i.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else a.push(Number(e));else a.push(e);if(0===a.length);else if(1===a.length){let e=a[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else a.every(e=>"number"==typeof e)&&(r.type="number"),a.every(e=>"string"==typeof e)&&(r.type="string"),a.every(e=>"boolean"==typeof e)&&(r.type="boolean"),a.every(e=>null===e)&&(r.type="null"),r.enum=a},$7=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},je=(e,t,r,n)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},jt=(e,t,r,n)=>{let i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:o,mime:s}=e._zod.bag;void 0!==a&&(i.minLength=a),void 0!==o&&(i.maxLength=o),s?1===s.length?(i.contentMediaType=s[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=s.map(e=>({contentMediaType:e}))):Object.assign(r,i)},jr=(e,t,r,n)=>{r.type="boolean"},jn=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},ji=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},ja=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},jo=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},js=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},jl=(e,t,r,n)=>{let i=e._zod.def,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(r.minItems=a),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=$B(i.element,t,{...n,path:[...n.path,"items"]})},ju=(e,t,r,n)=>{let i=e._zod.def;r.type="object",r.properties={};let a=i.shape;for(let e in a)r.properties[e]=$B(a[e],t,{...n,path:[...n.path,"properties",e]});let o=new Set([...new Set(Object.keys(a))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=$B(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},jd=(e,t,r,n)=>{let i=e._zod.def,a=!1===i.inclusive,o=i.options.map((e,r)=>$B(e,t,{...n,path:[...n.path,a?"oneOf":"anyOf",r]}));a?r.oneOf=o:r.anyOf=o},jc=(e,t,r,n)=>{let i=e._zod.def,a=$B(i.left,t,{...n,path:[...n.path,"allOf",0]}),o=$B(i.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},jp=(e,t,r,n)=>{let i=e._zod.def;r.type="array";let a="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,r)=>$B(e,t,{...n,path:[...n.path,a,r]})),l=i.rest?$B(i.rest,t,{...n,path:[...n.path,o,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=s,l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:s},l&&r.items.anyOf.push(l),r.minItems=s.length,l||(r.maxItems=s.length)):(r.items=s,l&&(r.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;"number"==typeof u&&(r.minItems=u),"number"==typeof d&&(r.maxItems=d)},jm=(e,t,r,n)=>{let i=e._zod.def;r.type="object";let a=i.keyType,o=a._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=$B(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=$B(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),r.additionalProperties=$B(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let l=a._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},jf=(e,t,r,n)=>{let i=e._zod.def,a=$B(i.innerType,t,n),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]},jh=(e,t,r,n)=>{let i=e._zod.def;$B(i.innerType,t,n),t.seen.get(e).ref=i.innerType},jg=(e,t,r,n)=>{let i=e._zod.def;$B(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},jv=(e,t,r,n)=>{let i=e._zod.def;$B(i.innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},jy=(e,t,r,n)=>{let i,a=e._zod.def;$B(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},jb=(e,t,r,n)=>{let i=e._zod.def,a=i.in._zod.traits.has("$ZodTransform"),o="input"===t.io?a?i.out:i.in:i.out;$B(o,t,n),t.seen.get(e).ref=o},jx=(e,t,r,n)=>{let i=e._zod.def;$B(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0},j_=(e,t,r,n)=>{let i=e._zod.def;$B(i.innerType,t,n),t.seen.get(e).ref=i.innerType},jw=(e,t,r,n)=>{let i=e._zod.def;$B(i.innerType,t,n),t.seen.get(e).ref=i.innerType},jk=(e,t,r,n)=>{let i=e._zod.innerType;$B(i,t,n),t.seen.get(e).ref=i},jI={string:$K,number:$G,boolean:$Y,bigint:$X,symbol:$Q,null:$0,undefined:$1,void:$2,never:$4,any:$6,unknown:$5,date:$3,enum:$9,literal:$8,nan:$7,template_literal:je,file:jt,success:jr,custom:jn,function:ji,transform:ja,map:jo,set:js,array:jl,object:ju,union:jd,intersection:jc,tuple:jp,record:jm,nullable:jf,nonoptional:jh,default:jg,prefault:jv,catch:jy,pipe:jb,readonly:jx,promise:j_,optional:jw,lazy:jk};function jS(e,t){if("_idmap"in e){let r=$F({...t,processors:jI}),n={};for(let t of e._idmap.entries()){let[e,n]=t;$B(n,r)}let i={};for(let a of(r.external={registry:e,uri:t?.uri,defs:n},e._idmap.entries())){let[e,t]=a;$V(r,t),i[e]=$q(r,t)}return Object.keys(n).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:n}),{schemas:i}}let r=$F({...t,processors:jI});return $B(e,r),$V(r,e),$q(r,e)}(f=z||(z={})).assertEqual=e=>{},f.assertIs=function(e){},f.assertNever=function(e){throw Error()},f.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},f.getValidEnumValues=e=>{let t=f.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return f.objectValues(r)},f.objectValues=e=>f.objectKeys(e).map(function(t){return e[t]}),f.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},f.find=(e,t)=>{for(let r of e)if(t(r))return r},f.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,f.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},f.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(D||(D={})).mergeShapes=(e,t)=>({...e,...t});let j$=z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jj=e=>{switch(typeof e){case"undefined":return j$.undefined;case"string":return j$.string;case"number":return Number.isNaN(e)?j$.nan:j$.number;case"boolean":return j$.boolean;case"function":return j$.function;case"bigint":return j$.bigint;case"symbol":return j$.symbol;case"object":if(Array.isArray(e))return j$.array;if(null===e)return j$.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return j$.promise;if("u">typeof Map&&e instanceof Map)return j$.map;if("u">typeof Set&&e instanceof Set)return j$.set;if("u">typeof Date&&e instanceof Date)return j$.date;return j$.object;default:return j$.unknown}},jE=z.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class jC extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof jC))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let n of this.issues)if(n.path.length>0){let r=n.path[0];t[r]=t[r]||[],t[r].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}jC.create=e=>new jC(e);let jT=(e,t)=>{let r;switch(e.code){case jE.invalid_type:r=e.received===j$.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case jE.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,z.jsonStringifyReplacer)}`;break;case jE.unrecognized_keys:r=`Unrecognized key(s) in object: ${z.joinValues(e.keys,", ")}`;break;case jE.invalid_union:r="Invalid input";break;case jE.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${z.joinValues(e.options)}`;break;case jE.invalid_enum_value:r=`Invalid enum value. Expected ${z.joinValues(e.options)}, received '${e.received}'`;break;case jE.invalid_arguments:r="Invalid function arguments";break;case jE.invalid_return_type:r="Invalid function return type";break;case jE.invalid_date:r="Invalid date";break;case jE.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:z.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case jE.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case jE.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case jE.custom:r="Invalid input";break;case jE.invalid_intersection_types:r="Intersection results could not be merged";break;case jE.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case jE.not_finite:r="Number must be finite";break;default:r=t.defaultError,z.assertNever(e)}return{message:r}};(h=U||(U={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},h.toString=e=>"string"==typeof e?e:e?.message;let jN=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],o={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let s="";for(let e of n.filter(e=>!!e).slice().reverse())s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function jA(e,t){let r=jN({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,jT,void 0].filter(e=>!!e)});e.common.issues.push(r)}class jR{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return jP;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return jR.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return jP;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let jP=Object.freeze({status:"aborted"}),jO=e=>({status:"dirty",value:e}),jM=e=>({status:"valid",value:e}),jz=e=>"u">typeof Promise&&e instanceof Promise;class jD{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let jU=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new jC(e.common.issues);return this._error=t,this._error}}};function jL(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return"invalid_enum_value"===t.code?{message:a??i.defaultError}:void 0===i.data?{message:a??n??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:a??r??i.defaultError}},description:i}}class jZ{get description(){return this._def.description}_getType(e){return jj(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:jj(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new jR,ctx:{common:e.parent.common,data:e.data,parsedType:jj(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(jz(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jj(e)},n=this._parseSync({data:e,path:r.path,parent:r});return jU(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jj(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jj(e)},n=this._parse({data:e,path:r.path,parent:r});return jU(r,await (jz(n)?n:Promise.resolve(n)))}refine(e,t){return this._refinement((r,n)=>{let i=e(r),a=()=>n.addIssue({code:jE.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"u">typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new EI({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ES.create(this,this._def)}nullable(){return E$.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Es.create(this)}promise(){return Ek.create(this,this._def)}or(e){return Eu.create([this,e],this._def)}and(e){return Ep.create(this,e,this._def)}transform(e){return new EI({...jL(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new Ej({...jL(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:L.ZodDefault})}brand(){return new ET({typeName:L.ZodBranded,type:this,...jL(this._def)})}catch(e){return new EE({...jL(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:L.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return EN.create(this,e)}readonly(){return EA.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let jF=/^c[^\s-]{8,}$/i,jB=/^[0-9a-z]+$/,jV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jq=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,jW=/^[a-z0-9_-]{21}$/i,jJ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jH=/^[-+]?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)?)??$/,jK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jG=/^(?:(?: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])$/,jY=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,jX=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,jQ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,j0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,j1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,j2="((\\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])))",j4=RegExp(`^${j2}$`);function j6(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class j5 extends jZ{_parse(e){var r,n,i,a;let o;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j$.string){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.string,received:t.parsedType}),jP}let s=new jR;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(jA(o=this._getOrReturnCtx(e,o),{code:jE.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("max"===l.kind)e.data.length>l.value&&(jA(o=this._getOrReturnCtx(e,o),{code:jE.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("length"===l.kind){let t=e.data.length>l.value,r=e.data.length<l.value;(t||r)&&(o=this._getOrReturnCtx(e,o),t?jA(o,{code:jE.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&jA(o,{code:jE.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),s.dirty())}else if("email"===l.kind)jK.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"email",code:jE.invalid_string,message:l.message}),s.dirty());else if("emoji"===l.kind)t||(t=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),t.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"emoji",code:jE.invalid_string,message:l.message}),s.dirty());else if("uuid"===l.kind)jq.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"uuid",code:jE.invalid_string,message:l.message}),s.dirty());else if("nanoid"===l.kind)jW.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"nanoid",code:jE.invalid_string,message:l.message}),s.dirty());else if("cuid"===l.kind)jF.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"cuid",code:jE.invalid_string,message:l.message}),s.dirty());else if("cuid2"===l.kind)jB.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"cuid2",code:jE.invalid_string,message:l.message}),s.dirty());else if("ulid"===l.kind)jV.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"ulid",code:jE.invalid_string,message:l.message}),s.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{jA(o=this._getOrReturnCtx(e,o),{validation:"url",code:jE.invalid_string,message:l.message}),s.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"regex",code:jE.invalid_string,message:l.message}),s.dirty())):"trim"===l.kind?e.data=e.data.trim():"includes"===l.kind?e.data.includes(l.value,l.position)||(jA(o=this._getOrReturnCtx(e,o),{code:jE.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),s.dirty()):"toLowerCase"===l.kind?e.data=e.data.toLowerCase():"toUpperCase"===l.kind?e.data=e.data.toUpperCase():"startsWith"===l.kind?e.data.startsWith(l.value)||(jA(o=this._getOrReturnCtx(e,o),{code:jE.invalid_string,validation:{startsWith:l.value},message:l.message}),s.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(jA(o=this._getOrReturnCtx(e,o),{code:jE.invalid_string,validation:{endsWith:l.value},message:l.message}),s.dirty()):"datetime"===l.kind?(function(e){let t=`${j2}T${j6(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(l).test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{code:jE.invalid_string,validation:"datetime",message:l.message}),s.dirty()):"date"===l.kind?j4.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{code:jE.invalid_string,validation:"date",message:l.message}),s.dirty()):"time"===l.kind?RegExp(`^${j6(l)}$`).test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{code:jE.invalid_string,validation:"time",message:l.message}),s.dirty()):"duration"===l.kind?jH.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"duration",code:jE.invalid_string,message:l.message}),s.dirty()):"ip"===l.kind?(r=e.data,!(("v4"===(n=l.version)||!n)&&jG.test(r)||("v6"===n||!n)&&jX.test(r))&&1&&(jA(o=this._getOrReturnCtx(e,o),{validation:"ip",code:jE.invalid_string,message:l.message}),s.dirty())):"jwt"===l.kind?!function(e,t){if(!jJ.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(e.data,l.alg)&&(jA(o=this._getOrReturnCtx(e,o),{validation:"jwt",code:jE.invalid_string,message:l.message}),s.dirty()):"cidr"===l.kind?(i=e.data,!(("v4"===(a=l.version)||!a)&&jY.test(i)||("v6"===a||!a)&&jQ.test(i))&&1&&(jA(o=this._getOrReturnCtx(e,o),{validation:"cidr",code:jE.invalid_string,message:l.message}),s.dirty())):"base64"===l.kind?j0.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"base64",code:jE.invalid_string,message:l.message}),s.dirty()):"base64url"===l.kind?j1.test(e.data)||(jA(o=this._getOrReturnCtx(e,o),{validation:"base64url",code:jE.invalid_string,message:l.message}),s.dirty()):z.assertNever(l);return{status:s.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:jE.invalid_string,...U.errToObj(r)})}_addCheck(e){return new j5({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...U.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...U.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...U.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...U.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...U.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...U.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...U.errToObj(t)})}nonempty(e){return this.min(1,U.errToObj(e))}trim(){return new j5({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j5({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j5({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}j5.create=e=>new j5({checks:[],typeName:L.ZodString,coerce:e?.coerce??!1,...jL(e)});class j3 extends jZ{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==j$.number){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.number,received:t.parsedType}),jP}let r=new jR;for(let n of this._def.checks)"int"===n.kind?z.isInteger(e.data)||(jA(t=this._getOrReturnCtx(e,t),{code:jE.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(jA(t=this._getOrReturnCtx(e,t),{code:jE.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(jA(t=this._getOrReturnCtx(e,t),{code:jE.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,n.value)&&(jA(t=this._getOrReturnCtx(e,t),{code:jE.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(jA(t=this._getOrReturnCtx(e,t),{code:jE.not_finite,message:n.message}),r.dirty()):z.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,r,n){return new j3({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:U.toString(n)}]})}_addCheck(e){return new j3({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&z.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}j3.create=e=>new j3({checks:[],typeName:L.ZodNumber,coerce:e?.coerce||!1,...jL(e)});class j9 extends jZ{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==j$.bigint)return this._getInvalidInput(e);let r=new jR;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(jA(t=this._getOrReturnCtx(e,t),{code:jE.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(jA(t=this._getOrReturnCtx(e,t),{code:jE.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(jA(t=this._getOrReturnCtx(e,t),{code:jE.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):z.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.bigint,received:t.parsedType}),jP}gte(e,t){return this.setLimit("min",e,!0,U.toString(t))}gt(e,t){return this.setLimit("min",e,!1,U.toString(t))}lte(e,t){return this.setLimit("max",e,!0,U.toString(t))}lt(e,t){return this.setLimit("max",e,!1,U.toString(t))}setLimit(e,t,r,n){return new j9({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:U.toString(n)}]})}_addCheck(e){return new j9({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}j9.create=e=>new j9({checks:[],typeName:L.ZodBigInt,coerce:e?.coerce??!1,...jL(e)});class j8 extends jZ{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j$.boolean){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.boolean,received:t.parsedType}),jP}return jM(e.data)}}j8.create=e=>new j8({typeName:L.ZodBoolean,coerce:e?.coerce||!1,...jL(e)});class j7 extends jZ{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j$.date){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.date,received:t.parsedType}),jP}if(Number.isNaN(e.data.getTime()))return jA(this._getOrReturnCtx(e),{code:jE.invalid_date}),jP;let r=new jR;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(jA(t=this._getOrReturnCtx(e,t),{code:jE.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(jA(t=this._getOrReturnCtx(e,t),{code:jE.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):z.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new j7({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:U.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:U.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}j7.create=e=>new j7({checks:[],coerce:e?.coerce||!1,typeName:L.ZodDate,...jL(e)});class Ee extends jZ{_parse(e){if(this._getType(e)!==j$.symbol){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.symbol,received:t.parsedType}),jP}return jM(e.data)}}Ee.create=e=>new Ee({typeName:L.ZodSymbol,...jL(e)});class Et extends jZ{_parse(e){if(this._getType(e)!==j$.undefined){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.undefined,received:t.parsedType}),jP}return jM(e.data)}}Et.create=e=>new Et({typeName:L.ZodUndefined,...jL(e)});class Er extends jZ{_parse(e){if(this._getType(e)!==j$.null){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.null,received:t.parsedType}),jP}return jM(e.data)}}Er.create=e=>new Er({typeName:L.ZodNull,...jL(e)});class En extends jZ{constructor(){super(...arguments),this._any=!0}_parse(e){return jM(e.data)}}En.create=e=>new En({typeName:L.ZodAny,...jL(e)});class Ei extends jZ{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jM(e.data)}}Ei.create=e=>new Ei({typeName:L.ZodUnknown,...jL(e)});class Ea extends jZ{_parse(e){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.never,received:t.parsedType}),jP}}Ea.create=e=>new Ea({typeName:L.ZodNever,...jL(e)});class Eo extends jZ{_parse(e){if(this._getType(e)!==j$.undefined){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.void,received:t.parsedType}),jP}return jM(e.data)}}Eo.create=e=>new Eo({typeName:L.ZodVoid,...jL(e)});class Es extends jZ{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==j$.array)return jA(t,{code:jE.invalid_type,expected:j$.array,received:t.parsedType}),jP;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(jA(t,{code:e?jE.too_big:jE.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(jA(t,{code:jE.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(jA(t,{code:jE.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new jD(t,e,t.path,r)))).then(e=>jR.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new jD(t,e,t.path,r)));return jR.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new Es({...this._def,minLength:{value:e,message:U.toString(t)}})}max(e,t){return new Es({...this._def,maxLength:{value:e,message:U.toString(t)}})}length(e,t){return new Es({...this._def,exactLength:{value:e,message:U.toString(t)}})}nonempty(e){return this.min(1,e)}}Es.create=(e,t)=>new Es({type:e,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...jL(t)});class El extends jZ{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=z.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==j$.object){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.object,received:t.parsedType}),jP}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ea&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=n[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new jD(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Ea){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(jA(r,{code:jE.unrecognized_keys,keys:a}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of a){let n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new jD(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>jR.mergeObjectSync(t,e)):jR.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new El({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:U.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new El({...this._def,unknownKeys:"strip"})}passthrough(){return new El({...this._def,unknownKeys:"passthrough"})}extend(e){return new El({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new El({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:L.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new El({...this._def,catchall:e})}pick(e){let t={};for(let r of z.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new El({...this._def,shape:()=>t})}omit(e){let t={};for(let r of z.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new El({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof El){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=ES.create(e(i))}return new El({...t._def,shape:()=>r})}if(t instanceof Es)return new Es({...t._def,type:e(t.element)});if(t instanceof ES)return ES.create(e(t.unwrap()));if(t instanceof E$)return E$.create(e(t.unwrap()));if(t instanceof Em)return Em.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of z.objectKeys(this.shape)){let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new El({...this._def,shape:()=>t})}required(e){let t={};for(let r of z.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ES;)e=e._def.innerType;t[r]=e}return new El({...this._def,shape:()=>t})}keyof(){return Ex(z.objectKeys(this.shape))}}El.create=(e,t)=>new El({shape:()=>e,unknownKeys:"strip",catchall:Ea.create(),typeName:L.ZodObject,...jL(t)}),El.strictCreate=(e,t)=>new El({shape:()=>e,unknownKeys:"strict",catchall:Ea.create(),typeName:L.ZodObject,...jL(t)}),El.lazycreate=(e,t)=>new El({shape:e,unknownKeys:"strip",catchall:Ea.create(),typeName:L.ZodObject,...jL(t)});class Eu extends jZ{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new jC(e.ctx.common.issues));return jA(t,{code:jE.invalid_union,unionErrors:r}),jP});{let e,n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new jC(e));return jA(t,{code:jE.invalid_union,unionErrors:i}),jP}}get options(){return this._def.options}}Eu.create=(e,t)=>new Eu({options:e,typeName:L.ZodUnion,...jL(t)});let Ed=e=>{if(e instanceof Ey)return Ed(e.schema);if(e instanceof EI)return Ed(e.innerType());if(e instanceof Eb)return[e.value];if(e instanceof E_)return e.options;if(e instanceof Ew)return z.objectValues(e.enum);else if(e instanceof Ej)return Ed(e._def.innerType);else if(e instanceof Et)return[void 0];else if(e instanceof Er)return[null];else if(e instanceof ES)return[void 0,...Ed(e.unwrap())];else if(e instanceof E$)return[null,...Ed(e.unwrap())];else if(e instanceof ET)return Ed(e.unwrap());else if(e instanceof EA)return Ed(e.unwrap());else if(e instanceof EE)return Ed(e._def.innerType);else return[]};class Ec extends jZ{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j$.object)return jA(t,{code:jE.invalid_type,expected:j$.object,received:t.parsedType}),jP;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(jA(t,{code:jE.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),jP)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=Ed(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new Ec({typeName:L.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...jL(r)})}}class Ep extends jZ{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if("aborted"===e.status||"aborted"===n.status)return jP;let i=function e(t,r){let n=jj(t),i=jj(r);if(t===r)return{valid:!0,data:t};if(n===j$.object&&i===j$.object){let n=z.objectKeys(r),i=z.objectKeys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};a[n]=i.data}return{valid:!0,data:a}}if(n===j$.array&&i===j$.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}if(n===j$.date&&i===j$.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return i.valid?(("dirty"===e.status||"dirty"===n.status)&&t.dirty(),{status:t.value,value:i.data}):(jA(r,{code:jE.invalid_intersection_types}),jP)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ep.create=(e,t,r)=>new Ep({left:e,right:t,typeName:L.ZodIntersection,...jL(r)});class Em extends jZ{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==j$.array)return jA(r,{code:jE.invalid_type,expected:j$.array,received:r.parsedType}),jP;if(r.data.length<this._def.items.length)return jA(r,{code:jE.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),jP;!this._def.rest&&r.data.length>this._def.items.length&&(jA(r,{code:jE.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new jD(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>jR.mergeArray(t,e)):jR.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Em({...this._def,rest:e})}}Em.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Em({items:e,typeName:L.ZodTuple,rest:null,...jL(t)})};class Ef extends jZ{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==j$.object)return jA(r,{code:jE.invalid_type,expected:j$.object,received:r.parsedType}),jP;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new jD(r,e,r.path,e)),value:a._parse(new jD(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?jR.mergeObjectAsync(t,n):jR.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new Ef(t instanceof jZ?{keyType:e,valueType:t,typeName:L.ZodRecord,...jL(r)}:{keyType:j5.create(),valueType:e,typeName:L.ZodRecord,...jL(t)})}}class Eh extends jZ{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==j$.map)return jA(r,{code:jE.invalid_type,expected:j$.map,received:r.parsedType}),jP;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new jD(r,e,r.path,[a,"key"])),value:i._parse(new jD(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return jP;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return jP;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}Eh.create=(e,t,r)=>new Eh({valueType:t,keyType:e,typeName:L.ZodMap,...jL(r)});class Eg extends jZ{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==j$.set)return jA(r,{code:jE.invalid_type,expected:j$.set,received:r.parsedType}),jP;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(jA(r,{code:jE.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(jA(r,{code:jE.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let n of e){if("aborted"===n.status)return jP;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>i._parse(new jD(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(e,t){return new Eg({...this._def,minSize:{value:e,message:U.toString(t)}})}max(e,t){return new Eg({...this._def,maxSize:{value:e,message:U.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Eg.create=(e,t)=>new Eg({valueType:e,minSize:null,maxSize:null,typeName:L.ZodSet,...jL(t)});class Ev extends jZ{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j$.function)return jA(t,{code:jE.invalid_type,expected:j$.function,received:t.parsedType}),jP;function r(e,r){return jN({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jT,jT].filter(e=>!!e),issueData:{code:jE.invalid_arguments,argumentsError:r}})}function n(e,r){return jN({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jT,jT].filter(e=>!!e),issueData:{code:jE.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Ek){let e=this;return jM(async function(...t){let o=new jC([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(r(t,e)),o}),l=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw o.addIssue(n(l,e)),o})})}{let e=this;return jM(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new jC([r(t,o.error)]);let s=Reflect.apply(a,this,o.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new jC([n(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ev({...this._def,args:Em.create(e).rest(Ei.create())})}returns(e){return new Ev({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Ev({args:e||Em.create([]).rest(Ei.create()),returns:t||Ei.create(),typeName:L.ZodFunction,...jL(r)})}}class Ey extends jZ{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ey.create=(e,t)=>new Ey({getter:e,typeName:L.ZodLazy,...jL(t)});class Eb extends jZ{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return jA(t,{received:t.data,code:jE.invalid_literal,expected:this._def.value}),jP}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ex(e,t){return new E_({values:e,typeName:L.ZodEnum,...jL(t)})}Eb.create=(e,t)=>new Eb({value:e,typeName:L.ZodLiteral,...jL(t)});class E_ extends jZ{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return jA(t,{expected:z.joinValues(r),received:t.parsedType,code:jE.invalid_type}),jP}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return jA(t,{received:t.data,code:jE.invalid_enum_value,options:r}),jP}return jM(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return E_.create(e,{...this._def,...t})}exclude(e,t=this._def){return E_.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}E_.create=Ex;class Ew extends jZ{_parse(e){let t=z.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==j$.string&&r.parsedType!==j$.number){let e=z.objectValues(t);return jA(r,{expected:z.joinValues(e),received:r.parsedType,code:jE.invalid_type}),jP}if(this._cache||(this._cache=new Set(z.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=z.objectValues(t);return jA(r,{received:r.data,code:jE.invalid_enum_value,options:e}),jP}return jM(e.data)}get enum(){return this._def.values}}Ew.create=(e,t)=>new Ew({values:e,typeName:L.ZodNativeEnum,...jL(t)});class Ek extends jZ{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==j$.promise&&!1===t.common.async?(jA(t,{code:jE.invalid_type,expected:j$.promise,received:t.parsedType}),jP):jM((t.parsedType===j$.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ek.create=(e,t)=>new Ek({type:e,typeName:L.ZodPromise,...jL(t)});class EI extends jZ{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{jA(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return jP;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?jP:"dirty"===n.status||"dirty"===t.value?jO(n.value):n});{if("aborted"===t.value)return jP;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?jP:"dirty"===n.status||"dirty"===t.value?jO(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?jP:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?jP:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?jP:Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return jP;let a=n.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}z.assertNever(n)}}EI.create=(e,t,r)=>new EI({schema:e,typeName:L.ZodEffects,effect:t,...jL(r)}),EI.createWithPreprocess=(e,t,r)=>new EI({schema:t,effect:{type:"preprocess",transform:e},typeName:L.ZodEffects,...jL(r)});class ES extends jZ{_parse(e){return this._getType(e)===j$.undefined?jM(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ES.create=(e,t)=>new ES({innerType:e,typeName:L.ZodOptional,...jL(t)});class E$ extends jZ{_parse(e){return this._getType(e)===j$.null?jM(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E$.create=(e,t)=>new E$({innerType:e,typeName:L.ZodNullable,...jL(t)});class Ej extends jZ{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===j$.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ej.create=(e,t)=>new Ej({innerType:e,typeName:L.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...jL(t)});class EE extends jZ{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return jz(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new jC(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new jC(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}EE.create=(e,t)=>new EE({innerType:e,typeName:L.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...jL(t)});class EC extends jZ{_parse(e){if(this._getType(e)!==j$.nan){let t=this._getOrReturnCtx(e);return jA(t,{code:jE.invalid_type,expected:j$.nan,received:t.parsedType}),jP}return{status:"valid",value:e.data}}}EC.create=e=>new EC({typeName:L.ZodNaN,...jL(e)}),Symbol("zod_brand");class ET extends jZ{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class EN extends jZ{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?jP:"dirty"===e.status?(t.dirty(),jO(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?jP:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new EN({in:e,out:t,typeName:L.ZodPipeline})}}class EA extends jZ{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return jz(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}EA.create=(e,t)=>new EA({innerType:e,typeName:L.ZodReadonly,...jL(t)}),El.lazycreate,(g=L||(L={})).ZodString="ZodString",g.ZodNumber="ZodNumber",g.ZodNaN="ZodNaN",g.ZodBigInt="ZodBigInt",g.ZodBoolean="ZodBoolean",g.ZodDate="ZodDate",g.ZodSymbol="ZodSymbol",g.ZodUndefined="ZodUndefined",g.ZodNull="ZodNull",g.ZodAny="ZodAny",g.ZodUnknown="ZodUnknown",g.ZodNever="ZodNever",g.ZodVoid="ZodVoid",g.ZodArray="ZodArray",g.ZodObject="ZodObject",g.ZodUnion="ZodUnion",g.ZodDiscriminatedUnion="ZodDiscriminatedUnion",g.ZodIntersection="ZodIntersection",g.ZodTuple="ZodTuple",g.ZodRecord="ZodRecord",g.ZodMap="ZodMap",g.ZodSet="ZodSet",g.ZodFunction="ZodFunction",g.ZodLazy="ZodLazy",g.ZodLiteral="ZodLiteral",g.ZodEnum="ZodEnum",g.ZodEffects="ZodEffects",g.ZodNativeEnum="ZodNativeEnum",g.ZodOptional="ZodOptional",g.ZodNullable="ZodNullable",g.ZodDefault="ZodDefault",g.ZodCatch="ZodCatch",g.ZodPromise="ZodPromise",g.ZodBranded="ZodBranded",g.ZodPipeline="ZodPipeline",g.ZodReadonly="ZodReadonly",j5.create,j3.create,EC.create,j9.create,j8.create,j7.create,Ee.create,Et.create,Er.create,En.create,Ei.create,Ea.create,Eo.create,Es.create,El.create,El.strictCreate,Eu.create,Ec.create,Ep.create,Em.create,Ef.create,Eh.create,Eg.create,Ev.create,Ey.create,Eb.create,E_.create,Ew.create,Ek.create,EI.create,ES.create,E$.create,EI.createWithPreprocess,EN.create;class ER extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function EP(e){}function EO(e,t,r){return 100===r&&97===e.charCodeAt(t+1)&&116===e.charCodeAt(t+2)&&97===e.charCodeAt(t+3)&&58===e.charCodeAt(t+4)}function EM(e,t,r){return 101===r&&118===e.charCodeAt(t+1)&&101===e.charCodeAt(t+2)&&110===e.charCodeAt(t+3)&&116===e.charCodeAt(t+4)&&58===e.charCodeAt(t+5)}class Ez extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let n;super({start(i){n=function(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=EP,onError:r=EP,onRetry:n=EP,onComment:i}=e,a=[],o=!0,s,l="",u=0,d;function c(e){let r=0;if(-1===e.indexOf("\r")){let n=e.indexOf(`
12
+ `,r);for(;-1!==n;){if(r===n){u>0&&t({id:s,event:d,data:l}),s=void 0,l="",u=0,d=void 0,r=n+1,n=e.indexOf(`
13
+ `,r);continue}let i=e.charCodeAt(r);if(EO(e,r,i)){let i=32===e.charCodeAt(r+5)?r+6:r+5,a=e.slice(i,n);if(0===u&&10===e.charCodeAt(n+1)){t({id:s,event:d,data:a}),s=void 0,l="",d=void 0,r=n+2,n=e.indexOf(`
14
+ `,r);continue}l=0===u?a:`${l}
15
+ ${a}`,u++}else EM(e,r,i)?d=e.slice(32===e.charCodeAt(r+6)?r+7:r+6,n)||void 0:p(e,r,n);r=n+1,n=e.indexOf(`
16
+ `,r)}return e.slice(r)}for(;r<e.length;){let t=e.indexOf("\r",r),n=e.indexOf(`
17
+ `,r),i=-1;if(-1!==t&&-1!==n?i=t<n?t:n:-1!==t?i=t===e.length-1?-1:t:-1!==n&&(i=n),-1===i)break;p(e,r,i),r=i+1,13===e.charCodeAt(r-1)&&10===e.charCodeAt(r)&&r++}return e.slice(r)}function p(e,r,n){if(r===n)return void(u>0&&t({id:s,event:d,data:l}),s=void 0,l="",u=0,d=void 0);let a=e.charCodeAt(r);if(EO(e,r,a)){let t=32===e.charCodeAt(r+5)?r+6:r+5,i=e.slice(t,n);l=0===u?i:`${l}
18
+ ${i}`,u++;return}if(EM(e,r,a)){d=e.slice(32===e.charCodeAt(r+6)?r+7:r+6,n)||void 0;return}if(105===a&&100===e.charCodeAt(r+1)&&58===e.charCodeAt(r+2)){let t=e.slice(32===e.charCodeAt(r+3)?r+4:r+3,n);s=t.includes("\0")?void 0:t;return}if(58===a){i&&i(e.slice(r,n).slice(32===e.charCodeAt(r+1)?2:1));return}let o=e.slice(r,n),c=o.indexOf(":");if(-1===c)return void m(o,"",o);let p=o.slice(0,c),f=32===o.charCodeAt(c+1)?2:1;m(p,o.slice(c+f),o)}function m(e,t,i){switch(e){case"event":d=t||void 0;break;case"data":l=0===u?t:`${l}
19
+ ${t}`,u++;break;case"id":s=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?n(parseInt(t,10)):r(new ER(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:i}));break;default:r(new ER(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:"unknown-field",field:e,value:t,line:i}))}}return{feed:function(e){if(o&&(o=!1,239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)&&(e=e.slice(3))),0===a.length){let t=c(e);""!==t&&a.push(t);return}if(-1===e.indexOf(`
20
+ `)&&-1===e.indexOf("\r"))return void a.push(e);a.push(e);let t=a.join("");a.length=0;let r=c(t);""!==r&&a.push(r)},reset:function(e={}){if(e.consume&&a.length>0){let e=a.join("");p(e,0,e.length)}o=!0,s=void 0,l="",u=0,d=void 0,a.length=0}}}({onEvent:e=>{i.enqueue(e)},onError(t){"terminate"===e?i.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){n.feed(e)}})}}function ED(...e){return e.reduce((e,t)=>({...e,...null!=t?t:{}}),{})}function EU(e){return Object.fromEntries([...e.headers])}var{btoa:EL,atob:EZ}=globalThis;function EF(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return EL(t)}var EB="AI_DownloadError",EV=`vercel.ai.error.${EB}`,Eq=Symbol.for(EV),EW=class extends(F=IH,Z=Eq,F){constructor({url:e,statusCode:t,statusText:r,cause:n,message:i=null==n?`Failed to download ${e}: ${t} ${r}`:`Failed to download ${e}: ${n}`}){super({name:EB,message:i,cause:n}),this[Z]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return IH.hasMarker(e,EV)}};async function EJ({response:e,url:t,maxBytes:r=0x80000000}){let n=e.headers.get("content-length");if(null!=n){let e=parseInt(n,10);if(!isNaN(e)&&e>r)throw new EW({url:t,message:`Download of ${t} exceeded maximum size of ${r} bytes (Content-Length: ${e}).`})}let i=e.body;if(null==i)return new Uint8Array(0);let a=i.getReader(),o=[],s=0;try{for(;;){let{done:e,value:n}=await a.read();if(e)break;if((s+=n.length)>r)throw new EW({url:t,message:`Download of ${t} exceeded maximum size of ${r} bytes.`});o.push(n)}}finally{try{await a.cancel()}finally{a.releaseLock()}}let l=new Uint8Array(s),u=0;for(let e of o)l.set(e,u),u+=e.length;return l}function EH(e){let t;try{t=new URL(e)}catch(t){throw new EW({url:e,message:`Invalid URL: ${e}`})}if("data:"===t.protocol)return;if("http:"!==t.protocol&&"https:"!==t.protocol)throw new EW({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let r=t.hostname;if(!r)throw new EW({url:e,message:"URL must have a hostname"});if("localhost"===r||r.endsWith(".local")||r.endsWith(".localhost"))throw new EW({url:e,message:`URL with hostname ${r} is not allowed`});if(r.startsWith("[")&&r.endsWith("]")){if(function(e){let t=e.toLowerCase();if("::1"===t||"::"===t)return!0;if(t.startsWith("::ffff:")){let e=t.slice(7);if(EK(e))return EG(e);let r=e.split(":");if(2===r.length){let e=parseInt(r[0],16),t=parseInt(r[1],16);if(!isNaN(e)&&!isNaN(t))return EG(`${e>>8&255}.${255&e}.${t>>8&255}.${255&t}`)}}return!!(t.startsWith("fc")||t.startsWith("fd")||t.startsWith("fe80"))}(r.slice(1,-1)))throw new EW({url:e,message:`URL with IPv6 address ${r} is not allowed`});return}if(EK(r)){if(EG(r))throw new EW({url:e,message:`URL with IP address ${r} is not allowed`});return}}function EK(e){let t=e.split(".");return 4===t.length&&t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e})}function EG(e){let[t,r]=e.split(".").map(Number);return 0===t||10===t||127===t||169===t&&254===r||172===t&&!!(r>=16)&&!!(r<=31)||192===t&&168===r}var EY=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{let i=()=>{let e=r.length,n=Array(t);for(let i=0;i<t;i++)n[i]=r[Math.random()*e|0];return n.join("")};if(null==e)return i;if(r.includes(n))throw new I9({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${i()}`},EX=EY();function EQ(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}var E0=["fetch failed","failed to fetch"],E1=["ConnectionRefused","ConnectionClosed","FailedToOpenSocket","ECONNRESET","ECONNREFUSED","ETIMEDOUT","EPIPE"];function E2({error:e,url:t,requestBodyValues:r}){if(EQ(e))return e;if(e instanceof TypeError&&E0.includes(e.message.toLowerCase())){let n=e.cause;if(null!=n)return new IX({message:`Cannot connect to API: ${n.message}`,cause:n,url:t,requestBodyValues:r,isRetryable:!0})}return!function(e){if(!(e instanceof Error))return!1;let t=e.code;return!!("string"==typeof t&&E1.includes(t))}(e)?e:new IX({message:`Cannot connect to API: ${e.message}`,cause:e,url:t,requestBodyValues:r,isRetryable:!0})}function E4(e=globalThis){var t,r,n;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(n=null==(r=e.process)?void 0:r.versions)?void 0:n.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function E6(e){if(null==e)return{};let t={};if(e instanceof Headers)e.forEach((e,r)=>{t[r.toLowerCase()]=e});else for(let[r,n]of(Array.isArray(e)||(e=Object.entries(e)),e))null!=n&&(t[r.toLowerCase()]=n);return t}function E5(e,...t){let r=new Headers(E6(e)),n=r.get("user-agent")||"";return r.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var E3="4.0.27",E9=()=>globalThis.fetch,E8=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:n,abortSignal:i,fetch:a=E9()})=>{try{let o=await a(e,{method:"GET",headers:E5(t,`ai-sdk/provider-utils/${E3}`,E4()),signal:i}),s=EU(o);if(!o.ok){let t;try{t=await n({response:o,url:e,requestBodyValues:{}})}catch(t){if(EQ(t)||IX.isInstance(t))throw t;throw new IX({message:"Failed to process error response",cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}throw t.value}try{return await r({response:o,url:e,requestBodyValues:{}})}catch(t){if(t instanceof Error&&(EQ(t)||IX.isInstance(t)))throw t;throw new IX({message:"Failed to process successful response",cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}}catch(t){throw E2({error:t,url:e,requestBodyValues:{}})}};function E7({settingValue:e,environmentVariableName:t}){return"string"==typeof e?e:null!=e||void 0===ew.default?void 0:null!=(e=ew.default.env[t])&&"string"==typeof e?e:void 0}var Ce=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Ct=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Cr(e){let t=JSON.parse(e);return null===t||"object"!=typeof t||!1===Ce.test(e)&&!1===Ct.test(e)?t:function(e){let t=[e];for(;t.length;){let e=t;for(let r of(t=[],e)){if(Object.prototype.hasOwnProperty.call(r,"__proto__")||Object.prototype.hasOwnProperty.call(r,"constructor")&&null!==r.constructor&&"object"==typeof r.constructor&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let e in r){let n=r[e];n&&"object"==typeof n&&t.push(n)}}}return e}(t)}function Cn(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return Cr(e)}try{return Cr(e)}finally{Error.stackTraceLimit=t}}function Ci(e){if("object"===e.type||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;let{properties:t}=e;if(null!=t)for(let e of Object.keys(t))t[e]=Ca(t[e])}null!=e.items&&(e.items=Array.isArray(e.items)?e.items.map(Ca):Ca(e.items)),null!=e.anyOf&&(e.anyOf=e.anyOf.map(Ca)),null!=e.allOf&&(e.allOf=e.allOf.map(Ca)),null!=e.oneOf&&(e.oneOf=e.oneOf.map(Ca));let{definitions:t}=e;if(null!=t)for(let e of Object.keys(t))t[e]=Ca(t[e]);return e}function Ca(e){return"boolean"==typeof e?e:Ci(e)}var Co=Symbol("Let zodToJsonSchema decide on which parser to use"),Cs={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};function Cl(e,t){return CC(e.type._def,t)}var Cu=void 0,Cd=/^[cC][^\s-]{8,}$/,Cc=/^[0-9a-z]+$/,Cp=/^[0-9A-HJKMNP-TV-Z]{26}$/,Cm=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Cf=()=>(void 0===Cu&&(Cu=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Cu),Ch=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Cg=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Cy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cb=/^[a-zA-Z0-9_-]{21}$/,Cx=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function C_(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":CI(r,"email",n.message,t);break;case"format:idn-email":CI(r,"idn-email",n.message,t);break;case"pattern:zod":CS(r,Cm,n.message,t)}break;case"url":CI(r,"uri",n.message,t);break;case"uuid":CI(r,"uuid",n.message,t);break;case"regex":CS(r,n.regex,n.message,t);break;case"cuid":CS(r,Cd,n.message,t);break;case"cuid2":CS(r,Cc,n.message,t);break;case"startsWith":CS(r,RegExp(`^${Cw(n.value,t)}`),n.message,t);break;case"endsWith":CS(r,RegExp(`${Cw(n.value,t)}$`),n.message,t);break;case"datetime":CI(r,"date-time",n.message,t);break;case"date":CI(r,"date",n.message,t);break;case"time":CI(r,"time",n.message,t);break;case"duration":CI(r,"duration",n.message,t);break;case"length":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,n.value):n.value,r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,n.value):n.value;break;case"includes":CS(r,RegExp(Cw(n.value,t)),n.message,t);break;case"ip":"v6"!==n.version&&CI(r,"ipv4",n.message,t),"v4"!==n.version&&CI(r,"ipv6",n.message,t);break;case"base64url":CS(r,Cy,n.message,t);break;case"jwt":CS(r,Cx,n.message,t);break;case"cidr":"v6"!==n.version&&CS(r,Ch,n.message,t),"v4"!==n.version&&CS(r,Cg,n.message,t);break;case"emoji":CS(r,Cf(),n.message,t);break;case"ulid":CS(r,Cp,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":CI(r,"binary",n.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":CS(r,Cv,n.message,t)}break;case"nanoid":CS(r,Cb,n.message,t)}return r}function Cw(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)Ck.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}var Ck=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function CI(e,t,r,n){var i;e.format||(null==(i=e.anyOf)?void 0:i.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function CS(e,t,r,n){var i;e.pattern||(null==(i=e.allOf)?void 0:i.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:C$(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=C$(t,n)}function C$(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=n.i?e.source.toLowerCase():e.source,a="",o=!1,s=!1,l=!1;for(let e=0;e<i.length;e++){if(o){a+=i[e],o=!1;continue}if(n.i){if(s){if(i[e].match(/[a-z]/)){l?(a+=i[e],a+=`${i[e-2]}-${i[e]}`.toUpperCase(),l=!1):"-"===i[e+1]&&(null==(r=i[e+2])?void 0:r.match(/[a-z]/))?(a+=i[e],l=!0):a+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){a+=`[${i[e]}${i[e].toUpperCase()}]`;continue}}if(n.m){if("^"===i[e]){a+=`(^|(?<=[\r
21
+ ]))`;continue}else if("$"===i[e]){a+=`($|(?=[\r
22
+ ]))`;continue}}if(n.s&&"."===i[e]){a+=s?`${i[e]}\r
23
+ `:`[${i[e]}\r
24
+ ]`;continue}a+=i[e],"\\"===i[e]?o=!0:s&&"]"===i[e]?s=!1:s||"["!==i[e]||(s=!0)}try{new RegExp(a)}catch(r){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return a}function Cj(e,t){var r,n,i,a,o,s;let l={type:"object",additionalProperties:null!=(r=CC(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if((null==(n=e.keyType)?void 0:n._def.typeName)===L.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){let{type:r,...n}=C_(e.keyType._def,t);return{...l,propertyNames:n}}if((null==(a=e.keyType)?void 0:a._def.typeName)===L.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===L.ZodBranded&&e.keyType._def.type._def.typeName===L.ZodString&&(null==(s=e.keyType._def.type._def.checks)?void 0:s.length)){let{type:r,...n}=Cl(e.keyType._def,t);return{...l,propertyNames:n}}return l}var CE={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function CC(e,t,r=!1){var n;let i=t.seen.get(e);if(t.override){let a=null==(n=t.override)?void 0:n.call(t,e,t,i,r);if(a!==Co)return a}if(i&&!r){let e=CT(i,t);if(void 0!==e)return e}let a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);let o=((e,t,r)=>{var n,i,a,o,s,l;switch(t){case L.ZodString:return C_(e,r);case L.ZodNumber:let u={type:"number"};if(!e.checks)return u;for(let t of e.checks)switch(t.kind){case"int":u.type="integer";break;case"min":t.inclusive?u.minimum=t.value:u.exclusiveMinimum=t.value;break;case"max":t.inclusive?u.maximum=t.value:u.exclusiveMaximum=t.value;break;case"multipleOf":u.multipleOf=t.value}return u;case L.ZodObject:return function(e,t){let r={type:"object",properties:{}},n=[],i=e.shape();for(let e in i){let a=i[e];if(void 0===a||void 0===a._def)continue;let o=function(e){try{return e.isOptional()}catch(e){return!0}}(a),s=CC(a._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==s&&(r.properties[e]=s,o||n.push(e))}n.length&&(r.required=n);let a=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return CC(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==a&&(r.additionalProperties=a),r}(e,r);case L.ZodBigInt:let d={type:"integer",format:"int64"};if(!e.checks)return d;for(let t of e.checks)switch(t.kind){case"min":t.inclusive?d.minimum=t.value:d.exclusiveMinimum=t.value;break;case"max":t.inclusive?d.maximum=t.value:d.exclusiveMaximum=t.value;break;case"multipleOf":d.multipleOf=t.value}return d;case L.ZodBoolean:return{type:"boolean"};case L.ZodDate:return function e(t,r,n){let i=null!=n?n:r.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,i)=>e(t,r,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var a=t;let o={type:"integer",format:"unix-time"};for(let e of a.checks)switch(e.kind){case"min":o.minimum=e.value;break;case"max":o.maximum=e.value}return o}}(e,r);case L.ZodUndefined:return{not:{}};case L.ZodNull:return{type:"null"};case L.ZodArray:let c;return c={type:"array"},(null==(a=e.type)?void 0:a._def)&&(null==(s=null==(o=e.type)?void 0:o._def)?void 0:s.typeName)!==L.ZodAny&&(c.items=CC(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&(c.minItems=e.minLength.value),e.maxLength&&(c.maxItems=e.maxLength.value),e.exactLength&&(c.minItems=e.exactLength.value,c.maxItems=e.exactLength.value),c;case L.ZodUnion:case L.ZodDiscriminatedUnion:let p,m=e.options instanceof Map?Array.from(e.options.values()):e.options;if(m.every(e=>e._def.typeName in CE&&(!e._def.checks||!e._def.checks.length))){let e=m.reduce((e,t)=>{let r=CE[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(m.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=m.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===m.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:m.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(m.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:m.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return n=e,i=r,(p=(n.options instanceof Map?Array.from(n.options.values()):n.options).map((e,t)=>CC(e._def,{...i,currentPath:[...i.currentPath,"anyOf",`${t}`]})).filter(e=>!!e&&(!i.strictUnions||"object"==typeof e&&Object.keys(e).length>0))).length?{anyOf:p}:void 0;case L.ZodIntersection:let f,h;return f=[CC(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),CC(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),h=[],f.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)h.push(...e.allOf);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...n}=e;t=n}h.push(t)}}),h.length?{allOf:h}:void 0;case L.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>CC(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:CC(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>CC(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case L.ZodRecord:return Cj(e,r);case L.ZodLiteral:let g;return"bigint"!=(g=typeof e.value)&&"number"!==g&&"boolean"!==g&&"string"!==g?{type:Array.isArray(e.value)?"array":"object"}:{type:"bigint"===g?"integer":g,const:e.value};case L.ZodEnum:return{type:"string",enum:Array.from(e.values)};case L.ZodNativeEnum:let v,y,b;return v=e.values,{type:1===(b=Array.from(new Set((y=Object.keys(e.values).filter(e=>"number"!=typeof v[v[e]]).map(e=>v[e])).map(e=>typeof e)))).length?"string"===b[0]?"string":"number":["string","number"],enum:y};case L.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[CE[e.innerType._def.typeName],"null"]};let x=CC(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return x&&{anyOf:[x,{type:"null"}]};case L.ZodOptional:if(r.currentPath.toString()===(null==(l=r.propertyPath)?void 0:l.toString()))return CC(e.innerType._def,r);let _=CC(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return _?{anyOf:[{not:{}},_]}:{};case L.ZodMap:if("record"===r.mapStrategy)return Cj(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[CC(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||{},CC(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}};case L.ZodSet:let w;return w={type:"array",uniqueItems:!0,items:CC(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&(w.minItems=e.minSize.value),e.maxSize&&(w.maxItems=e.maxSize.value),w;case L.ZodLazy:return()=>e.getter()._def;case L.ZodPromise:return CC(e.type._def,r);case L.ZodNaN:case L.ZodNever:return{not:{}};case L.ZodEffects:return"input"===r.effectStrategy?CC(e.schema._def,r):{};case L.ZodAny:case L.ZodUnknown:return{};case L.ZodDefault:return{...CC(e.innerType._def,r),default:e.defaultValue()};case L.ZodBranded:return Cl(e,r);case L.ZodReadonly:case L.ZodCatch:return CC(e.innerType._def,r);case L.ZodPipeline:if("input"===r.pipeStrategy)return CC(e.in._def,r);if("output"===r.pipeStrategy)return CC(e.out._def,r);let k=CC(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),I=CC(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",k?"1":"0"]});return{allOf:[k,I].filter(e=>void 0!==e)};case L.ZodFunction:case L.ZodVoid:case L.ZodSymbol:default:return}})(e,e.typeName,t),s="function"==typeof o?CC(o(),t):o;if(s&&CN(e,t,s),t.postProcess){let r=t.postProcess(s,e,t);return a.jsonSchema=s,r}return a.jsonSchema=s,s}var CT=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:((e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")})(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{};return"seen"===t.$refStrategy?{}:void 0}},CN=(e,t,r)=>(e.description&&(r.description=e.description),r),CA=Symbol.for("vercel.ai.schema");function CR(e){let t;return()=>(null==t&&(t=e()),t)}function CP(e,{validate:t}={}){return{[CA]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function CO(e){var t;return null==e?CP({properties:{},additionalProperties:!1}):"object"==typeof e&&null!==e&&CA in e&&!0===e[CA]&&"jsonSchema"in e&&"validate"in e?e:"~standard"in e?"zod"===e["~standard"].vendor?CM(e):(t=e,CP(()=>Ci(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{let r=await t["~standard"].validate(e);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new Ss({value:e,cause:r.issues})}}})):e()}function CM(e,t){var r,n;let i;if("_zod"in e){let n;return n=null!=(r=null==t?void 0:t.useReferences)&&r,CP(()=>Ci(jS(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async t=>{let r=await $E(e,t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}return i=null!=(n=null==t?void 0:t.useReferences)&&n,CP(()=>((e,t)=>{var r;let n,i,a=(i=void 0!==(n="string"==typeof t?{...Cs,name:t}:{...Cs,...t}).name?[...n.basePath,n.definitionPath,n.name]:n.basePath,{...n,currentPath:i,propertyPath:void 0,seen:new Map(Object.entries(n.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...n.basePath,n.definitionPath,e],jsonSchema:void 0}]))}),o="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>{var n;return{...e,[t]:null!=(n=CC(r._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?n:{}}},{}):void 0,s="string"==typeof t?t:(null==t?void 0:t.nameStrategy)==="title"||null==t?void 0:t.name,l=null!=(r=CC(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?r:{},u="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==u&&(l.title=u);let d=void 0===s?o?{...l,[a.definitionPath]:o}:l:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...o,[s]:l}};return d.$schema="http://json-schema.org/draft-07/schema#",d})(e,{$refStrategy:i?"root":"none"}),{validate:async t=>{let r=await e.safeParseAsync(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}async function Cz({value:e,schema:t,context:r}){let n=await CD({value:e,schema:t,context:r});if(!n.success)throw Ss.wrap({value:e,cause:n.error,context:r});return n.value}async function CD({value:e,schema:t,context:r}){let n=CO(t);try{if(null==n.validate)return{success:!0,value:e,rawValue:e};let t=await n.validate(e);if(t.success)return{success:!0,value:t.value,rawValue:e};return{success:!1,error:Ss.wrap({value:e,cause:t.error,context:r}),rawValue:e}}catch(t){return{success:!1,error:Ss.wrap({value:e,cause:t,context:r}),rawValue:e}}}async function CU({text:e,schema:t}){try{let r=Cn(e);if(null==t)return r;return Cz({value:r,schema:t})}catch(t){if(Sr.isInstance(t)||Ss.isInstance(t))throw t;throw new Sr({text:e,cause:t})}}async function CL({text:e,schema:t}){try{let r=Cn(e);if(null==t)return{success:!0,value:r,rawValue:r};return await CD({value:r,schema:t})}catch(t){return{success:!1,error:Sr.isInstance(t)?t:new Sr({text:e,cause:t}),rawValue:void 0}}}function CZ({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ez).pipeThrough(new TransformStream({async transform({data:e},r){"[DONE]"!==e&&r.enqueue(await CL({text:e,schema:t}))}}))}var CF=()=>globalThis.fetch,CB=async({url:e,headers:t,body:r,failedResponseHandler:n,successfulResponseHandler:i,abortSignal:a,fetch:o})=>CV({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:n,successfulResponseHandler:i,abortSignal:a,fetch:o}),CV=async({url:e,headers:t={},body:r,successfulResponseHandler:n,failedResponseHandler:i,abortSignal:a,fetch:o=CF()})=>{try{let s=await o(e,{method:"POST",headers:E5(t,`ai-sdk/provider-utils/${E3}`,E4()),body:r.content,signal:a}),l=EU(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:r.values})}catch(t){if(EQ(t)||IX.isInstance(t))throw t;throw new IX({message:"Failed to process error response",cause:t,statusCode:s.status,url:e,responseHeaders:l,requestBodyValues:r.values})}throw t.value}try{return await n({response:s,url:e,requestBodyValues:r.values})}catch(t){if(t instanceof Error&&(EQ(t)||IX.isInstance(t)))throw t;throw new IX({message:"Failed to process successful response",cause:t,statusCode:s.status,url:e,responseHeaders:l,requestBodyValues:r.values})}}catch(t){throw E2({error:t,url:e,requestBodyValues:r.values})}};function Cq({id:e,inputSchema:t,outputSchema:r,supportsDeferredResults:n}){return({execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:l,onInputAvailable:u,...d})=>({type:"provider",id:e,args:d,inputSchema:t,outputSchema:r,execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:l,onInputAvailable:u,supportsDeferredResults:n})}async function CW(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var CJ=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:n,url:i,requestBodyValues:a})=>{let o=await n.text(),s=EU(n);if(""===o.trim())return{responseHeaders:s,value:new IX({message:n.statusText,url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,isRetryable:null==r?void 0:r(n)})};try{let l=await CU({text:o,schema:e});return{responseHeaders:s,value:new IX({message:t(l),url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,data:l,isRetryable:null==r?void 0:r(n,l)})}}catch(e){return{responseHeaders:s,value:new IX({message:n.statusText,url:i,requestBodyValues:a,statusCode:n.status,responseHeaders:s,responseBody:o,isRetryable:null==r?void 0:r(n)})}}},CH=e=>async({response:t,url:r,requestBodyValues:n})=>{let i=await t.text(),a=await CL({text:i,schema:e}),o=EU(t);if(!a.success)throw new IX({message:"Invalid JSON response",cause:a.error,statusCode:t.status,responseHeaders:o,responseBody:i,url:r,requestBodyValues:n});return{responseHeaders:o,value:a.value,rawValue:a.rawValue}};function CK(){let e,t,r;return{localeError:(e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;return`Invalid input: expected ${e}, received ${i}`}case"invalid_value":if(1===n.values.length)return`Invalid input: expected ${SU(n.values[0])}`;return`Invalid option: expected one of ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Too big: expected ${n.origin??"value"} to have ${t}${n.maximum.toString()} ${r.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Too small: expected ${n.origin} to have ${t}${n.minimum.toString()} ${r.unit}`;return`Too small: expected ${n.origin} to be ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Invalid string: must start with "${n.prefix}"`;if("ends_with"===n.format)return`Invalid string: must end with "${n.suffix}"`;if("includes"===n.format)return`Invalid string: must include "${n.includes}"`;if("regex"===n.format)return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0){let e=n.options.map(e=>`'${e}'`).join(" | ");return`Invalid discriminator value. Expected ${e}`}return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}})}}Sh(CK()),e.s([],98821),e.i(98821),e.s([],92135),e.i(92135),e.i(97753),e.i(3108),e.i(74969);let CG=/^[cC][0-9a-z]{6,}$/,CY=/^[0-9a-z]+$/,CX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,CQ=/^[0-9a-vA-V]{20}$/,C0=/^[A-Za-z0-9]{27}$/,C1=/^[a-zA-Z0-9_-]{21}$/,C2=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,C4=/^([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})$/,C6=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,C5=C6(4),C3=C6(6),C9=C6(7),C8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,C7=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;function Te(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let Tt=/^(?:(?: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])$/,Tr=/^(([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}|:))$/,Tn=e=>{let t=SM(e??":");return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Ti=/^((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])$/,Ta=/^(([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])$/,To=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ts=/^[A-Za-z0-9_-]*$/,Tl=/^https?$/,Tu=/^\+[1-9]\d{6,14}$/,Td="(?:(?:\\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])))",Tc=RegExp(`^${Td}$`);function Tp(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Tm(e){return RegExp(`^${Tp(e)}$`)}function Tf(e){let t=Tp({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return RegExp(`^${Td}T(?:${n})$`)}let Th=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},Tg=/^-?\d+n?$/,Tv=/^-?\d+$/,Ty=/^-?\d+(?:\.\d+)?$/,Tb=/^(?:true|false)$/i,Tx=/^null$/i,T_=/^undefined$/i,Tw=/^[^A-Z]*$/,Tk=/^[^a-z]*$/;function TI(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function TS(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}let T$=TI(22,"=="),Tj=TS(22),TE=TI(27,"="),TC=TS(27),TT=TI(43,"="),TN=TS(43),TA=TI(64,""),TR=TS(64),TP=TI(86,"=="),TO=TS(86);e.s(["base64",0,To,"base64url",0,Ts,"bigint",0,Tg,"boolean",0,Tb,"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,Ti,"cidrv6",0,Ta,"cuid",0,CG,"cuid2",0,CY,"date",0,Tc,"datetime",0,Tf,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,C2,"e164",0,Tu,"email",0,C8,"emoji",0,Te,"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,C4,"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,Tl,"idnEmail",0,C7,"integer",0,Tv,"ipv4",0,Tt,"ipv6",0,Tr,"ksuid",0,C0,"lowercase",0,Tw,"mac",0,Tn,"md5_base64",0,T$,"md5_base64url",0,Tj,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,C1,"null",0,Tx,"number",0,Ty,"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,TE,"sha1_base64url",0,TC,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,TT,"sha256_base64url",0,TN,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,TA,"sha384_base64url",0,TR,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,TP,"sha512_base64url",0,TO,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,Th,"time",0,Tm,"ulid",0,CX,"undefined",0,T_,"unicodeEmail",0,C7,"uppercase",0,Tk,"uuid",0,C6,"uuid4",0,C5,"uuid6",0,C3,"uuid7",0,C9,"xid",0,CQ],82358);let TM=Sd("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Tz={number:"number",bigint:"bigint",object:"date"},TD=Sd("$ZodCheckLessThan",(e,t)=>{TM.init(e,t);let r=Tz[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),TU=Sd("$ZodCheckGreaterThan",(e,t)=>{TM.init(e,t);let r=Tz[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),TL=Sd("$ZodCheckMultipleOf",(e,t)=>{TM.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===Sw(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),TZ=Sd("$ZodCheckNumberFormat",(e,t)=>{TM.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=SZ[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=a,r&&(n.pattern=Tv)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),TF=Sd("$ZodCheckBigIntFormat",(e,t)=>{TM.init(e,t);let[r,n]=SF[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),TB=Sd("$ZodCheckMaxSize",(e,t)=>{var r;TM.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sx(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:SH(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),TV=Sd("$ZodCheckMinSize",(e,t)=>{var r;TM.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sx(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:SH(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Tq=Sd("$ZodCheckSizeEquals",(e,t)=>{var r;TM.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sx(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=r=>{let n=r.value,i=n.size;if(i===t.size)return;let a=i>t.size;r.issues.push({origin:SH(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),TW=Sd("$ZodCheckMaxLength",(e,t)=>{var r;TM.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sx(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=SK(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),TJ=Sd("$ZodCheckMinLength",(e,t)=>{var r;TM.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sx(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=SK(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),TH=Sd("$ZodCheckLengthEquals",(e,t)=>{var r;TM.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sx(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let a=SK(n),o=i>t.length;r.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),TK=Sd("$ZodCheckStringFormat",(e,t)=>{var r,n;TM.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),TG=Sd("$ZodCheckRegex",(e,t)=>{TK.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),TY=Sd("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Tw),TK.init(e,t)}),TX=Sd("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Tk),TK.init(e,t)}),TQ=Sd("$ZodCheckIncludes",(e,t)=>{TM.init(e,t);let r=SM(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),T0=Sd("$ZodCheckStartsWith",(e,t)=>{TM.init(e,t);let r=RegExp(`^${SM(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),T1=Sd("$ZodCheckEndsWith",(e,t)=>{TM.init(e,t);let r=RegExp(`.*${SM(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function T2(e,t,r){e.issues.length&&t.issues.push(...Sq(r,e.issues))}let T4=Sd("$ZodCheckProperty",(e,t)=>{TM.init(e,t),e._zod.check=e=>{let r=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(r=>T2(r,e,t.property));T2(r,e,t.property)}}),T6=Sd("$ZodCheckMimeType",(e,t)=>{TM.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),T5=Sd("$ZodCheckOverwrite",(e,t)=>{TM.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});e.s(["$ZodCheck",0,TM,"$ZodCheckBigIntFormat",0,TF,"$ZodCheckEndsWith",0,T1,"$ZodCheckGreaterThan",0,TU,"$ZodCheckIncludes",0,TQ,"$ZodCheckLengthEquals",0,TH,"$ZodCheckLessThan",0,TD,"$ZodCheckLowerCase",0,TY,"$ZodCheckMaxLength",0,TW,"$ZodCheckMaxSize",0,TB,"$ZodCheckMimeType",0,T6,"$ZodCheckMinLength",0,TJ,"$ZodCheckMinSize",0,TV,"$ZodCheckMultipleOf",0,TL,"$ZodCheckNumberFormat",0,TZ,"$ZodCheckOverwrite",0,T5,"$ZodCheckProperty",0,T4,"$ZodCheckRegex",0,TG,"$ZodCheckSizeEquals",0,Tq,"$ZodCheckStartsWith",0,T0,"$ZodCheckStringFormat",0,TK,"$ZodCheckUpperCase",0,TX],55605);class T3{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}e.s(["Doc",0,T3],98530);let T9={major:4,minor:4,patch:3};e.s(["version",0,T9],98477);let T8=Sd("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=T9;let n=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&n.unshift(e),n))for(let r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let n,i=SB(e);for(let a of t){if(a._zod.def.when){if(SV(e)||!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new Sp;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=SB(e,t)))});else{if(e.issues.length===t)continue;i||(i=SB(e,t))}}return n?n.then(()=>e):e},r=(r,i,a)=>{if(SB(r))return r.aborted=!0,r;let o=t(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new Sp;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new Sp;return o.then(e=>t(e,n,a))}return t(o,n,a)}}SI(e,"~standard",()=>({validate:t=>{try{let r=$n(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return $a(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),T7=Sd("$ZodString",(e,t)=>{T8.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Th(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ne=Sd("$ZodStringFormat",(e,t)=>{TK.init(e,t),T7.init(e,t)}),Nt=Sd("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=C4),Ne.init(e,t)}),Nr=Sd("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=C6(e))}else t.pattern??(t.pattern=C6());Ne.init(e,t)}),Nn=Sd("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=C8),Ne.init(e,t)}),Ni=Sd("$ZodURL",(e,t)=>{Ne.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Tl.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Na=Sd("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Te()),Ne.init(e,t)}),No=Sd("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=C1),Ne.init(e,t)}),Ns=Sd("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=CG),Ne.init(e,t)}),Nl=Sd("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=CY),Ne.init(e,t)}),Nu=Sd("$ZodULID",(e,t)=>{t.pattern??(t.pattern=CX),Ne.init(e,t)}),Nd=Sd("$ZodXID",(e,t)=>{t.pattern??(t.pattern=CQ),Ne.init(e,t)}),Nc=Sd("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=C0),Ne.init(e,t)}),Np=Sd("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Tf(t)),Ne.init(e,t)}),Nm=Sd("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Tc),Ne.init(e,t)}),Nf=Sd("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Tm(t)),Ne.init(e,t)}),Nh=Sd("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=C2),Ne.init(e,t)}),Ng=Sd("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Tt),Ne.init(e,t),e._zod.bag.format="ipv4"}),Nv=Sd("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Tr),Ne.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ny=Sd("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Tn(t.delimiter)),Ne.init(e,t),e._zod.bag.format="mac"}),Nb=Sd("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ti),Ne.init(e,t)}),Nx=Sd("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ta),Ne.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(2!==n.length)throw Error();let[e,t]=n;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function N_(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Nw=Sd("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=To),Ne.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{N_(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Nk(e){if(!Ts.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return N_(t.padEnd(4*Math.ceil(t.length/4),"="))}let NI=Sd("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ts),Ne.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Nk(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),NS=Sd("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Tu),Ne.init(e,t)});function N$(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}let Nj=Sd("$ZodJWT",(e,t)=>{Ne.init(e,t),e._zod.check=r=>{N$(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),NE=Sd("$ZodCustomStringFormat",(e,t)=>{Ne.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),NC=Sd("$ZodNumber",(e,t)=>{T8.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ty,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}}),NT=Sd("$ZodNumberFormat",(e,t)=>{TZ.init(e,t),NC.init(e,t)}),NN=Sd("$ZodBoolean",(e,t)=>{T8.init(e,t),e._zod.pattern=Tb,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),NA=Sd("$ZodBigInt",(e,t)=>{T8.init(e,t),e._zod.pattern=Tg,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),NR=Sd("$ZodBigIntFormat",(e,t)=>{TF.init(e,t),NA.init(e,t)}),NP=Sd("$ZodSymbol",(e,t)=>{T8.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return"symbol"==typeof n||t.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),t}}),NO=Sd("$ZodUndefined",(e,t)=>{T8.init(e,t),e._zod.pattern=T_,e._zod.values=new Set([void 0]),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),t}}),NM=Sd("$ZodNull",(e,t)=>{T8.init(e,t),e._zod.pattern=Tx,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),Nz=Sd("$ZodAny",(e,t)=>{T8.init(e,t),e._zod.parse=e=>e}),ND=Sd("$ZodUnknown",(e,t)=>{T8.init(e,t),e._zod.parse=e=>e}),NU=Sd("$ZodNever",(e,t)=>{T8.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),NL=Sd("$ZodVoid",(e,t)=>{T8.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),t}}),NZ=Sd("$ZodDate",(e,t)=>{T8.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}});function NF(e,t,r){e.issues.length&&t.issues.push(...Sq(r,e.issues)),t.value[r]=e.value}let NB=Sd("$ZodArray",(e,t)=>{T8.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?a.push(s.then(t=>NF(t,r,e))):NF(s,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function NV(e,t,r,n,i,a){let o=r in n;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Sq(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function Nq(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=SL(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function NW(e,t,r,n,i,a){let o=[],s=i.keySet,l=i.catchall._zod,u=l.def.type,d="optional"===l.optin,c="optional"===l.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===u){o.push(i);continue}let a=l.run({value:t[i],issues:[]},n);a instanceof Promise?e.push(a.then(e=>NV(e,r,i,t,d,c))):NV(a,r,i,t,d,c)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let NJ=Sd("$ZodObject",(e,t)=>{let r;T8.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=Sb(()=>Nq(t));SI(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let n=e[t]._zod;if(n.values)for(let e of(r[t]??(r[t]=new Set),n.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,n)=>{r??(r=i.value);let o=t.value;if(!ST(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],l=r.shape;for(let e of r.keys){let r=l[e],i="optional"===r._zod.optin,a="optional"===r._zod.optout,u=r._zod.run({value:o[e],issues:[]},n);u instanceof Promise?s.push(u.then(r=>NV(r,t,e,o,i,a))):NV(u,t,e,o,i,a)}return a?NW(s,o,t,n,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),NH=Sd("$ZodObjectJIT",(e,t)=>{let r,n;NJ.init(e,t);let i=e._zod.parse,a=Sb(()=>Nq(t)),o=!Sf.jitless,s=o&&SN.value,l=t.catchall;e._zod.parse=(u,d)=>{n??(n=a.value);let c=u.value;return ST(c)?o&&s&&d?.async===!1&&!0!==d.jitless?(r||(r=(e=>{let t=new T3(["shape","payload","ctx"]),r=a.value,n=e=>{let t=Sj(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let a of(t.write("const newResult = {};"),r.keys)){let r=i[a],o=Sj(a),s=e[a],l=s?._zod?.optin==="optional",u=s?._zod?.optout==="optional";t.write(`const ${r} = ${n(a)};`),l&&u?t.write(`
25
+ if (${r}.issues.length) {
26
+ if (${o} in input) {
27
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
28
+ ...iss,
29
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
30
+ })));
31
+ }
32
+ }
33
+
34
+ if (${r}.value === undefined) {
35
+ if (${o} in input) {
36
+ newResult[${o}] = undefined;
37
+ }
38
+ } else {
39
+ newResult[${o}] = ${r}.value;
40
+ }
41
+
42
+ `):l?t.write(`
43
+ if (${r}.issues.length) {
44
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
45
+ ...iss,
46
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
47
+ })));
48
+ }
49
+
50
+ if (${r}.value === undefined) {
51
+ if (${o} in input) {
52
+ newResult[${o}] = undefined;
53
+ }
54
+ } else {
55
+ newResult[${o}] = ${r}.value;
56
+ }
57
+
58
+ `):t.write(`
59
+ const ${r}_present = ${o} in input;
60
+ if (${r}.issues.length) {
61
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
62
+ ...iss,
63
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
64
+ })));
65
+ }
66
+ if (!${r}_present && !${r}.issues.length) {
67
+ payload.issues.push({
68
+ code: "invalid_type",
69
+ expected: "nonoptional",
70
+ input: undefined,
71
+ path: [${o}]
72
+ });
73
+ }
74
+
75
+ if (${r}_present) {
76
+ if (${r}.value === undefined) {
77
+ newResult[${o}] = undefined;
78
+ } else {
79
+ newResult[${o}] = ${r}.value;
80
+ }
81
+ }
82
+
83
+ `)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),u=r(u,d),l)?NW([],c,u,d,n,e):u:i(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),u)}});function NK(e,t,r,n){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!SB(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>SJ(e,n,Sh())))}),t)}let NG=Sd("$ZodUnion",(e,t)=>{T8.init(e,t),SI(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),SI(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),SI(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),SI(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>S_(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(0===t.issues.length)return t;o.push(t)}}return a?Promise.all(o).then(t=>NK(t,n,e,i)):NK(o,n,e,i)}});function NY(e,t,r,n){let i=e.filter(e=>0===e.issues.length);return 1===i.length?t.value=i[0].value:0===i.length?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>SJ(e,n,Sh())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t}let NX=Sd("$ZodXor",(e,t)=>{NG.init(e,t),t.inclusive=!1;let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},i);t instanceof Promise?(o.push(t),a=!0):o.push(t)}return a?Promise.all(o).then(t=>NY(t,n,e,i)):NY(o,n,e,i)}}),NQ=Sd("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,NG.init(e,t);let r=e._zod.parse;SI(e._zod,"propValues",()=>{let e={};for(let r of t.options){let n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(n))for(let n of(e[t]||(e[t]=new Set),r))e[t].add(n)}return e});let n=Sb(()=>{let e=t.options,r=new Map;for(let n of e){let e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(i,a)=>{let o=i.value;if(!ST(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=n.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||"backward"===a.direction?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),N0=Sd("$ZodIntersection",(e,t)=>{T8.init(e,t),e._zod.parse=(e,r)=>{let n=e.value,i=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,r])=>N1(e,t,r)):N1(e,i,a)}});function N1(e,t,r){let n,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(n??(n=r),r.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let a=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&n&&e.issues.push({...n,keys:a}),SB(e))return e;let o=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(SA(t)&&SA(r)){let n=Object.keys(r),i=Object.keys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};a[n]=i.data}return{valid:!0,data:a}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let N2=Sd("$ZodTuple",(e,t)=>{T8.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let o=[],s=N4(r,"optin"),l=N4(r,"optout");if(!t.rest){if(a.length<s)return n.issues.push({code:"too_small",minimum:s,inclusive:!0,input:a,inst:e,origin:"array"}),n;a.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let u=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{u[e]=t})):u[e]=t}if(t.rest){let e=r.length-1;for(let s of a.slice(r.length)){e++;let r=t.rest._zod.run({value:s,issues:[]},i);r instanceof Promise?o.push(r.then(t=>N6(t,n,e))):N6(r,n,e)}}return o.length?Promise.all(o).then(()=>N5(u,n,r,a,l)):N5(u,n,r,a,l)}});function N4(e,t){for(let r=e.length-1;r>=0;r--)if("optional"!==e[r]._zod[t])return r+1;return 0}function N6(e,t,r){e.issues.length&&t.issues.push(...Sq(r,e.issues)),t.value[r]=e.value}function N5(e,t,r,n,i){for(let a=0;a<r.length;a++){let r=e[a],o=a<n.length;if(r.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...Sq(a,r.issues))}t.value[a]=r.value}for(let e=t.value.length-1;e>=n.length;e--)if("optional"===r[e]._zod.optout&&void 0===t.value[e])t.value.length=e;else break;return t}let N3=Sd("$ZodRecord",(e,t)=>{T8.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!SA(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],o=t.keyType._zod.values;if(o){let s;r.value={};let l=new Set;for(let s of o)if("string"==typeof s||"number"==typeof s||"symbol"==typeof s){l.add("number"==typeof s?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},n);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>SJ(e,n,Sh())),input:s,path:[s],inst:e});continue}let u=o.value,d=t.valueType._zod.run({value:i[s],issues:[]},n);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&r.issues.push(...Sq(s,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Sq(s,d.issues)),r.value[u]=d.value)}for(let e in i)l.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},n);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof o&&Ty.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},n);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?r.value[o]=i[o]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>SJ(e,n,Sh())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},n);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&r.issues.push(...Sq(o,e.issues)),r.value[s.value]=e.value})):(l.issues.length&&r.issues.push(...Sq(o,l.issues)),r.value[s.value]=l.value)}return a.length?Promise.all(a).then(()=>r):r}}),N9=Sd("$ZodMap",(e,t)=>{T8.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let a=[];for(let[o,s]of(r.value=new Map,i)){let l=t.keyType._zod.run({value:o,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);l instanceof Promise||u instanceof Promise?a.push(Promise.all([l,u]).then(([t,a])=>{N8(t,a,r,o,i,e,n)})):N8(l,u,r,o,i,e,n)}return a.length?Promise.all(a).then(()=>r):r}});function N8(e,t,r,n,i,a,o){e.issues.length&&(SP.has(typeof n)?r.issues.push(...Sq(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:a,issues:e.issues.map(e=>SJ(e,o,Sh()))})),t.issues.length&&(SP.has(typeof n)?r.issues.push(...Sq(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:a,key:n,issues:t.issues.map(e=>SJ(e,o,Sh()))})),r.value.set(e.value,t.value)}let N7=Sd("$ZodSet",(e,t)=>{T8.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let a=[];for(let e of(r.value=new Set,i)){let i=t.valueType._zod.run({value:e,issues:[]},n);i instanceof Promise?a.push(i.then(e=>Ae(e,r))):Ae(i,r)}return a.length?Promise.all(a).then(()=>r):r}});function Ae(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}let At=Sd("$ZodEnum",(e,t)=>{T8.init(e,t);let r=Sg(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=RegExp(`^(${r.filter(e=>SP.has(typeof e)).map(e=>"string"==typeof e?SM(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let a=t.value;return n.has(a)||t.issues.push({code:"invalid_value",values:r,input:a,inst:e}),t}}),Ar=Sd("$ZodLiteral",(e,t)=>{if(T8.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?SM(e):e?SM(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}}),An=Sd("$ZodFile",(e,t)=>{T8.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return n instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),t}}),Ai=Sd("$ZodTransform",(e,t)=>{T8.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Sm(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new Sp;return r.value=i,r.fallback=!0,r}});function Aa(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Ao=Sd("$ZodOptional",(e,t)=>{T8.init(e,t),e._zod.optin="optional",e._zod.optout="optional",SI(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),SI(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${S_(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let n=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>Aa(e,n)):Aa(i,n)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),As=Sd("$ZodExactOptional",(e,t)=>{Ao.init(e,t),SI(e._zod,"values",()=>t.innerType._zod.values),SI(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),Al=Sd("$ZodNullable",(e,t)=>{T8.init(e,t),SI(e._zod,"optin",()=>t.innerType._zod.optin),SI(e._zod,"optout",()=>t.innerType._zod.optout),SI(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${S_(e.source)}|null)$`):void 0}),SI(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Au=Sd("$ZodDefault",(e,t)=>{T8.init(e,t),e._zod.optin="optional",SI(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Ad(e,t)):Ad(n,t)}});function Ad(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let Ac=Sd("$ZodPrefault",(e,t)=>{T8.init(e,t),e._zod.optin="optional",SI(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Ap=Sd("$ZodNonOptional",(e,t)=>{T8.init(e,t),SI(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>Am(t,e)):Am(i,e)}});function Am(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let Af=Sd("$ZodSuccess",(e,t)=>{T8.init(e,t),e._zod.parse=(e,r)=>{if("backward"===r.direction)throw new Sm("ZodSuccess");let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>(e.value=0===t.issues.length,e)):(e.value=0===n.issues.length,e)}}),Ah=Sd("$ZodCatch",(e,t)=>{T8.init(e,t),e._zod.optin="optional",SI(e._zod,"optout",()=>t.innerType._zod.optout),SI(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>SJ(e,r,Sh()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>SJ(e,r,Sh()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Ag=Sd("$ZodNaN",(e,t)=>{T8.init(e,t),e._zod.parse=(t,r)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)}),Av=Sd("$ZodPipe",(e,t)=>{T8.init(e,t),SI(e._zod,"values",()=>t.in._zod.values),SI(e._zod,"optin",()=>t.in._zod.optin),SI(e._zod,"optout",()=>t.out._zod.optout),SI(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Ay(e,t.in,r)):Ay(n,t.in,r)}let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Ay(e,t.out,r)):Ay(n,t.out,r)}});function Ay(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}let Ab=Sd("$ZodCodec",(e,t)=>{T8.init(e,t),SI(e._zod,"values",()=>t.in._zod.values),SI(e._zod,"optin",()=>t.in._zod.optin),SI(e._zod,"optout",()=>t.out._zod.optout),SI(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("forward"===(r.direction||"forward")){let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Ax(e,t,r)):Ax(n,t,r)}{let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Ax(e,t,r)):Ax(n,t,r)}}});function Ax(e,t,r){if(e.issues.length)return e.aborted=!0,e;if("forward"===(r.direction||"forward")){let n=t.transform(e.value,e);return n instanceof Promise?n.then(n=>A_(e,n,t.out,r)):A_(e,n,t.out,r)}{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(n=>A_(e,n,t.in,r)):A_(e,n,t.in,r)}}function A_(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}let Aw=Sd("$ZodPreprocess",(e,t)=>{Av.init(e,t)}),Ak=Sd("$ZodReadonly",(e,t)=>{T8.init(e,t),SI(e._zod,"propValues",()=>t.innerType._zod.propValues),SI(e._zod,"values",()=>t.innerType._zod.values),SI(e._zod,"optin",()=>t.innerType?._zod?.optin),SI(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(AI):AI(n)}});function AI(e){return e.value=Object.freeze(e.value),e}let AS=Sd("$ZodTemplateLiteral",(e,t)=>{T8.init(e,t);let r=[];for(let e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let n=+!!t.startsWith("^"),i=t.endsWith("$")?t.length-1:t.length;r.push(t.slice(n,i))}else if(null===e||SO.has(typeof e))r.push(SM(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${r.join("")}$`),e._zod.parse=(r,n)=>("string"!=typeof r.value?r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source})),r)}),A$=Sd("$ZodFunction",(e,t)=>(T8.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw Error("implement() must be called with a function");return function(...r){let n=Reflect.apply(t,this,e._def.input?S7(e._def.input,r):r);return e._def.output?S7(e._def.output,n):n}},e.implementAsync=t=>{if("function"!=typeof t)throw Error("implementAsync() must be called with a function");return async function(...r){let n=e._def.input?await $t(e._def.input,r):r,i=await Reflect.apply(t,this,n);return e._def.output?await $t(e._def.output,i):i}},e._zod.parse=(t,r)=>("function"!=typeof t.value?t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}):e._def.output&&"promise"===e._def.output._zod.def.type?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t),e.input=(...t)=>{let r=e.constructor;return new r(Array.isArray(t[0])?{type:"function",input:new N2({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}:{type:"function",input:t[0],output:e._def.output})},e.output=t=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),Aj=Sd("$ZodPromise",(e,t)=>{T8.init(e,t),e._zod.parse=(e,r)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},r))}),AE=Sd("$ZodLazy",(e,t)=>{T8.init(e,t),SI(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),SI(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),SI(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),SI(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),SI(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),AC=Sd("$ZodCustom",(e,t)=>{TM.init(e,t),T8.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>AT(t,r,n,e));AT(i,r,n,e)}});function AT(e,t,r,n){if(!e){let e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(SY(e))}}e.s(["$ZodAny",0,Nz,"$ZodArray",0,NB,"$ZodBase64",0,Nw,"$ZodBase64URL",0,NI,"$ZodBigInt",0,NA,"$ZodBigIntFormat",0,NR,"$ZodBoolean",0,NN,"$ZodCIDRv4",0,Nb,"$ZodCIDRv6",0,Nx,"$ZodCUID",0,Ns,"$ZodCUID2",0,Nl,"$ZodCatch",0,Ah,"$ZodCodec",0,Ab,"$ZodCustom",0,AC,"$ZodCustomStringFormat",0,NE,"$ZodDate",0,NZ,"$ZodDefault",0,Au,"$ZodDiscriminatedUnion",0,NQ,"$ZodE164",0,NS,"$ZodEmail",0,Nn,"$ZodEmoji",0,Na,"$ZodEnum",0,At,"$ZodExactOptional",0,As,"$ZodFile",0,An,"$ZodFunction",0,A$,"$ZodGUID",0,Nt,"$ZodIPv4",0,Ng,"$ZodIPv6",0,Nv,"$ZodISODate",0,Nm,"$ZodISODateTime",0,Np,"$ZodISODuration",0,Nh,"$ZodISOTime",0,Nf,"$ZodIntersection",0,N0,"$ZodJWT",0,Nj,"$ZodKSUID",0,Nc,"$ZodLazy",0,AE,"$ZodLiteral",0,Ar,"$ZodMAC",0,Ny,"$ZodMap",0,N9,"$ZodNaN",0,Ag,"$ZodNanoID",0,No,"$ZodNever",0,NU,"$ZodNonOptional",0,Ap,"$ZodNull",0,NM,"$ZodNullable",0,Al,"$ZodNumber",0,NC,"$ZodNumberFormat",0,NT,"$ZodObject",0,NJ,"$ZodObjectJIT",0,NH,"$ZodOptional",0,Ao,"$ZodPipe",0,Av,"$ZodPrefault",0,Ac,"$ZodPreprocess",0,Aw,"$ZodPromise",0,Aj,"$ZodReadonly",0,Ak,"$ZodRecord",0,N3,"$ZodSet",0,N7,"$ZodString",0,T7,"$ZodStringFormat",0,Ne,"$ZodSuccess",0,Af,"$ZodSymbol",0,NP,"$ZodTemplateLiteral",0,AS,"$ZodTransform",0,Ai,"$ZodTuple",0,N2,"$ZodType",0,T8,"$ZodULID",0,Nu,"$ZodURL",0,Ni,"$ZodUUID",0,Nr,"$ZodUndefined",0,NO,"$ZodUnion",0,NG,"$ZodUnknown",0,ND,"$ZodVoid",0,NL,"$ZodXID",0,Nd,"$ZodXor",0,NX,"isValidBase64",0,N_,"isValidBase64URL",0,Nk,"isValidJWT",0,N$],76094),e.i(76094),e.s(["$ZodAny",0,Nz,"$ZodArray",0,NB,"$ZodBase64",0,Nw,"$ZodBase64URL",0,NI,"$ZodBigInt",0,NA,"$ZodBigIntFormat",0,NR,"$ZodBoolean",0,NN,"$ZodCIDRv4",0,Nb,"$ZodCIDRv6",0,Nx,"$ZodCUID",0,Ns,"$ZodCUID2",0,Nl,"$ZodCatch",0,Ah,"$ZodCodec",0,Ab,"$ZodCustom",0,AC,"$ZodCustomStringFormat",0,NE,"$ZodDate",0,NZ,"$ZodDefault",0,Au,"$ZodDiscriminatedUnion",0,NQ,"$ZodE164",0,NS,"$ZodEmail",0,Nn,"$ZodEmoji",0,Na,"$ZodEnum",0,At,"$ZodExactOptional",0,As,"$ZodFile",0,An,"$ZodFunction",0,A$,"$ZodGUID",0,Nt,"$ZodIPv4",0,Ng,"$ZodIPv6",0,Nv,"$ZodISODate",0,Nm,"$ZodISODateTime",0,Np,"$ZodISODuration",0,Nh,"$ZodISOTime",0,Nf,"$ZodIntersection",0,N0,"$ZodJWT",0,Nj,"$ZodKSUID",0,Nc,"$ZodLazy",0,AE,"$ZodLiteral",0,Ar,"$ZodMAC",0,Ny,"$ZodMap",0,N9,"$ZodNaN",0,Ag,"$ZodNanoID",0,No,"$ZodNever",0,NU,"$ZodNonOptional",0,Ap,"$ZodNull",0,NM,"$ZodNullable",0,Al,"$ZodNumber",0,NC,"$ZodNumberFormat",0,NT,"$ZodObject",0,NJ,"$ZodObjectJIT",0,NH,"$ZodOptional",0,Ao,"$ZodPipe",0,Av,"$ZodPrefault",0,Ac,"$ZodPreprocess",0,Aw,"$ZodPromise",0,Aj,"$ZodReadonly",0,Ak,"$ZodRecord",0,N3,"$ZodSet",0,N7,"$ZodString",0,T7,"$ZodStringFormat",0,Ne,"$ZodSuccess",0,Af,"$ZodSymbol",0,NP,"$ZodTemplateLiteral",0,AS,"$ZodTransform",0,Ai,"$ZodTuple",0,N2,"$ZodType",0,T8,"$ZodULID",0,Nu,"$ZodURL",0,Ni,"$ZodUUID",0,Nr,"$ZodUndefined",0,NO,"$ZodUnion",0,NG,"$ZodUnknown",0,ND,"$ZodVoid",0,NL,"$ZodXID",0,Nd,"$ZodXor",0,NX,"clone",0,Sz,"isValidBase64",0,N_,"isValidBase64URL",0,Nk,"isValidJWT",0,N$],32952),e.i(32952),e.i(55605),e.i(98477);var AN=e.i(22143),AA=e.i(82358);function AR(e,t,r,n){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?n:1===a?t:a>=2&&a<=4?r:n}function AP(e,t,r){return 1===Math.abs(e)?t:r}function AO(e){if(!e)return"";let t=e[e.length-1];return e+(["ա","ե","ը","ի","ո","ու","օ"].includes(t)?"ն":"ը")}function AM(){let e,t,r;return{localeError:(e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}},t={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},r={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${n.expected} ប៉ុន្តែទទួលបាន ${i}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${e} ប៉ុន្តែទទួលបាន ${i}`}case"invalid_value":if(1===n.values.length)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${SU(n.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${t} ${n.maximum.toString()} ${r.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`តូចពេក៖ ត្រូវការ ${n.origin} ${t} ${n.minimum.toString()} ${r.unit}`;return`តូចពេក៖ ត្រូវការ ${n.origin} ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${n.prefix}"`;if("ends_with"===n.format)return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${n.suffix}"`;if("includes"===n.format)return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${n.includes}"`;if("regex"===n.format)return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${n.pattern}`;return`មិនត្រឹមត្រូវ៖ ${t[n.format]??n.format}`;case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${Sv(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":default:return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`}})}}e.s([],43365),e.i(43365);let Az=e=>e.charAt(0).toUpperCase()+e.slice(1);function AD(e){let t=Math.abs(e),r=t%10,n=t%100;return n>=11&&n<=19||0===r?"many":1===r?"one":"few"}function AU(e,t,r,n){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?n:1===a?t:a>=2&&a<=4?r:n}function AL(){let e,t,r;return{localeError:(e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}},t={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},r={nan:"NaN",number:"число",array:"масив"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Неправильні вхідні дані: очікується instanceof ${n.expected}, отримано ${i}`;return`Неправильні вхідні дані: очікується ${e}, отримано ${i}`}case"invalid_value":if(1===n.values.length)return`Неправильні вхідні дані: очікується ${SU(n.values[0])}`;return`Неправильна опція: очікується одне з ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Занадто велике: очікується, що ${n.origin??"значення"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"елементів"}`;return`Занадто велике: очікується, що ${n.origin??"значення"} буде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Занадто мале: очікується, що ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Занадто мале: очікується, що ${n.origin} буде ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Неправильний рядок: повинен починатися з "${n.prefix}"`;if("ends_with"===n.format)return`Неправильний рядок: повинен закінчуватися на "${n.suffix}"`;if("includes"===n.format)return`Неправильний рядок: повинен містити "${n.includes}"`;if("regex"===n.format)return`Неправильний рядок: повинен відповідати шаблону ${n.pattern}`;return`Неправильний ${t[n.format]??n.format}`;case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":default:return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`}})}}e.s(["ar",0,function(){let e,t,r;return{localeError:(e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}},t={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${n.expected}، ولكن تم إدخال ${i}`;return`مدخلات غير مقبولة: يفترض إدخال ${e}، ولكن تم إدخال ${i}`}case"invalid_value":if(1===n.values.length)return`مدخلات غير مقبولة: يفترض إدخال ${SU(n.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${t} ${n.maximum.toString()} ${r.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${t} ${n.minimum.toString()} ${r.unit}`;return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`;if("ends_with"===n.format)return`نَص غير مقبول: يجب أن ينتهي بـ "${n.suffix}"`;if("includes"===n.format)return`نَص غير مقبول: يجب أن يتضمَّن "${n.includes}"`;if("regex"===n.format)return`نَص غير مقبول: يجب أن يطابق النمط ${n.pattern}`;return`${t[n.format]??n.format} غير مقبول`;case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${Sv(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":default:return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`}})}},"az",0,function(){let e,t,r;return{localeError:(e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Yanlış dəyər: g\xf6zlənilən instanceof ${n.expected}, daxil olan ${i}`;return`Yanlış dəyər: g\xf6zlənilən ${e}, daxil olan ${i}`}case"invalid_value":if(1===n.values.length)return`Yanlış dəyər: g\xf6zlənilən ${SU(n.values[0])}`;return`Yanlış se\xe7im: aşağıdakılardan biri olmalıdır: ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`\xc7ox b\xf6y\xfck: g\xf6zlənilən ${n.origin??"dəyər"} ${t}${n.maximum.toString()} ${r.unit??"element"}`;return`\xc7ox b\xf6y\xfck: g\xf6zlənilən ${n.origin??"dəyər"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`\xc7ox ki\xe7ik: g\xf6zlənilən ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`\xc7ox ki\xe7ik: g\xf6zlənilən ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Yanlış mətn: "${n.prefix}" ilə başlamalıdır`;if("ends_with"===n.format)return`Yanlış mətn: "${n.suffix}" ilə bitməlidir`;if("includes"===n.format)return`Yanlış mətn: "${n.includes}" daxil olmalıdır`;if("regex"===n.format)return`Yanlış mətn: ${n.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${t[n.format]??n.format}`;case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə b\xf6l\xfcnə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan a\xe7ar${n.keys.length>1?"lar":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış a\xe7ar`;case"invalid_union":default:return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`}})}},"be",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}},t={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},r={nan:"NaN",number:"лік",array:"масіў"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Няправільны ўвод: чакаўся instanceof ${n.expected}, атрымана ${i}`;return`Няправільны ўвод: чакаўся ${e}, атрымана ${i}`}case"invalid_value":if(1===n.values.length)return`Няправільны ўвод: чакалася ${SU(n.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=AR(Number(n.maximum),r.unit.one,r.unit.few,r.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${r.verb} ${t}${n.maximum.toString()} ${e}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=AR(Number(n.minimum),r.unit.one,r.unit.few,r.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${r.verb} ${t}${n.minimum.toString()} ${e}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Няправільны радок: павінен пачынацца з "${n.prefix}"`;if("ends_with"===n.format)return`Няправільны радок: павінен заканчвацца на "${n.suffix}"`;if("includes"===n.format)return`Няправільны радок: павінен змяшчаць "${n.includes}"`;if("regex"===n.format)return`Няправільны радок: павінен адпавядаць шаблону ${n.pattern}`;return`Няправільны ${t[n.format]??n.format}`;case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":default:return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`}})}},"bg",0,function(){let e,t,r;return{localeError:(e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}},t={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},r={nan:"NaN",number:"число",array:"масив"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Невалиден вход: очакван instanceof ${n.expected}, получен ${i}`;return`Невалиден вход: очакван ${e}, получен ${i}`}case"invalid_value":if(1===n.values.length)return`Невалиден вход: очакван ${SU(n.values[0])}`;return`Невалидна опция: очаквано едно от ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Твърде голямо: очаква се ${n.origin??"стойност"} да съдържа ${t}${n.maximum.toString()} ${r.unit??"елемента"}`;return`Твърде голямо: очаква се ${n.origin??"стойност"} да бъде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Твърде малко: очаква се ${n.origin} да съдържа ${t}${n.minimum.toString()} ${r.unit}`;return`Твърде малко: очаква се ${n.origin} да бъде ${t}${n.minimum.toString()}`}case"invalid_format":{if("starts_with"===n.format)return`Невалиден низ: трябва да започва с "${n.prefix}"`;if("ends_with"===n.format)return`Невалиден низ: трябва да завършва с "${n.suffix}"`;if("includes"===n.format)return`Невалиден низ: трябва да включва "${n.includes}"`;if("regex"===n.format)return`Невалиден низ: трябва да съвпада с ${n.pattern}`;let e="Невалиден";return"emoji"===n.format&&(e="Невалидно"),"datetime"===n.format&&(e="Невалидно"),"date"===n.format&&(e="Невалидна"),"time"===n.format&&(e="Невалидно"),"duration"===n.format&&(e="Невалидна"),`${e} ${t[n.format]??n.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${n.divisor}`;case"unrecognized_keys":return`Неразпознат${n.keys.length>1?"и":""} ключ${n.keys.length>1?"ове":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${n.origin}`;case"invalid_union":default:return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${n.origin}`}})}},"ca",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}},t={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Tipus inv\xe0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${i}`;return`Tipus inv\xe0lid: s'esperava ${e}, s'ha rebut ${i}`}case"invalid_value":if(1===n.values.length)return`Valor inv\xe0lid: s'esperava ${SU(n.values[0])}`;return`Opci\xf3 inv\xe0lida: s'esperava una de ${Sv(n.values," o ")}`;case"too_big":{let t=n.inclusive?"com a màxim":"menys de",r=e[n.origin]??null;if(r)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xe9s ${t} ${n.maximum.toString()} ${r.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"com a mínim":"més de",r=e[n.origin]??null;if(r)return`Massa petit: s'esperava que ${n.origin} contingu\xe9s ${t} ${n.minimum.toString()} ${r.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Format inv\xe0lid: ha de comen\xe7ar amb "${n.prefix}"`;if("ends_with"===n.format)return`Format inv\xe0lid: ha d'acabar amb "${n.suffix}"`;if("includes"===n.format)return`Format inv\xe0lid: ha d'incloure "${n.includes}"`;if("regex"===n.format)return`Format inv\xe0lid: ha de coincidir amb el patr\xf3 ${n.pattern}`;return`Format inv\xe0lid per a ${t[n.format]??n.format}`;case"not_multiple_of":return`N\xfamero inv\xe0lid: ha de ser m\xfaltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Clau inv\xe0lida a ${n.origin}`;case"invalid_union":default:return"Entrada invàlida";case"invalid_element":return`Element inv\xe0lid a ${n.origin}`}})}},"cs",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}},t={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},r={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Neplatn\xfd vstup: oček\xe1v\xe1no instanceof ${n.expected}, obdrženo ${i}`;return`Neplatn\xfd vstup: oček\xe1v\xe1no ${e}, obdrženo ${i}`}case"invalid_value":if(1===n.values.length)return`Neplatn\xfd vstup: oček\xe1v\xe1no ${SU(n.values[0])}`;return`Neplatn\xe1 možnost: oček\xe1v\xe1na jedna z hodnot ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Hodnota je př\xedliš velk\xe1: ${n.origin??"hodnota"} mus\xed m\xedt ${t}${n.maximum.toString()} ${r.unit??"prvků"}`;return`Hodnota je př\xedliš velk\xe1: ${n.origin??"hodnota"} mus\xed b\xfdt ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Hodnota je př\xedliš mal\xe1: ${n.origin??"hodnota"} mus\xed m\xedt ${t}${n.minimum.toString()} ${r.unit??"prvků"}`;return`Hodnota je př\xedliš mal\xe1: ${n.origin??"hodnota"} mus\xed b\xfdt ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Neplatn\xfd řetězec: mus\xed zač\xednat na "${n.prefix}"`;if("ends_with"===n.format)return`Neplatn\xfd řetězec: mus\xed končit na "${n.suffix}"`;if("includes"===n.format)return`Neplatn\xfd řetězec: mus\xed obsahovat "${n.includes}"`;if("regex"===n.format)return`Neplatn\xfd řetězec: mus\xed odpov\xeddat vzoru ${n.pattern}`;return`Neplatn\xfd form\xe1t ${t[n.format]??n.format}`;case"not_multiple_of":return`Neplatn\xe9 č\xedslo: mus\xed b\xfdt n\xe1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xe1m\xe9 kl\xedče: ${Sv(n.keys,", ")}`;case"invalid_key":return`Neplatn\xfd kl\xedč v ${n.origin}`;case"invalid_union":default:return"Neplatný vstup";case"invalid_element":return`Neplatn\xe1 hodnota v ${n.origin}`}})}},"da",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ugyldigt input: forventede instanceof ${n.expected}, fik ${i}`;return`Ugyldigt input: forventede ${e}, fik ${i}`}case"invalid_value":if(1===n.values.length)return`Ugyldig v\xe6rdi: forventede ${SU(n.values[0])}`;return`Ugyldigt valg: forventede en af f\xf8lgende ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`For stor: forventede ${a??"value"} ${i.verb} ${t} ${n.maximum.toString()} ${i.unit??"elementer"}`;return`For stor: forventede ${a??"value"} havde ${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`For lille: forventede ${a} ${i.verb} ${t} ${n.minimum.toString()} ${i.unit}`;return`For lille: forventede ${a} havde ${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ugyldig streng: skal starte med "${n.prefix}"`;if("ends_with"===n.format)return`Ugyldig streng: skal ende med "${n.suffix}"`;if("includes"===n.format)return`Ugyldig streng: skal indeholde "${n.includes}"`;if("regex"===n.format)return`Ugyldig streng: skal matche m\xf8nsteret ${n.pattern}`;return`Ugyldig ${t[n.format]??n.format}`;case"not_multiple_of":return`Ugyldigt tal: skal v\xe6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xf8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xe6rdi i ${n.origin}`;default:return"Ugyldigt input"}})}},"de",0,function(){let e,t,r;return{localeError:(e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}},t={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},r={nan:"NaN",number:"Zahl",array:"Array"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ung\xfcltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${i}`;return`Ung\xfcltige Eingabe: erwartet ${e}, erhalten ${i}`}case"invalid_value":if(1===n.values.length)return`Ung\xfcltige Eingabe: erwartet ${SU(n.values[0])}`;return`Ung\xfcltige Option: erwartet eine von ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Zu gro\xdf: erwartet, dass ${n.origin??"Wert"} ${t}${n.maximum.toString()} ${r.unit??"Elemente"} hat`;return`Zu gro\xdf: erwartet, dass ${n.origin??"Wert"} ${t}${n.maximum.toString()} ist`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Zu klein: erwartet, dass ${n.origin} ${t}${n.minimum.toString()} ${r.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${t}${n.minimum.toString()} ist`}case"invalid_format":if("starts_with"===n.format)return`Ung\xfcltiger String: muss mit "${n.prefix}" beginnen`;if("ends_with"===n.format)return`Ung\xfcltiger String: muss mit "${n.suffix}" enden`;if("includes"===n.format)return`Ung\xfcltiger String: muss "${n.includes}" enthalten`;if("regex"===n.format)return`Ung\xfcltiger String: muss dem Muster ${n.pattern} entsprechen`;return`Ung\xfcltig: ${t[n.format]??n.format}`;case"not_multiple_of":return`Ung\xfcltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Ung\xfcltiger Schl\xfcssel in ${n.origin}`;case"invalid_union":default:return"Ungültige Eingabe";case"invalid_element":return`Ung\xfcltiger Wert in ${n.origin}`}})}},"el",0,function(){let e,t,r;return{localeError:(e={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}},t={regex:"είσοδος",email:"διεύθυνση email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",jwt:"JWT",template_literal:"είσοδος"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if("string"==typeof n.expected&&/^[A-Z]/.test(n.expected))return`Μη έγκυρη είσοδος: αναμενόταν instanceof ${n.expected}, λήφθηκε ${i}`;return`Μη έγκυρη είσοδος: αναμενόταν ${e}, λήφθηκε ${i}`}case"invalid_value":if(1===n.values.length)return`Μη έγκυρη είσοδος: αναμενόταν ${SU(n.values[0])}`;return`Μη έγκυρη επιλογή: αναμενόταν ένα από ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Πολύ μεγάλο: αναμενόταν ${n.origin??"τιμή"} να έχει ${t}${n.maximum.toString()} ${r.unit??"στοιχεία"}`;return`Πολύ μεγάλο: αναμενόταν ${n.origin??"τιμή"} να είναι ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Πολύ μικρό: αναμενόταν ${n.origin} να έχει ${t}${n.minimum.toString()} ${r.unit}`;return`Πολύ μικρό: αναμενόταν ${n.origin} να είναι ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${n.prefix}"`;if("ends_with"===n.format)return`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${n.suffix}"`;if("includes"===n.format)return`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${n.includes}"`;if("regex"===n.format)return`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${n.pattern}`;return`Μη έγκυρο: ${t[n.format]??n.format}`;case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${n.divisor}`;case"unrecognized_keys":return`Άγνωστ${n.keys.length>1?"α":"ο"} κλειδ${n.keys.length>1?"ιά":"ί"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${n.origin}`;case"invalid_union":default:return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${n.origin}`}})}},"en",0,CK,"eo",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}},t={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},r={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Nevalida enigo: atendiĝis instanceof ${n.expected}, riceviĝis ${i}`;return`Nevalida enigo: atendiĝis ${e}, riceviĝis ${i}`}case"invalid_value":if(1===n.values.length)return`Nevalida enigo: atendiĝis ${SU(n.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${t}${n.maximum.toString()} ${r.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Tro malgranda: atendiĝis ke ${n.origin} havu ${t}${n.minimum.toString()} ${r.unit}`;return`Tro malgranda: atendiĝis ke ${n.origin} estu ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`;if("ends_with"===n.format)return`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`;if("includes"===n.format)return`Nevalida karaktraro: devas inkluzivi "${n.includes}"`;if("regex"===n.format)return`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`;return`Nevalida ${t[n.format]??n.format}`;case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} ŝlosilo${n.keys.length>1?"j":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${n.origin}`;case"invalid_union":default:return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`}})}},"es",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entrada inv\xe1lida: se esperaba instanceof ${n.expected}, recibido ${i}`;return`Entrada inv\xe1lida: se esperaba ${e}, recibido ${i}`}case"invalid_value":if(1===n.values.length)return`Entrada inv\xe1lida: se esperaba ${SU(n.values[0])}`;return`Opci\xf3n inv\xe1lida: se esperaba una de ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${t}${n.maximum.toString()} ${i.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${a??"valor"} fuera ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Demasiado peque\xf1o: se esperaba que ${a} tuviera ${t}${n.minimum.toString()} ${i.unit}`;return`Demasiado peque\xf1o: se esperaba que ${a} fuera ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cadena inv\xe1lida: debe comenzar con "${n.prefix}"`;if("ends_with"===n.format)return`Cadena inv\xe1lida: debe terminar en "${n.suffix}"`;if("includes"===n.format)return`Cadena inv\xe1lida: debe incluir "${n.includes}"`;if("regex"===n.format)return`Cadena inv\xe1lida: debe coincidir con el patr\xf3n ${n.pattern}`;return`Inv\xe1lido ${t[n.format]??n.format}`;case"not_multiple_of":return`N\xfamero inv\xe1lido: debe ser m\xfaltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Llave inv\xe1lida en ${r[n.origin]??n.origin}`;case"invalid_union":default:return"Entrada inválida";case"invalid_element":return`Valor inv\xe1lido en ${r[n.origin]??n.origin}`}})}},"fa",0,function(){let e,t,r;return{localeError:(e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}},t={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},r={nan:"NaN",number:"عدد",array:"آرایه"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ورودی نامعتبر: می‌بایست instanceof ${n.expected} می‌بود، ${i} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${e} می‌بود، ${i} دریافت شد`}case"invalid_value":if(1===n.values.length)return`ورودی نامعتبر: می‌بایست ${SU(n.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${Sv(n.values,"|")} می‌بود`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${t}${n.maximum.toString()} ${r.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${t}${n.maximum.toString()} باشد`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`خیلی کوچک: ${n.origin} باید ${t}${n.minimum.toString()} ${r.unit} باشد`;return`خیلی کوچک: ${n.origin} باید ${t}${n.minimum.toString()} باشد`}case"invalid_format":if("starts_with"===n.format)return`رشته نامعتبر: باید با "${n.prefix}" شروع شود`;if("ends_with"===n.format)return`رشته نامعتبر: باید با "${n.suffix}" تمام شود`;if("includes"===n.format)return`رشته نامعتبر: باید شامل "${n.includes}" باشد`;if("regex"===n.format)return`رشته نامعتبر: باید با الگوی ${n.pattern} مطابقت داشته باشد`;return`${t[n.format]??n.format} نامعتبر`;case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${Sv(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":default:return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`}})}},"fi",0,function(){let e,t,r;return{localeError:(e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}},t={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${i}`;return`Virheellinen tyyppi: odotettiin ${e}, oli ${i}`}case"invalid_value":if(1===n.values.length)return`Virheellinen sy\xf6te: t\xe4ytyy olla ${SU(n.values[0])}`;return`Virheellinen valinta: t\xe4ytyy olla yksi seuraavista: ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Liian suuri: ${r.subject} t\xe4ytyy olla ${t}${n.maximum.toString()} ${r.unit}`.trim();return`Liian suuri: arvon t\xe4ytyy olla ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Liian pieni: ${r.subject} t\xe4ytyy olla ${t}${n.minimum.toString()} ${r.unit}`.trim();return`Liian pieni: arvon t\xe4ytyy olla ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy alkaa "${n.prefix}"`;if("ends_with"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy loppua "${n.suffix}"`;if("includes"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy sis\xe4lt\xe4\xe4 "${n.includes}"`;if("regex"===n.format)return`Virheellinen sy\xf6te: t\xe4ytyy vastata s\xe4\xe4nn\xf6llist\xe4 lauseketta ${n.pattern}`;return`Virheellinen ${t[n.format]??n.format}`;case"not_multiple_of":return`Virheellinen luku: t\xe4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${Sv(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}})}},"fr",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}},t={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},r={string:"chaîne",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entr\xe9e invalide : instanceof ${n.expected} attendu, ${i} re\xe7u`;return`Entr\xe9e invalide : ${e} attendu, ${i} re\xe7u`}case"invalid_value":if(1===n.values.length)return`Entr\xe9e invalide : ${SU(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${Sv(n.values,"|")} attendue`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null;if(i)return`Trop grand : ${r[n.origin]??"valeur"} doit ${i.verb} ${t}${n.maximum.toString()} ${i.unit??"élément(s)"}`;return`Trop grand : ${r[n.origin]??"valeur"} doit \xeatre ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null;if(i)return`Trop petit : ${r[n.origin]??"valeur"} doit ${i.verb} ${t}${n.minimum.toString()} ${i.unit}`;return`Trop petit : ${r[n.origin]??"valeur"} doit \xeatre ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cha\xeene invalide : doit commencer par "${n.prefix}"`;if("ends_with"===n.format)return`Cha\xeene invalide : doit se terminer par "${n.suffix}"`;if("includes"===n.format)return`Cha\xeene invalide : doit inclure "${n.includes}"`;if("regex"===n.format)return`Cha\xeene invalide : doit correspondre au mod\xe8le ${n.pattern}`;return`${t[n.format]??n.format} invalide`;case"not_multiple_of":return`Nombre invalide : doit \xeatre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xe9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${Sv(n.keys,", ")}`;case"invalid_key":return`Cl\xe9 invalide dans ${n.origin}`;case"invalid_union":default:return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`}})}},"frCA",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}},t={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Entr\xe9e invalide : attendu instanceof ${n.expected}, re\xe7u ${i}`;return`Entr\xe9e invalide : attendu ${e}, re\xe7u ${i}`}case"invalid_value":if(1===n.values.length)return`Entr\xe9e invalide : attendu ${SU(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"≤":"<",r=e[n.origin]??null;if(r)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${t}${n.maximum.toString()} ${r.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"≥":">",r=e[n.origin]??null;if(r)return`Trop petit : attendu que ${n.origin} ait ${t}${n.minimum.toString()} ${r.unit}`;return`Trop petit : attendu que ${n.origin} soit ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Cha\xeene invalide : doit commencer par "${n.prefix}"`;if("ends_with"===n.format)return`Cha\xeene invalide : doit se terminer par "${n.suffix}"`;if("includes"===n.format)return`Cha\xeene invalide : doit inclure "${n.includes}"`;if("regex"===n.format)return`Cha\xeene invalide : doit correspondre au motif ${n.pattern}`;return`${t[n.format]??n.format} invalide`;case"not_multiple_of":return`Nombre invalide : doit \xeatre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xe9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${Sv(n.keys,", ")}`;case"invalid_key":return`Cl\xe9 invalide dans ${n.origin}`;case"invalid_union":default:return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`}})}},"he",0,function(){let e,t,r,n,i,a,o,s,l;return{localeError:(e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},t={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},r=t=>t?e[t]:void 0,n=t=>{let n=r(t);return n?n.label:t??e.unknown.label},i=e=>`ה${n(e)}`,a=e=>{let t=r(e);return"f"===(t?.gender??"m")?"צריכה להיות":"צריך להיות"},o=e=>e?t[e]??null:null,s={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},l={nan:"NaN"},t=>{switch(t.code){case"invalid_type":{let r=t.expected,i=l[r??""]??n(r),a=SG(t.input),o=l[a]??e[a]?.label??a;if(/^[A-Z]/.test(t.expected))return`קלט לא תקין: צריך להיות instanceof ${t.expected}, התקבל ${o}`;return`קלט לא תקין: צריך להיות ${i}, התקבל ${o}`}case"invalid_value":{if(1===t.values.length)return`ערך לא תקין: הערך חייב להיות ${SU(t.values[0])}`;let e=t.values.map(e=>SU(e));if(2===t.values.length)return`ערך לא תקין: האפשרויות המתאימות הן ${e[0]} או ${e[1]}`;let r=e[e.length-1],n=e.slice(0,-1).join(", ");return`ערך לא תקין: האפשרויות המתאימות הן ${n} או ${r}`}case"too_big":{let e=o(t.origin),r=i(t.origin??"value");if("string"===t.origin)return`${e?.longLabel??"ארוך"} מדי: ${r} צריכה להכיל ${t.maximum.toString()} ${e?.unit??""} ${t.inclusive?"או פחות":"לכל היותר"}`.trim();if("number"===t.origin){let e=t.inclusive?`קטן או שווה ל-${t.maximum}`:`קטן מ-${t.maximum}`;return`גדול מדי: ${r} צריך להיות ${e}`}if("array"===t.origin||"set"===t.origin){let n="set"===t.origin?"צריכה":"צריך",i=t.inclusive?`${t.maximum} ${e?.unit??""} או פחות`:`פחות מ-${t.maximum} ${e?.unit??""}`;return`גדול מדי: ${r} ${n} להכיל ${i}`.trim()}let n=t.inclusive?"<=":"<",s=a(t.origin??"value");if(e?.unit)return`${e.longLabel} מדי: ${r} ${s} ${n}${t.maximum.toString()} ${e.unit}`;return`${e?.longLabel??"גדול"} מדי: ${r} ${s} ${n}${t.maximum.toString()}`}case"too_small":{let e=o(t.origin),r=i(t.origin??"value");if("string"===t.origin)return`${e?.shortLabel??"קצר"} מדי: ${r} צריכה להכיל ${t.minimum.toString()} ${e?.unit??""} ${t.inclusive?"או יותר":"לפחות"}`.trim();if("number"===t.origin){let e=t.inclusive?`גדול או שווה ל-${t.minimum}`:`גדול מ-${t.minimum}`;return`קטן מדי: ${r} צריך להיות ${e}`}if("array"===t.origin||"set"===t.origin){let n="set"===t.origin?"צריכה":"צריך";if(1===t.minimum&&t.inclusive){let e=(t.origin,"לפחות פריט אחד");return`קטן מדי: ${r} ${n} להכיל ${e}`}let i=t.inclusive?`${t.minimum} ${e?.unit??""} או יותר`:`יותר מ-${t.minimum} ${e?.unit??""}`;return`קטן מדי: ${r} ${n} להכיל ${i}`.trim()}let n=t.inclusive?">=":">",s=a(t.origin??"value");if(e?.unit)return`${e.shortLabel} מדי: ${r} ${s} ${n}${t.minimum.toString()} ${e.unit}`;return`${e?.shortLabel??"קטן"} מדי: ${r} ${s} ${n}${t.minimum.toString()}`}case"invalid_format":{if("starts_with"===t.format)return`המחרוזת חייבת להתחיל ב "${t.prefix}"`;if("ends_with"===t.format)return`המחרוזת חייבת להסתיים ב "${t.suffix}"`;if("includes"===t.format)return`המחרוזת חייבת לכלול "${t.includes}"`;if("regex"===t.format)return`המחרוזת חייבת להתאים לתבנית ${t.pattern}`;let e=s[t.format],r=e?.label??t.format,n=e?.gender??"m";return`${r} לא ${"f"===n?"תקינה":"תקין"}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${t.divisor}`;case"unrecognized_keys":return`מפתח${t.keys.length>1?"ות":""} לא מזוה${t.keys.length>1?"ים":"ה"}: ${Sv(t.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":default:return"קלט לא תקין";case"invalid_element":{let e=i(t.origin??"array");return`ערך לא תקין ב${e}`}}})}},"hr",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}},t={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},r={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Neispravan unos: očekuje se instanceof ${n.expected}, a primljeno je ${i}`;return`Neispravan unos: očekuje se ${e}, a primljeno je ${i}`}case"invalid_value":if(1===n.values.length)return`Neispravna vrijednost: očekivano ${SU(n.values[0])}`;return`Neispravna opcija: očekivano jedno od ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Preveliko: očekivano da ${a??"vrijednost"} ima ${t}${n.maximum.toString()} ${i.unit??"elemenata"}`;return`Preveliko: očekivano da ${a??"vrijednost"} bude ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",i=e[n.origin]??null,a=r[n.origin]??n.origin;if(i)return`Premalo: očekivano da ${a} ima ${t}${n.minimum.toString()} ${i.unit}`;return`Premalo: očekivano da ${a} bude ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Neispravan tekst: mora započinjati s "${n.prefix}"`;if("ends_with"===n.format)return`Neispravan tekst: mora završavati s "${n.suffix}"`;if("includes"===n.format)return`Neispravan tekst: mora sadržavati "${n.includes}"`;if("regex"===n.format)return`Neispravan tekst: mora odgovarati uzorku ${n.pattern}`;return`Neispravna ${t[n.format]??n.format}`;case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i ključevi":" ključ"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${r[n.origin]??n.origin}`;case"invalid_union":default:return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${r[n.origin]??n.origin}`}})}},"hu",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}},t={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},r={nan:"NaN",number:"szám",array:"tömb"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k instanceof ${n.expected}, a kapott \xe9rt\xe9k ${i}`;return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k ${e}, a kapott \xe9rt\xe9k ${i}`}case"invalid_value":if(1===n.values.length)return`\xc9rv\xe9nytelen bemenet: a v\xe1rt \xe9rt\xe9k ${SU(n.values[0])}`;return`\xc9rv\xe9nytelen opci\xf3: valamelyik \xe9rt\xe9k v\xe1rt ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`T\xfal nagy: ${n.origin??"érték"} m\xe9rete t\xfal nagy ${t}${n.maximum.toString()} ${r.unit??"elem"}`;return`T\xfal nagy: a bemeneti \xe9rt\xe9k ${n.origin??"érték"} t\xfal nagy: ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`T\xfal kicsi: a bemeneti \xe9rt\xe9k ${n.origin} m\xe9rete t\xfal kicsi ${t}${n.minimum.toString()} ${r.unit}`;return`T\xfal kicsi: a bemeneti \xe9rt\xe9k ${n.origin} t\xfal kicsi ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`\xc9rv\xe9nytelen string: "${n.prefix}" \xe9rt\xe9kkel kell kezdődnie`;if("ends_with"===n.format)return`\xc9rv\xe9nytelen string: "${n.suffix}" \xe9rt\xe9kkel kell v\xe9gződnie`;if("includes"===n.format)return`\xc9rv\xe9nytelen string: "${n.includes}" \xe9rt\xe9ket kell tartalmaznia`;if("regex"===n.format)return`\xc9rv\xe9nytelen string: ${n.pattern} mint\xe1nak kell megfelelnie`;return`\xc9rv\xe9nytelen ${t[n.format]??n.format}`;case"not_multiple_of":return`\xc9rv\xe9nytelen sz\xe1m: ${n.divisor} t\xf6bbsz\xf6r\xf6s\xe9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`\xc9rv\xe9nytelen kulcs ${n.origin}`;case"invalid_union":default:return"Érvénytelen bemenet";case"invalid_element":return`\xc9rv\xe9nytelen \xe9rt\xe9k: ${n.origin}`}})}},"hy",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}},t={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},r={nan:"NaN",number:"թիվ",array:"զանգված"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${n.expected}, ստացվել է ${i}`;return`Սխալ մուտքագրում․ սպասվում էր ${e}, ստացվել է ${i}`}case"invalid_value":if(1===n.values.length)return`Սխալ մուտքագրում․ սպասվում էր ${SU(n.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=AP(Number(n.maximum),r.unit.one,r.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${AO(n.origin??"արժեք")} կունենա ${t}${n.maximum.toString()} ${e}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${AO(n.origin??"արժեք")} լինի ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=AP(Number(n.minimum),r.unit.one,r.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${AO(n.origin)} կունենա ${t}${n.minimum.toString()} ${e}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${AO(n.origin)} լինի ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Սխալ տող․ պետք է սկսվի "${n.prefix}"-ով`;if("ends_with"===n.format)return`Սխալ տող․ պետք է ավարտվի "${n.suffix}"-ով`;if("includes"===n.format)return`Սխալ տող․ պետք է պարունակի "${n.includes}"`;if("regex"===n.format)return`Սխալ տող․ պետք է համապատասխանի ${n.pattern} ձևաչափին`;return`Սխալ ${t[n.format]??n.format}`;case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${n.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${n.keys.length>1?"ներ":""}. ${Sv(n.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${AO(n.origin)}-ում`;case"invalid_union":default:return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${AO(n.origin)}-ում`}})}},"id",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}},t={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${i}`;return`Input tidak valid: diharapkan ${e}, diterima ${i}`}case"invalid_value":if(1===n.values.length)return`Input tidak valid: diharapkan ${SU(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${t}${n.maximum.toString()} ${r.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${t}${n.minimum.toString()} ${r.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`String tidak valid: harus dimulai dengan "${n.prefix}"`;if("ends_with"===n.format)return`String tidak valid: harus berakhir dengan "${n.suffix}"`;if("includes"===n.format)return`String tidak valid: harus menyertakan "${n.includes}"`;if("regex"===n.format)return`String tidak valid: harus sesuai pola ${n.pattern}`;return`${t[n.format]??n.format} tidak valid`;case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":default:return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`}})}},"is",0,function(){let e,t,r;return{localeError:(e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}},t={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},r={nan:"NaN",number:"númer",array:"fylki"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Rangt gildi: \xde\xfa sl\xf3st inn ${i} \xfear sem \xe1 a\xf0 vera instanceof ${n.expected}`;return`Rangt gildi: \xde\xfa sl\xf3st inn ${i} \xfear sem \xe1 a\xf0 vera ${e}`}case"invalid_value":if(1===n.values.length)return`Rangt gildi: gert r\xe1\xf0 fyrir ${SU(n.values[0])}`;return`\xd3gilt val: m\xe1 vera eitt af eftirfarandi ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Of st\xf3rt: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin??"gildi"} hafi ${t}${n.maximum.toString()} ${r.unit??"hluti"}`;return`Of st\xf3rt: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin??"gildi"} s\xe9 ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Of l\xedti\xf0: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin} hafi ${t}${n.minimum.toString()} ${r.unit}`;return`Of l\xedti\xf0: gert er r\xe1\xf0 fyrir a\xf0 ${n.origin} s\xe9 ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 byrja \xe1 "${n.prefix}"`;if("ends_with"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 enda \xe1 "${n.suffix}"`;if("includes"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 innihalda "${n.includes}"`;if("regex"===n.format)return`\xd3gildur strengur: ver\xf0ur a\xf0 fylgja mynstri ${n.pattern}`;return`Rangt ${t[n.format]??n.format}`;case"not_multiple_of":return`R\xf6ng tala: ver\xf0ur a\xf0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xd3\xfeekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xed ${n.origin}`;case"invalid_union":default:return"Rangt gildi";case"invalid_element":return`Rangt gildi \xed ${n.origin}`}})}},"it",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}},t={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"numero",array:"vettore"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input non valido: atteso instanceof ${n.expected}, ricevuto ${i}`;return`Input non valido: atteso ${e}, ricevuto ${i}`}case"invalid_value":if(1===n.values.length)return`Input non valido: atteso ${SU(n.values[0])}`;return`Opzione non valida: atteso uno tra ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Troppo grande: ${n.origin??"valore"} deve avere ${t}${n.maximum.toString()} ${r.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Troppo piccolo: ${n.origin} deve avere ${t}${n.minimum.toString()} ${r.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Stringa non valida: deve iniziare con "${n.prefix}"`;if("ends_with"===n.format)return`Stringa non valida: deve terminare con "${n.suffix}"`;if("includes"===n.format)return`Stringa non valida: deve includere "${n.includes}"`;if("regex"===n.format)return`Stringa non valida: deve corrispondere al pattern ${n.pattern}`;return`Input non valido: ${t[n.format]??n.format}`;case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":default:return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`}})}},"ja",0,function(){let e,t,r;return{localeError:(e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}},t={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},r={nan:"NaN",number:"数値",array:"配列"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`無効な入力: instanceof ${n.expected}が期待されましたが、${i}が入力されました`;return`無効な入力: ${e}が期待されましたが、${i}が入力されました`}case"invalid_value":if(1===n.values.length)return`無効な入力: ${SU(n.values[0])}が期待されました`;return`無効な選択: ${Sv(n.values,"、")}のいずれかである必要があります`;case"too_big":{let t=n.inclusive?"以下である":"より小さい",r=e[n.origin]??null;if(r)return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${r.unit??"要素"}${t}必要があります`;return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${t}必要があります`}case"too_small":{let t=n.inclusive?"以上である":"より大きい",r=e[n.origin]??null;if(r)return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${r.unit}${t}必要があります`;return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${t}必要があります`}case"invalid_format":if("starts_with"===n.format)return`無効な文字列: "${n.prefix}"で始まる必要があります`;if("ends_with"===n.format)return`無効な文字列: "${n.suffix}"で終わる必要があります`;if("includes"===n.format)return`無効な文字列: "${n.includes}"を含む必要があります`;if("regex"===n.format)return`無効な文字列: パターン${n.pattern}に一致する必要があります`;return`無効な${t[n.format]??n.format}`;case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${Sv(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":default:return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`}})}},"ka",0,function(){let e,t,r;return{localeError:(e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}},t={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},r={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${n.expected}, მიღებული ${i}`;return`არასწორი შეყვანა: მოსალოდნელი ${e}, მიღებული ${i}`}case"invalid_value":if(1===n.values.length)return`არასწორი შეყვანა: მოსალოდნელი ${SU(n.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${Sv(n.values,"|")}-დან`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} იყოს ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`ზედმეტად პატარა: მოსალოდნელი ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${n.origin} იყოს ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`არასწორი ველი: უნდა იწყებოდეს "${n.prefix}"-ით`;if("ends_with"===n.format)return`არასწორი ველი: უნდა მთავრდებოდეს "${n.suffix}"-ით`;if("includes"===n.format)return`არასწორი ველი: უნდა შეიცავდეს "${n.includes}"-ს`;if("regex"===n.format)return`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${n.pattern}`;return`არასწორი ${t[n.format]??n.format}`;case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${n.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${n.keys.length>1?"ები":"ი"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${n.origin}-ში`;case"invalid_union":default:return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${n.origin}-ში`}})}},"kh",0,function(){return AM()},"km",0,AM,"ko",0,function(){let e,t,r;return{localeError:(e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}},t={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`잘못된 입력: 예상 타입은 instanceof ${n.expected}, 받은 타입은 ${i}입니다`;return`잘못된 입력: 예상 타입은 ${e}, 받은 타입은 ${i}입니다`}case"invalid_value":if(1===n.values.length)return`잘못된 입력: 값은 ${SU(n.values[0])} 이어야 합니다`;return`잘못된 옵션: ${Sv(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let t=n.inclusive?"이하":"미만",r="미만"===t?"이어야 합니다":"여야 합니다",i=e[n.origin]??null,a=i?.unit??"요소";if(i)return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${a} ${t}${r}`;return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${t}${r}`}case"too_small":{let t=n.inclusive?"이상":"초과",r="이상"===t?"이어야 합니다":"여야 합니다",i=e[n.origin]??null,a=i?.unit??"요소";if(i)return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${a} ${t}${r}`;return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${t}${r}`}case"invalid_format":if("starts_with"===n.format)return`잘못된 문자열: "${n.prefix}"(으)로 시작해야 합니다`;if("ends_with"===n.format)return`잘못된 문자열: "${n.suffix}"(으)로 끝나야 합니다`;if("includes"===n.format)return`잘못된 문자열: "${n.includes}"을(를) 포함해야 합니다`;if("regex"===n.format)return`잘못된 문자열: 정규식 ${n.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${t[n.format]??n.format}`;case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${Sv(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":default:return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`}})}},"lt",0,function(){return{localeError:(()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(t,r,n,i){let a=e[t]??null;return null===a?a:{unit:a.unit[r],verb:a.verb[i][n?"inclusive":"notInclusive"]}}let r={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},n={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=SG(e.input),i=n[r]??r;if(/^[A-Z]/.test(e.expected))return`Gautas tipas ${i}, o tikėtasi - instanceof ${e.expected}`;return`Gautas tipas ${i}, o tikėtasi - ${t}`}case"invalid_value":if(1===e.values.length)return`Privalo būti ${SU(e.values[0])}`;return`Privalo būti vienas iš ${Sv(e.values,"|")} pasirinkimų`;case"too_big":{let r=n[e.origin]??e.origin,i=t(e.origin,AD(Number(e.maximum)),e.inclusive??!1,"smaller");if(i?.verb)return`${Az(r??e.origin??"reikšmė")} ${i.verb} ${e.maximum.toString()} ${i.unit??"elementų"}`;let a=e.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Az(r??e.origin??"reikšmė")} turi būti ${a} ${e.maximum.toString()} ${i?.unit}`}case"too_small":{let r=n[e.origin]??e.origin,i=t(e.origin,AD(Number(e.minimum)),e.inclusive??!1,"bigger");if(i?.verb)return`${Az(r??e.origin??"reikšmė")} ${i.verb} ${e.minimum.toString()} ${i.unit??"elementų"}`;let a=e.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Az(r??e.origin??"reikšmė")} turi būti ${a} ${e.minimum.toString()} ${i?.unit}`}case"invalid_format":if("starts_with"===e.format)return`Eilutė privalo prasidėti "${e.prefix}"`;if("ends_with"===e.format)return`Eilutė privalo pasibaigti "${e.suffix}"`;if("includes"===e.format)return`Eilutė privalo įtraukti "${e.includes}"`;if("regex"===e.format)return`Eilutė privalo atitikti ${e.pattern}`;return`Neteisingas ${r[e.format]??e.format}`;case"not_multiple_of":return`Skaičius privalo būti ${e.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${e.keys.length>1?"i":"as"} rakt${e.keys.length>1?"ai":"as"}: ${Sv(e.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":default:return"Klaidinga įvestis";case"invalid_element":{let t=n[e.origin]??e.origin;return`${Az(t??e.origin??"reikšmė")} turi klaidingą įvestį`}}}})()}},"mk",0,function(){let e,t,r;return{localeError:(e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}},t={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},r={nan:"NaN",number:"број",array:"низа"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Грешен внес: се очекува instanceof ${n.expected}, примено ${i}`;return`Грешен внес: се очекува ${e}, примено ${i}`}case"invalid_value":if(1===n.values.length)return`Invalid input: expected ${SU(n.values[0])}`;return`Грешана опција: се очекува една ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${t}${n.maximum.toString()} ${r.unit??"елементи"}`;return`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Премногу мал: се очекува ${n.origin} да има ${t}${n.minimum.toString()} ${r.unit}`;return`Премногу мал: се очекува ${n.origin} да биде ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Неважечка низа: мора да започнува со "${n.prefix}"`;if("ends_with"===n.format)return`Неважечка низа: мора да завршува со "${n.suffix}"`;if("includes"===n.format)return`Неважечка низа: мора да вклучува "${n.includes}"`;if("regex"===n.format)return`Неважечка низа: мора да одгоара на патернот ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":default:return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`}})}},"ms",0,function(){let e,t,r;return{localeError:(e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}},t={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"nombor"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${i}`;return`Input tidak sah: dijangka ${e}, diterima ${i}`}case"invalid_value":if(1===n.values.length)return`Input tidak sah: dijangka ${SU(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Terlalu kecil: dijangka ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`String tidak sah: mesti bermula dengan "${n.prefix}"`;if("ends_with"===n.format)return`String tidak sah: mesti berakhir dengan "${n.suffix}"`;if("includes"===n.format)return`String tidak sah: mesti mengandungi "${n.includes}"`;if("regex"===n.format)return`String tidak sah: mesti sepadan dengan corak ${n.pattern}`;return`${t[n.format]??n.format} tidak sah`;case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${Sv(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":default:return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`}})}},"nl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}},t={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},r={nan:"NaN",number:"getal"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${i}`;return`Ongeldige invoer: verwacht ${e}, ontving ${i}`}case"invalid_value":if(1===n.values.length)return`Ongeldige invoer: verwacht ${SU(n.values[0])}`;return`Ongeldige optie: verwacht \xe9\xe9n van ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null,i="date"===n.origin?"laat":"string"===n.origin?"lang":"groot";if(r)return`Te ${i}: verwacht dat ${n.origin??"waarde"} ${t}${n.maximum.toString()} ${r.unit??"elementen"} ${r.verb}`;return`Te ${i}: verwacht dat ${n.origin??"waarde"} ${t}${n.maximum.toString()} is`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null,i="date"===n.origin?"vroeg":"string"===n.origin?"kort":"klein";if(r)return`Te ${i}: verwacht dat ${n.origin} ${t}${n.minimum.toString()} ${r.unit} ${r.verb}`;return`Te ${i}: verwacht dat ${n.origin} ${t}${n.minimum.toString()} is`}case"invalid_format":if("starts_with"===n.format)return`Ongeldige tekst: moet met "${n.prefix}" beginnen`;if("ends_with"===n.format)return`Ongeldige tekst: moet op "${n.suffix}" eindigen`;if("includes"===n.format)return`Ongeldige tekst: moet "${n.includes}" bevatten`;if("regex"===n.format)return`Ongeldige tekst: moet overeenkomen met patroon ${n.pattern}`;return`Ongeldig: ${t[n.format]??n.format}`;case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":default:return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`}})}},"no",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}},t={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"tall",array:"liste"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ugyldig input: forventet instanceof ${n.expected}, fikk ${i}`;return`Ugyldig input: forventet ${e}, fikk ${i}`}case"invalid_value":if(1===n.values.length)return`Ugyldig verdi: forventet ${SU(n.values[0])}`;return`Ugyldig valg: forventet en av ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`For stor(t): forventet ${n.origin??"value"} til \xe5 ha ${t}${n.maximum.toString()} ${r.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til \xe5 ha ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`For lite(n): forventet ${n.origin} til \xe5 ha ${t}${n.minimum.toString()} ${r.unit}`;return`For lite(n): forventet ${n.origin} til \xe5 ha ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ugyldig streng: m\xe5 starte med "${n.prefix}"`;if("ends_with"===n.format)return`Ugyldig streng: m\xe5 ende med "${n.suffix}"`;if("includes"===n.format)return`Ugyldig streng: m\xe5 inneholde "${n.includes}"`;if("regex"===n.format)return`Ugyldig streng: m\xe5 matche m\xf8nsteret ${n.pattern}`;return`Ugyldig ${t[n.format]??n.format}`;case"not_multiple_of":return`Ugyldig tall: m\xe5 v\xe6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xf8kkel i ${n.origin}`;case"invalid_union":default:return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`}})}},"ota",0,function(){let e,t,r;return{localeError:(e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}},t={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},r={nan:"NaN",number:"numara",array:"saf",null:"gayb"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`F\xe2sit giren: umulan instanceof ${n.expected}, alınan ${i}`;return`F\xe2sit giren: umulan ${e}, alınan ${i}`}case"invalid_value":if(1===n.values.length)return`F\xe2sit giren: umulan ${SU(n.values[0])}`;return`F\xe2sit tercih: m\xfbteberler ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Fazla b\xfcy\xfck: ${n.origin??"value"}, ${t}${n.maximum.toString()} ${r.unit??"elements"} sahip olmalıydı.`;return`Fazla b\xfcy\xfck: ${n.origin??"value"}, ${t}${n.maximum.toString()} olmalıydı.`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Fazla k\xfc\xe7\xfck: ${n.origin}, ${t}${n.minimum.toString()} ${r.unit} sahip olmalıydı.`;return`Fazla k\xfc\xe7\xfck: ${n.origin}, ${t}${n.minimum.toString()} olmalıydı.`}case"invalid_format":if("starts_with"===n.format)return`F\xe2sit metin: "${n.prefix}" ile başlamalı.`;if("ends_with"===n.format)return`F\xe2sit metin: "${n.suffix}" ile bitmeli.`;if("includes"===n.format)return`F\xe2sit metin: "${n.includes}" ihtiv\xe2 etmeli.`;if("regex"===n.format)return`F\xe2sit metin: ${n.pattern} nakşına uymalı.`;return`F\xe2sit ${t[n.format]??n.format}`;case"not_multiple_of":return`F\xe2sit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xe7in tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} i\xe7in tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}})}},"pl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}},t={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},r={nan:"NaN",number:"liczba",array:"tablica"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${n.expected}, otrzymano ${i}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${e}, otrzymano ${i}`}case"invalid_value":if(1===n.values.length)return`Nieprawidłowe dane wejściowe: oczekiwano ${SU(n.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${t}${n.maximum.toString()} ${r.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${t}${n.minimum.toString()} ${r.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Nieprawidłowy ciąg znak\xf3w: musi zaczynać się od "${n.prefix}"`;if("ends_with"===n.format)return`Nieprawidłowy ciąg znak\xf3w: musi kończyć się na "${n.suffix}"`;if("includes"===n.format)return`Nieprawidłowy ciąg znak\xf3w: musi zawierać "${n.includes}"`;if("regex"===n.format)return`Nieprawidłowy ciąg znak\xf3w: musi odpowiadać wzorcowi ${n.pattern}`;return`Nieprawidłow(y/a/e) ${t[n.format]??n.format}`;case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":default:return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`}})}},"ps",0,function(){let e,t,r;return{localeError:(e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}},t={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},r={nan:"NaN",number:"عدد",array:"ارې"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ناسم ورودي: باید instanceof ${n.expected} وای, مګر ${i} ترلاسه شو`;return`ناسم ورودي: باید ${e} وای, مګر ${i} ترلاسه شو`}case"invalid_value":if(1===n.values.length)return`ناسم ورودي: باید ${SU(n.values[0])} وای`;return`ناسم انتخاب: باید یو له ${Sv(n.values,"|")} څخه وای`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`ډیر لوی: ${n.origin??"ارزښت"} باید ${t}${n.maximum.toString()} ${r.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${n.origin??"ارزښت"} باید ${t}${n.maximum.toString()} وي`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`ډیر کوچنی: ${n.origin} باید ${t}${n.minimum.toString()} ${r.unit} ولري`;return`ډیر کوچنی: ${n.origin} باید ${t}${n.minimum.toString()} وي`}case"invalid_format":if("starts_with"===n.format)return`ناسم متن: باید د "${n.prefix}" سره پیل شي`;if("ends_with"===n.format)return`ناسم متن: باید د "${n.suffix}" سره پای ته ورسيږي`;if("includes"===n.format)return`ناسم متن: باید "${n.includes}" ولري`;if("regex"===n.format)return`ناسم متن: باید د ${n.pattern} سره مطابقت ولري`;return`${t[n.format]??n.format} ناسم دی`;case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":default:return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`}})}},"pt",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}},t={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",number:"número",null:"nulo"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Tipo inv\xe1lido: esperado instanceof ${n.expected}, recebido ${i}`;return`Tipo inv\xe1lido: esperado ${e}, recebido ${i}`}case"invalid_value":if(1===n.values.length)return`Entrada inv\xe1lida: esperado ${SU(n.values[0])}`;return`Op\xe7\xe3o inv\xe1lida: esperada uma das ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${t}${n.maximum.toString()} ${r.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Muito pequeno: esperado que ${n.origin} tivesse ${t}${n.minimum.toString()} ${r.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Texto inv\xe1lido: deve come\xe7ar com "${n.prefix}"`;if("ends_with"===n.format)return`Texto inv\xe1lido: deve terminar com "${n.suffix}"`;if("includes"===n.format)return`Texto inv\xe1lido: deve incluir "${n.includes}"`;if("regex"===n.format)return`Texto inv\xe1lido: deve corresponder ao padr\xe3o ${n.pattern}`;return`${t[n.format]??n.format} inv\xe1lido`;case"not_multiple_of":return`N\xfamero inv\xe1lido: deve ser m\xfaltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Chave inv\xe1lida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inv\xe1lido em ${n.origin}`;default:return"Campo inválido"}})}},"ro",0,function(){let e,t,r;return{localeError:(e={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}},t={regex:"intrare",email:"adresă de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dată și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",jwt:"JWT",template_literal:"intrare"},r={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;return`Intrare invalidă: așteptat ${e}, primit ${i}`}case"invalid_value":if(1===n.values.length)return`Intrare invalidă: așteptat ${SU(n.values[0])}`;return`Opțiune invalidă: așteptat una dintre ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Prea mare: așteptat ca ${n.origin??"valoarea"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"elemente"}`;return`Prea mare: așteptat ca ${n.origin??"valoarea"} să fie ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Prea mic: așteptat ca ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Prea mic: așteptat ca ${n.origin} să fie ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Șir invalid: trebuie să \xeenceapă cu "${n.prefix}"`;if("ends_with"===n.format)return`Șir invalid: trebuie să se termine cu "${n.suffix}"`;if("includes"===n.format)return`Șir invalid: trebuie să includă "${n.includes}"`;if("regex"===n.format)return`Șir invalid: trebuie să se potrivească cu modelul ${n.pattern}`;return`Format invalid: ${t[n.format]??n.format}`;case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${Sv(n.keys,", ")}`;case"invalid_key":return`Cheie invalidă \xeen ${n.origin}`;case"invalid_union":default:return"Intrare invalidă";case"invalid_element":return`Valoare invalidă \xeen ${n.origin}`}})}},"ru",0,function(){let e,t,r;return{localeError:(e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}},t={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},r={nan:"NaN",number:"число",array:"массив"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Неверный ввод: ожидалось instanceof ${n.expected}, получено ${i}`;return`Неверный ввод: ожидалось ${e}, получено ${i}`}case"invalid_value":if(1===n.values.length)return`Неверный ввод: ожидалось ${SU(n.values[0])}`;return`Неверный вариант: ожидалось одно из ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r){let e=AU(Number(n.maximum),r.unit.one,r.unit.few,r.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${t}${n.maximum.toString()} ${e}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r){let e=AU(Number(n.minimum),r.unit.one,r.unit.few,r.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${t}${n.minimum.toString()} ${e}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Неверная строка: должна начинаться с "${n.prefix}"`;if("ends_with"===n.format)return`Неверная строка: должна заканчиваться на "${n.suffix}"`;if("includes"===n.format)return`Неверная строка: должна содержать "${n.includes}"`;if("regex"===n.format)return`Неверная строка: должна соответствовать шаблону ${n.pattern}`;return`Неверный ${t[n.format]??n.format}`;case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":default:return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`}})}},"sl",0,function(){let e,t,r;return{localeError:(e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}},t={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},r={nan:"NaN",number:"število",array:"tabela"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Neveljaven vnos: pričakovano instanceof ${n.expected}, prejeto ${i}`;return`Neveljaven vnos: pričakovano ${e}, prejeto ${i}`}case"invalid_value":if(1===n.values.length)return`Neveljaven vnos: pričakovano ${SU(n.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${t}${n.maximum.toString()} ${r.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Premajhno: pričakovano, da bo ${n.origin} imelo ${t}${n.minimum.toString()} ${r.unit}`;return`Premajhno: pričakovano, da bo ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Neveljaven niz: mora se začeti z "${n.prefix}"`;if("ends_with"===n.format)return`Neveljaven niz: mora se končati z "${n.suffix}"`;if("includes"===n.format)return`Neveljaven niz: mora vsebovati "${n.includes}"`;if("regex"===n.format)return`Neveljaven niz: mora ustrezati vzorcu ${n.pattern}`;return`Neveljaven ${t[n.format]??n.format}`;case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":default:return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`}})}},"sv",0,function(){let e,t,r;return{localeError:(e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}},t={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},r={nan:"NaN",number:"antal",array:"lista"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ogiltig inmatning: f\xf6rv\xe4ntat instanceof ${n.expected}, fick ${i}`;return`Ogiltig inmatning: f\xf6rv\xe4ntat ${e}, fick ${i}`}case"invalid_value":if(1===n.values.length)return`Ogiltig inmatning: f\xf6rv\xe4ntat ${SU(n.values[0])}`;return`Ogiltigt val: f\xf6rv\xe4ntade en av ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`F\xf6r stor(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.maximum.toString()} ${r.unit??"element"}`;return`F\xf6r stor(t): f\xf6rv\xe4ntat ${n.origin??"värdet"} att ha ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`F\xf6r lite(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.minimum.toString()} ${r.unit}`;return`F\xf6r lite(t): f\xf6rv\xe4ntade ${n.origin??"värdet"} att ha ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ogiltig str\xe4ng: m\xe5ste b\xf6rja med "${n.prefix}"`;if("ends_with"===n.format)return`Ogiltig str\xe4ng: m\xe5ste sluta med "${n.suffix}"`;if("includes"===n.format)return`Ogiltig str\xe4ng: m\xe5ste inneh\xe5lla "${n.includes}"`;if("regex"===n.format)return`Ogiltig str\xe4ng: m\xe5ste matcha m\xf6nstret "${n.pattern}"`;return`Ogiltig(t) ${t[n.format]??n.format}`;case"not_multiple_of":return`Ogiltigt tal: m\xe5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${Sv(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":default:return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xe4rde i ${n.origin??"värdet"}`}})}},"ta",0,function(){let e,t,r;return{localeError:(e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}},t={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${n.expected}, பெறப்பட்டது ${i}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${e}, பெறப்பட்டது ${i}`}case"invalid_value":if(1===n.values.length)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${SU(n.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${Sv(n.values,"|")} இல் ஒன்று`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${t}${n.maximum.toString()} ${r.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${t}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${t}${n.minimum.toString()} ${r.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${t}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":if("starts_with"===n.format)return`தவறான சரம்: "${n.prefix}" இல் தொடங்க வேண்டும்`;if("ends_with"===n.format)return`தவறான சரம்: "${n.suffix}" இல் முடிவடைய வேண்டும்`;if("includes"===n.format)return`தவறான சரம்: "${n.includes}" ஐ உள்ளடக்க வேண்டும்`;if("regex"===n.format)return`தவறான சரம்: ${n.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${t[n.format]??n.format}`;case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":default:return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`}})}},"th",0,function(){let e,t,r;return{localeError:(e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}},t={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},r={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${n.expected} แต่ได้รับ ${i}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${e} แต่ได้รับ ${i}`}case"invalid_value":if(1===n.values.length)return`ค่าไม่ถูกต้อง: ควรเป็น ${SU(n.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"ไม่เกิน":"น้อยกว่า",r=e[n.origin]??null;if(r)return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${t} ${n.maximum.toString()} ${r.unit??"รายการ"}`;return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${t} ${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?"อย่างน้อย":"มากกว่า",r=e[n.origin]??null;if(r)return`น้อยกว่ากำหนด: ${n.origin} ควรมี${t} ${n.minimum.toString()} ${r.unit}`;return`น้อยกว่ากำหนด: ${n.origin} ควรมี${t} ${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${n.prefix}"`;if("ends_with"===n.format)return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${n.suffix}"`;if("includes"===n.format)return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${n.includes}" อยู่ในข้อความ`;if("regex"===n.format)return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${n.pattern}`;return`รูปแบบไม่ถูกต้อง: ${t[n.format]??n.format}`;case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${Sv(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}})}},"tr",0,function(){let e,t,r;return{localeError:(e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}},t={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Ge\xe7ersiz değer: beklenen instanceof ${n.expected}, alınan ${i}`;return`Ge\xe7ersiz değer: beklenen ${e}, alınan ${i}`}case"invalid_value":if(1===n.values.length)return`Ge\xe7ersiz değer: beklenen ${SU(n.values[0])}`;return`Ge\xe7ersiz se\xe7enek: aşağıdakilerden biri olmalı: ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`\xc7ok b\xfcy\xfck: beklenen ${n.origin??"değer"} ${t}${n.maximum.toString()} ${r.unit??"öğe"}`;return`\xc7ok b\xfcy\xfck: beklenen ${n.origin??"değer"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`\xc7ok k\xfc\xe7\xfck: beklenen ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`\xc7ok k\xfc\xe7\xfck: beklenen ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Ge\xe7ersiz metin: "${n.prefix}" ile başlamalı`;if("ends_with"===n.format)return`Ge\xe7ersiz metin: "${n.suffix}" ile bitmeli`;if("includes"===n.format)return`Ge\xe7ersiz metin: "${n.includes}" i\xe7ermeli`;if("regex"===n.format)return`Ge\xe7ersiz metin: ${n.pattern} desenine uymalı`;return`Ge\xe7ersiz ${t[n.format]??n.format}`;case"not_multiple_of":return`Ge\xe7ersiz sayı: ${n.divisor} ile tam b\xf6l\xfcnebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${n.keys.length>1?"lar":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xe7inde ge\xe7ersiz anahtar`;case"invalid_union":default:return"Geçersiz değer";case"invalid_element":return`${n.origin} i\xe7inde ge\xe7ersiz değer`}})}},"ua",0,function(){return AL()},"uk",0,AL,"ur",0,function(){let e,t,r;return{localeError:(e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}},t={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},r={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`غلط ان پٹ: instanceof ${n.expected} متوقع تھا، ${i} موصول ہوا`;return`غلط ان پٹ: ${e} متوقع تھا، ${i} موصول ہوا`}case"invalid_value":if(1===n.values.length)return`غلط ان پٹ: ${SU(n.values[0])} متوقع تھا`;return`غلط آپشن: ${Sv(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`بہت بڑا: ${n.origin??"ویلیو"} کے ${t}${n.maximum.toString()} ${r.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${n.origin??"ویلیو"} کا ${t}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`بہت چھوٹا: ${n.origin} کے ${t}${n.minimum.toString()} ${r.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${n.origin} کا ${t}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":if("starts_with"===n.format)return`غلط سٹرنگ: "${n.prefix}" سے شروع ہونا چاہیے`;if("ends_with"===n.format)return`غلط سٹرنگ: "${n.suffix}" پر ختم ہونا چاہیے`;if("includes"===n.format)return`غلط سٹرنگ: "${n.includes}" شامل ہونا چاہیے`;if("regex"===n.format)return`غلط سٹرنگ: پیٹرن ${n.pattern} سے میچ ہونا چاہیے`;return`غلط ${t[n.format]??n.format}`;case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${Sv(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":default:return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`}})}},"uz",0,function(){let e,t,r;return{localeError:(e={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}},t={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},r={nan:"NaN",number:"raqam",array:"massiv"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${i}`;return`Noto‘g‘ri kirish: kutilgan ${e}, qabul qilingan ${i}`}case"invalid_value":if(1===n.values.length)return`Noto‘g‘ri kirish: kutilgan ${SU(n.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Juda katta: kutilgan ${n.origin??"qiymat"} ${t}${n.maximum.toString()} ${r.unit} ${r.verb}`;return`Juda katta: kutilgan ${n.origin??"qiymat"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Juda kichik: kutilgan ${n.origin} ${t}${n.minimum.toString()} ${r.unit} ${r.verb}`;return`Juda kichik: kutilgan ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Noto‘g‘ri satr: "${n.prefix}" bilan boshlanishi kerak`;if("ends_with"===n.format)return`Noto‘g‘ri satr: "${n.suffix}" bilan tugashi kerak`;if("includes"===n.format)return`Noto‘g‘ri satr: "${n.includes}" ni o‘z ichiga olishi kerak`;if("regex"===n.format)return`Noto‘g‘ri satr: ${n.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${t[n.format]??n.format}`;case"not_multiple_of":return`Noto‘g‘ri raqam: ${n.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${n.keys.length>1?"lar":""}: ${Sv(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto‘g‘ri`;case"invalid_union":default:return"Noto‘g‘ri kirish";case"invalid_element":return`${n.origin} da noto‘g‘ri qiymat`}})}},"vi",0,function(){let e,t,r;return{localeError:(e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}},t={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},r={nan:"NaN",number:"số",array:"mảng"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`Đầu v\xe0o kh\xf4ng hợp lệ: mong đợi instanceof ${n.expected}, nhận được ${i}`;return`Đầu v\xe0o kh\xf4ng hợp lệ: mong đợi ${e}, nhận được ${i}`}case"invalid_value":if(1===n.values.length)return`Đầu v\xe0o kh\xf4ng hợp lệ: mong đợi ${SU(n.values[0])}`;return`T\xf9y chọn kh\xf4ng hợp lệ: mong đợi một trong c\xe1c gi\xe1 trị ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Qu\xe1 lớn: mong đợi ${n.origin??"giá trị"} ${r.verb} ${t}${n.maximum.toString()} ${r.unit??"phần tử"}`;return`Qu\xe1 lớn: mong đợi ${n.origin??"giá trị"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Qu\xe1 nhỏ: mong đợi ${n.origin} ${r.verb} ${t}${n.minimum.toString()} ${r.unit}`;return`Qu\xe1 nhỏ: mong đợi ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Chuỗi kh\xf4ng hợp lệ: phải bắt đầu bằng "${n.prefix}"`;if("ends_with"===n.format)return`Chuỗi kh\xf4ng hợp lệ: phải kết th\xfac bằng "${n.suffix}"`;if("includes"===n.format)return`Chuỗi kh\xf4ng hợp lệ: phải bao gồm "${n.includes}"`;if("regex"===n.format)return`Chuỗi kh\xf4ng hợp lệ: phải khớp với mẫu ${n.pattern}`;return`${t[n.format]??n.format} kh\xf4ng hợp lệ`;case"not_multiple_of":return`Số kh\xf4ng hợp lệ: phải l\xe0 bội số của ${n.divisor}`;case"unrecognized_keys":return`Kh\xf3a kh\xf4ng được nhận dạng: ${Sv(n.keys,", ")}`;case"invalid_key":return`Kh\xf3a kh\xf4ng hợp lệ trong ${n.origin}`;case"invalid_union":default:return"Đầu vào không hợp lệ";case"invalid_element":return`Gi\xe1 trị kh\xf4ng hợp lệ trong ${n.origin}`}})}},"yo",0,function(){let e,t,r;return{localeError:(e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}},t={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},r={nan:"NaN",number:"nọ́mbà",array:"akopọ"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`\xccb\xe1wọl\xe9 aṣ\xecṣe: a n\xed l\xe1ti fi instanceof ${n.expected}, \xe0mọ̀ a r\xed ${i}`;return`\xccb\xe1wọl\xe9 aṣ\xecṣe: a n\xed l\xe1ti fi ${e}, \xe0mọ̀ a r\xed ${i}`}case"invalid_value":if(1===n.values.length)return`\xccb\xe1wọl\xe9 aṣ\xecṣe: a n\xed l\xe1ti fi ${SU(n.values[0])}`;return`\xc0ṣ\xe0y\xe0n aṣ\xecṣe: yan ọ̀kan l\xe1ra ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`T\xf3 pọ̀ j\xf9: a n\xed l\xe1ti jẹ́ p\xe9 ${n.origin??"iye"} ${r.verb} ${t}${n.maximum} ${r.unit}`;return`T\xf3 pọ̀ j\xf9: a n\xed l\xe1ti jẹ́ ${t}${n.maximum}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`K\xe9r\xe9 ju: a n\xed l\xe1ti jẹ́ p\xe9 ${n.origin} ${r.verb} ${t}${n.minimum} ${r.unit}`;return`K\xe9r\xe9 ju: a n\xed l\xe1ti jẹ́ ${t}${n.minimum}`}case"invalid_format":if("starts_with"===n.format)return`Ọ̀rọ̀ aṣ\xecṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀l\xfa "${n.prefix}"`;if("ends_with"===n.format)return`Ọ̀rọ̀ aṣ\xecṣe: gbọ́dọ̀ par\xed pẹ̀l\xfa "${n.suffix}"`;if("includes"===n.format)return`Ọ̀rọ̀ aṣ\xecṣe: gbọ́dọ̀ n\xed "${n.includes}"`;if("regex"===n.format)return`Ọ̀rọ̀ aṣ\xecṣe: gbọ́dọ̀ b\xe1 \xe0pẹẹrẹ mu ${n.pattern}`;return`Aṣ\xecṣe: ${t[n.format]??n.format}`;case"not_multiple_of":return`Nọ́mb\xe0 aṣ\xecṣe: gbọ́dọ̀ jẹ́ \xe8y\xe0 p\xedp\xedn ti ${n.divisor}`;case"unrecognized_keys":return`Bọt\xecn\xec \xe0\xecmọ̀: ${Sv(n.keys,", ")}`;case"invalid_key":return`Bọt\xecn\xec aṣ\xecṣe n\xedn\xfa ${n.origin}`;case"invalid_union":default:return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣ\xecṣe n\xedn\xfa ${n.origin}`}})}},"zhCN",0,function(){let e,t,r;return{localeError:(e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}},t={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},r={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`无效输入:期望 instanceof ${n.expected},实际接收 ${i}`;return`无效输入:期望 ${e},实际接收 ${i}`}case"invalid_value":if(1===n.values.length)return`无效输入:期望 ${SU(n.values[0])}`;return`无效选项:期望以下之一 ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`数值过大:期望 ${n.origin??"值"} ${t}${n.maximum.toString()} ${r.unit??"个元素"}`;return`数值过大:期望 ${n.origin??"值"} ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`数值过小:期望 ${n.origin} ${t}${n.minimum.toString()} ${r.unit}`;return`数值过小:期望 ${n.origin} ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`无效字符串:必须以 "${n.prefix}" 开头`;if("ends_with"===n.format)return`无效字符串:必须以 "${n.suffix}" 结尾`;if("includes"===n.format)return`无效字符串:必须包含 "${n.includes}"`;if("regex"===n.format)return`无效字符串:必须满足正则表达式 ${n.pattern}`;return`无效${t[n.format]??n.format}`;case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${Sv(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":default:return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`}})}},"zhTW",0,function(){let e,t,r;return{localeError:(e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}},t={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},r={nan:"NaN"},n=>{switch(n.code){case"invalid_type":{let e=r[n.expected]??n.expected,t=SG(n.input),i=r[t]??t;if(/^[A-Z]/.test(n.expected))return`無效的輸入值:預期為 instanceof ${n.expected},但收到 ${i}`;return`無效的輸入值:預期為 ${e},但收到 ${i}`}case"invalid_value":if(1===n.values.length)return`無效的輸入值:預期為 ${SU(n.values[0])}`;return`無效的選項:預期為以下其中之一 ${Sv(n.values,"|")}`;case"too_big":{let t=n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`數值過大:預期 ${n.origin??"值"} 應為 ${t}${n.maximum.toString()} ${r.unit??"個元素"}`;return`數值過大:預期 ${n.origin??"值"} 應為 ${t}${n.maximum.toString()}`}case"too_small":{let t=n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`數值過小:預期 ${n.origin} 應為 ${t}${n.minimum.toString()} ${r.unit}`;return`數值過小:預期 ${n.origin} 應為 ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`無效的字串:必須以 "${n.prefix}" 開頭`;if("ends_with"===n.format)return`無效的字串:必須以 "${n.suffix}" 結尾`;if("includes"===n.format)return`無效的字串:必須包含 "${n.includes}"`;if("regex"===n.format)return`無效的字串:必須符合格式 ${n.pattern}`;return`無效的 ${t[n.format]??n.format}`;case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${Sv(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":default:return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`}})}}],54580);var AZ=e.i(54580);function AF(e,t){return new e({type:"string",...SD(t)})}function AB(e,t){return new e({type:"string",coerce:!0,...SD(t)})}function AV(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...SD(t)})}function Aq(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...SD(t)})}function AW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...SD(t)})}function AJ(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...SD(t)})}function AH(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...SD(t)})}function AK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...SD(t)})}function AG(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...SD(t)})}function AY(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...SD(t)})}function AX(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...SD(t)})}function AQ(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...SD(t)})}function A0(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...SD(t)})}function A1(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...SD(t)})}function A2(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...SD(t)})}function A4(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...SD(t)})}function A6(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...SD(t)})}function A5(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...SD(t)})}function A3(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...SD(t)})}function A9(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...SD(t)})}function A8(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...SD(t)})}function A7(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...SD(t)})}function Re(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...SD(t)})}function Rt(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...SD(t)})}function Rr(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...SD(t)})}e.i(25527),e.i(98530);let Rn={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Ri(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...SD(t)})}function Ra(e,t){return new e({type:"string",format:"date",check:"string_format",...SD(t)})}function Ro(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...SD(t)})}function Rs(e,t){return new e({type:"string",format:"duration",check:"string_format",...SD(t)})}function Rl(e,t){return new e({type:"number",checks:[],...SD(t)})}function Ru(e,t){return new e({type:"number",coerce:!0,checks:[],...SD(t)})}function Rd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...SD(t)})}function Rc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...SD(t)})}function Rp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...SD(t)})}function Rm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...SD(t)})}function Rf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...SD(t)})}function Rh(e,t){return new e({type:"boolean",...SD(t)})}function Rg(e,t){return new e({type:"boolean",coerce:!0,...SD(t)})}function Rv(e,t){return new e({type:"bigint",...SD(t)})}function Ry(e,t){return new e({type:"bigint",coerce:!0,...SD(t)})}function Rb(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...SD(t)})}function Rx(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...SD(t)})}function R_(e,t){return new e({type:"symbol",...SD(t)})}function Rw(e,t){return new e({type:"undefined",...SD(t)})}function Rk(e,t){return new e({type:"null",...SD(t)})}function RI(e){return new e({type:"any"})}function RS(e){return new e({type:"unknown"})}function R$(e,t){return new e({type:"never",...SD(t)})}function Rj(e,t){return new e({type:"void",...SD(t)})}function RE(e,t){return new e({type:"date",...SD(t)})}function RC(e,t){return new e({type:"date",coerce:!0,...SD(t)})}function RT(e,t){return new e({type:"nan",...SD(t)})}function RN(e,t){return new TD({check:"less_than",...SD(t),value:e,inclusive:!1})}function RA(e,t){return new TD({check:"less_than",...SD(t),value:e,inclusive:!0})}function RR(e,t){return new TU({check:"greater_than",...SD(t),value:e,inclusive:!1})}function RP(e,t){return new TU({check:"greater_than",...SD(t),value:e,inclusive:!0})}function RO(e){return RR(0,e)}function RM(e){return RN(0,e)}function Rz(e){return RA(0,e)}function RD(e){return RP(0,e)}function RU(e,t){return new TL({check:"multiple_of",...SD(t),value:e})}function RL(e,t){return new TB({check:"max_size",...SD(t),maximum:e})}function RZ(e,t){return new TV({check:"min_size",...SD(t),minimum:e})}function RF(e,t){return new Tq({check:"size_equals",...SD(t),size:e})}function RB(e,t){return new TW({check:"max_length",...SD(t),maximum:e})}function RV(e,t){return new TJ({check:"min_length",...SD(t),minimum:e})}function Rq(e,t){return new TH({check:"length_equals",...SD(t),length:e})}function RW(e,t){return new TG({check:"string_format",format:"regex",...SD(t),pattern:e})}function RJ(e){return new TY({check:"string_format",format:"lowercase",...SD(e)})}function RH(e){return new TX({check:"string_format",format:"uppercase",...SD(e)})}function RK(e,t){return new TQ({check:"string_format",format:"includes",...SD(t),includes:e})}function RG(e,t){return new T0({check:"string_format",format:"starts_with",...SD(t),prefix:e})}function RY(e,t){return new T1({check:"string_format",format:"ends_with",...SD(t),suffix:e})}function RX(e,t,r){return new T4({check:"property",property:e,schema:t,...SD(r)})}function RQ(e,t){return new T6({check:"mime_type",mime:e,...SD(t)})}function R0(e){return new T5({check:"overwrite",tx:e})}function R1(e){return R0(t=>t.normalize(e))}function R2(){return R0(e=>e.trim())}function R4(){return R0(e=>e.toLowerCase())}function R6(){return R0(e=>e.toUpperCase())}function R5(){return R0(e=>SE(e))}function R3(e,t,r){return new e({type:"array",element:t,...SD(r)})}function R9(e,t,r){return new e({type:"union",options:t,...SD(r)})}function R8(e,t,r){return new e({type:"union",options:t,inclusive:!1,...SD(r)})}function R7(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...SD(n)})}function Pe(e,t,r){return new e({type:"intersection",left:t,right:r})}function Pt(e,t,r,n){let i=r instanceof T8,a=i?n:r;return new e({type:"tuple",items:t,rest:i?r:null,...SD(a)})}function Pr(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...SD(n)})}function Pn(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...SD(n)})}function Pi(e,t,r){return new e({type:"set",valueType:t,...SD(r)})}function Pa(e,t,r){return new e({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...SD(r)})}function Po(e,t,r){return new e({type:"enum",entries:t,...SD(r)})}function Ps(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...SD(r)})}function Pl(e,t){return new e({type:"file",...SD(t)})}function Pu(e,t){return new e({type:"transform",transform:t})}function Pd(e,t){return new e({type:"optional",innerType:t})}function Pc(e,t){return new e({type:"nullable",innerType:t})}function Pp(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():SR(r)}})}function Pm(e,t,r){return new e({type:"nonoptional",innerType:t,...SD(r)})}function Pf(e,t){return new e({type:"success",innerType:t})}function Ph(e,t,r){return new e({type:"catch",innerType:t,catchValue:"function"==typeof r?r:()=>r})}function Pg(e,t,r){return new e({type:"pipe",in:t,out:r})}function Pv(e,t){return new e({type:"readonly",innerType:t})}function Py(e,t,r){return new e({type:"template_literal",parts:t,...SD(r)})}function Pb(e,t){return new e({type:"lazy",getter:t})}function Px(e,t){return new e({type:"promise",innerType:t})}function P_(e,t,r){let n=SD(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Pw(e,t,r){return new e({type:"custom",check:"custom",fn:t,...SD(r)})}function Pk(e,t){let r=PI(t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(SY(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(SY(e)))},e(t.value,t)),t);return r}function PI(e,t){let r=new TM({check:"custom",...SD(t)});return r._zod.check=e,r}function PS(e){let t=new TM({check:"describe"});return t._zod.onattach=[t=>{let r=$Z.get(t)??{};$Z.add(t,{...r,description:e})}],t._zod.check=()=>{},t}function P$(e){let t=new TM({check:"meta"});return t._zod.onattach=[t=>{let r=$Z.get(t)??{};$Z.add(t,{...r,...e})}],t._zod.check=()=>{},t}function Pj(e,t){let r=SD(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];"sensitive"!==r.case&&(n=n.map(e=>"string"==typeof e?e.toLowerCase():e),i=i.map(e=>"string"==typeof e?e.toLowerCase():e));let a=new Set(n),o=new Set(i),s=e.Codec??Ab,l=e.Boolean??NN,u=new s({type:"pipe",in:new(e.String??T7)({type:"string",error:r.error}),out:new l({type:"boolean",error:r.error}),transform:(e,t)=>{let n=e;return"sensitive"!==r.case&&(n=n.toLowerCase()),!!a.has(n)||!o.has(n)&&(t.issues.push({code:"invalid_value",expected:"stringbool",values:[...a,...o],input:t.value,inst:u,continue:!1}),{})},reverseTransform:(e,t)=>!0===e?n[0]||"true":i[0]||"false",error:r.error});return u}function PE(e,t,r,n={}){let i=SD(n),a={...SD(n),check:"string_format",type:"string",format:t,fn:"function"==typeof r?r:e=>r.test(e),...i};return r instanceof RegExp&&(a.pattern=r),new e(a)}e.s(["TimePrecision",0,Rn,"_any",0,RI,"_array",0,R3,"_base64",0,A7,"_base64url",0,Re,"_bigint",0,Rv,"_boolean",0,Rh,"_catch",0,Ph,"_check",0,PI,"_cidrv4",0,A9,"_cidrv6",0,A8,"_coercedBigint",0,Ry,"_coercedBoolean",0,Rg,"_coercedDate",0,RC,"_coercedNumber",0,Ru,"_coercedString",0,AB,"_cuid",0,AQ,"_cuid2",0,A0,"_custom",0,P_,"_date",0,RE,"_default",0,Pp,"_discriminatedUnion",0,R7,"_e164",0,Rt,"_email",0,AV,"_emoji",0,AY,"_endsWith",0,RY,"_enum",0,Pa,"_file",0,Pl,"_float32",0,Rc,"_float64",0,Rp,"_gt",0,RR,"_gte",0,RP,"_guid",0,Aq,"_includes",0,RK,"_int",0,Rd,"_int32",0,Rm,"_int64",0,Rb,"_intersection",0,Pe,"_ipv4",0,A6,"_ipv6",0,A5,"_isoDate",0,Ra,"_isoDateTime",0,Ri,"_isoDuration",0,Rs,"_isoTime",0,Ro,"_jwt",0,Rr,"_ksuid",0,A4,"_lazy",0,Pb,"_length",0,Rq,"_literal",0,Ps,"_lowercase",0,RJ,"_lt",0,RN,"_lte",0,RA,"_mac",0,A3,"_map",0,Pn,"_max",0,RA,"_maxLength",0,RB,"_maxSize",0,RL,"_mime",0,RQ,"_min",0,RP,"_minLength",0,RV,"_minSize",0,RZ,"_multipleOf",0,RU,"_nan",0,RT,"_nanoid",0,AX,"_nativeEnum",0,Po,"_negative",0,RM,"_never",0,R$,"_nonnegative",0,RD,"_nonoptional",0,Pm,"_nonpositive",0,Rz,"_normalize",0,R1,"_null",0,Rk,"_nullable",0,Pc,"_number",0,Rl,"_optional",0,Pd,"_overwrite",0,R0,"_pipe",0,Pg,"_positive",0,RO,"_promise",0,Px,"_property",0,RX,"_readonly",0,Pv,"_record",0,Pr,"_refine",0,Pw,"_regex",0,RW,"_set",0,Pi,"_size",0,RF,"_slugify",0,R5,"_startsWith",0,RG,"_string",0,AF,"_stringFormat",0,PE,"_stringbool",0,Pj,"_success",0,Pf,"_superRefine",0,Pk,"_symbol",0,R_,"_templateLiteral",0,Py,"_toLowerCase",0,R4,"_toUpperCase",0,R6,"_transform",0,Pu,"_trim",0,R2,"_tuple",0,Pt,"_uint32",0,Rf,"_uint64",0,Rx,"_ulid",0,A1,"_undefined",0,Rw,"_union",0,R9,"_unknown",0,RS,"_uppercase",0,RH,"_url",0,AG,"_uuid",0,AW,"_uuidv4",0,AJ,"_uuidv6",0,AH,"_uuidv7",0,AK,"_void",0,Rj,"_xid",0,A2,"_xor",0,R8,"describe",0,PS,"meta",0,P$],50215),e.i(50215),e.i(34966),e.s([],18249);var PC=e.i(18249);e.s(["$ZodAny",0,Nz,"$ZodArray",0,NB,"$ZodAsyncError",0,Sp,"$ZodBase64",0,Nw,"$ZodBase64URL",0,NI,"$ZodBigInt",0,NA,"$ZodBigIntFormat",0,NR,"$ZodBoolean",0,NN,"$ZodCIDRv4",0,Nb,"$ZodCIDRv6",0,Nx,"$ZodCUID",0,Ns,"$ZodCUID2",0,Nl,"$ZodCatch",0,Ah,"$ZodCheck",0,TM,"$ZodCheckBigIntFormat",0,TF,"$ZodCheckEndsWith",0,T1,"$ZodCheckGreaterThan",0,TU,"$ZodCheckIncludes",0,TQ,"$ZodCheckLengthEquals",0,TH,"$ZodCheckLessThan",0,TD,"$ZodCheckLowerCase",0,TY,"$ZodCheckMaxLength",0,TW,"$ZodCheckMaxSize",0,TB,"$ZodCheckMimeType",0,T6,"$ZodCheckMinLength",0,TJ,"$ZodCheckMinSize",0,TV,"$ZodCheckMultipleOf",0,TL,"$ZodCheckNumberFormat",0,TZ,"$ZodCheckOverwrite",0,T5,"$ZodCheckProperty",0,T4,"$ZodCheckRegex",0,TG,"$ZodCheckSizeEquals",0,Tq,"$ZodCheckStartsWith",0,T0,"$ZodCheckStringFormat",0,TK,"$ZodCheckUpperCase",0,TX,"$ZodCodec",0,Ab,"$ZodCustom",0,AC,"$ZodCustomStringFormat",0,NE,"$ZodDate",0,NZ,"$ZodDefault",0,Au,"$ZodDiscriminatedUnion",0,NQ,"$ZodE164",0,NS,"$ZodEmail",0,Nn,"$ZodEmoji",0,Na,"$ZodEncodeError",0,Sm,"$ZodEnum",0,At,"$ZodError",0,S1,"$ZodExactOptional",0,As,"$ZodFile",0,An,"$ZodFunction",0,A$,"$ZodGUID",0,Nt,"$ZodIPv4",0,Ng,"$ZodIPv6",0,Nv,"$ZodISODate",0,Nm,"$ZodISODateTime",0,Np,"$ZodISODuration",0,Nh,"$ZodISOTime",0,Nf,"$ZodIntersection",0,N0,"$ZodJWT",0,Nj,"$ZodKSUID",0,Nc,"$ZodLazy",0,AE,"$ZodLiteral",0,Ar,"$ZodMAC",0,Ny,"$ZodMap",0,N9,"$ZodNaN",0,Ag,"$ZodNanoID",0,No,"$ZodNever",0,NU,"$ZodNonOptional",0,Ap,"$ZodNull",0,NM,"$ZodNullable",0,Al,"$ZodNumber",0,NC,"$ZodNumberFormat",0,NT,"$ZodObject",0,NJ,"$ZodObjectJIT",0,NH,"$ZodOptional",0,Ao,"$ZodPipe",0,Av,"$ZodPrefault",0,Ac,"$ZodPreprocess",0,Aw,"$ZodPromise",0,Aj,"$ZodReadonly",0,Ak,"$ZodRealError",0,S2,"$ZodRecord",0,N3,"$ZodRegistry",0,$U,"$ZodSet",0,N7,"$ZodString",0,T7,"$ZodStringFormat",0,Ne,"$ZodSuccess",0,Af,"$ZodSymbol",0,NP,"$ZodTemplateLiteral",0,AS,"$ZodTransform",0,Ai,"$ZodTuple",0,N2,"$ZodType",0,T8,"$ZodULID",0,Nu,"$ZodURL",0,Ni,"$ZodUUID",0,Nr,"$ZodUndefined",0,NO,"$ZodUnion",0,NG,"$ZodUnknown",0,ND,"$ZodVoid",0,NL,"$ZodXID",0,Nd,"$ZodXor",0,NX,"$brand",0,Sc,"$constructor",0,Sd,"$input",0,$D,"$output",0,$z,"Doc",0,T3,"JSONSchema",0,PC,"JSONSchemaGenerator",0,class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),this.ctx=$F({processors:jI,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return $B(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),$V(this.ctx,e);let{"~standard":r,...n}=$q(this.ctx,e);return n}},"NEVER",0,Su,"TimePrecision",0,Rn,"_any",0,RI,"_array",0,R3,"_base64",0,A7,"_base64url",0,Re,"_bigint",0,Rv,"_boolean",0,Rh,"_catch",0,Ph,"_check",0,PI,"_cidrv4",0,A9,"_cidrv6",0,A8,"_coercedBigint",0,Ry,"_coercedBoolean",0,Rg,"_coercedDate",0,RC,"_coercedNumber",0,Ru,"_coercedString",0,AB,"_cuid",0,AQ,"_cuid2",0,A0,"_custom",0,P_,"_date",0,RE,"_decode",0,$l,"_decodeAsync",0,$p,"_default",0,Pp,"_discriminatedUnion",0,R7,"_e164",0,Rt,"_email",0,AV,"_emoji",0,AY,"_encode",0,$o,"_encodeAsync",0,$d,"_endsWith",0,RY,"_enum",0,Pa,"_file",0,Pl,"_float32",0,Rc,"_float64",0,Rp,"_gt",0,RR,"_gte",0,RP,"_guid",0,Aq,"_includes",0,RK,"_int",0,Rd,"_int32",0,Rm,"_int64",0,Rb,"_intersection",0,Pe,"_ipv4",0,A6,"_ipv6",0,A5,"_isoDate",0,Ra,"_isoDateTime",0,Ri,"_isoDuration",0,Rs,"_isoTime",0,Ro,"_jwt",0,Rr,"_ksuid",0,A4,"_lazy",0,Pb,"_length",0,Rq,"_literal",0,Ps,"_lowercase",0,RJ,"_lt",0,RN,"_lte",0,RA,"_mac",0,A3,"_map",0,Pn,"_max",0,RA,"_maxLength",0,RB,"_maxSize",0,RL,"_mime",0,RQ,"_min",0,RP,"_minLength",0,RV,"_minSize",0,RZ,"_multipleOf",0,RU,"_nan",0,RT,"_nanoid",0,AX,"_nativeEnum",0,Po,"_negative",0,RM,"_never",0,R$,"_nonnegative",0,RD,"_nonoptional",0,Pm,"_nonpositive",0,Rz,"_normalize",0,R1,"_null",0,Rk,"_nullable",0,Pc,"_number",0,Rl,"_optional",0,Pd,"_overwrite",0,R0,"_parse",0,S8,"_parseAsync",0,$e,"_pipe",0,Pg,"_positive",0,RO,"_promise",0,Px,"_property",0,RX,"_readonly",0,Pv,"_record",0,Pr,"_refine",0,Pw,"_regex",0,RW,"_safeDecode",0,$g,"_safeDecodeAsync",0,$x,"_safeEncode",0,$f,"_safeEncodeAsync",0,$y,"_safeParse",0,$r,"_safeParseAsync",0,$i,"_set",0,Pi,"_size",0,RF,"_slugify",0,R5,"_startsWith",0,RG,"_string",0,AF,"_stringFormat",0,PE,"_stringbool",0,Pj,"_success",0,Pf,"_superRefine",0,Pk,"_symbol",0,R_,"_templateLiteral",0,Py,"_toLowerCase",0,R4,"_toUpperCase",0,R6,"_transform",0,Pu,"_trim",0,R2,"_tuple",0,Pt,"_uint32",0,Rf,"_uint64",0,Rx,"_ulid",0,A1,"_undefined",0,Rw,"_union",0,R9,"_unknown",0,RS,"_uppercase",0,RH,"_url",0,AG,"_uuid",0,AW,"_uuidv4",0,AJ,"_uuidv6",0,AH,"_uuidv7",0,AK,"_void",0,Rj,"_xid",0,A2,"_xor",0,R8,"clone",0,Sz,"config",0,Sh,"createStandardJSONSchemaMethod",0,$J,"createToJSONSchemaMethod",0,$W,"decode",0,$u,"decodeAsync",0,$m,"describe",0,PS,"encode",0,$s,"encodeAsync",0,$c,"extractDefs",0,$V,"finalize",0,$q,"flattenError",0,S4,"formatError",0,S6,"globalConfig",0,Sf,"globalRegistry",0,$Z,"initializeContext",0,$F,"isValidBase64",0,N_,"isValidBase64URL",0,Nk,"isValidJWT",0,N$,"locales",0,AZ,"meta",0,P$,"parse",0,S7,"parseAsync",0,$t,"prettifyError",0,S9,"process",0,$B,"regexes",0,AA,"registry",0,$L,"safeDecode",0,$v,"safeDecodeAsync",0,$_,"safeEncode",0,$h,"safeEncodeAsync",0,$b,"safeParse",0,$n,"safeParseAsync",0,$a,"toDotPath",0,S3,"toJSONSchema",0,jS,"treeifyError",0,S5,"util",0,AN,"version",0,T9],12717);var PT=e.i(12717);e.s(["ZodAny",()=>O0,"ZodArray",()=>Me,"ZodBase64",()=>Ox,"ZodBase64URL",()=>Ow,"ZodBigInt",()=>OB,"ZodBigIntFormat",()=>Oq,"ZodBoolean",()=>OZ,"ZodCIDRv4",()=>Og,"ZodCIDRv6",()=>Oy,"ZodCUID",()=>Oe,"ZodCUID2",()=>Or,"ZodCatch",()=>MK,"ZodCodec",()=>M1,"ZodCustom",()=>za,"ZodCustomStringFormat",()=>OE,"ZodDate",()=>O8,"ZodDefault",()=>MZ,"ZodDiscriminatedUnion",()=>Mc,"ZodE164",()=>OI,"ZodEmail",()=>PH,"ZodEmoji",()=>P3,"ZodEnum",()=>MS,"ZodExactOptional",()=>MM,"ZodFile",()=>MT,"ZodFunction",()=>zn,"ZodGUID",()=>PG,"ZodIPv4",()=>Od,"ZodIPv6",()=>Of,"ZodIntersection",()=>Mm,"ZodJWT",()=>O$,"ZodKSUID",()=>Ol,"ZodLazy",()=>M7,"ZodLiteral",()=>ME,"ZodMAC",()=>Op,"ZodMap",()=>M_,"ZodNaN",()=>MY,"ZodNanoID",()=>P8,"ZodNever",()=>O6,"ZodNonOptional",()=>Mq,"ZodNull",()=>OX,"ZodNullable",()=>MD,"ZodNumber",()=>OR,"ZodNumberFormat",()=>OO,"ZodObject",()=>Mn,"ZodOptional",()=>MP,"ZodPipe",()=>MQ,"ZodPrefault",()=>MB,"ZodPreprocess",()=>M6,"ZodPromise",()=>zt,"ZodReadonly",()=>M5,"ZodRecord",()=>Mv,"ZodSet",()=>Mk,"ZodString",()=>Pq,"ZodStringFormat",()=>PJ,"ZodSuccess",()=>MJ,"ZodSymbol",()=>OH,"ZodTemplateLiteral",()=>M9,"ZodTransform",()=>MA,"ZodTuple",()=>Mh,"ZodType",()=>PB,"ZodULID",()=>Oi,"ZodURL",()=>P4,"ZodUUID",()=>PX,"ZodUndefined",()=>OG,"ZodUnion",()=>Ms,"ZodUnknown",()=>O2,"ZodVoid",()=>O3,"ZodXID",()=>Oo,"ZodXor",()=>Mu,"_ZodString",()=>PV,"_default",()=>MF,"_function",()=>zi,"any",()=>O1,"array",()=>Mt,"base64",()=>O_,"base64url",()=>Ok,"bigint",()=>OV,"boolean",()=>OF,"catch",()=>MG,"check",()=>zo,"cidrv4",()=>Ov,"cidrv6",()=>Ob,"codec",()=>M2,"cuid",()=>Ot,"cuid2",()=>On,"custom",()=>zs,"date",()=>O7,"describe",()=>zd,"discriminatedUnion",()=>Mp,"e164",()=>OS,"email",()=>PK,"emoji",()=>P9,"enum",()=>M$,"exactOptional",()=>Mz,"file",()=>MN,"float32",()=>Oz,"float64",()=>OD,"function",()=>zi,"guid",()=>PY,"hash",()=>OA,"hex",()=>ON,"hostname",()=>OT,"httpUrl",()=>P5,"instanceof",()=>zp,"int",()=>OM,"int32",()=>OU,"int64",()=>OW,"intersection",()=>Mf,"invertCodec",()=>M4,"ipv4",()=>Oc,"ipv6",()=>Oh,"json",()=>zf,"jwt",()=>Oj,"keyof",()=>Mr,"ksuid",()=>Ou,"lazy",()=>ze,"literal",()=>MC,"looseObject",()=>Mo,"looseRecord",()=>Mx,"mac",()=>Om,"map",()=>Mw,"meta",()=>zc,"nan",()=>MX,"nanoid",()=>P7,"nativeEnum",()=>Mj,"never",()=>O5,"nonoptional",()=>MW,"null",()=>OQ,"nullable",()=>MU,"nullish",()=>ML,"number",()=>OP,"object",()=>Mi,"optional",()=>MO,"partialRecord",()=>Mb,"pipe",()=>M0,"prefault",()=>MV,"preprocess",()=>zh,"promise",()=>zr,"readonly",()=>M3,"record",()=>My,"refine",()=>zl,"set",()=>MI,"strictObject",()=>Ma,"string",()=>PW,"stringFormat",()=>OC,"stringbool",()=>zm,"success",()=>MH,"superRefine",()=>zu,"symbol",()=>OK,"templateLiteral",()=>M8,"transform",()=>MR,"tuple",()=>Mg,"uint32",()=>OL,"uint64",()=>OJ,"ulid",()=>Oa,"undefined",()=>OY,"union",()=>Ml,"unknown",()=>O4,"url",()=>P6,"uuid",()=>PQ,"uuidv4",()=>P0,"uuidv6",()=>P1,"uuidv7",()=>P2,"void",()=>O9,"xid",()=>Os,"xor",()=>Md],62201);var PN=AA,PA=AN;e.s(["ZodISODate",()=>PO,"ZodISODateTime",()=>PR,"ZodISODuration",()=>PU,"ZodISOTime",()=>Pz,"date",()=>PM,"datetime",()=>PP,"duration",()=>PL,"time",()=>PD],49732);let PR=Sd("ZodISODateTime",(e,t)=>{Np.init(e,t),PJ.init(e,t)});function PP(e){return Ri(PR,e)}let PO=Sd("ZodISODate",(e,t)=>{Nm.init(e,t),PJ.init(e,t)});function PM(e){return Ra(PO,e)}let Pz=Sd("ZodISOTime",(e,t)=>{Nf.init(e,t),PJ.init(e,t)});function PD(e){return Ro(Pz,e)}let PU=Sd("ZodISODuration",(e,t)=>{Nh.init(e,t),PJ.init(e,t)});function PL(e){return Rs(PU,e)}let PZ=new WeakMap;function PF(e,t,r){let n=Object.getPrototypeOf(e),i=PZ.get(n);if(i||(i=new Set,PZ.set(n,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let PB=Sd("ZodType",(e,t)=>(T8.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:$J(e,"input"),output:$J(e,"output")}}),e.toJSONSchema=$W(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>$S(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>$j(e,t,r),e.parseAsync=async(t,r)=>$$(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>$E(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>$C(e,t,r),e.decode=(t,r)=>$T(e,t,r),e.encodeAsync=async(t,r)=>$N(e,t,r),e.decodeAsync=async(t,r)=>$A(e,t,r),e.safeEncode=(t,r)=>$R(e,t,r),e.safeDecode=(t,r)=>$P(e,t,r),e.safeEncodeAsync=async(t,r)=>$O(e,t,r),e.safeDecodeAsync=async(t,r)=>$M(e,t,r),PF(e,"ZodType",{check(...e){let t=this.def;return this.clone(PA.mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Sz(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(zl(e,t))},superRefine(e,t){return this.check(zu(e,t))},overwrite(e){return this.check(R0(e))},optional(){return MO(this)},exactOptional(){return Mz(this)},nullable(){return MU(this)},nullish(){return MO(MU(this))},nonoptional(e){return MW(this,e)},array(){return Mt(this)},or(e){return Ml([this,e])},and(e){return Mf(this,e)},transform(e){return M0(this,MR(e))},default(e){return MF(this,e)},prefault(e){return MV(this,e)},catch(e){return MG(this,e)},pipe(e){return M0(this,e)},readonly(){return M3(this)},describe(e){let t=this.clone();return $Z.add(t,{description:e}),t},meta(...e){if(0===e.length)return $Z.get(this);let t=this.clone();return $Z.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>$Z.get(e)?.description,configurable:!0}),e)),PV=Sd("_ZodString",(e,t)=>{T7.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$K(e,t,r,n);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,PF(e,"_ZodString",{regex(...e){return this.check(RW(...e))},includes(...e){return this.check(RK(...e))},startsWith(...e){return this.check(RG(...e))},endsWith(...e){return this.check(RY(...e))},min(...e){return this.check(RV(...e))},max(...e){return this.check(RB(...e))},length(...e){return this.check(Rq(...e))},nonempty(...e){return this.check(RV(1,...e))},lowercase(e){return this.check(RJ(e))},uppercase(e){return this.check(RH(e))},trim(){return this.check(R2())},normalize(...e){return this.check(R1(...e))},toLowerCase(){return this.check(R4())},toUpperCase(){return this.check(R6())},slugify(){return this.check(R5())}})}),Pq=Sd("ZodString",(e,t)=>{T7.init(e,t),PV.init(e,t),e.email=t=>e.check(AV(PH,t)),e.url=t=>e.check(AG(P4,t)),e.jwt=t=>e.check(Rr(O$,t)),e.emoji=t=>e.check(AY(P3,t)),e.guid=t=>e.check(Aq(PG,t)),e.uuid=t=>e.check(AW(PX,t)),e.uuidv4=t=>e.check(AJ(PX,t)),e.uuidv6=t=>e.check(AH(PX,t)),e.uuidv7=t=>e.check(AK(PX,t)),e.nanoid=t=>e.check(AX(P8,t)),e.guid=t=>e.check(Aq(PG,t)),e.cuid=t=>e.check(AQ(Oe,t)),e.cuid2=t=>e.check(A0(Or,t)),e.ulid=t=>e.check(A1(Oi,t)),e.base64=t=>e.check(A7(Ox,t)),e.base64url=t=>e.check(Re(Ow,t)),e.xid=t=>e.check(A2(Oo,t)),e.ksuid=t=>e.check(A4(Ol,t)),e.ipv4=t=>e.check(A6(Od,t)),e.ipv6=t=>e.check(A5(Of,t)),e.cidrv4=t=>e.check(A9(Og,t)),e.cidrv6=t=>e.check(A8(Oy,t)),e.e164=t=>e.check(Rt(OI,t)),e.datetime=t=>e.check(PP(t)),e.date=t=>e.check(PM(t)),e.time=t=>e.check(PD(t)),e.duration=t=>e.check(PL(t))});function PW(e){return AF(Pq,e)}let PJ=Sd("ZodStringFormat",(e,t)=>{Ne.init(e,t),PV.init(e,t)}),PH=Sd("ZodEmail",(e,t)=>{Nn.init(e,t),PJ.init(e,t)});function PK(e){return AV(PH,e)}let PG=Sd("ZodGUID",(e,t)=>{Nt.init(e,t),PJ.init(e,t)});function PY(e){return Aq(PG,e)}let PX=Sd("ZodUUID",(e,t)=>{Nr.init(e,t),PJ.init(e,t)});function PQ(e){return AW(PX,e)}function P0(e){return AJ(PX,e)}function P1(e){return AH(PX,e)}function P2(e){return AK(PX,e)}let P4=Sd("ZodURL",(e,t)=>{Ni.init(e,t),PJ.init(e,t)});function P6(e){return AG(P4,e)}function P5(e){return AG(P4,{protocol:PN.httpProtocol,hostname:PN.domain,...PA.normalizeParams(e)})}let P3=Sd("ZodEmoji",(e,t)=>{Na.init(e,t),PJ.init(e,t)});function P9(e){return AY(P3,e)}let P8=Sd("ZodNanoID",(e,t)=>{No.init(e,t),PJ.init(e,t)});function P7(e){return AX(P8,e)}let Oe=Sd("ZodCUID",(e,t)=>{Ns.init(e,t),PJ.init(e,t)});function Ot(e){return AQ(Oe,e)}let Or=Sd("ZodCUID2",(e,t)=>{Nl.init(e,t),PJ.init(e,t)});function On(e){return A0(Or,e)}let Oi=Sd("ZodULID",(e,t)=>{Nu.init(e,t),PJ.init(e,t)});function Oa(e){return A1(Oi,e)}let Oo=Sd("ZodXID",(e,t)=>{Nd.init(e,t),PJ.init(e,t)});function Os(e){return A2(Oo,e)}let Ol=Sd("ZodKSUID",(e,t)=>{Nc.init(e,t),PJ.init(e,t)});function Ou(e){return A4(Ol,e)}let Od=Sd("ZodIPv4",(e,t)=>{Ng.init(e,t),PJ.init(e,t)});function Oc(e){return A6(Od,e)}let Op=Sd("ZodMAC",(e,t)=>{Ny.init(e,t),PJ.init(e,t)});function Om(e){return A3(Op,e)}let Of=Sd("ZodIPv6",(e,t)=>{Nv.init(e,t),PJ.init(e,t)});function Oh(e){return A5(Of,e)}let Og=Sd("ZodCIDRv4",(e,t)=>{Nb.init(e,t),PJ.init(e,t)});function Ov(e){return A9(Og,e)}let Oy=Sd("ZodCIDRv6",(e,t)=>{Nx.init(e,t),PJ.init(e,t)});function Ob(e){return A8(Oy,e)}let Ox=Sd("ZodBase64",(e,t)=>{Nw.init(e,t),PJ.init(e,t)});function O_(e){return A7(Ox,e)}let Ow=Sd("ZodBase64URL",(e,t)=>{NI.init(e,t),PJ.init(e,t)});function Ok(e){return Re(Ow,e)}let OI=Sd("ZodE164",(e,t)=>{NS.init(e,t),PJ.init(e,t)});function OS(e){return Rt(OI,e)}let O$=Sd("ZodJWT",(e,t)=>{Nj.init(e,t),PJ.init(e,t)});function Oj(e){return Rr(O$,e)}let OE=Sd("ZodCustomStringFormat",(e,t)=>{NE.init(e,t),PJ.init(e,t)});function OC(e,t,r={}){return PE(OE,e,t,r)}function OT(e){return PE(OE,"hostname",PN.hostname,e)}function ON(e){return PE(OE,"hex",PN.hex,e)}function OA(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=PN[n];if(!i)throw Error(`Unrecognized hash format: ${n}`);return PE(OE,n,i,t)}let OR=Sd("ZodNumber",(e,t)=>{NC.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$G(e,t,r,n),PF(e,"ZodNumber",{gt(e,t){return this.check(RR(e,t))},gte(e,t){return this.check(RP(e,t))},min(e,t){return this.check(RP(e,t))},lt(e,t){return this.check(RN(e,t))},lte(e,t){return this.check(RA(e,t))},max(e,t){return this.check(RA(e,t))},int(e){return this.check(OM(e))},safe(e){return this.check(OM(e))},positive(e){return this.check(RR(0,e))},nonnegative(e){return this.check(RP(0,e))},negative(e){return this.check(RN(0,e))},nonpositive(e){return this.check(RA(0,e))},multipleOf(e,t){return this.check(RU(e,t))},step(e,t){return this.check(RU(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function OP(e){return Rl(OR,e)}let OO=Sd("ZodNumberFormat",(e,t)=>{NT.init(e,t),OR.init(e,t)});function OM(e){return Rd(OO,e)}function Oz(e){return Rc(OO,e)}function OD(e){return Rp(OO,e)}function OU(e){return Rm(OO,e)}function OL(e){return Rf(OO,e)}let OZ=Sd("ZodBoolean",(e,t)=>{NN.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$Y(e,t,r,n)});function OF(e){return Rh(OZ,e)}let OB=Sd("ZodBigInt",(e,t)=>{NA.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$X(e,t,r,n),e.gte=(t,r)=>e.check(RP(t,r)),e.min=(t,r)=>e.check(RP(t,r)),e.gt=(t,r)=>e.check(RR(t,r)),e.gte=(t,r)=>e.check(RP(t,r)),e.min=(t,r)=>e.check(RP(t,r)),e.lt=(t,r)=>e.check(RN(t,r)),e.lte=(t,r)=>e.check(RA(t,r)),e.max=(t,r)=>e.check(RA(t,r)),e.positive=t=>e.check(RR(BigInt(0),t)),e.negative=t=>e.check(RN(BigInt(0),t)),e.nonpositive=t=>e.check(RA(BigInt(0),t)),e.nonnegative=t=>e.check(RP(BigInt(0),t)),e.multipleOf=(t,r)=>e.check(RU(t,r));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function OV(e){return Rv(OB,e)}let Oq=Sd("ZodBigIntFormat",(e,t)=>{NR.init(e,t),OB.init(e,t)});function OW(e){return Rb(Oq,e)}function OJ(e){return Rx(Oq,e)}let OH=Sd("ZodSymbol",(e,t)=>{NP.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$Q(e,t,r,n)});function OK(e){return R_(OH,e)}let OG=Sd("ZodUndefined",(e,t)=>{NO.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$1(e,t,r,n)});function OY(e){return Rw(OG,e)}let OX=Sd("ZodNull",(e,t)=>{NM.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$0(e,t,r,n)});function OQ(e){return Rk(OX,e)}let O0=Sd("ZodAny",(e,t)=>{Nz.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$6(e,t,r,n)});function O1(){return RI(O0)}let O2=Sd("ZodUnknown",(e,t)=>{ND.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$5(e,t,r,n)});function O4(){return RS(O2)}let O6=Sd("ZodNever",(e,t)=>{NU.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$4(e,t,r,n)});function O5(e){return R$(O6,e)}let O3=Sd("ZodVoid",(e,t)=>{NL.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$2(e,t,r,n)});function O9(e){return Rj(O3,e)}let O8=Sd("ZodDate",(e,t)=>{NZ.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$3(e,t,r,n),e.min=(t,r)=>e.check(RP(t,r)),e.max=(t,r)=>e.check(RA(t,r));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function O7(e){return RE(O8,e)}let Me=Sd("ZodArray",(e,t)=>{NB.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jl(e,t,r,n),e.element=t.element,PF(e,"ZodArray",{min(e,t){return this.check(RV(e,t))},nonempty(e){return this.check(RV(1,e))},max(e,t){return this.check(RB(e,t))},length(e,t){return this.check(Rq(e,t))},unwrap(){return this.element}})});function Mt(e,t){return R3(Me,e,t)}function Mr(e){return M$(Object.keys(e._zod.def.shape))}let Mn=Sd("ZodObject",(e,t)=>{NH.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ju(e,t,r,n),PA.defineLazy(e,"shape",()=>t.shape),PF(e,"ZodObject",{keyof(){return M$(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:O4()})},loose(){return this.clone({...this._zod.def,catchall:O4()})},strict(){return this.clone({...this._zod.def,catchall:O5()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return PA.extend(this,e)},safeExtend(e){return PA.safeExtend(this,e)},merge(e){return PA.merge(this,e)},pick(e){return PA.pick(this,e)},omit(e){return PA.omit(this,e)},partial(...e){return PA.partial(MP,this,e[0])},required(...e){return PA.required(Mq,this,e[0])}})});function Mi(e,t){return new Mn({type:"object",shape:e??{},...PA.normalizeParams(t)})}function Ma(e,t){return new Mn({type:"object",shape:e,catchall:O5(),...PA.normalizeParams(t)})}function Mo(e,t){return new Mn({type:"object",shape:e,catchall:O4(),...PA.normalizeParams(t)})}let Ms=Sd("ZodUnion",(e,t)=>{NG.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jd(e,t,r,n),e.options=t.options});function Ml(e,t){return new Ms({type:"union",options:e,...PA.normalizeParams(t)})}let Mu=Sd("ZodXor",(e,t)=>{Ms.init(e,t),NX.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jd(e,t,r,n),e.options=t.options});function Md(e,t){return new Mu({type:"union",options:e,inclusive:!1,...PA.normalizeParams(t)})}let Mc=Sd("ZodDiscriminatedUnion",(e,t)=>{Ms.init(e,t),NQ.init(e,t)});function Mp(e,t,r){return new Mc({type:"union",options:t,discriminator:e,...PA.normalizeParams(r)})}let Mm=Sd("ZodIntersection",(e,t)=>{N0.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jc(e,t,r,n)});function Mf(e,t){return new Mm({type:"intersection",left:e,right:t})}let Mh=Sd("ZodTuple",(e,t)=>{N2.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jp(e,t,r,n),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Mg(e,t,r){let n=t instanceof T8,i=n?r:t;return new Mh({type:"tuple",items:e,rest:n?t:null,...PA.normalizeParams(i)})}let Mv=Sd("ZodRecord",(e,t)=>{N3.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jm(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function My(e,t,r){return new Mv(t&&t._zod?{type:"record",keyType:e,valueType:t,...PA.normalizeParams(r)}:{type:"record",keyType:PW(),valueType:e,...PA.normalizeParams(t)})}function Mb(e,t,r){let n=Sz(e);return n._zod.values=void 0,new Mv({type:"record",keyType:n,valueType:t,...PA.normalizeParams(r)})}function Mx(e,t,r){return new Mv({type:"record",keyType:e,valueType:t,mode:"loose",...PA.normalizeParams(r)})}let M_=Sd("ZodMap",(e,t)=>{N9.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jo(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(RZ(...t)),e.nonempty=t=>e.check(RZ(1,t)),e.max=(...t)=>e.check(RL(...t)),e.size=(...t)=>e.check(RF(...t))});function Mw(e,t,r){return new M_({type:"map",keyType:e,valueType:t,...PA.normalizeParams(r)})}let Mk=Sd("ZodSet",(e,t)=>{N7.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>js(e,t,r,n),e.min=(...t)=>e.check(RZ(...t)),e.nonempty=t=>e.check(RZ(1,t)),e.max=(...t)=>e.check(RL(...t)),e.size=(...t)=>e.check(RF(...t))});function MI(e,t){return new Mk({type:"set",valueType:e,...PA.normalizeParams(t)})}let MS=Sd("ZodEnum",(e,t)=>{At.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$9(e,t,r,n),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{let i={};for(let n of e)if(r.has(n))i[n]=t.entries[n];else throw Error(`Key ${n} not found in enum`);return new MS({...t,checks:[],...PA.normalizeParams(n),entries:i})},e.exclude=(e,n)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new MS({...t,checks:[],...PA.normalizeParams(n),entries:i})}});function M$(e,t){return new MS({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...PA.normalizeParams(t)})}function Mj(e,t){return new MS({type:"enum",entries:e,...PA.normalizeParams(t)})}let ME=Sd("ZodLiteral",(e,t)=>{Ar.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$8(e,t,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function MC(e,t){return new ME({type:"literal",values:Array.isArray(e)?e:[e],...PA.normalizeParams(t)})}let MT=Sd("ZodFile",(e,t)=>{An.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jt(e,t,r,n),e.min=(t,r)=>e.check(RZ(t,r)),e.max=(t,r)=>e.check(RL(t,r)),e.mime=(t,r)=>e.check(RQ(Array.isArray(t)?t:[t],r))});function MN(e){return Pl(MT,e)}let MA=Sd("ZodTransform",(e,t)=>{Ai.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ja(e,t,r,n),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Sm(e.constructor.name);r.addIssue=n=>{"string"==typeof n?r.issues.push(PA.issue(n,r.value,t)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),r.issues.push(PA.issue(n)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function MR(e){return new MA({type:"transform",transform:e})}let MP=Sd("ZodOptional",(e,t)=>{Ao.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jw(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function MO(e){return new MP({type:"optional",innerType:e})}let MM=Sd("ZodExactOptional",(e,t)=>{As.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jw(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function Mz(e){return new MM({type:"optional",innerType:e})}let MD=Sd("ZodNullable",(e,t)=>{Al.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jf(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function MU(e){return new MD({type:"nullable",innerType:e})}function ML(e){return MO(MU(e))}let MZ=Sd("ZodDefault",(e,t)=>{Au.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jg(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function MF(e,t){return new MZ({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():PA.shallowClone(t)}})}let MB=Sd("ZodPrefault",(e,t)=>{Ac.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jv(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function MV(e,t){return new MB({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():PA.shallowClone(t)}})}let Mq=Sd("ZodNonOptional",(e,t)=>{Ap.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jh(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function MW(e,t){return new Mq({type:"nonoptional",innerType:e,...PA.normalizeParams(t)})}let MJ=Sd("ZodSuccess",(e,t)=>{Af.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jr(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function MH(e){return new MJ({type:"success",innerType:e})}let MK=Sd("ZodCatch",(e,t)=>{Ah.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jy(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function MG(e,t){return new MK({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})}let MY=Sd("ZodNaN",(e,t)=>{Ag.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$7(e,t,r,n)});function MX(e){return RT(MY,e)}let MQ=Sd("ZodPipe",(e,t)=>{Av.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jb(e,t,r,n),e.in=t.in,e.out=t.out});function M0(e,t){return new MQ({type:"pipe",in:e,out:t})}let M1=Sd("ZodCodec",(e,t)=>{MQ.init(e,t),Ab.init(e,t)});function M2(e,t,r){return new M1({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function M4(e){let t=e._zod.def;return new M1({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}let M6=Sd("ZodPreprocess",(e,t)=>{MQ.init(e,t),Aw.init(e,t)}),M5=Sd("ZodReadonly",(e,t)=>{Ak.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jx(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function M3(e){return new M5({type:"readonly",innerType:e})}let M9=Sd("ZodTemplateLiteral",(e,t)=>{AS.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>je(e,t,r,n)});function M8(e,t){return new M9({type:"template_literal",parts:e,...PA.normalizeParams(t)})}let M7=Sd("ZodLazy",(e,t)=>{AE.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jk(e,t,r,n),e.unwrap=()=>e._zod.def.getter()});function ze(e){return new M7({type:"lazy",getter:e})}let zt=Sd("ZodPromise",(e,t)=>{Aj.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>j_(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function zr(e){return new zt({type:"promise",innerType:e})}let zn=Sd("ZodFunction",(e,t)=>{A$.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ji(e,t,r,n)});function zi(e){return new zn({type:"function",input:Array.isArray(e?.input)?Mg(e?.input):e?.input??Mt(O4()),output:e?.output??O4()})}let za=Sd("ZodCustom",(e,t)=>{AC.init(e,t),PB.init(e,t),e._zod.processJSONSchema=(t,r,n)=>jn(e,t,r,n)});function zo(e){let t=new TM({check:"custom"});return t._zod.check=e,t}function zs(e,t){return P_(za,e??(()=>!0),t)}function zl(e,t={}){return Pw(za,e,t)}function zu(e,t){return Pk(e,t)}let zd=PS,zc=P$;function zp(e,t={}){let r=new za({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...PA.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:r,path:[...r._zod.def.path??[]]})},r}let zm=(...e)=>Pj({Codec:M1,Boolean:OZ,String:Pq},...e);function zf(e){let t=ze(()=>Ml([PW(e),OP(),OF(),OQ(),Mt(t),My(PW(),t)]));return t}function zh(e,t){return new M6({type:"pipe",in:MR(e),out:t})}var zg=e.i(62201);e.s([],42332),e.i(42332),e.s(["endsWith",0,RY,"gt",0,RR,"gte",0,RP,"includes",0,RK,"length",0,Rq,"lowercase",0,RJ,"lt",0,RN,"lte",0,RA,"maxLength",0,RB,"maxSize",0,RL,"mime",0,RQ,"minLength",0,RV,"minSize",0,RZ,"multipleOf",0,RU,"negative",0,RM,"nonnegative",0,RD,"nonpositive",0,Rz,"normalize",0,R1,"overwrite",0,R0,"positive",0,RO,"property",0,RX,"regex",0,RW,"size",0,RF,"slugify",0,R5,"startsWith",0,RG,"toLowerCase",0,R4,"toUpperCase",0,R6,"trim",0,R2,"uppercase",0,RH],30421);var zv=e.i(30421);e.i(89282),e.i(364);let zy={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function zb(e){Sh({customError:e})}function zx(){return Sh().customError}B||(B={}),e.s(["ZodFirstPartyTypeKind",0,B,"ZodIssueCode",0,zy,"getErrorMap",0,zx,"setErrorMap",0,zb],6034),e.i(6034),e.s(["$brand",0,Sc,"ZodFirstPartyTypeKind",0,B,"ZodIssueCode",0,zy,"config",0,Sh,"getErrorMap",0,zx,"setErrorMap",0,zb],58829),e.i(58829);var PN=AA,PA=AN,z_=e.i(49732);let zw={...zg,...zv,iso:z_},zk=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);e.s(["bigint",0,function(e){return Ry(OB,e)},"boolean",0,function(e){return Rg(OZ,e)},"date",0,function(e){return RC(O8,e)},"number",0,function(e){return Ru(OR,e)},"string",0,function(e){return AB(Pq,e)}],13657);var zI=e.i(13657);e.s(["$brand",0,Sc,"$input",0,$D,"$output",0,$z,"NEVER",0,Su,"TimePrecision",0,Rn,"ZodAny",0,O0,"ZodArray",0,Me,"ZodBase64",0,Ox,"ZodBase64URL",0,Ow,"ZodBigInt",0,OB,"ZodBigIntFormat",0,Oq,"ZodBoolean",0,OZ,"ZodCIDRv4",0,Og,"ZodCIDRv6",0,Oy,"ZodCUID",0,Oe,"ZodCUID2",0,Or,"ZodCatch",0,MK,"ZodCodec",0,M1,"ZodCustom",0,za,"ZodCustomStringFormat",0,OE,"ZodDate",0,O8,"ZodDefault",0,MZ,"ZodDiscriminatedUnion",0,Mc,"ZodE164",0,OI,"ZodEmail",0,PH,"ZodEmoji",0,P3,"ZodEnum",0,MS,"ZodError",0,$k,"ZodExactOptional",0,MM,"ZodFile",0,MT,"ZodFirstPartyTypeKind",0,B,"ZodFunction",0,zn,"ZodGUID",0,PG,"ZodIPv4",0,Od,"ZodIPv6",0,Of,"ZodISODate",0,PO,"ZodISODateTime",0,PR,"ZodISODuration",0,PU,"ZodISOTime",0,Pz,"ZodIntersection",0,Mm,"ZodIssueCode",0,zy,"ZodJWT",0,O$,"ZodKSUID",0,Ol,"ZodLazy",0,M7,"ZodLiteral",0,ME,"ZodMAC",0,Op,"ZodMap",0,M_,"ZodNaN",0,MY,"ZodNanoID",0,P8,"ZodNever",0,O6,"ZodNonOptional",0,Mq,"ZodNull",0,OX,"ZodNullable",0,MD,"ZodNumber",0,OR,"ZodNumberFormat",0,OO,"ZodObject",0,Mn,"ZodOptional",0,MP,"ZodPipe",0,MQ,"ZodPrefault",0,MB,"ZodPreprocess",0,M6,"ZodPromise",0,zt,"ZodReadonly",0,M5,"ZodRealError",0,$I,"ZodRecord",0,Mv,"ZodSet",0,Mk,"ZodString",0,Pq,"ZodStringFormat",0,PJ,"ZodSuccess",0,MJ,"ZodSymbol",0,OH,"ZodTemplateLiteral",0,M9,"ZodTransform",0,MA,"ZodTuple",0,Mh,"ZodType",0,PB,"ZodULID",0,Oi,"ZodURL",0,P4,"ZodUUID",0,PX,"ZodUndefined",0,OG,"ZodUnion",0,Ms,"ZodUnknown",0,O2,"ZodVoid",0,O3,"ZodXID",0,Oo,"ZodXor",0,Mu,"_ZodString",0,PV,"_default",0,MF,"_function",0,zi,"any",0,O1,"array",0,Mt,"base64",0,O_,"base64url",0,Ok,"bigint",0,OV,"boolean",0,OF,"catch",0,MG,"check",0,zo,"cidrv4",0,Ov,"cidrv6",0,Ob,"clone",0,Sz,"codec",0,M2,"coerce",0,zI,"config",0,Sh,"core",0,PT,"cuid",0,Ot,"cuid2",0,On,"custom",0,zs,"date",0,O7,"decode",0,$T,"decodeAsync",0,$A,"describe",0,zd,"discriminatedUnion",0,Mp,"e164",0,OS,"email",0,PK,"emoji",0,P9,"encode",0,$C,"encodeAsync",0,$N,"endsWith",0,RY,"enum",0,M$,"exactOptional",0,Mz,"file",0,MN,"flattenError",0,S4,"float32",0,Oz,"float64",0,OD,"formatError",0,S6,"fromJSONSchema",0,function(e,t){var r,n;let i,a;if("boolean"==typeof e)return e?zw.any():zw.never();try{i=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o={version:(r=i,n=t?.defaultTarget,"https://json-schema.org/draft/2020-12/schema"===(a=r.$schema)?"draft-2020-12":"http://json-schema.org/draft-07/schema#"===a?"draft-7":"http://json-schema.org/draft-04/schema#"===a?"draft-4":n??"draft-2020-12"),defs:i.$defs||i.definitions||{},refs:new Map,processing:new Set,rootSchema:i,registry:t?.registry??$Z};return function e(t,r){if("boolean"==typeof t)return t?zw.any():zw.never();let n=function t(r,n){let i;if(void 0!==r.not){if("object"==typeof r.not&&0===Object.keys(r.not).length)return zw.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(void 0!==r.unevaluatedItems)throw Error("unevaluatedItems is not supported");if(void 0!==r.unevaluatedProperties)throw Error("unevaluatedProperties is not supported");if(void 0!==r.if||void 0!==r.then||void 0!==r.else)throw Error("Conditional schemas (if/then/else) are not supported");if(void 0!==r.dependentSchemas||void 0!==r.dependentRequired)throw Error("dependentSchemas and dependentRequired are not supported");if(r.$ref){let t=r.$ref;if(n.refs.has(t))return n.refs.get(t);if(n.processing.has(t))return zw.lazy(()=>{if(!n.refs.has(t))throw Error(`Circular reference not resolved: ${t}`);return n.refs.get(t)});n.processing.add(t);let i=e(function(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(0===r.length)return t.rootSchema;let n="draft-2020-12"===t.version?"$defs":"definitions";if(r[0]===n){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}(t,n),n);return n.refs.set(t,i),n.processing.delete(t),i}if(void 0!==r.enum){let e=r.enum;if("openapi-3.0"===n.version&&!0===r.nullable&&1===e.length&&null===e[0])return zw.null();if(0===e.length)return zw.never();if(1===e.length)return zw.literal(e[0]);if(e.every(e=>"string"==typeof e))return zw.enum(e);let t=e.map(e=>zw.literal(e));return t.length<2?t[0]:zw.union([t[0],t[1],...t.slice(2)])}if(void 0!==r.const)return zw.literal(r.const);let a=r.type;if(Array.isArray(a)){let e=a.map(e=>t({...r,type:e},n));return 0===e.length?zw.never():1===e.length?e[0]:zw.union(e)}if(!a)return zw.any();switch(a){case"string":{let e=zw.string();if(r.format){let t=r.format;"email"===t?e=e.check(zw.email()):"uri"===t||"uri-reference"===t?e=e.check(zw.url()):"uuid"===t||"guid"===t?e=e.check(zw.uuid()):"date-time"===t?e=e.check(zw.iso.datetime()):"date"===t?e=e.check(zw.iso.date()):"time"===t?e=e.check(zw.iso.time()):"duration"===t?e=e.check(zw.iso.duration()):"ipv4"===t?e=e.check(zw.ipv4()):"ipv6"===t?e=e.check(zw.ipv6()):"mac"===t?e=e.check(zw.mac()):"cidr"===t?e=e.check(zw.cidrv4()):"cidr-v6"===t?e=e.check(zw.cidrv6()):"base64"===t?e=e.check(zw.base64()):"base64url"===t?e=e.check(zw.base64url()):"e164"===t?e=e.check(zw.e164()):"jwt"===t?e=e.check(zw.jwt()):"emoji"===t?e=e.check(zw.emoji()):"nanoid"===t?e=e.check(zw.nanoid()):"cuid"===t?e=e.check(zw.cuid()):"cuid2"===t?e=e.check(zw.cuid2()):"ulid"===t?e=e.check(zw.ulid()):"xid"===t?e=e.check(zw.xid()):"ksuid"===t&&(e=e.check(zw.ksuid()))}"number"==typeof r.minLength&&(e=e.min(r.minLength)),"number"==typeof r.maxLength&&(e=e.max(r.maxLength)),r.pattern&&(e=e.regex(new RegExp(r.pattern))),i=e;break}case"number":case"integer":{let e="integer"===a?zw.number().int():zw.number();"number"==typeof r.minimum&&(e=e.min(r.minimum)),"number"==typeof r.maximum&&(e=e.max(r.maximum)),"number"==typeof r.exclusiveMinimum?e=e.gt(r.exclusiveMinimum):!0===r.exclusiveMinimum&&"number"==typeof r.minimum&&(e=e.gt(r.minimum)),"number"==typeof r.exclusiveMaximum?e=e.lt(r.exclusiveMaximum):!0===r.exclusiveMaximum&&"number"==typeof r.maximum&&(e=e.lt(r.maximum)),"number"==typeof r.multipleOf&&(e=e.multipleOf(r.multipleOf)),i=e;break}case"boolean":i=zw.boolean();break;case"null":i=zw.null();break;case"object":{let t={},a=r.properties||{},o=new Set(r.required||[]);for(let[r,i]of Object.entries(a)){let a=e(i,n);t[r]=o.has(r)?a:a.optional()}if(r.propertyNames){let a=e(r.propertyNames,n),o=r.additionalProperties&&"object"==typeof r.additionalProperties?e(r.additionalProperties,n):zw.any();if(0===Object.keys(t).length){i=zw.record(a,o);break}let s=zw.object(t).passthrough(),l=zw.looseRecord(a,o);i=zw.intersection(s,l);break}if(r.patternProperties){let a=r.patternProperties,o=Object.keys(a),s=[];for(let t of o){let r=e(a[t],n),i=zw.string().regex(new RegExp(t));s.push(zw.looseRecord(i,r))}let l=[];if(Object.keys(t).length>0&&l.push(zw.object(t).passthrough()),l.push(...s),0===l.length)i=zw.object({}).passthrough();else if(1===l.length)i=l[0];else{let e=zw.intersection(l[0],l[1]);for(let t=2;t<l.length;t++)e=zw.intersection(e,l[t]);i=e}break}let s=zw.object(t);i=!1===r.additionalProperties?s.strict():"object"==typeof r.additionalProperties?s.catchall(e(r.additionalProperties,n)):s.passthrough();break}case"array":{let t=r.prefixItems,a=r.items;if(t&&Array.isArray(t)){let o=t.map(t=>e(t,n)),s=a&&"object"==typeof a&&!Array.isArray(a)?e(a,n):void 0;i=s?zw.tuple(o).rest(s):zw.tuple(o),"number"==typeof r.minItems&&(i=i.check(zw.minLength(r.minItems))),"number"==typeof r.maxItems&&(i=i.check(zw.maxLength(r.maxItems)))}else if(Array.isArray(a)){let t=a.map(t=>e(t,n)),o=r.additionalItems&&"object"==typeof r.additionalItems?e(r.additionalItems,n):void 0;i=o?zw.tuple(t).rest(o):zw.tuple(t),"number"==typeof r.minItems&&(i=i.check(zw.minLength(r.minItems))),"number"==typeof r.maxItems&&(i=i.check(zw.maxLength(r.maxItems)))}else if(void 0!==a){let t=e(a,n),o=zw.array(t);"number"==typeof r.minItems&&(o=o.min(r.minItems)),"number"==typeof r.maxItems&&(o=o.max(r.maxItems)),i=o}else i=zw.array(zw.any());break}default:throw Error(`Unsupported type: ${a}`)}return i}(t,r),i=t.type||void 0!==t.enum||void 0!==t.const;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(t=>e(t,r)),o=zw.union(a);n=i?zw.intersection(n,o):o}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(t=>e(t,r)),o=zw.xor(a);n=i?zw.intersection(n,o):o}if(t.allOf&&Array.isArray(t.allOf))if(0===t.allOf.length)n=i?n:zw.any();else{let a=i?n:e(t.allOf[0],r),o=+!i;for(let n=o;n<t.allOf.length;n++)a=zw.intersection(a,e(t.allOf[n],r));n=a}!0===t.nullable&&"openapi-3.0"===r.version&&(n=zw.nullable(n)),!0===t.readOnly&&(n=zw.readonly(n)),void 0!==t.default&&(n=n.default(t.default));let a={};for(let e of["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"])e in t&&(a[e]=t[e]);for(let e of["contentEncoding","contentMediaType","contentSchema"])e in t&&(a[e]=t[e]);for(let e of Object.keys(t))zk.has(e)||(a[e]=t[e]);return Object.keys(a).length>0&&r.registry.add(n,a),t.description&&(n=n.describe(t.description)),n}(i,o)},"function",0,zi,"getErrorMap",0,zx,"globalRegistry",0,$Z,"gt",0,RR,"gte",0,RP,"guid",0,PY,"hash",0,OA,"hex",0,ON,"hostname",0,OT,"httpUrl",0,P5,"includes",0,RK,"instanceof",0,zp,"int",0,OM,"int32",0,OU,"int64",0,OW,"intersection",0,Mf,"invertCodec",0,M4,"ipv4",0,Oc,"ipv6",0,Oh,"iso",0,z_,"json",0,zf,"jwt",0,Oj,"keyof",0,Mr,"ksuid",0,Ou,"lazy",0,ze,"length",0,Rq,"literal",0,MC,"locales",0,AZ,"looseObject",0,Mo,"looseRecord",0,Mx,"lowercase",0,RJ,"lt",0,RN,"lte",0,RA,"mac",0,Om,"map",0,Mw,"maxLength",0,RB,"maxSize",0,RL,"meta",0,zc,"mime",0,RQ,"minLength",0,RV,"minSize",0,RZ,"multipleOf",0,RU,"nan",0,MX,"nanoid",0,P7,"nativeEnum",0,Mj,"negative",0,RM,"never",0,O5,"nonnegative",0,RD,"nonoptional",0,MW,"nonpositive",0,Rz,"normalize",0,R1,"null",0,OQ,"nullable",0,MU,"nullish",0,ML,"number",0,OP,"object",0,Mi,"optional",0,MO,"overwrite",0,R0,"parse",0,$S,"parseAsync",0,$$,"partialRecord",0,Mb,"pipe",0,M0,"positive",0,RO,"prefault",0,MV,"preprocess",0,zh,"prettifyError",0,S9,"promise",0,zr,"property",0,RX,"readonly",0,M3,"record",0,My,"refine",0,zl,"regex",0,RW,"regexes",()=>PN,"registry",0,$L,"safeDecode",0,$P,"safeDecodeAsync",0,$M,"safeEncode",0,$R,"safeEncodeAsync",0,$O,"safeParse",0,$j,"safeParseAsync",0,$E,"set",0,MI,"setErrorMap",0,zb,"size",0,RF,"slugify",0,R5,"startsWith",0,RG,"strictObject",0,Ma,"string",0,PW,"stringFormat",0,OC,"stringbool",0,zm,"success",0,MH,"superRefine",0,zu,"symbol",0,OK,"templateLiteral",0,M8,"toJSONSchema",0,jS,"toLowerCase",0,R4,"toUpperCase",0,R6,"transform",0,MR,"treeifyError",0,S5,"trim",0,R2,"tuple",0,Mg,"uint32",0,OL,"uint64",0,OJ,"ulid",0,Oa,"undefined",0,OY,"union",0,Ml,"unknown",0,O4,"uppercase",0,RH,"url",0,P6,"util",()=>PA,"uuid",0,PQ,"uuidv4",0,P0,"uuidv6",0,P1,"uuidv7",0,P2,"void",0,O9,"xid",0,Os,"xor",0,Md],22219);var zS=e.i(22219),zS=zS,z$=e.i(25150),zj=Symbol.for("vercel.ai.gateway.error"),zE=class e extends(q=Error,V=zj,q){constructor({message:e,statusCode:t=500,cause:r,generationId:n,isRetryable:i=null!=t&&(408===t||409===t||429===t||t>=500)}){super(n?`${e} [${n}]`:e),this[V]=!0,this.statusCode=t,this.cause=r,this.generationId=n,this.isRetryable=i}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return"object"==typeof e&&null!==e&&zj in e&&!0===e[zj]}},zC="GatewayAuthenticationError",zT=Symbol.for(`vercel.ai.gateway.error.${zC}`),zN=class e extends(J=zE,W=zT,J){constructor({message:e="Authentication failed",statusCode:t=401,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[W]=!0,this.name=zC,this.type="authentication_error"}static isInstance(e){return zE.hasMarker(e)&&zT in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:n="Authentication failed",statusCode:i=401,cause:a,generationId:o}){return new e({message:t?`AI Gateway authentication failed: Invalid API key.
84
+
85
+ Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
86
+
87
+ Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:r?`AI Gateway authentication failed: Invalid OIDC token.
88
+
89
+ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
90
+
91
+ Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`:`AI Gateway authentication failed: No authentication provided.
92
+
93
+ Option 1 - API key:
94
+ Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
95
+ Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
96
+
97
+ Option 2 - OIDC token:
98
+ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,statusCode:i,cause:a,generationId:o})}},zA="GatewayInvalidRequestError",zR=Symbol.for(`vercel.ai.gateway.error.${zA}`),zP=class extends(K=zE,H=zR,K){constructor({message:e="Invalid request",statusCode:t=400,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[H]=!0,this.name=zA,this.type="invalid_request_error"}static isInstance(e){return zE.hasMarker(e)&&zR in e}},zO="GatewayRateLimitError",zM=Symbol.for(`vercel.ai.gateway.error.${zO}`),zz=class extends(Y=zE,G=zM,Y){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[G]=!0,this.name=zO,this.type="rate_limit_exceeded"}static isInstance(e){return zE.hasMarker(e)&&zM in e}},zD="GatewayModelNotFoundError",zU=Symbol.for(`vercel.ai.gateway.error.${zD}`),zL=CR(()=>CM(zS.object({modelId:zS.string()}))),zZ=class extends(Q=zE,X=zU,Q){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:n,generationId:i}={}){super({message:e,statusCode:t,cause:n,generationId:i}),this[X]=!0,this.name=zD,this.type="model_not_found",this.modelId=r}static isInstance(e){return zE.hasMarker(e)&&zU in e}},zF="GatewayInternalServerError",zB=Symbol.for(`vercel.ai.gateway.error.${zF}`),zV=class extends(et=zE,ee=zB,et){constructor({message:e="Internal server error",statusCode:t=500,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[ee]=!0,this.name=zF,this.type="internal_server_error"}static isInstance(e){return zE.hasMarker(e)&&zB in e}},zq="GatewayResponseError",zW=Symbol.for(`vercel.ai.gateway.error.${zq}`),zJ=class extends(en=zE,er=zW,en){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:n,cause:i,generationId:a}={}){super({message:e,statusCode:t,cause:i,generationId:a}),this[er]=!0,this.name=zq,this.type="response_error",this.response=r,this.validationError=n}static isInstance(e){return zE.hasMarker(e)&&zW in e}};async function zH({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:n,authMethod:i}){var a;let o=await CD({value:e,schema:zK});if(!o.success){let i="object"==typeof e&&null!==e&&"generationId"in e?e.generationId:void 0;return new zJ({message:`Invalid error response format: ${r}`,statusCode:t,response:e,validationError:o.error,cause:n,generationId:i})}let s=o.value,l=s.error.type,u=s.error.message,d=null!=(a=s.generationId)?a:void 0;switch(l){case"authentication_error":return zN.createContextualError({apiKeyProvided:"api-key"===i,oidcTokenProvided:"oidc"===i,statusCode:t,cause:n,generationId:d});case"invalid_request_error":return new zP({message:u,statusCode:t,cause:n,generationId:d});case"rate_limit_exceeded":return new zz({message:u,statusCode:t,cause:n,generationId:d});case"model_not_found":{let e=await CD({value:s.error.param,schema:zL});return new zZ({message:u,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:n,generationId:d})}default:return new zV({message:u,statusCode:t,cause:n,generationId:d})}}var zK=CR(()=>CM(zS.object({error:zS.object({message:zS.string(),type:zS.string().nullish(),param:zS.unknown().nullish(),code:zS.union([zS.string(),zS.number()]).nullish()}),generationId:zS.string().nullish()}))),zG="GatewayTimeoutError",zY=Symbol.for(`vercel.ai.gateway.error.${zG}`),zX=class e extends(ea=zE,ei=zY,ea){constructor({message:e="Request timed out",statusCode:t=408,cause:r,generationId:n}={}){super({message:e,statusCode:t,cause:r,generationId:n}),this[ei]=!0,this.name=zG,this.type="timeout_error"}static isInstance(e){return zE.hasMarker(e)&&zY in e}static createTimeoutError({originalMessage:t,statusCode:r=408,cause:n,generationId:i}){return new e({message:`Gateway request timed out: ${t}
99
+
100
+ This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`,statusCode:r,cause:n,generationId:i})}};function zQ(e){if(!(e instanceof Error))return!1;let t=e.code;return"string"==typeof t&&["UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT"].includes(t)}async function z0(e,t){var r;return zE.isInstance(e)?e:zQ(e)?zX.createTimeoutError({originalMessage:e instanceof Error?e.message:"Unknown error",cause:e}):IX.isInstance(e)?e.cause&&zQ(e.cause)?zX.createTimeoutError({originalMessage:e.message,cause:e}):await zH({response:function(e){if(void 0!==e.data)return e.data;if(null!=e.responseBody)try{return JSON.parse(e.responseBody)}catch(t){return e.responseBody}return{}}(e),statusCode:null!=(r=e.statusCode)?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):await zH({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}var z1="ai-gateway-auth-method";async function z2(e){let t=await CD({value:e[z1],schema:z4});return t.success?t.value:void 0}var z4=CR(()=>CM(zS.union([zS.literal("api-key"),zS.literal("oidc")]))),z6=["embedding","image","language","reranking","video"],z5=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await E8({url:`${this.config.baseURL}/config`,headers:await CW(this.config.headers()),successfulResponseHandler:CH(z3),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await z0(e)}}async getCredits(){try{let e=new URL(this.config.baseURL),{value:t}=await E8({url:`${e.origin}/v1/credits`,headers:await CW(this.config.headers()),successfulResponseHandler:CH(z9),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await z0(e)}}},z3=CR(()=>CM(zS.object({models:zS.array(zS.object({id:zS.string(),name:zS.string(),description:zS.string().nullish(),pricing:zS.object({input:zS.string(),output:zS.string(),input_cache_read:zS.string().nullish(),input_cache_write:zS.string().nullish()}).transform(({input:e,output:t,input_cache_read:r,input_cache_write:n})=>({input:e,output:t,...r?{cachedInputTokens:r}:{},...n?{cacheCreationInputTokens:n}:{}})).nullish(),specification:zS.object({specificationVersion:zS.literal("v3"),provider:zS.string(),modelId:zS.string()}),modelType:zS.string().nullish()})).transform(e=>e.filter(e=>null==e.modelType||z6.includes(e.modelType)))}))),z9=CR(()=>CM(zS.object({balance:zS.string(),total_used:zS.string()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),z8=class{constructor(e){this.config=e}async getSpendReport(e){try{let t=new URL(this.config.baseURL),r=new URLSearchParams;r.set("start_date",e.startDate),r.set("end_date",e.endDate),e.groupBy&&r.set("group_by",e.groupBy),e.datePart&&r.set("date_part",e.datePart),e.userId&&r.set("user_id",e.userId),e.model&&r.set("model",e.model),e.provider&&r.set("provider",e.provider),e.credentialType&&r.set("credential_type",e.credentialType),e.tags&&e.tags.length>0&&r.set("tags",e.tags.join(","));let{value:n}=await E8({url:`${t.origin}/v1/report?${r.toString()}`,headers:await CW(this.config.headers()),successfulResponseHandler:CH(z7),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return n}catch(e){throw await z0(e)}}},z7=CR(()=>CM(zS.object({results:zS.array(zS.object({day:zS.string().optional(),hour:zS.string().optional(),user:zS.string().optional(),model:zS.string().optional(),tag:zS.string().optional(),provider:zS.string().optional(),credential_type:zS.enum(["byok","system"]).optional(),total_cost:zS.number(),market_cost:zS.number().optional(),input_tokens:zS.number().optional(),output_tokens:zS.number().optional(),cached_input_tokens:zS.number().optional(),cache_creation_input_tokens:zS.number().optional(),reasoning_tokens:zS.number().optional(),request_count:zS.number().optional()}).transform(({credential_type:e,total_cost:t,market_cost:r,input_tokens:n,output_tokens:i,cached_input_tokens:a,cache_creation_input_tokens:o,reasoning_tokens:s,request_count:l,...u})=>({...u,...void 0!==e?{credentialType:e}:{},totalCost:t,...void 0!==r?{marketCost:r}:{},...void 0!==n?{inputTokens:n}:{},...void 0!==i?{outputTokens:i}:{},...void 0!==a?{cachedInputTokens:a}:{},...void 0!==o?{cacheCreationInputTokens:o}:{},...void 0!==s?{reasoningTokens:s}:{},...void 0!==l?{requestCount:l}:{}})))}))),De=class{constructor(e){this.config=e}async getGenerationInfo(e){try{let t=new URL(this.config.baseURL),{value:r}=await E8({url:`${t.origin}/v1/generation?id=${encodeURIComponent(e.id)}`,headers:await CW(this.config.headers()),successfulResponseHandler:CH(Dt),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),fetch:this.config.fetch});return r}catch(e){throw await z0(e)}}},Dt=CR(()=>CM(zS.object({data:zS.object({id:zS.string(),total_cost:zS.number(),upstream_inference_cost:zS.number(),usage:zS.number(),created_at:zS.string(),model:zS.string(),is_byok:zS.boolean(),provider_name:zS.string(),streamed:zS.boolean(),finish_reason:zS.string(),latency:zS.number(),generation_time:zS.number(),native_tokens_prompt:zS.number(),native_tokens_completion:zS.number(),native_tokens_reasoning:zS.number(),native_tokens_cached:zS.number(),native_tokens_cache_creation:zS.number(),billable_web_search_calls:zS.number()}).transform(({total_cost:e,upstream_inference_cost:t,created_at:r,is_byok:n,provider_name:i,finish_reason:a,generation_time:o,native_tokens_prompt:s,native_tokens_completion:l,native_tokens_reasoning:u,native_tokens_cached:d,native_tokens_cache_creation:c,billable_web_search_calls:p,...m})=>({...m,totalCost:e,upstreamInferenceCost:t,createdAt:r,isByok:n,providerName:i,finishReason:a,generationTime:o,promptTokens:s,completionTokens:l,reasoningTokens:u,cachedTokens:d,cacheCreationTokens:c,billableWebSearchCalls:p}))}).transform(({data:e})=>e))),Dr=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(e){let{abortSignal:t,...r}=e;return{args:this.maybeEncodeFileParts(r),warnings:[]}}async doGenerate(e){let{args:t,warnings:r}=await this.getArgs(e),{abortSignal:n}=e,i=await CW(this.config.headers());try{let{responseHeaders:a,value:o,rawValue:s}=await CB({url:this.getUrl(),headers:ED(i,e.headers,this.getModelConfigHeaders(this.modelId,!1),await CW(this.config.o11yHeaders)),body:t,successfulResponseHandler:CH(zS.any()),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:a,body:s},warnings:r}}catch(e){throw await z0(e,await z2(i))}}async doStream(e){let{args:t,warnings:r}=await this.getArgs(e),{abortSignal:n}=e,i=await CW(this.config.headers());try{let a,{value:o,responseHeaders:s}=await CB({url:this.getUrl(),headers:ED(i,e.headers,this.getModelConfigHeaders(this.modelId,!0),await CW(this.config.o11yHeaders)),body:t,successfulResponseHandler:(a=zS.any(),async({response:e})=>{let t=EU(e);if(null==e.body)throw new I2({});return{responseHeaders:t,value:CZ({stream:e.body,schema:a})}}),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{stream:o.pipeThrough(new TransformStream({start(e){r.length>0&&e.enqueue({type:"stream-start",warnings:r})},transform(t,r){if(t.success){let n=t.value;("raw"!==n.type||e.includeRawChunks)&&("response-metadata"===n.type&&n.timestamp&&"string"==typeof n.timestamp&&(n.timestamp=new Date(n.timestamp)),r.enqueue(n))}else r.error(t.error)}})),request:{body:t},response:{headers:s}}}catch(e){throw await z0(e,await z2(i))}}isFilePart(e){return e&&"object"==typeof e&&"type"in e&&"file"===e.type}maybeEncodeFileParts(e){for(let t of e.prompt)for(let e of t.content)if(this.isFilePart(e)&&e.data instanceof Uint8Array){let t=Uint8Array.from(e.data),r=Iq.Buffer.from(t).toString("base64");e.data=new URL(`data:${e.mediaType||"application/octet-stream"};base64,${r}`)}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":"3","ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},Dn=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:r,providerOptions:n}){var i;let a=await CW(this.config.headers());try{let{responseHeaders:o,value:s,rawValue:l}=await CB({url:this.getUrl(),headers:ED(a,null!=t?t:{},this.getModelConfigHeaders(),await CW(this.config.o11yHeaders)),body:{values:e,...n?{providerOptions:n}:{}},successfulResponseHandler:CH(Di),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{embeddings:s.embeddings,usage:null!=(i=s.usage)?i:void 0,providerMetadata:s.providerMetadata,response:{headers:o,body:l},warnings:[]}}catch(e){throw await z0(e,await z2(a))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},Di=CR(()=>CM(zS.object({embeddings:zS.array(zS.array(zS.number())),usage:zS.object({tokens:zS.number()}).nullish(),providerMetadata:zS.record(zS.string(),zS.record(zS.string(),zS.unknown())).optional()}))),Da=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:r,aspectRatio:n,seed:i,files:a,mask:o,providerOptions:s,headers:l,abortSignal:u}){var d,c,p,m;let f=await CW(this.config.headers());try{let{responseHeaders:h,value:g,rawValue:v}=await CB({url:this.getUrl(),headers:ED(f,null!=l?l:{},this.getModelConfigHeaders(),await CW(this.config.o11yHeaders)),body:{prompt:e,n:t,...r&&{size:r},...n&&{aspectRatio:n},...i&&{seed:i},...s&&{providerOptions:s},...a&&{files:a.map(e=>Do(e))},...o&&{mask:Do(o)}},successfulResponseHandler:CH(Dd),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),...u&&{abortSignal:u},fetch:this.config.fetch});return{images:g.images,warnings:null!=(d=g.warnings)?d:[],providerMetadata:g.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:h},...null!=g.usage&&{usage:{inputTokens:null!=(c=g.usage.inputTokens)?c:void 0,outputTokens:null!=(p=g.usage.outputTokens)?p:void 0,totalTokens:null!=(m=g.usage.totalTokens)?m:void 0}}}}catch(e){throw await z0(e,await z2(f))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function Do(e){return"file"===e.type&&e.data instanceof Uint8Array?{...e,data:EF(e.data)}:e}var Ds=zS.object({images:zS.array(zS.unknown()).optional()}).catchall(zS.unknown()),Dl=zS.discriminatedUnion("type",[zS.object({type:zS.literal("unsupported"),feature:zS.string(),details:zS.string().optional()}),zS.object({type:zS.literal("compatibility"),feature:zS.string(),details:zS.string().optional()}),zS.object({type:zS.literal("other"),message:zS.string()})]),Du=zS.object({inputTokens:zS.number().nullish(),outputTokens:zS.number().nullish(),totalTokens:zS.number().nullish()}),Dd=zS.object({images:zS.array(zS.string()),warnings:zS.array(Dl).optional(),providerMetadata:zS.record(zS.string(),Ds).optional(),usage:Du.optional()}),Dc=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxVideosPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,aspectRatio:r,resolution:n,duration:i,fps:a,seed:o,image:s,providerOptions:l,headers:u,abortSignal:d}){var c,p;let m=await CW(this.config.headers());try{let{responseHeaders:f,value:h}=await CB({url:this.getUrl(),headers:ED(m,null!=u?u:{},this.getModelConfigHeaders(),await CW(this.config.o11yHeaders),{accept:"text/event-stream"}),body:{prompt:e,n:t,...r&&{aspectRatio:r},...n&&{resolution:n},...i&&{duration:i},...a&&{fps:a},...o&&{seed:o},...l&&{providerOptions:l},...s&&{image:(p=s,"file"===p.type&&p.data instanceof Uint8Array?{...p,data:EF(p.data)}:p)}},successfulResponseHandler:async({response:e,url:t,requestBodyValues:r})=>{if(null==e.body)throw new IX({message:"SSE response body is empty",url:t,requestBodyValues:r,statusCode:e.status});let n=CZ({stream:e.body,schema:Dh}).getReader(),{done:i,value:a}=await n.read();if(n.releaseLock(),i||!a)throw new IX({message:"SSE stream ended without a data event",url:t,requestBodyValues:r,statusCode:e.status});if(!a.success)throw new IX({message:"Failed to parse video SSE event",cause:a.error,url:t,requestBodyValues:r,statusCode:e.status});let o=a.value;if("error"===o.type)throw new IX({message:o.message,statusCode:o.statusCode,url:t,requestBodyValues:r,responseHeaders:Object.fromEntries([...e.headers]),responseBody:JSON.stringify(o),data:{error:{message:o.message,type:o.errorType,param:o.param}}});return{value:{videos:o.videos,warnings:o.warnings,providerMetadata:o.providerMetadata},responseHeaders:Object.fromEntries([...e.headers])}},failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),...d&&{abortSignal:d},fetch:this.config.fetch});return{videos:h.videos,warnings:null!=(c=h.warnings)?c:[],providerMetadata:h.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:f}}}catch(e){throw await z0(e,await z2(m))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":"3","ai-model-id":this.modelId}}},Dp=zS.object({videos:zS.array(zS.unknown()).optional()}).catchall(zS.unknown()),Dm=zS.union([zS.object({type:zS.literal("url"),url:zS.string(),mediaType:zS.string()}),zS.object({type:zS.literal("base64"),data:zS.string(),mediaType:zS.string()})]),Df=zS.discriminatedUnion("type",[zS.object({type:zS.literal("unsupported"),feature:zS.string(),details:zS.string().optional()}),zS.object({type:zS.literal("compatibility"),feature:zS.string(),details:zS.string().optional()}),zS.object({type:zS.literal("other"),message:zS.string()})]),Dh=zS.discriminatedUnion("type",[zS.object({type:zS.literal("result"),videos:zS.array(Dm),warnings:zS.array(Df).optional(),providerMetadata:zS.record(zS.string(),Dp).optional()}),zS.object({type:zS.literal("error"),message:zS.string(),errorType:zS.string(),statusCode:zS.number(),param:zS.unknown().nullable()})]),Dg=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3"}get provider(){return this.config.provider}async doRerank({documents:e,query:t,topN:r,headers:n,abortSignal:i,providerOptions:a}){let o=await CW(this.config.headers());try{let{responseHeaders:s,value:l,rawValue:u}=await CB({url:this.getUrl(),headers:ED(o,null!=n?n:{},this.getModelConfigHeaders(),await CW(this.config.o11yHeaders)),body:{documents:e,query:t,...null!=r?{topN:r}:{},...a?{providerOptions:a}:{}},successfulResponseHandler:CH(Dv),failedResponseHandler:CJ({errorSchema:zS.any(),errorToMessage:e=>e}),...i&&{abortSignal:i},fetch:this.config.fetch});return{ranking:l.ranking,providerMetadata:l.providerMetadata,response:{headers:s,body:u},warnings:[]}}catch(e){throw await z0(e,await z2(o))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":"3","ai-model-id":this.modelId}}},Dv=CR(()=>CM(zS.object({ranking:zS.array(zS.object({index:zS.number(),relevanceScore:zS.number()})),providerMetadata:zS.record(zS.string(),zS.record(zS.string(),zS.unknown())).optional()}))),Dy=Cq({id:"gateway.parallel_search",inputSchema:CR(()=>CM(zS.object({objective:zS.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),search_queries:zS.array(zS.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),mode:zS.enum(["one-shot","agentic"]).optional().describe('Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'),max_results:zS.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),source_policy:zS.object({include_domains:zS.array(zS.string()).optional().describe("List of domains to include in search results."),exclude_domains:zS.array(zS.string()).optional().describe("List of domains to exclude from search results."),after_date:zS.string().optional().describe("Only include results published after this date (ISO 8601 format).")}).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),excerpts:zS.object({max_chars_per_result:zS.number().optional().describe("Maximum characters per result."),max_chars_total:zS.number().optional().describe("Maximum total characters across all results.")}).optional().describe("Excerpt configuration for controlling result length."),fetch_policy:zS.object({max_age_seconds:zS.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.")}).optional().describe("Fetch policy for controlling content freshness.")}))),outputSchema:CR(()=>CM(zS.union([zS.object({searchId:zS.string(),results:zS.array(zS.object({url:zS.string(),title:zS.string(),excerpt:zS.string(),publishDate:zS.string().nullable().optional(),relevanceScore:zS.number().optional()}))}),zS.object({error:zS.enum(["api_error","rate_limit","timeout","invalid_input","configuration_error","unknown"]),statusCode:zS.number().optional(),message:zS.string()})])))}),Db=Cq({id:"gateway.perplexity_search",inputSchema:CR(()=>CM(zS.object({query:zS.union([zS.string(),zS.array(zS.string())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:zS.number().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:zS.number().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:zS.number().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:zS.string().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:zS.array(zS.string()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:zS.array(zS.string()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:zS.string().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:zS.string().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:zS.string().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:zS.string().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:zS.enum(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")}))),outputSchema:CR(()=>CM(zS.union([zS.object({results:zS.array(zS.object({title:zS.string(),url:zS.string(),snippet:zS.string(),date:zS.string().optional(),lastUpdated:zS.string().optional()})),id:zS.string()}),zS.object({error:zS.enum(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:zS.number().optional(),message:zS.string()})])))}),Dx={parallelSearch:(e={})=>Dy(e),perplexitySearch:(e={})=>Db(e)};async function D_(){var e;return null==(e=(0,z$.getContext)().headers)?void 0:e["x-vercel-id"]}async function Dw(e){let t=E7({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});return t?{token:t,authMethod:"api-key"}:{token:await (0,z$.getVercelOidcToken)(),authMethod:"oidc"}}!function(e={}){var t,r,n;let i=null,a=null,o=null!=(t=e.metadataCacheRefreshMillis)?t:3e5,s=0,l=null!=(r=null==(n=e.baseURL)?void 0:n.replace(/\/$/,""))?r:"https://ai-gateway.vercel.sh/v3/ai",u=async()=>{try{let t=await Dw(e);return E5({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":"0.0.1",[z1]:t.authMethod,...e.headers},"ai-sdk/gateway/3.0.120")}catch(e){throw zN.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},d=()=>{let e=E7({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),t=E7({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),r=E7({settingValue:void 0,environmentVariableName:"VERCEL_REGION"}),n=E7({settingValue:void 0,environmentVariableName:"VERCEL_PROJECT_ID"});return async()=>{let i=await D_();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...r&&{"ai-o11y-region":r},...i&&{"ai-o11y-request-id":i},...n&&{"ai-o11y-project-id":n}}}},c=t=>new Dr(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()}),p=async()=>{var t,r,n;let d=null!=(n=null==(r=null==(t=e._internal)?void 0:t.currentDate)?void 0:r.call(t).getTime())?n:Date.now();return(!i||d-s>o)&&(s=d,i=new z5({baseURL:l,headers:u,fetch:e.fetch}).getAvailableModels().then(e=>(a=e,e)).catch(async e=>{throw await z0(e,await z2(await u()))})),a?Promise.resolve(a):i},m=async()=>new z5({baseURL:l,headers:u,fetch:e.fetch}).getCredits().catch(async e=>{throw await z0(e,await z2(await u()))}),f=async t=>new z8({baseURL:l,headers:u,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await z0(e,await z2(await u()))}),h=async t=>new De({baseURL:l,headers:u,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await z0(e,await z2(await u()))}),g=function(e){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return c(e)};g.specificationVersion="v3",g.getAvailableModels=p,g.getCredits=m,g.getSpendReport=f,g.getGenerationInfo=h,g.imageModel=t=>new Da(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()}),g.languageModel=c;let v=t=>new Dn(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()});g.embeddingModel=v,g.textEmbeddingModel=v,g.videoModel=t=>new Dc(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()});let y=t=>new Dg(t,{provider:"gateway",baseURL:l,headers:u,fetch:e.fetch,o11yHeaders:d()});g.rerankingModel=y,g.reranking=y,g.chat=g.languageModel,g.embedding=g.embeddingModel,g.image=g.imageModel,g.video=g.videoModel,g.tools=Dx}();var zS=zS;let Dk="1.9.1",DI=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,DS=function(e){let t=new Set([e]),r=new Set,n=e.match(DI);if(!n)return()=>!1;let i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(null!=i.prerelease)return function(t){return t===e};function a(e){return r.add(e),!1}return function(e){if(t.has(e))return!0;if(r.has(e))return!1;let n=e.match(DI);if(!n)return a(e);let o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(null!=o.prerelease||i.major!==o.major)return a(e);if(0===i.major)return i.minor===o.minor&&i.patch<=o.patch?(t.add(e),!0):a(e);return i.minor<=o.minor?(t.add(e),!0):a(e)}}(Dk),D$=Dk.split(".")[0],Dj=Symbol.for(`opentelemetry.js.api.${D$}`),DE="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:e.g;function DC(e,t,r,n=!1){var i;let a=DE[Dj]=null!=(i=DE[Dj])?i:{version:Dk};if(!n&&a[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(t.stack||t.message),!1}if(a.version!==Dk){let t=Error(`@opentelemetry/api: Registration of version v${a.version} for ${e} does not match previously registered API v${Dk}`);return r.error(t.stack||t.message),!1}return a[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Dk}.`),!0}function DT(e){var t,r;let n=null==(t=DE[Dj])?void 0:t.version;if(n&&DS(n))return null==(r=DE[Dj])?void 0:r[e]}function DN(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Dk}.`);let r=DE[Dj];r&&delete r[e]}class DA{constructor(e){const t=this;t._currentContext=e?new Map(e):new Map,t.getValue=e=>t._currentContext.get(e),t.setValue=(e,r)=>{let n=new DA(t._currentContext);return n._currentContext.set(e,r),n},t.deleteValue=e=>{let r=new DA(t._currentContext);return r._currentContext.delete(e),r}}}let DR=new DA;class DP{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return DO("debug",this._namespace,e)}error(...e){return DO("error",this._namespace,e)}info(...e){return DO("info",this._namespace,e)}warn(...e){return DO("warn",this._namespace,e)}verbose(...e){return DO("verbose",this._namespace,e)}}function DO(e,t,r){let n=DT("diag");if(n)return n[e](t,...r)}(v=eo||(eo={}))[v.NONE=0]="NONE",v[v.ERROR=30]="ERROR",v[v.WARN=50]="WARN",v[v.INFO=60]="INFO",v[v.DEBUG=70]="DEBUG",v[v.VERBOSE=80]="VERBOSE",v[v.ALL=9999]="ALL";class DM{static instance(){return this._instance||(this._instance=new DM),this._instance}constructor(){function e(e){return function(...t){let r=DT("diag");if(r)return r[e](...t)}}const t=this,r=(e,r={logLevel:eo.INFO})=>{var n,i,a;if(e===t){let e=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!=(n=e.stack)?n:e.message),!1}"number"==typeof r&&(r={logLevel:r});let o=DT("diag"),s=function(e,t){function r(r,n){let i=t[r];return"function"==typeof i&&e>=n?i.bind(t):function(){}}return e<eo.NONE?e=eo.NONE:e>eo.ALL&&(e=eo.ALL),t=t||{},{error:r("error",eo.ERROR),warn:r("warn",eo.WARN),info:r("info",eo.INFO),debug:r("debug",eo.DEBUG),verbose:r("verbose",eo.VERBOSE)}}(null!=(i=r.logLevel)?i:eo.INFO,e);if(o&&!r.suppressOverrideMessage){let e=null!=(a=Error().stack)?a:"<failed to generate stacktrace>";o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return DC("diag",s,t,!0)};t.setLogger=r,t.disable=()=>{DN("diag",t)},t.createComponentLogger=e=>new DP(e),t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}}let Dz="context",DD=new class{active(){return DR}with(e,t,r,...n){return t.call(r,...n)}bind(e,t){return t}enable(){return this}disable(){return this}};class DU{static getInstance(){return this._instance||(this._instance=new DU),this._instance}setGlobalContextManager(e){return DC(Dz,e,DM.instance())}active(){return this._getContextManager().active()}with(e,t,r,...n){return this._getContextManager().with(e,t,r,...n)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return DT(Dz)||DD}disable(){this._getContextManager().disable(),DN(Dz,DM.instance())}}(y=es||(es={}))[y.NONE=0]="NONE",y[y.SAMPLED=1]="SAMPLED";let DL="0000000000000000",DZ="00000000000000000000000000000000",DF={traceId:DZ,spanId:DL,traceFlags:es.NONE};class DB{constructor(e=DF){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}let DV=Symbol.for("OpenTelemetry Context Key SPAN");function Dq(e){return e.getValue(DV)||void 0}function DW(){return Dq(DU.getInstance().active())}function DJ(e,t){return e.setValue(DV,t)}function DH(e){return e.deleteValue(DV)}function DK(e,t){return DJ(e,new DB(t))}function DG(e){var t;return null==(t=Dq(e))?void 0:t.spanContext()}let DY=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function DX(e,t){if("string"!=typeof e||e.length!==t)return!1;let r=0;for(let t=0;t<e.length;t+=4)r+=(0|DY[e.charCodeAt(t)])+(0|DY[e.charCodeAt(t+1)])+(0|DY[e.charCodeAt(t+2)])+(0|DY[e.charCodeAt(t+3)]);return r===t}function DQ(e){var t,r;return DX(t=e.traceId,32)&&t!==DZ&&DX(r=e.spanId,16)&&r!==DL}function D0(e){return new DB(e)}let D1=DU.getInstance();class D2{startSpan(e,t,r=D1.active()){var n;if(null==t?void 0:t.root)return new DB;let i=r&&DG(r);return null!==(n=i)&&"object"==typeof n&&"spanId"in n&&"string"==typeof n.spanId&&"traceId"in n&&"string"==typeof n.traceId&&"traceFlags"in n&&"number"==typeof n.traceFlags&&DQ(i)?new DB(i):new DB}startActiveSpan(e,t,r,n){let i,a,o;if(arguments.length<2)return;2==arguments.length?o=t:3==arguments.length?(i=t,o=r):(i=t,a=r,o=n);let s=null!=a?a:D1.active(),l=this.startSpan(e,i,s),u=DJ(s,l);return D1.with(u,o,void 0,l)}}let D4=new D2;class D6{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,n){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):D4}}let D5=new class{getTracer(e,t,r){return new D2}};class D3{getTracer(e,t,r){var n;return null!=(n=this.getDelegateTracer(e,t,r))?n:new D6(this,e,t,r)}getDelegate(){var e;return null!=(e=this._delegate)?e:D5}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getTracer(e,t,r)}}let D9="trace";class D8{constructor(){this._proxyTracerProvider=new D3,this.wrapSpanContext=D0,this.isSpanContextValid=DQ,this.deleteSpan=DH,this.getSpan=Dq,this.getActiveSpan=DW,this.getSpanContext=DG,this.setSpan=DJ,this.setSpanContext=DK}static getInstance(){return this._instance||(this._instance=new D8),this._instance}setGlobalTracerProvider(e){let t=DC(D9,this._proxyTracerProvider,DM.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return DT(D9)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){DN(D9,DM.instance()),this._proxyTracerProvider=new D3}}D8.getInstance(),(b=el||(el={}))[b.UNSET=0]="UNSET",b[b.OK=1]="OK",b[b.ERROR=2]="ERROR",DU.getInstance();var D7=Object.defineProperty,Ue=(Symbol.for("vercel.ai.error.AI_InvalidArgumentError"),Symbol.for("vercel.ai.error.AI_InvalidStreamPartError"),Symbol.for("vercel.ai.error.AI_InvalidToolApprovalError"),Symbol.for("vercel.ai.error.AI_InvalidToolInputError"),Symbol.for("vercel.ai.error.AI_ToolCallNotFoundForApprovalError"),Symbol.for("vercel.ai.error.AI_MissingToolResultsError"),Symbol.for("vercel.ai.error.AI_NoImageGeneratedError"),"AI_NoObjectGeneratedError"),Ut=`vercel.ai.error.${Ue}`,Ur=Symbol.for(Ut),Un=class extends IH{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:i,finishReason:a}){super({name:Ue,message:e,cause:t}),this[eu]=!0,this.text=r,this.response=n,this.usage=i,this.finishReason=a}static isInstance(e){return IH.hasMarker(e,Ut)}};eu=Ur,Symbol.for("vercel.ai.error.AI_NoOutputGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSpeechGeneratedError"),Symbol.for("vercel.ai.error.AI_NoTranscriptGeneratedError"),Symbol.for("vercel.ai.error.AI_NoVideoGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSuchToolError"),Symbol.for("vercel.ai.error.AI_ToolCallRepairError");var Ui="AI_UIMessageStreamError",Ua=`vercel.ai.error.${Ui}`,Uo=Symbol.for(Ua),Us=class extends IH{constructor({chunkType:e,chunkId:t,message:r}){super({name:Ui,message:r}),this[ed]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return IH.hasMarker(e,Ua)}};ed=Uo,Symbol.for("vercel.ai.error.AI_InvalidDataContentError"),Symbol.for("vercel.ai.error.AI_InvalidMessageRoleError"),Symbol.for("vercel.ai.error.AI_MessageConversionError"),Symbol.for("vercel.ai.error.AI_RetryError");var Ul=async({url:e,maxBytes:t,abortSignal:r})=>{var n;let i=e.toString();EH(i);try{let e=await fetch(i,{headers:E5({},"ai-sdk/6.0.191",E4()),signal:r});if(e.redirected&&EH(e.url),!e.ok)throw new EW({url:i,statusCode:e.status,statusText:e.statusText});return{data:await EJ({response:e,url:i,maxBytes:null!=t?t:0x80000000}),mediaType:null!=(n=e.headers.get("content-type"))?n:void 0}}catch(e){if(EW.isInstance(e))throw e;throw new EW({url:i,cause:e})}},Uu=zS.union([zS.string(),zS.instanceof(Uint8Array),zS.instanceof(ArrayBuffer),zS.custom(e=>{var t,r;return null!=(r=null==(t=globalThis.Buffer)?void 0:t.isBuffer(e))&&r},{message:"Must be a Buffer"})]),Ud=zS.lazy(()=>zS.union([zS.null(),zS.string(),zS.number(),zS.boolean(),zS.record(zS.string(),Ud.optional()),zS.array(Ud)])),Uc=zS.record(zS.string(),zS.record(zS.string(),Ud.optional())),Up=zS.object({type:zS.literal("text"),text:zS.string(),providerOptions:Uc.optional()}),Um=zS.object({type:zS.literal("image"),image:zS.union([Uu,zS.instanceof(URL)]),mediaType:zS.string().optional(),providerOptions:Uc.optional()}),Uf=zS.object({type:zS.literal("file"),data:zS.union([Uu,zS.instanceof(URL)]),filename:zS.string().optional(),mediaType:zS.string(),providerOptions:Uc.optional()}),Uh=zS.object({type:zS.literal("reasoning"),text:zS.string(),providerOptions:Uc.optional()}),Ug=zS.object({type:zS.literal("tool-call"),toolCallId:zS.string(),toolName:zS.string(),input:zS.unknown(),providerOptions:Uc.optional(),providerExecuted:zS.boolean().optional()}),Uv=zS.discriminatedUnion("type",[zS.object({type:zS.literal("text"),value:zS.string(),providerOptions:Uc.optional()}),zS.object({type:zS.literal("json"),value:Ud,providerOptions:Uc.optional()}),zS.object({type:zS.literal("execution-denied"),reason:zS.string().optional(),providerOptions:Uc.optional()}),zS.object({type:zS.literal("error-text"),value:zS.string(),providerOptions:Uc.optional()}),zS.object({type:zS.literal("error-json"),value:Ud,providerOptions:Uc.optional()}),zS.object({type:zS.literal("content"),value:zS.array(zS.union([zS.object({type:zS.literal("text"),text:zS.string(),providerOptions:Uc.optional()}),zS.object({type:zS.literal("media"),data:zS.string(),mediaType:zS.string()}),zS.object({type:zS.literal("file-data"),data:zS.string(),mediaType:zS.string(),filename:zS.string().optional(),providerOptions:Uc.optional()}),zS.object({type:zS.literal("file-url"),url:zS.string(),providerOptions:Uc.optional()}),zS.object({type:zS.literal("file-id"),fileId:zS.union([zS.string(),zS.record(zS.string(),zS.string())]),providerOptions:Uc.optional()}),zS.object({type:zS.literal("image-data"),data:zS.string(),mediaType:zS.string(),providerOptions:Uc.optional()}),zS.object({type:zS.literal("image-url"),url:zS.string(),providerOptions:Uc.optional()}),zS.object({type:zS.literal("image-file-id"),fileId:zS.union([zS.string(),zS.record(zS.string(),zS.string())]),providerOptions:Uc.optional()}),zS.object({type:zS.literal("custom"),providerOptions:Uc.optional()})]))})]),Uy=zS.object({type:zS.literal("tool-result"),toolCallId:zS.string(),toolName:zS.string(),output:Uv,providerOptions:Uc.optional()}),Ub=zS.object({type:zS.literal("tool-approval-request"),approvalId:zS.string(),toolCallId:zS.string()}),Ux=zS.object({type:zS.literal("tool-approval-response"),approvalId:zS.string(),approved:zS.boolean(),reason:zS.string().optional()}),U_=zS.object({role:zS.literal("system"),content:zS.string(),providerOptions:Uc.optional()}),Uw=zS.object({role:zS.literal("user"),content:zS.union([zS.string(),zS.array(zS.union([Up,Um,Uf]))]),providerOptions:Uc.optional()}),Uk=zS.object({role:zS.literal("assistant"),content:zS.union([zS.string(),zS.array(zS.union([Up,Uf,Uh,Ug,Uy,Ub]))]),providerOptions:Uc.optional()}),UI=zS.object({role:zS.literal("tool"),content:zS.array(zS.union([Uy,Ux])),providerOptions:Uc.optional()});zS.union([U_,Uw,Uk,UI]);var US={},U$={array:()=>UN,choice:()=>UA,json:()=>UR,object:()=>UT,text:()=>UC};for(var Uj in U$)D7(US,Uj,{get:U$[Uj],enumerable:!0});async function UE(e){if(void 0===e)return{value:void 0,state:"undefined-input"};let t=await CL({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await CL({text:function(e){let t=["ROOT"],r=-1,n=null;function i(e,i,a){switch(e){case'"':r=i,t.pop(),t.push(a),t.push("INSIDE_STRING");break;case"f":case"t":case"n":r=i,n=i,t.pop(),t.push(a),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=i,t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"{":r=i,t.pop(),t.push(a),t.push("INSIDE_OBJECT_START");break;case"[":r=i,t.pop(),t.push(a),t.push("INSIDE_ARRAY_START")}}function a(e,n){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=n,t.pop()}}function o(e,n){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=n,t.pop()}}for(let s=0;s<e.length;s++){let l=e[s];switch(t[t.length-1]){case"ROOT":i(l,s,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":r=s,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===l&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":i(l,s,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":a(l,s);break;case"INSIDE_STRING":switch(l){case'"':t.pop(),r=s;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:r=s}break;case"INSIDE_ARRAY_START":"]"===l?(r=s,t.pop()):(r=s,i(l,s,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(l){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=s,t.pop();break;default:r=s}break;case"INSIDE_ARRAY_AFTER_COMMA":i(l,s,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),r=s;break;case"INSIDE_NUMBER":switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=s;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,s),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&a(l,s);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&a(l,s);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,s);break;default:t.pop()}break;case"INSIDE_LITERAL":{let i=e.substring(n,s+1);"false".startsWith(i)||"true".startsWith(i)||"null".startsWith(i)?r=s:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?a(l,s):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,s))}}}let s=e.slice(0,r+1);for(let r=t.length-1;r>=0;r--)switch(t[r]){case"INSIDE_STRING":s+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":s+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":s+="]";break;case"INSIDE_LITERAL":{let t=e.substring(n,e.length);"true".startsWith(t)?s+="true".slice(t.length):"false".startsWith(t)?s+="false".slice(t.length):"null".startsWith(t)&&(s+="null".slice(t.length))}}return s}(e)})).success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"}}var UC=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),parseCompleteOutput:async({text:e})=>e,parsePartialOutput:async({text:e})=>({partial:e}),createElementStreamTransform(){}}),UT=({schema:e,name:t,description:r})=>{let n=CO(e);return{name:"object",responseFormat:CW(n.jsonSchema).then(e=>({type:"json",schema:e,...null!=t&&{name:t},...null!=r&&{description:r}})),async parseCompleteOutput({text:e},t){let r=await CL({text:e});if(!r.success)throw new Un({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await CD({value:r.value,schema:n});if(!i.success)throw new Un({message:"No object generated: response did not match schema.",cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await UE(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:t.value}}},createElementStreamTransform(){}}},UN=({element:e,name:t,description:r})=>{let n=CO(e);return{name:"array",responseFormat:CW(n.jsonSchema).then(e=>{let{$schema:n,...i}=e;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}}),async parseCompleteOutput({text:e},t){let r=await CL({text:e});if(!r.success)throw new Un({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=r.value;if(null==i||"object"!=typeof i||!("elements"in i)||!Array.isArray(i.elements))throw new Un({message:"No object generated: response did not match schema.",cause:new Ss({value:i,cause:"response must be an object with an elements array"}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(let r of i.elements){let i=await CD({value:r,schema:n});if(!i.success)throw new Un({message:"No object generated: response did not match schema.",cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return i.elements},async parsePartialOutput({text:e}){let t=await UE(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let e=t.value;if(null==e||"object"!=typeof e||!("elements"in e)||!Array.isArray(e.elements))return;let r="repaired-parse"===t.state&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of r){let t=await CD({value:e,schema:n});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},r){if(null!=t)for(;e<t.length;e++)r.enqueue(t[e])}})}}},UA=({options:e,name:t,description:r})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}),async parseCompleteOutput({text:t},r){let n=await CL({text:t});if(!n.success)throw new Un({message:"No object generated: could not parse the response.",cause:n.error,text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});let i=n.value;if(null==i||"object"!=typeof i||!("result"in i)||"string"!=typeof i.result||!e.includes(i.result))throw new Un({message:"No object generated: response did not match schema.",cause:new Ss({value:i,cause:"response must be an object that contains a choice value."}),text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:t}){let r=await UE(t);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let t=r.value;if(null==t||"object"!=typeof t||!("result"in t)||"string"!=typeof t.result)return;let n=e.filter(e=>e.startsWith(t.result));if("successful-parse"===r.state)return n.includes(t.result)?{partial:t.result}:void 0;return 1===n.length?{partial:n[0]}:void 0}}},createElementStreamTransform(){}}),UR=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...null!=e&&{name:e},...null!=t&&{description:t}}),async parseCompleteOutput({text:e},t){let r=await CL({text:e});if(!r.success)throw new Un({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return r.value},async parsePartialOutput({text:e}){let t=await UE(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return void 0===t.value?void 0:{partial:t.value}}},createElementStreamTransform(){}});EY({prefix:"aitxt",size:24}),TransformStream;var UP=zS.record(zS.string(),Ud.optional()),UO=CR(()=>CM(zS.union([zS.strictObject({type:zS.literal("text-start"),id:zS.string(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.literal("text-delta"),id:zS.string(),delta:zS.string(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.literal("text-end"),id:zS.string(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.literal("error"),errorText:zS.string()}),zS.strictObject({type:zS.literal("tool-input-start"),toolCallId:zS.string(),toolName:zS.string(),providerExecuted:zS.boolean().optional(),providerMetadata:Uc.optional(),toolMetadata:UP.optional(),dynamic:zS.boolean().optional(),title:zS.string().optional()}),zS.strictObject({type:zS.literal("tool-input-delta"),toolCallId:zS.string(),inputTextDelta:zS.string()}),zS.strictObject({type:zS.literal("tool-input-available"),toolCallId:zS.string(),toolName:zS.string(),input:zS.unknown(),providerExecuted:zS.boolean().optional(),providerMetadata:Uc.optional(),toolMetadata:UP.optional(),dynamic:zS.boolean().optional(),title:zS.string().optional()}),zS.strictObject({type:zS.literal("tool-input-error"),toolCallId:zS.string(),toolName:zS.string(),input:zS.unknown(),providerExecuted:zS.boolean().optional(),providerMetadata:Uc.optional(),toolMetadata:UP.optional(),dynamic:zS.boolean().optional(),errorText:zS.string(),title:zS.string().optional()}),zS.strictObject({type:zS.literal("tool-approval-request"),approvalId:zS.string(),toolCallId:zS.string()}),zS.strictObject({type:zS.literal("tool-output-available"),toolCallId:zS.string(),output:zS.unknown(),providerExecuted:zS.boolean().optional(),providerMetadata:Uc.optional(),toolMetadata:UP.optional(),dynamic:zS.boolean().optional(),preliminary:zS.boolean().optional()}),zS.strictObject({type:zS.literal("tool-output-error"),toolCallId:zS.string(),errorText:zS.string(),providerExecuted:zS.boolean().optional(),providerMetadata:Uc.optional(),toolMetadata:UP.optional(),dynamic:zS.boolean().optional()}),zS.strictObject({type:zS.literal("tool-output-denied"),toolCallId:zS.string()}),zS.strictObject({type:zS.literal("reasoning-start"),id:zS.string(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.literal("reasoning-delta"),id:zS.string(),delta:zS.string(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.literal("reasoning-end"),id:zS.string(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.literal("source-url"),sourceId:zS.string(),url:zS.string(),title:zS.string().optional(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.literal("source-document"),sourceId:zS.string(),mediaType:zS.string(),title:zS.string(),filename:zS.string().optional(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.literal("file"),url:zS.string(),mediaType:zS.string(),providerMetadata:Uc.optional()}),zS.strictObject({type:zS.custom(e=>"string"==typeof e&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:zS.string().optional(),data:zS.unknown(),transient:zS.boolean().optional()}),zS.strictObject({type:zS.literal("start-step")}),zS.strictObject({type:zS.literal("finish-step")}),zS.strictObject({type:zS.literal("start"),messageId:zS.string().optional(),messageMetadata:zS.unknown().optional()}),zS.strictObject({type:zS.literal("finish"),finishReason:zS.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:zS.unknown().optional()}),zS.strictObject({type:zS.literal("abort"),reason:zS.string().optional()}),zS.strictObject({type:zS.literal("message-metadata"),messageMetadata:zS.unknown()})])));function UM(e){return e.type.startsWith("tool-")}function Uz(e){return"dynamic-tool"===e.type}function UD(e){return UM(e)||Uz(e)}function UU(e){return e.type.split("-").slice(1).join("-")}async function UL({stream:e,onError:t}){let r=e.getReader();try{for(;;){let{done:e}=await r.read();if(e)break}}catch(e){null==t||t(e)}finally{r.releaseLock()}}EY({prefix:"aitxt",size:24});var UZ=zS.record(zS.string(),Ud.optional());function UF(e){return({url:t,abortSignal:r})=>Ul({url:t,maxBytes:null==e?void 0:e.maxBytes,abortSignal:r})}CR(()=>CM(zS.array(zS.object({id:zS.string(),role:zS.enum(["system","user","assistant"]),metadata:zS.unknown().optional(),parts:zS.array(zS.union([zS.object({type:zS.literal("text"),text:zS.string(),state:zS.enum(["streaming","done"]).optional(),providerMetadata:Uc.optional()}),zS.object({type:zS.literal("reasoning"),text:zS.string(),state:zS.enum(["streaming","done"]).optional(),providerMetadata:Uc.optional()}),zS.object({type:zS.literal("source-url"),sourceId:zS.string(),url:zS.string(),title:zS.string().optional(),providerMetadata:Uc.optional()}),zS.object({type:zS.literal("source-document"),sourceId:zS.string(),mediaType:zS.string(),title:zS.string(),filename:zS.string().optional(),providerMetadata:Uc.optional()}),zS.object({type:zS.literal("file"),mediaType:zS.string(),filename:zS.string().optional(),url:zS.string(),providerMetadata:Uc.optional()}),zS.object({type:zS.literal("step-start")}),zS.object({type:zS.string().startsWith("data-"),id:zS.string().optional(),data:zS.unknown()}),zS.object({type:zS.literal("dynamic-tool"),toolName:zS.string(),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("input-streaming"),input:zS.unknown().optional(),providerExecuted:zS.boolean().optional(),callProviderMetadata:Uc.optional(),output:zS.never().optional(),errorText:zS.never().optional(),approval:zS.never().optional()}),zS.object({type:zS.literal("dynamic-tool"),toolName:zS.string(),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("input-available"),input:zS.unknown(),providerExecuted:zS.boolean().optional(),output:zS.never().optional(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),approval:zS.never().optional()}),zS.object({type:zS.literal("dynamic-tool"),toolName:zS.string(),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("approval-requested"),input:zS.unknown(),providerExecuted:zS.boolean().optional(),output:zS.never().optional(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),approval:zS.object({id:zS.string(),approved:zS.never().optional(),reason:zS.never().optional()})}),zS.object({type:zS.literal("dynamic-tool"),toolName:zS.string(),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("approval-responded"),input:zS.unknown(),providerExecuted:zS.boolean().optional(),output:zS.never().optional(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),approval:zS.object({id:zS.string(),approved:zS.boolean(),reason:zS.string().optional()})}),zS.object({type:zS.literal("dynamic-tool"),toolName:zS.string(),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("output-available"),input:zS.unknown(),providerExecuted:zS.boolean().optional(),output:zS.unknown(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),resultProviderMetadata:Uc.optional(),preliminary:zS.boolean().optional(),approval:zS.object({id:zS.string(),approved:zS.literal(!0),reason:zS.string().optional()}).optional()}),zS.object({type:zS.literal("dynamic-tool"),toolName:zS.string(),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("output-error"),input:zS.unknown().optional(),rawInput:zS.unknown().optional(),providerExecuted:zS.boolean().optional(),output:zS.never().optional(),errorText:zS.string(),callProviderMetadata:Uc.optional(),resultProviderMetadata:Uc.optional(),approval:zS.object({id:zS.string(),approved:zS.literal(!0),reason:zS.string().optional()}).optional()}),zS.object({type:zS.literal("dynamic-tool"),toolName:zS.string(),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("output-denied"),input:zS.unknown(),providerExecuted:zS.boolean().optional(),output:zS.never().optional(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),approval:zS.object({id:zS.string(),approved:zS.literal(!1),reason:zS.string().optional()})}),zS.object({type:zS.string().startsWith("tool-"),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("input-streaming"),providerExecuted:zS.boolean().optional(),callProviderMetadata:Uc.optional(),input:zS.unknown().optional(),output:zS.never().optional(),errorText:zS.never().optional(),approval:zS.never().optional()}),zS.object({type:zS.string().startsWith("tool-"),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("input-available"),providerExecuted:zS.boolean().optional(),input:zS.unknown(),output:zS.never().optional(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),approval:zS.never().optional()}),zS.object({type:zS.string().startsWith("tool-"),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("approval-requested"),input:zS.unknown(),providerExecuted:zS.boolean().optional(),output:zS.never().optional(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),approval:zS.object({id:zS.string(),approved:zS.never().optional(),reason:zS.never().optional()})}),zS.object({type:zS.string().startsWith("tool-"),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("approval-responded"),input:zS.unknown(),providerExecuted:zS.boolean().optional(),output:zS.never().optional(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),approval:zS.object({id:zS.string(),approved:zS.boolean(),reason:zS.string().optional()})}),zS.object({type:zS.string().startsWith("tool-"),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("output-available"),providerExecuted:zS.boolean().optional(),input:zS.unknown(),output:zS.unknown(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),resultProviderMetadata:Uc.optional(),preliminary:zS.boolean().optional(),approval:zS.object({id:zS.string(),approved:zS.literal(!0),reason:zS.string().optional()}).optional()}),zS.object({type:zS.string().startsWith("tool-"),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("output-error"),providerExecuted:zS.boolean().optional(),input:zS.unknown().optional(),rawInput:zS.unknown().optional(),output:zS.never().optional(),errorText:zS.string(),callProviderMetadata:Uc.optional(),resultProviderMetadata:Uc.optional(),approval:zS.object({id:zS.string(),approved:zS.literal(!0),reason:zS.string().optional()}).optional()}),zS.object({type:zS.string().startsWith("tool-"),toolCallId:zS.string(),toolMetadata:UZ.optional(),state:zS.literal("output-denied"),providerExecuted:zS.boolean().optional(),input:zS.unknown(),output:zS.never().optional(),errorText:zS.never().optional(),callProviderMetadata:Uc.optional(),approval:zS.object({id:zS.string(),approved:zS.literal(!1),reason:zS.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty"))),EY({prefix:"aiobj",size:24});var UB=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,r)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){r(e)}}),this.processQueue()})}};async function UV(e){if(null==e)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async e=>{let{name:t,type:r}=e;return{type:"file",mediaType:r,filename:t,url:await new Promise((t,r)=>{let n=new FileReader;n.onload=e=>{var r;t(null==(r=e.target)?void 0:r.result)},n.onerror=e=>r(e),n.readAsDataURL(e)})}}))}EY({prefix:"aiobj",size:24}),UF(),Symbol.for("vercel.ai.error.AI_NoSuchProviderError"),UF();var Uq=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:n,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=r,this.body=n,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){var r,n,i,a,o;let s=await CW(this.body),l=await CW(this.headers),u=await CW(this.credentials),d={...E6(l),...E6(t.headers)},c=await (null==(r=this.prepareSendMessagesRequest)?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...s,...t.body},headers:d,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=null!=(n=null==c?void 0:c.api)?n:this.api,m=(null==c?void 0:c.headers)!==void 0?E6(c.headers):d,f=(null==c?void 0:c.body)!==void 0?c.body:{...s,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},h=null!=(i=null==c?void 0:c.credentials)?i:u,g=null!=(a=this.fetch)?a:globalThis.fetch,v=await g(p,{method:"POST",headers:{"Content-Type":"application/json",...m},body:JSON.stringify(f),credentials:h,signal:e});if(!v.ok)throw Error(null!=(o=await v.text())?o:"Failed to fetch the chat response.");if(!v.body)throw Error("The response body is empty.");return this.processResponseStream(v.body)}async reconnectToStream(e){var t,r,n,i,a;let o=await CW(this.body),s=await CW(this.headers),l=await CW(this.credentials),u={...E6(s),...E6(e.headers)},d=await (null==(t=this.prepareReconnectToStreamRequest)?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...o,...e.body},headers:u,credentials:l,requestMetadata:e.metadata})),c=null!=(r=null==d?void 0:d.api)?r:`${this.api}/${e.chatId}/stream`,p=(null==d?void 0:d.headers)!==void 0?E6(d.headers):u,m=null!=(n=null==d?void 0:d.credentials)?n:l,f=null!=(i=this.fetch)?i:globalThis.fetch,h=await f(c,{method:"GET",headers:p,credentials:m});if(204===h.status)return null;if(!h.ok)throw Error(null!=(a=await h.text())?a:"Failed to fetch the chat response.");if(!h.body)throw Error("The response body is empty.");return this.processResponseStream(h.body)}},UW=class extends Uq{constructor(e={}){super(e)}processResponseStream(e){return CZ({stream:e,schema:UO}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},UJ=class{constructor({generateId:e=EX,id:t=e(),transport:r=new UW,messageMetadataSchema:n,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:l,onData:u,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new UB,this.sendMessage=async(e,t)=>{var r,n,i,a;let o;if(null==e)return void await this.makeRequest({trigger:"submit-message",messageId:null==(r=this.lastMessage)?void 0:r.id,...t});if(o="text"in e||"files"in e?{parts:[...Array.isArray(e.files)?e.files:await UV(e.files),..."text"in e&&null!=e.text?[{type:"text",text:e.text}]:[]]}:e,null!=e.messageId){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(-1===t)throw Error(`message with id ${e.messageId} not found`);if("user"!==this.state.messages[t].role)throw Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...o,id:e.messageId,role:null!=(n=o.role)?n:"user",metadata:e.metadata})}else this.state.pushMessage({...o,id:null!=(i=o.id)?i:this.generateId(),role:null!=(a=o.role)?a:"user",metadata:e.metadata});await this.makeRequest({trigger:"submit-message",messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let r=null==e?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(-1===r)throw Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,"assistant"===this.messages[r].role?r:r+1),await this.makeRequest({trigger:"regenerate-message",messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:"resume-stream",...e})},this.clearError=()=>{"error"===this.status&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:r,options:n})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=i[i.length-1],o=n=>UD(n)&&"approval-requested"===n.state&&n.approval.id===e?{...n,state:"approval-responded",approval:{id:e,approved:t,reason:r}}:n;this.state.replaceMessage(i.length-1,{...a,parts:a.parts.map(o)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{var t;e&&this.makeRequest({trigger:"submit-message",messageId:null==(t=this.lastMessage)?void 0:t.id,...n})})}),this.addToolOutput=async({state:e="output-available",toolCallId:t,output:r,errorText:n,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=a[a.length-1],s=i=>UD(i)&&i.toolCallId===t?{...i,state:e,output:r,errorText:n}:i;this.state.replaceMessage(a.length-1,{...o,parts:o.parts.map(s)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{var t;e&&this.makeRequest({trigger:"submit-message",messageId:null==(t=this.lastMessage)?void 0:t.id,...i})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var e;("streaming"===this.status||"submitted"===this.status)&&(null==(e=this.activeResponse)?void 0:e.abortController)&&this.activeResponse.abortController.abort()},this.id=t,this.transport=r,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=l,this.onData=u,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&"object"==typeof e&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:r,body:n,messageId:i}){var a,o,s;let l;if("resume-stream"===e)try{let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:n});if(null==e)return;l=e}catch(e){this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e});return}this.setStatus({status:"submitted",error:void 0});let u=this.lastMessage,d=!1,c=!1,p=!1;try{let a,o={state:function({lastMessage:e,messageId:t}){return{message:(null==e?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};o.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=o,a="resume-stream"===e?l:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:o.abortController.signal,metadata:t,headers:r,body:n,trigger:e,messageId:i});let s=e=>this.jobExecutor.run(()=>e({state:o.state,write:()=>{var e;this.setStatus({status:"streaming"}),o.state.message.id===(null==(e=this.lastMessage)?void 0:e.id)?this.state.replaceMessage(this.state.messages.length-1,o.state.message):this.state.pushMessage(o.state.message)}}));await UL({stream:function({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:n,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await n(async({state:n,write:l})=>{var u,d,c,p;function m(e){let t=n.message.parts.filter(UD).find(t=>t.toolCallId===e);if(null==t)throw new Us({chunkType:"tool-invocation",chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function f(e){var t;let r=n.message.parts.find(t=>UM(t)&&t.toolCallId===e.toolCallId);if(null!=r){r.state=e.state,r.input=e.input,r.output=e.output,r.errorText=e.errorText,r.rawInput=e.rawInput,r.preliminary=e.preliminary,void 0!==e.title&&(r.title=e.title),void 0!==e.toolMetadata&&(r.toolMetadata=e.toolMetadata),r.providerExecuted=null!=(t=e.providerExecuted)?t:r.providerExecuted;let n=e.providerMetadata;null!=n&&("output-available"===e.state||"output-error"===e.state?r.resultProviderMetadata=n:r.callProviderMetadata=n)}else n.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,...void 0!==e.toolMetadata?{toolMetadata:e.toolMetadata}:{},input:e.input,output:e.output,rawInput:e.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,preliminary:e.preliminary,...null!=e.providerMetadata&&("output-available"===e.state||"output-error"===e.state)?{resultProviderMetadata:e.providerMetadata}:{},...null!=e.providerMetadata&&"output-available"!==e.state&&"output-error"!==e.state?{callProviderMetadata:e.providerMetadata}:{}})}function h(e){var t,r;let i=n.message.parts.find(t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId);if(null!=i){i.state=e.state,i.toolName=e.toolName,i.input=e.input,i.output=e.output,i.errorText=e.errorText,i.rawInput=null!=(t=e.rawInput)?t:i.rawInput,i.preliminary=e.preliminary,void 0!==e.title&&(i.title=e.title),void 0!==e.toolMetadata&&(i.toolMetadata=e.toolMetadata),i.providerExecuted=null!=(r=e.providerExecuted)?r:i.providerExecuted;let n=e.providerMetadata;null!=n&&("output-available"===e.state||"output-error"===e.state?i.resultProviderMetadata=n:i.callProviderMetadata=n)}else n.message.parts.push({type:"dynamic-tool",toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:e.input,output:e.output,errorText:e.errorText,preliminary:e.preliminary,providerExecuted:e.providerExecuted,title:e.title,...void 0!==e.toolMetadata?{toolMetadata:e.toolMetadata}:{},...null!=e.providerMetadata&&("output-available"===e.state||"output-error"===e.state)?{resultProviderMetadata:e.providerMetadata}:{},...null!=e.providerMetadata&&"output-available"!==e.state&&"output-error"!==e.state?{callProviderMetadata:e.providerMetadata}:{}})}async function g(e){if(null!=e){let r=null!=n.message.metadata?function e(t,r){if(void 0===t&&void 0===r)return;if(void 0===t)return r;if(void 0===r)return t;let n={...t};for(let i in r)if("__proto__"!==i&&"constructor"!==i&&"prototype"!==i&&Object.prototype.hasOwnProperty.call(r,i)){let a=r[i];if(void 0===a)continue;let o=i in t?t[i]:void 0,s=null!==a&&"object"==typeof a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp),l=null!=o&&"object"==typeof o&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);s&&l?n[i]=e(o,a):n[i]=a}return n}(n.message.metadata,e):e;null!=t&&await Cz({value:r,schema:t,context:{field:"message.metadata",entityId:n.message.id}}),n.message.metadata=r}}switch(e.type){case"text-start":{let t={type:"text",text:"",providerMetadata:e.providerMetadata,state:"streaming"};n.activeTextParts[e.id]=t,n.message.parts.push(t),l();break}case"text-delta":{let t=n.activeTextParts[e.id];if(null==t)throw new Us({chunkType:"text-delta",chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=null!=(u=e.providerMetadata)?u:t.providerMetadata,l();break}case"text-end":{let t=n.activeTextParts[e.id];if(null==t)throw new Us({chunkType:"text-end",chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state="done",t.providerMetadata=null!=(d=e.providerMetadata)?d:t.providerMetadata,delete n.activeTextParts[e.id],l();break}case"reasoning-start":{let t={type:"reasoning",text:"",providerMetadata:e.providerMetadata,state:"streaming"};n.activeReasoningParts[e.id]=t,n.message.parts.push(t),l();break}case"reasoning-delta":{let t=n.activeReasoningParts[e.id];if(null==t)throw new Us({chunkType:"reasoning-delta",chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=null!=(c=e.providerMetadata)?c:t.providerMetadata,l();break}case"reasoning-end":{let t=n.activeReasoningParts[e.id];if(null==t)throw new Us({chunkType:"reasoning-end",chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=null!=(p=e.providerMetadata)?p:t.providerMetadata,t.state="done",delete n.activeReasoningParts[e.id],l();break}case"file":n.message.parts.push({type:"file",mediaType:e.mediaType,url:e.url,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}),l();break;case"source-url":n.message.parts.push({type:"source-url",sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),l();break;case"source-document":n.message.parts.push({type:"source-document",sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),l();break;case"tool-input-start":{let t=n.message.parts.filter(UM);n.partialToolCalls[e.toolCallId]={text:"",toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title,toolMetadata:e.toolMetadata},e.dynamic?h({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}),l();break}case"tool-input-delta":{let t=n.partialToolCalls[e.toolCallId];if(null==t)throw new Us({chunkType:"tool-input-delta",chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let{value:r}=await UE(t.text);t.dynamic?h({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title,toolMetadata:t.toolMetadata}),l();break}case"tool-input-available":e.dynamic?h({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}),l(),a&&!e.providerExecuted&&await a({toolCall:e});break;case"tool-input-error":{let t=n.message.parts.filter(UD).find(t=>t.toolCallId===e.toolCallId);(null!=t?"dynamic-tool"===t.type:e.dynamic)?h({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}):f({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}),l();break}case"tool-approval-request":{let t=m(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId},l();break}case"tool-output-denied":m(e.toolCallId).state="output-denied",l();break;case"tool-output-available":{let t=m(e.toolCallId);"dynamic-tool"===t.type?h({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-available",input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:UU(t),state:"output-available",input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}),l();break}case"tool-output-error":{let t=m(e.toolCallId);"dynamic-tool"===t.type?h({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-error",input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}):f({toolCallId:e.toolCallId,toolName:UU(t),state:"output-error",input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:t.toolMetadata}),l();break}case"start-step":n.message.parts.push({type:"step-start"});break;case"finish-step":n.activeTextParts={},n.activeReasoningParts={};break;case"start":null!=e.messageId&&(n.message.id=e.messageId),await g(e.messageMetadata),(null!=e.messageId||null!=e.messageMetadata)&&l();break;case"finish":null!=e.finishReason&&(n.finishReason=e.finishReason),await g(e.messageMetadata),null!=e.messageMetadata&&l();break;case"message-metadata":await g(e.messageMetadata),null!=e.messageMetadata&&l();break;case"error":null==i||i(Error(e.errorText));break;default:if(e.type.startsWith("data-")){if((null==r?void 0:r[e.type])!=null){let t=n.message.parts.findIndex(t=>"id"in t&&"data"in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:n.message.parts.length;await Cz({value:e.data,schema:r[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}if(e.transient){null==o||o(e);break}let t=null!=e.id?n.message.parts.find(t=>e.type===t.type&&e.id===t.id):void 0;null!=t?t.data=e.data:n.message.parts.push(e),null==o||o(e),l()}}s.enqueue(e)})}}))}({stream:a,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:s,onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:"ready"})}catch(e){if(d||"AbortError"===e.name)return d=!0,this.setStatus({status:"ready"}),null;p=!0,e instanceof TypeError&&(e.message.toLowerCase().includes("fetch")||e.message.toLowerCase().includes("network"))&&(c=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e})}finally{try{null==(o=this.onFinish)||o.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:c,isError:p,finishReason:null==(a=this.activeResponse)?void 0:a.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}!p&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:null==(s=this.lastMessage)?void 0:s.id,metadata:t,headers:r,body:n})}};function UH({messages:e}){let t=e[e.length-1];if(!t||"assistant"!==t.role)return!1;let r=t.parts.reduce((e,t,r)=>"step-start"===t.type?r:e,-1),n=t.parts.slice(r+1).filter(UD).filter(e=>!e.providerExecuted);return n.length>0&&n.every(e=>"output-available"===e.state||"output-error"===e.state)}function UK(e){return"object"==typeof e&&null!==e&&"~standard"in e&&"object"==typeof e["~standard"]}function UG(e,t){return!t.disabled&&"backend"!==t.type}class UY extends UW{runtime;getThreadListItem;resumable;constructor(e){const{resumable:t,...r}=e??{},n=r.fetch,i=r.prepareReconnectToStreamRequest;super({...r,...t&&{fetch:function(e,t){let r=t?(e,r)=>t(e,r):globalThis.fetch.bind(globalThis);return async(t,n)=>{let i=await r(t,n),a=i.headers.get("x-resumable-stream-id");if(a&&e.storage.setStreamId(a),!i.body)return i;let o=e.isFinishEvent??UX,s=new TextDecoder,l="",u=new TransformStream({transform(t,r){r.enqueue(t),l+=s.decode(t,{stream:!0}),o(t,l)?(e.storage.clear(),l=""):l.length>4096&&(l=l.slice(-1024))}});return new Response(i.body.pipeThrough(u),{status:i.status,statusText:i.statusText,headers:i.headers})}}(t,n),prepareReconnectToStreamRequest:function(e,t){return async r=>{let n=e.storage.getStreamId();if(!n)throw Error("AssistantChatTransport: no resumable stream id available; nothing to resume");let i="function"==typeof e.resumeApi?e.resumeApi(n):e.resumeApi,a=await t?.({...r,api:i});return{...a,api:a?.api??i}}}(t,i)},prepareSendMessagesRequest:async e=>{let t=this.runtime?.thread.getModelContext(),n=this.getThreadListItem?.()??this.runtime?.threads.mainItem,i=(await n?.initialize())?.remoteId??e.id,a={...e,body:{callSettings:t?.callSettings,system:t?.system,config:t?.config,tools:function(e,t={}){if(!e)return{};let r=t.filter??UG;return Object.fromEntries(Object.entries(e).filter(([e,t])=>r(e,t)&&t.parameters).map(([e,t])=>[e,{...t.description&&{description:t.description},parameters:function(e){if(UK(e)){let t=e["~standard"].toJSONSchema;if("function"==typeof t)return t();let r=e["~standard"].jsonSchema;if("object"==typeof r&&null!==r&&"function"==typeof r.input)return r.input()}if("object"==typeof e&&null!==e&&"toJSONSchema"in e&&"function"==typeof e.toJSONSchema)return e.toJSONSchema();if("object"==typeof e&&null!==e&&"toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();if(UK(e))throw Error("Could not convert schema to JSON Schema. The schema implements Standard Schema but does not support JSON Schema conversion. If you are using Zod, please upgrade to Zod v4 (npm install zod@latest). Alternatively, pass a plain JSON Schema object instead.");return e}(t.parameters)}]))}(t?.tools??{}),...e?.body}},o=await r.prepareSendMessagesRequest?.(a);return{...o,body:o?.body??{...a.body,id:i,messages:e.messages,trigger:e.trigger,messageId:e.messageId,metadata:e.requestMetadata}}}}),this.resumable=t}setRuntime(e){this.runtime=e}getResumableAdapter(){return this.resumable}__internal_setGetThreadListItem(e){this.getThreadListItem=e}}function UX(e,t){return t.includes('"type":"finish"')}var UQ=e.i(61866);e.s(["ERROR_REVALIDATE_EVENT",0,3,"FOCUS_EVENT",0,0,"MUTATE_EVENT",0,2,"RECONNECT_EVENT",0,1],11671);var U0=Object.prototype.hasOwnProperty;let U1=new WeakMap,U2=()=>{},U4=U2(),U6=Object,U5=e=>e===U4,U3=(e,t)=>({...e,...t}),U9={},U8={},U7="undefined",Le=typeof window!=U7,Lt=typeof document!=U7,Lr=Le&&"Deno"in window,Ln=(e,t)=>{let r=U1.get(e);return[()=>!U5(t)&&e.get(t)||U9,n=>{if(!U5(t)){let i=e.get(t);t in U8||(U8[t]=i),r[5](t,U3(i,n),i||U9)}},r[6],()=>!U5(t)&&t in U8?U8[t]:!U5(t)&&e.get(t)||U9]},Li=!0,[La,Lo]=Le&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[U2,U2],Ls={initFocus:e=>(Lt&&document.addEventListener("visibilitychange",e),La("focus",e),()=>{Lt&&document.removeEventListener("visibilitychange",e),Lo("focus",e)}),initReconnect:e=>{let t=()=>{Li=!0,e()},r=()=>{Li=!1};return La("online",t),La("offline",r),()=>{Lo("online",t),Lo("offline",r)}}},Ll=!ek.default.useId,Lu=!Le||Lr,Ld=Lu?ek.useEffect:ek.useLayoutEffect,Lc="u">typeof navigator&&navigator.connection,Lp=!Lu&&Lc&&(["slow-2g","2g"].includes(Lc.effectiveType)||Lc.saveData),Lm=new WeakMap,Lf=(e,t)=>e===`[object ${t}]`,Lh=0,Lg=e=>{let t,r,n=typeof e,i=U6.prototype.toString.call(e),a=Lf(i,"Date"),o=Lf(i,"RegExp"),s=Lf(i,"Object");if(U6(e)!==e||a||o)t=a?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=Lm.get(e))return t;if(t=++Lh+"~",Lm.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=Lg(e[r])+",";Lm.set(e,t)}if(s){t="#";let n=U6.keys(e).sort();for(;!U5(r=n.pop());)U5(e[r])||(t+=r+":"+Lg(e[r])+",");Lm.set(e,t)}}return t},Lv=e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?Lg(e):"",t]},Ly=0,Lb=()=>++Ly;async function Lx(...e){let[t,r,n,i]=e,a=U3({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{}),o=a.populateCache,s=a.rollbackOnError,l=a.optimisticData,u=a.throwOnError;if("function"==typeof r){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(d))}return d(r);async function d(r){let i,[d]=Lv(r);if(!d)return;let[c,p]=Ln(t,d),[m,f,h,g]=U1.get(t),v=()=>{let e=m[d];return("function"==typeof a.revalidate?a.revalidate(c().data,r):!1!==a.revalidate)&&(delete h[d],delete g[d],e&&e[0])?e[0](2).then(()=>c().data):c().data};if(e.length<3)return v();let y=n,b=!1,x=Lb();f[d]=[x,0];let _=!U5(l),w=c(),k=w.data,I=w._c,S=U5(I)?k:I;if(_&&p({data:l="function"==typeof l?l(S,k):l,_c:S}),"function"==typeof y)try{y=y(S)}catch(e){i=e,b=!0}if(y&&"function"==typeof y.then){let e;if(y=await y.catch(e=>{i=e,b=!0}),x!==f[d][0]){if(b)throw i;return y}b&&_&&(e=i,"function"==typeof s?s(e):!1!==s)&&(o=!0,p({data:S,_c:U4}))}if(o&&!b&&("function"==typeof o?p({data:o(y,S),error:U4,_c:U4}):p({data:y,error:U4,_c:U4})),f[d][1]=Lb(),Promise.resolve(v()).then(()=>{p({_c:U4})}),b){if(u)throw i;return}return y}}let L_=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},Lw=(e,t)=>{if(!U1.has(e)){let r=U3(Ls,t),n=Object.create(null),i=Lx.bind(U4,e),a=U2,o=Object.create(null),s=(e,t)=>{let r=o[e]||[];return o[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},l=(t,r,n)=>{e.set(t,r);let i=o[t];if(i)for(let e of i)e(r,n)},u=()=>{if(!U1.has(e)&&(U1.set(e,[n,Object.create(null),Object.create(null),Object.create(null),i,l,s]),!Lu)){let t=r.initFocus(setTimeout.bind(U4,L_.bind(U4,n,0))),i=r.initReconnect(setTimeout.bind(U4,L_.bind(U4,n,1)));a=()=>{t&&t(),i&&i(),U1.delete(e)}}};return u(),[e,i,u,a]}return[e,U1.get(e)[4]]},[Lk,LI]=Lw(new Map),LS=U3({onLoadingSlow:U2,onSuccess:U2,onError:U2,onErrorRetry:(e,t,r,n,i)=>{let a=r.errorRetryCount,o=i.retryCount,s=~~((Math.random()+.5)*(1<<(o<8?o:8)))*r.errorRetryInterval;(U5(a)||!(o>a))&&setTimeout(n,s,i)},onDiscarded:U2,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Lp?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:Lp?5e3:3e3,compare:function e(t,r){var n,i;if(t===r)return!0;if(t&&r&&(n=t.constructor)===r.constructor){if(n===Date)return t.getTime()===r.getTime();if(n===RegExp)return t.toString()===r.toString();if(n===Array){if((i=t.length)===r.length)for(;i--&&e(t[i],r[i]););return -1===i}if(!n||"object"==typeof t){for(n in i=0,t)if(U0.call(t,n)&&++i&&!U0.call(r,n)||!(n in r)||!e(t[n],r[n]))return!1;return Object.keys(r).length===i}}return t!=t&&r!=r},isPaused:()=>!1,cache:Lk,mutate:LI,fallback:{}},{isOnline:()=>Li,isVisible:()=>{let e=Lt&&document.visibilityState;return U5(e)||"hidden"!==e}}),L$=(0,ek.createContext)({});e.i(11671);let Lj=Le&&window.__SWR_DEVTOOLS_USE__;(Lj?window.__SWR_DEVTOOLS_USE__:[]).concat(e=>(t,r,n)=>{let i=r&&((...e)=>{let[n]=Lv(t),[,,,i]=U1.get(Lk);if(n.startsWith("$inf$"))return r(...e);let a=i[n];return U5(a)?r(...e):(delete i[n],a)});return e(t,i,n)}),Lj&&(window.__SWR_DEVTOOLS_REACT__=ek.default);let LE=()=>{},LC=LE(),LT=(new WeakMap,ek.default.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}})),LN={dedupe:!0},LA=Promise.resolve(U4);U6.defineProperty(e=>{let{value:t}=e,r=(0,ek.useContext)(L$),n="function"==typeof t,i=(0,ek.useMemo)(()=>n?t(r):t,[n,r,t]),a=(0,ek.useMemo)(()=>n?i:((e,t)=>{let r=U3(e,t);if(t){let{use:n,fallback:i}=e,{use:a,fallback:o}=t;n&&a&&(r.use=n.concat(a)),i&&o&&(r.fallback=U3(i,o))}return r})(r,i),[n,r,i]),o=i&&i.provider,s=(0,ek.useRef)(U4);o&&!s.current&&(s.current=Lw(o(a.cache||Lk),i));let l=s.current;return l&&(a.cache=l[0],a.mutate=l[1]),Ld(()=>{if(l)return l[2]&&l[2](),l[3]},[]),(0,ek.createElement)(L$.Provider,U3(e,{value:a}))},"defaultValue",{value:LS});var LR=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},LP=(e,t,r)=>(LR(e,t,"read from private field"),r?r.call(e):t.get(e)),LO=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},LM=(e,t,r,n)=>(LR(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Lz=class{constructor(e=[]){LO(this,ec,void 0),LO(this,ep,"ready"),LO(this,em,void 0),LO(this,ef,new Set),LO(this,eh,new Set),LO(this,eg,new Set),this.pushMessage=e=>{LM(this,ec,LP(this,ec).concat(e)),LP(this,ev).call(this)},this.popMessage=()=>{LM(this,ec,LP(this,ec).slice(0,-1)),LP(this,ev).call(this)},this.replaceMessage=(e,t)=>{LM(this,ec,[...LP(this,ec).slice(0,e),this.snapshot(t),...LP(this,ec).slice(e+1)]),LP(this,ev).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,t)=>{let r=t?null!=t?(0,UQ.default)(e,t):e:e;return LP(this,ef).add(r),()=>{LP(this,ef).delete(r)}},this["~registerStatusCallback"]=e=>(LP(this,eh).add(e),()=>{LP(this,eh).delete(e)}),this["~registerErrorCallback"]=e=>(LP(this,eg).add(e),()=>{LP(this,eg).delete(e)}),LO(this,ev,()=>{LP(this,ef).forEach(e=>e())}),LO(this,ey,()=>{LP(this,eh).forEach(e=>e())}),LO(this,eb,()=>{LP(this,eg).forEach(e=>e())}),LM(this,ec,e)}get status(){return LP(this,ep)}set status(e){LM(this,ep,e),LP(this,ey).call(this)}get error(){return LP(this,em)}set error(e){LM(this,em,e),LP(this,eb).call(this)}get messages(){return LP(this,ec)}set messages(e){LM(this,ec,[...e]),LP(this,ev).call(this)}};ec=new WeakMap,ep=new WeakMap,em=new WeakMap,ef=new WeakMap,eh=new WeakMap,eg=new WeakMap,ev=new WeakMap,ey=new WeakMap,eb=new WeakMap;var LD=class extends UJ{constructor({messages:e,...t}){const r=new Lz(e);super({...t,state:r}),LO(this,ex,void 0),this["~registerMessagesCallback"]=(e,t)=>LP(this,ex)["~registerMessagesCallback"](e,t),this["~registerStatusCallback"]=e=>LP(this,ex)["~registerStatusCallback"](e),this["~registerErrorCallback"]=e=>LP(this,ex)["~registerErrorCallback"](e),LM(this,ex,r)}};ex=new WeakMap;let LU=Object.freeze([]),LL="DEFAULT_THREAD_ID",LZ=Object.freeze([LL]),LF=Object.freeze({id:LL,remoteId:void 0,externalId:void 0,status:"regular"}),LB=Promise.resolve(),LV=Object.freeze({[LL]:LF});class Lq{threadFactory;_mainThreadId=LL;_threads=LZ;_archivedThreads=LU;_threadData=LV;adapter={};get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return LB}_mainThread;get mainThreadId(){return this._mainThreadId}constructor(e={},t){this.threadFactory=t,this.__internal_setAdapter(e,!0)}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw Error("Method not implemented.")}getItemById(e){return this._threadData[e]}__internal_setAdapter(e,t=!1){let r=this.adapter;this.adapter=e;let n=e.threadId??LL,i=e.threads??LU,a=e.archivedThreads??LU,o=r.threadId??LL,s=r.threads??LU,l=r.archivedThreads??LU;(t||o!==n||s!==i||l!==a)&&((s!==i||l!==a||o!==n)&&(this._threadData={...LV,...Object.fromEntries(e.threads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"regular"}])??[]),...Object.fromEntries(e.archivedThreads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"archived"}])??[])}),s!==i&&(this._threads=this.adapter.threads?.map(e=>e.id)??LU),l!==a&&(this._archivedThreads=this.adapter.archivedThreads?.map(e=>e.id)??LU),(t||o!==n)&&(this._mainThreadId=n,this._mainThread=this.threadFactory()),this._threadData[this._mainThreadId]||(this._threadData={...this._threadData,[this._mainThreadId]:{id:this._mainThreadId,remoteId:void 0,externalId:void 0,status:"regular"}}),this._notifySubscribers())}async switchToThread(e){if(this._mainThreadId===e)return;let t=this.adapter.onSwitchToThread;if(!t)throw Error("External store adapter does not support switching to thread");await t(e)}async switchToNewThread(){let e=this.adapter.onSwitchToNewThread;if(!e)throw Error("External store adapter does not support switching to new thread");await e()}async rename(e,t){let r=this.adapter.onRename;if(!r)throw Error("External store adapter does not support renaming");await r(e,t)}async detach(){}async archive(e){let t=this.adapter.onArchive;if(!t)throw Error("External store adapter does not support archiving");await t(e)}async unarchive(e){let t=this.adapter.onUnarchive;if(!t)throw Error("External store adapter does not support unarchiving");await t(e)}async delete(e){let t=this.adapter.onDelete;if(!t)throw Error("External store adapter does not support deleting");await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error("Method not implemented.")}_subscriptions=new Set;subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(let e of this._subscriptions)e()}}class LW{cache=new WeakMap;convertMessages(e,t){return e.map((e,r)=>{let n=t(this.cache.get(e),e,r);return this.cache.set(e,n),n})}}let LJ=Object.freeze([]),LH=(e,t)=>{let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n of r)if(e[n]!==t[n])return!1;return!0};class LK extends hE{_assistantOptimisticId=null;_lastSyncedMessageIds=new Set;_capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1};get capabilities(){return this._capabilities}_messages;isDisabled;isSendDisabled;get isLoading(){return this._store.isLoading??!1}get isRunning(){return this._store.isRunning}_getBaseMessages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}suggestions=[];extras=void 0;_converter=new LW;_store;beginEdit(e){if(!this._store.onEdit)throw Error("Runtime does not support editing.");super.beginEdit(e)}constructor(e,t){super(e),this.__internal_setAdapter(t)}__internal_setAdapter(e){let t,r;if(this._store===e)return;let n=e.isRunning??!1;this.isDisabled=e.isDisabled??!1,this.isSendDisabled=e.isSendDisabled??!1;let i=this._store;this._store=e,this.extras!==e.extras&&(this.extras=e.extras);let a=e.suggestions??LJ;LH(this.suggestions,a)||(this.suggestions=a);let o={switchToBranch:void 0!==this._store.setMessages,switchBranchDuringRun:!1,edit:void 0!==this._store.onEdit,reload:void 0!==this._store.onReload,cancel:void 0!==this._store.onCancel,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,voice:this._store.adapters?.voice!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback,queue:!1};if(LH(this._capabilities,o)||(this._capabilities=o),e.messageRepository){if(i&&i.isRunning===e.isRunning&&i.messageRepository===e.messageRepository)return void this._notifySubscribers();this.repository.clear(),this._assistantOptimisticId=null,this._lastSyncedMessageIds=new Set,this.repository.import(e.messageRepository),t=this.repository.getMessages()}else if(e.messages){if(i){if(i.convertMessage!==e.convertMessage)this._converter=new LW;else if(i.isRunning===e.isRunning&&i.messages===e.messages)return void this._notifySubscribers()}let r=new Set((t=e.convertMessage?this._converter.convertMessages(e.messages,(t,r,i)=>{if(!e.convertMessage)return r;let a=fG(i===(e.messages?.length??0)-1,n,!1,!1,void 0);if(t&&("assistant"!==t.role||!fK(t.status)||t.status===a))return t;let o=f4(e.convertMessage(r,i),i.toString(),a);return hn(o,r),o}):e.messages).map(e=>e.id));for(let e of this._lastSyncedMessageIds)r.has(e)||this.repository.deleteMessage(e);this._lastSyncedMessageIds=r;for(let e=0;e<t.length;e++){let r=t[e],n=t[e-1];this.repository.addOrUpdateMessage(n?.id??null,r)}}else throw Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");t.length>0&&this.ensureInitialized(),(i?.isRunning??!1)!==(e.isRunning??!1)&&(e.isRunning?this._notifyEventSubscribers("runStart",{}):this._notifyEventSubscribers("runEnd",{})),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null),r=t,n&&r[r.length-1]?.role!=="assistant"&&(this._assistantOptimisticId=this.repository.appendOptimisticMessage(t.at(-1)?.id??null,{role:"assistant",content:[]})),this.repository.resetHead(this._assistantOptimisticId??t.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._notifySubscribers()}switchToBranch(e){if(!this._store.setMessages)throw Error("Runtime does not support switching branches.");this._store.isRunning||(this.repository.switchToBranch(e),this.updateMessages(this.repository.getMessages()))}async append(e){if(e.parentId!==(this.messages.at(-1)?.id??null)){if(!this._store.onEdit)throw Error("Runtime does not support editing messages.");await this._store.onEdit(e)}else await this._store.onNew(e)}async startRun(e){if(!this._store.onReload)throw Error("Runtime does not support reloading messages.");await this._store.onReload(e.parentId,e)}async resumeRun(e){if(!this._store.onResume)throw Error("Runtime does not support resuming runs.");await this._store.onResume(e)}exportExternalState(){if(!this._store.onExportExternalState)throw Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(e){if(!this._store.onLoadExternalState)throw Error("Runtime does not support importing external states.");this._store.onLoadExternalState(e)}cancelRun(){if(!this._store.onCancel)throw Error("Runtime does not support cancelling runs.");this._store.onCancel(),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null);let e=this.repository.getMessages(),t=e[e.length-1];t?.role==="user"&&t.id===e.at(-1)?.id?(this.repository.deleteMessage(t.id),this._lastSyncedMessageIds.delete(t.id),this.composer.text.trim()||this.composer.setText(ha(t)),e=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(e)},0)}addToolResult(e){if(!this._store.onAddToolResult&&!this._store.onAddToolResult)throw Error("Runtime does not support tool results.");this._store.onAddToolResult?.(e)}resumeToolCall(e){if(!this._store.onResumeToolCall)throw Error("Runtime does not support resuming tool calls.");this._store.onResumeToolCall(e)}reset(e){this._lastSyncedMessageIds=new Set;let t=new f9;t.import(f6(e??[])),this.updateMessages(t.getMessages())}import(e){this._assistantOptimisticId=null,this._lastSyncedMessageIds=new Set,super.import(e),this._store.onImport&&this._store.onImport(this.repository.getMessages())}updateMessages=e=>{void 0!==this._store.convertMessage?this._store.setMessages?.(e.flatMap(hi)):this._store.setMessages?.(e)}}let LG=e=>e.adapters?.threadList??{};class LY extends f8{threads;constructor(e){super(),this.threads=new Lq(LG(e),()=>new LK(this._contextProvider,e))}setAdapter(e){this.threads.__internal_setAdapter(LG(e)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(e)}}let LX=(e,t)=>{if(null==t)return[];let r=e.findIndex(e=>e.id===t);if(-1===r)throw Error("useVercelAIThreadState: Message not found. This is likely an internal bug in assistant-ui.");for(;e[r+1]?.role==="assistant";)r++;return e.slice(0,r+1)},LQ=e=>{let t=[...e.content.filter(e=>"file"!==e.type),...e.attachments?.flatMap(e=>e.content.map(t=>({...t,filename:e.name})))??[]].map(e=>{switch(e.type){case"text":return{type:"text",text:e.text};case"image":return{type:"file",url:e.image,...e.filename&&{filename:e.filename},mediaType:"image/png"};case"file":return{type:"file",url:e.data,mediaType:e.mimeType,...e.filename&&{filename:e.filename}};default:throw Error(`Unsupported part type: ${e.type}`)}});return{role:e.role,parts:t,metadata:e.metadata}},L0={accept:"*",add:async({file:e})=>({id:EX(),type:e.type.startsWith("image/")?"image":"file",name:e.name,file:e,contentType:e.type,content:[],status:{type:"requires-action",reason:"composer-send"}}),send:async e=>{let t;return{...e,status:{type:"complete"},content:[{type:"file",mimeType:e.contentType??"",filename:e.name,data:await (t=e.file,new Promise((e,r)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=e=>r(e),n.readAsDataURL(t)}))}]}},async remove(){}},L1=e=>hi(e),L2=(e,t)=>({[he]:[...e[he]??[],...t[he]??[]]}),L4=e=>{let t={role:"assistant",content:[]};for(let r of e)if("tool"===r.role){let e=t.content.findIndex(e=>"tool-call"===e.type&&e.toolCallId===r.toolCallId);if(-1!==e){let n=t.content[e];if(void 0!==r.toolName&&n.toolName!==r.toolName)throw Error(`Tool call name ${r.toolCallId} ${r.toolName} does not match existing tool call ${n.toolName}`);t.content[e]={...n,...{[he]:[...n[he]??[],r]},result:r.result,artifact:r.artifact,isError:r.isError,messages:r.messages}}}else{let e=r.role,n=("string"==typeof r.content?[{type:"text",text:r.content}]:r.content).map(e=>({...e,...{[he]:[r]}}));switch(e){case"system":case"user":return{...r,content:n};case"assistant":for(let e of(0===t.content.length&&(t.id=r.id,t.createdAt??=r.createdAt,t.status??=r.status,r.attachments&&(t.attachments=[...t.attachments??[],...r.attachments]),r.metadata&&(t.metadata??={},r.metadata.unstable_state&&(t.metadata.unstable_state=r.metadata.unstable_state),r.metadata.unstable_annotations&&(t.metadata.unstable_annotations=[...t.metadata.unstable_annotations??[],...r.metadata.unstable_annotations]),r.metadata.unstable_data&&(t.metadata.unstable_data=[...t.metadata.unstable_data??[],...r.metadata.unstable_data]),r.metadata.steps&&(t.metadata.steps=[...t.metadata.steps??[],...r.metadata.steps]),r.metadata.custom&&(t.metadata.custom={...t.metadata.custom??{},...r.metadata.custom}),r.metadata.timing&&(t.metadata.timing=r.metadata.timing),r.metadata.submittedFeedback&&(t.metadata.submittedFeedback=r.metadata.submittedFeedback))),n)){if("tool-call"===e.type){let r=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e.toolCallId);if(-1!==r){let n=t.content[r];t.content[r]={...n,...e,...L2(n,e)};continue}}if("reasoning"===e.type&&"parentId"in e&&e.parentId){let r=t.content.findIndex(t=>"reasoning"===t.type&&"parentId"in t&&t.parentId===e.parentId);if(-1!==r){let n=t.content[r];t.content[r]={...n,text:`${n.text}
101
+
102
+ ${e.text}`,...L2(n,e)};continue}}t.content.push(e)}break;default:throw Error(`Unknown message role: ${e}`)}}return t},L6=(e,t)=>{let r=[],n=!1,i=!1,a=[],o=[],s=()=>{o.length&&r.push({inputs:a,outputs:o}),a=[],o=[],n=!1,i=!1};for(let r of e)for(let e of r.outputs)(i&&"tool"!==e.role||!n||"user"===e.role||"system"===e.role)&&s(),n="assistant"===e.role||"tool"===e.role,a.at(-1)!==r.input&&a.push(r.input),o.push(e),"assistant"===e.role&&(e.convertConfig?.joinStrategy==="none"||"none"===t)&&(i=!0);return s(),r};function L5(e){let t={id:`__error__${fU()}`,role:"assistant",content:[],status:{type:"incomplete",reason:"error",error:e},createdAt:new Date,metadata:{unstable_state:null,unstable_annotations:[],unstable_data:[],custom:{},steps:[]}};return hn(t,[]),t}let L3=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},L9="__aui_modelContent",L8=(e,t,r)=>{if(Array.isArray(e))return e.map((e,n)=>L8(e,`${t}[${n}]`,r));if(e&&"object"==typeof e){let n=Object.keys(e),i=r.get(t)??[],a=new Set(i),o=[...i.filter(t=>Object.hasOwn(e,t)),...n.filter(e=>!a.has(e))];return r.set(t,o),Object.fromEntries(o.map(n=>[n,L8(e[n],`${t}.${n}`,r)]))}return e},L7=(x=(e,t)=>{let r=new Date,n=function(e,t){if(!e.parts||0===e.parts.length)return[];let r=e.parts.filter(t=>"step-start"!==t.type&&("user"!==e.role||"file"!==t.type)).map(r=>{if("text"===r.type)return{type:"text",text:r.text};if("reasoning"===r.type)return{type:"reasoning",text:r.text};if(UD(r)){var n,i,a,o;let s,l,u,d,c=Uz(r)?r.toolName:UU(r),p=r.toolCallId,m=`${e.id}:${p}`,f=r.input;null==f||"object"!=typeof f||Array.isArray(f)?s=t.toolLastInputCache?.get(m)??{}:(s=f,t.toolLastInputCache?.set(m,s));let h=!1;if("output-available"===r.state){let e=null!=(i=n=r.output)&&"object"==typeof i&&L9 in i&&Array.isArray(i[L9])?{result:n.value,modelContent:n[L9]}:{result:n};l=e.result,u=e.modelContent}else"output-error"===r.state?(h=!0,l={error:r.errorText}):"output-denied"===r.state&&(h=!0,l={error:r.approval.reason||"Tool approval denied"});let g=(a=t.toolArgsKeyOrderCache,o=s,d=a?.get(m)??new Map,a?.set(m,d),JSON.stringify(L8(o,"$",d)));"input-streaming"===r.state?g=g.replace(/[}\]"]+$/,""):(t.toolArgsKeyOrderCache?.delete(m),("output-available"===r.state||"output-error"===r.state||"output-denied"===r.state)&&t.toolLastInputCache?.delete(m));let v=t.toolStatuses?.[p],y=function(e,t){let r;if(!e||"object"!=typeof e)return;let n=e.callProviderMetadata,i=n&&"object"==typeof n?n.mcp:void 0,a=i&&"object"==typeof i?i.app:void 0;if(a&&"object"==typeof a)r=a;else{let t=e.output,n=t&&"object"==typeof t?t._meta:void 0,i=n&&"object"==typeof n?n["ui/resourceUri"]:void 0;if("string"!=typeof i)return;r={resourceUri:i}}if("string"!=typeof r.resourceUri||!uL(r.resourceUri))return;let o=t?.get(r.resourceUri);if(o)return t.delete(r.resourceUri),t.set(r.resourceUri,o),o;let s={resourceUri:r.resourceUri};if("string"==typeof r.mimeType&&(s.mimeType=r.mimeType),Array.isArray(r.visibility)&&(s.visibility=r.visibility.filter(e=>"model"===e||"app"===e)),t){if(t.size>=100){let e=t.keys().next().value;void 0!==e&&t.delete(e)}t.set(r.resourceUri,s)}return s}(r,t.mcpAppMetadataCache);return{type:"tool-call",toolName:c,toolCallId:p,argsText:g,args:s,result:l,isError:h,...void 0!==u&&{modelContent:u},...y&&{mcp:{app:y}},..."approval-requested"===r.state&&"approval"in r?{interrupt:{type:"human",payload:r.approval},status:{type:"requires-action",reason:"interrupt"}}:v?.type==="interrupt"?{interrupt:v.payload,status:{type:"requires-action",reason:"interrupt"}}:{}}}return"source-url"===r.type?{type:"source",sourceType:"url",id:r.sourceId,url:r.url,...null!=r.title?{title:r.title}:void 0,...null!=r.providerMetadata?{providerMetadata:r.providerMetadata}:void 0}:"file"===r.type?{type:"file",data:r.url,mimeType:r.mediaType,...null!=r.filename&&{filename:r.filename}}:"source-document"===r.type?{type:"source",sourceType:"document",id:r.sourceId,title:r.title,mediaType:r.mediaType,...null!=r.filename?{filename:r.filename}:void 0,...null!=r.providerMetadata?{providerMetadata:r.providerMetadata}:void 0}:r.type.startsWith("data-")?{type:"data",name:r.type.substring(5),data:r.data}:(console.warn(`Unsupported message part type: ${r.type}`),null)}).filter(Boolean),n=new Set;return r.filter(e=>{if("tool-call"===e.type&&null!=e.toolCallId){if(n.has(e.toolCallId))return!1;n.add(e.toolCallId)}return!0})}(e,t);switch(e.role){case"user":return{role:"user",id:e.id,createdAt:r,content:n,attachments:e.parts?.filter(e=>"file"===e.type).map((e,t)=>({id:t.toString(),type:e.mediaType.startsWith("image/")?"image":"file",name:e.filename??"file",content:[e.mediaType.startsWith("image/")?{type:"image",image:e.url,filename:e.filename}:{type:"file",filename:e.filename,data:e.url,mimeType:e.mediaType}],contentType:e.mediaType??"unknown/unknown",status:{type:"complete"}})),metadata:e.metadata};case"system":case"assistant":{let i=t.messageTiming?.[e.id];return{role:e.role,id:e.id,createdAt:r,content:n,metadata:{...e.metadata,...i&&{timing:i}}}}default:return console.warn(`Unsupported message role: ${e.role}`),[]}},i={useThreadMessages:({messages:e,isRunning:t,joinStrategy:r,metadata:n})=>(({callback:e,messages:t,isRunning:r,joinStrategy:n,metadata:i})=>{let a=(0,ek.useMemo)(()=>({metadata:i??{},callback:e,callbackCache:new WeakMap,chunkCache:new WeakMap,converterCache:new LW}),[e,i]);return(0,ek.useMemo)(()=>{let e=[];for(let r of t){let t=a.callbackCache.get(r);if(!t){let e=a.callback(r,a.metadata);t={input:r,outputs:Array.isArray(e)?e:[e]},a.callbackCache.set(r,t)}e.push(t)}let i=L6(e,n).map(e=>{let t=e.outputs[0];if(!t)return e;let r=a.chunkCache.get(t);return r&&L3(r.outputs,e.outputs)?r:(a.chunkCache.set(t,e),e)}),o=a.converterCache.convertMessages(i,(e,t,n)=>{let o=n===i.length-1,s=L4(t.outputs),l=fG(o,r,"object"==typeof s.content&&s.content.some(e=>"tool-call"===e.type&&void 0===e.result),"object"==typeof s.content&&s.content.some(e=>"tool-call"===e.type&&void 0===e.result),o?a.metadata.error:void 0);if(e&&("assistant"!==e.role||!fK(e.status)||e.status===l)&&L3(hi(e),t.inputs))return e;let u=f4(s,n.toString(),l);return hn(u,t.inputs),u});if(hn(o,t),a.metadata.error){let e=o.at(-1);e&&"assistant"===e.role||o.push(L5(a.metadata.error))}return o},[a,t,r,n])})({callback:x,messages:e,isRunning:t,joinStrategy:r,metadata:n}),toThreadMessages:(e,t=!1,r={})=>((e,t,r,n)=>{let i=[];for(let r of e){let e=t(r,n),a={input:r,outputs:Array.isArray(e)?e:[e]};i.push(a)}let a=L6(i),o=a.map((e,t)=>{let i=t===a.length-1,o=L4(e.outputs),s="object"==typeof o.content&&o.content.some(e=>"tool-call"===e.type&&void 0===e.result),l=fG(i,r,s,s,i?n.error:void 0),u=f4(o,t.toString(),l);return hn(u,e.inputs),u});if(n.error){let e=o.at(-1);e&&"assistant"===e.role||o.push(L5(n.error))}return o})(e,x,t,r),toOriginalMessages:e=>{let t=hi(e);if(0===t.length)throw Error("No original messages found");return t},toOriginalMessage:e=>i.toOriginalMessages(e)[0],useOriginalMessage:()=>i.useOriginalMessages()[0],useOriginalMessages:()=>{let e=tU(),t=ij(t=>{if(e.part.source)return hi(t.part)}),r=ij(e=>hi(e.message)),n=t??r;if(0===n.length)throw Error("No original messages found");return n}}),Ze={format:"ai-sdk/v6",encode:({message:{id:e,parts:t,...r}})=>({...r,parts:t}),decode:e=>({parentId:e.parent_id,message:{id:e.id,...e.content}}),getId:e=>e.id},Zt=(e,t)=>({headId:t.headId,messages:t.messages.map(t=>{let r=e([t.message])[0];return{...t,message:r}})}),Zr=(e,t)=>({...e,id:e.id??EX(),role:e.role??t}),Zn="codex";function Zi(e){return{remoteId:e.threadId,status:"archived"===e.status?"archived":"regular",title:e.title??void 0,custom:{provider:e.provider,model:e.model,modeId:e.modeId,thoughtLevel:e.thoughtLevel,workspacePath:e.workspacePath,providerSessionId:e.providerSessionId??null}}}function Za(e){return e.content.filter(e=>"text"===e.type).map(e=>e.text).join(" ").trim()}function Zo(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function Zs(e,t){let r="string"==typeof e?e.replace(/\s+/g," ").trim():"";return(t?r.slice(0,t):r).trim()}function Zl(e){for(let t of[...e].reverse()){let e=function(e){let t=Zo(e.metadata?.custom)?e.metadata.custom:void 0,r=Zo(t?.acpSessionUpdate)?t.acpSessionUpdate:void 0,n=Zo(r?.session_info_update)?r.session_info_update:void 0;return Zs(n?.title)}(t);if(e)return e}return""}let Zu=()=>{let e=tU(),t=ij(e=>e.threadListItem.remoteId),r=ij(e=>e.threadListItem.title),n=ij(e=>Zl(e.thread.messages)),i=(0,ek.useRef)(null);return(0,ek.useEffect)(()=>{if(!t||!n||n===r)return;let a=`${t}:${n}`;i.current===a||e.threadListItem().getState().remoteId===t&&(i.current=a,Promise.resolve().then(()=>e.threadListItem().rename(n)).catch(()=>{i.current=null}))},[n,e,r,t]),null};class Zd{aui;workspacePath;ensureConversation;constructor(e,t,r){this.aui=e,this.workspacePath=t,this.ensureConversation=r}async load(){return{messages:[]}}async append(){}withFormat(e){let t=this.aui,r=this.workspacePath,n=this.ensureConversation,i=()=>this.aui.threadListItem().getState().remoteId,a=async(t,n,i)=>{await aT.saveConversationMessage(t,r,{parentId:n.parentId,message:{id:i,content:e.encode(n)},format:e.format})};return{async load(){let t=i();if(!t)return{messages:[]};let n=await aT.loadConversationMessages(t,r,e.format);return 0===n.messages.length?null:{headId:n.headId,messages:n.messages.map(t=>e.decode({id:t.id,parent_id:t.parent_id,format:t.format,content:t.content}))}},async append(r){let{remoteId:i}=await t.threadListItem().initialize();await n?.(i),await a(i,r,e.getId(r.message))},async update(e,t){let r=i();r&&await a(r,e,t)}}}}let Zc=["cwd","project","workdir"];function Zp(e){let t=String(e??"").trim();if(!t)return"";let r=t.replace(/\\/g,"/");return"/"===r?"/":/^[A-Za-z]:\/?$/.test(r)?`${r[0].toUpperCase()}:/`:r.replace(/\/+$/g,"")}function Zm(e,t){let r,n,i=Zp(e);if(!i||(r=Zp(i),n=Zp(t),r&&r===n))return"";let a=new URLSearchParams;a.set("cwd",i);let o=a.toString();return o?`?${o}`:""}function Zf({threadId:e,workspacePath:t,defaultWorkspacePath:r}){return`/thread/${encodeURIComponent(e)}${Zm(t,r)}`}function Zh(e){return!!(e&&"function"==typeof e.postMessage)}function Zg(e){return e.trim()||"*"}function Zv(e){return String(e||"").trim()}function Zy(e,t){return JSON.stringify({messages:e,artifacts:t})}let Zb="acp.host-context.received";function Zx(e){window.dispatchEvent(new CustomEvent(Zb,{detail:e}))}let Z_=()=>{let e,t,r,n,i,a=(0,ek.useRef)((e=null,t=null,r=null,n=new Map,i=new Map,{rememberHost(t){Zh(t.source)&&(e={source:t.source,origin:t.origin,filter:t.filter})},activateForThread(n,a={}){let o=Zv(n);e&&o&&(t=o,r=Zv(a.localThreadId)||null,"snapshot"===e.filter&&i.set(o,{baselineSignature:Zy(a.messages??[],a.artifacts??[]),lastSentSignature:i.get(o)?.lastSentSignature??null,sawRunning:!1}))},flush(a){let o=Zv(a.threadId),s=Zv(a.localThreadId)||null;return e&&o&&((e,a)=>{if(!t)return!1;if(e===t)return!0;if(r&&a===r){let r=n.get(t),a=n.get(e);if(r&&r!==a)if(a)for(let[e,t]of r)a.has(e)||a.set(e,t);else n.set(e,r);let o=i.get(t);return o&&!i.has(e)&&i.set(e,o),t=e,!0}return!1})(o,s)&&Zh(e.source)?"artifacts"===e.filter?((t,r)=>{if(!e||!Zh(e.source))return[];let i=n.get(r)??new Map,a=[];for(let e of t.artifacts){let t=JSON.stringify({id:e.id,kind:e.kind,title:e.title,path:e.path||"",status:e.status||"",toolCallId:e.toolCallId,updatedAt:e.updatedAt||0});i.get(e.id)!==t&&(i.set(e.id,t),a.push(e))}if(!a.length)return[];n.set(r,i);let o={type:"acp.messages.changed",payload:{version:1,threadId:r,workspacePath:t.workspacePath||null,filter:"artifacts",artifacts:a}};return e.source.postMessage(o,{targetOrigin:Zg(e.origin)}),a})(a,o):((t,r)=>{if(!e||!Zh(e.source))return[];let n=i.get(r)??{baselineSignature:null,lastSentSignature:null,sawRunning:!1};if(t.isRunning)return n.sawRunning=!0,i.set(r,n),[];let a=Zy(t.messages,t.artifacts);if(!n.sawRunning)return n.baselineSignature=a,i.set(r,n),[];if(n.lastSentSignature===a)return[];n.baselineSignature=a,n.lastSentSignature=a,n.sawRunning=!1,i.set(r,n);let o=[...t.messages],s={type:"acp.messages.changed",payload:{version:1,threadId:r,workspacePath:t.workspacePath||null,filter:"snapshot",messages:o,artifacts:[...t.artifacts]}};return e.source.postMessage(s,{targetOrigin:Zg(e.origin)}),o})(a,o):[]}})),o=ij(e=>e.threads.mainThreadId),s=ij(e=>e.threadListItem.remoteId),l=ij(e=>e.thread.messages),u=ij(e=>e.thread.isRunning),d=oC(),[c,p]=(0,ek.useState)([]),m=(0,ek.useMemo)(()=>[...l].flatMap(e=>{let t=function e(t,r=new WeakSet){if(null===t)return null;let n=typeof t;if("string"===n||"number"===n||"boolean"===n)return t;if("bigint"===n)return String(t);if("undefined"===n||"function"===n||"symbol"===n)return;if(Array.isArray(t))return t.map(t=>{let n=e(t,r);return void 0===n?null:n});if("object"!==n||r.has(t))return;r.add(t);let i={};for(let[n,a]of Object.entries(t)){if("toolUI"===n)continue;let t=e(a,r);void 0!==t&&(i[n]=t)}return r.delete(t),i}(e);return t&&"object"==typeof t&&!Array.isArray(t)?[t]:[]}),[l]),f=(0,ek.useMemo)(()=>(function(...e){let t=new Map;for(let r of e.flat()){let e=`${r.kind}:${r.path||r.title}`,n=t.get(e);(!n||!n.newText&&r.newText||r.updatedAt>=n.updatedAt)&&t.set(e,r)}return[...t.values()]})(d,c),[d,c]),h=(0,ek.useRef)({artifacts:f,messages:m}),g=(0,ek.useRef)(null),{workspacePath:v}=ax(),y=String(s||o||"").trim();return(0,ek.useEffect)(()=>{h.current={artifacts:f,messages:m}},[f,m]),(0,ek.useEffect)(()=>{if(u){null===g.current&&(g.current=Date.now(),p([]));return}let e=g.current;if(g.current=null,!e||!y||!v)return;let t=!1;return aT.listWorkspaceOutputArtifacts(v,y,e-500).then(({artifacts:e})=>{t||p(e)}).catch(e=>{console.warn("[ACP UI] Failed to scan workspace output artifacts",e)}),()=>{t=!0}},[u,y,v]),(0,ek.useEffect)(()=>{let e=e=>{let t=e.detail;a.current.rememberHost({source:t?.source??null,origin:t?.origin??"",itemCount:Number(t?.itemCount||0),filter:t?.filter==="artifacts"?"artifacts":"snapshot"})},t=e=>{let t=e.detail;if(t?.change?.operation==="consume"){let e=h.current;a.current.activateForThread(y,{localThreadId:o,artifacts:e.artifacts,messages:e.messages})}};return window.addEventListener(Zb,e),window.addEventListener("acp.context.local-change",t),()=>{window.removeEventListener(Zb,e),window.removeEventListener("acp.context.local-change",t)}},[o,y]),(0,ek.useEffect)(()=>{a.current.flush({threadId:y,localThreadId:o,workspacePath:v,artifacts:f,messages:m,isRunning:u})},[f,u,o,m,y,v]),null};function Zw(e){return"string"==typeof e&&e.startsWith("__LOCALID_")}function Zk(e){`${window.location.pathname}${window.location.search}`!==e&&window.history.replaceState(window.history.state,"",e)}let ZI=new Map,ZS=({defaultWorkspacePath:e,initialThreadId:t})=>{let{workspacePath:r}=ax(),n=ij(e=>e.threads.mainThreadId),i=ij(e=>e.threadListItem.remoteId),a=(0,ek.useRef)(null);return(0,ek.useEffect)(()=>{let o=i??n;if(t&&Zw(o))return;i&&!Zw(i)&&(Zw(n)&&ZI.set(n,i),a.current={localThreadId:Zw(n)?n:null,remoteThreadId:i});let s=a.current,l=Zw(n)?ZI.get(n)??(s?.localThreadId===n?s.remoteThreadId:void 0):void 0;!i&&Zw(n)&&l?Zk(Zf({threadId:l,workspacePath:r,defaultWorkspacePath:e})):Zk(o&&!Zw(o)?Zf({threadId:o,workspacePath:r,defaultWorkspacePath:e}):function({workspacePath:e,defaultWorkspacePath:t}){return`/${Zm(e,t)}`}({workspacePath:r,defaultWorkspacePath:e}))},[e,t,n,i,r]),null};function Z$(e,t){if(!e||!(t in e))return;let r=e?.[t];return"string"==typeof r&&r.trim()?r.trim():null}let Zj=()=>{let{setModel:e,setModeId:t,setProvider:r,setThoughtLevel:n}=ax(),i=ij(e=>e.threadListItem.custom),a=Z$(i,"provider"),o=Z$(i,"model"),s=Z$(i,"modeId"),l=Z$(i,"thoughtLevel");return(0,ek.useEffect)(()=>{a&&r(a)},[a,r]),(0,ek.useEffect)(()=>{void 0!==o&&e(o)},[o,e]),(0,ek.useEffect)(()=>{void 0!==s&&t(s)},[s,t]),(0,ek.useEffect)(()=>{void 0!==l&&n(l)},[l,n]),null},ZE=new Set(["acp.attachment.add"]);function ZC(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ZT(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.attachment.result",requestId:t,payload:{ok:!0,name:r.name,mimeType:r.mimeType}},{targetOrigin:"*"})}function ZN(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.attachment.error",requestId:t,payload:r},{targetOrigin:"*"})}let ZA=()=>{let e=tU(),t=(0,ek.useRef)(new Map),r=(0,ek.useRef)(new Map);return(0,ek.useEffect)(()=>{let n=async n=>{if(n.source!==window&&n.source!==window.parent&&n.source!==window.opener)return;let i=n.data;if(!ZC(i)||"string"!=typeof i.type||!ZE.has(i.type))return;let a="string"==typeof i.requestId?i.requestId:void 0;if(a&&t.current.has(a)){let e=t.current.get(a);e?.type==="result"?ZT(n.source,a,e.payload):e?.type==="error"&&ZN(n.source,a,e.error);return}let o=a?r.current.get(a):null;if(o){let e=await o;"result"===e.type?ZT(n.source,a,e.payload):ZN(n.source,a,e.error);return}let s=(async()=>{let{name:t,mimeType:r,dataUrl:n}=function(e){if(!ZC(e))throw{code:"invalid_payload",message:"payload must be an object"};let t="string"==typeof e.name?e.name.trim():"",r="string"==typeof e.mimeType?e.mimeType.trim():"",n="string"==typeof e.dataUrl?e.dataUrl.trim():"";if(!t)throw{code:"invalid_payload",message:"payload.name must be a non-empty string"};if(!r.startsWith("image/"))throw{code:"invalid_payload",message:"payload.mimeType must be an image MIME type"};if(!n.startsWith("data:image/"))throw{code:"invalid_payload",message:"payload.dataUrl must be a data:image/* URL"};return{name:t,mimeType:r,dataUrl:n}}(i.payload);return await e.thread().composer().addAttachment({name:t,type:"image",contentType:r,content:[{type:"image",image:n}]}),{type:"result",payload:{name:t,mimeType:r}}})().catch(e=>({type:"error",error:ZC(e)&&"string"==typeof e.code?{code:e.code,message:"string"==typeof e.message?e.message:"Attachment message failed"}:{code:"internal_error",message:e instanceof Error?e.message:String(e)}}));a&&r.current.set(a,s);try{let e=await s;a&&t.current.set(a,e),"result"===e.type?ZT(n.source,a,e.payload):ZN(n.source,a,e.error)}finally{a&&r.current.delete(a)}};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)},[e]),null},ZR=new Set(["acp.chat.submit"]);function ZP(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ZO(e){let t=e.thread().getState(),r="",n="";try{let t=e.threadListItem().getState();r=String(t.remoteId||""),n=String(t.id||"")}catch{n=""}return{isRunning:!!t.isRunning,messageCount:t.messages.length,remoteId:r,threadId:n}}function ZM(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.chat.result",requestId:t,payload:{ok:!0,...r}},{targetOrigin:"*"})}function Zz(e,t,r){e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.chat.error",requestId:t,payload:r},{targetOrigin:"*"})}let ZD=()=>{let e=tU(),t=ij(e=>e.threads.mainThreadId),r=(0,ek.useRef)(new Map),n=(0,ek.useRef)(new Map);return(0,ek.useEffect)(()=>{let i=async i=>{if(i.source!==window&&i.source!==window.parent&&i.source!==window.opener)return;let a=i.data;if(!ZP(a)||"string"!=typeof a.type||!ZR.has(a.type))return;let o="string"==typeof a.requestId?a.requestId:void 0;if(o&&r.current.has(o)){let e=r.current.get(o);e?.type==="result"?ZM(i.source,o,e.payload):e?.type==="error"&&Zz(i.source,o,e.error);return}let s=o?n.current.get(o):null;if(s){let e=await s;"result"===e.type?ZM(i.source,o,e.payload):Zz(i.source,o,e.error);return}let l=(async()=>{let r=function(e){if(!ZP(e)||"string"!=typeof e.text)throw{code:"invalid_payload",message:"payload.text must be a non-empty string"};let t=e.text.trim();if(!t)throw{code:"invalid_payload",message:"payload.text must be a non-empty string"};return t}(a.payload);await function(e,t=1e4){let r=Date.now()+t;return new Promise((t,n)=>{let i=()=>{try{let r=e.thread().composer(),n=r.getState();return r.setText(n.text),t(),!0}catch(e){if(Date.now()>=r)return n(e),!0;return!1}};if(i())return;let a=window.setInterval(()=>{i()&&window.clearInterval(a)},100)})}(e);let n=e.thread().composer(),i=Date.now()+1e4,o=n.getState();for(;Date.now()<i&&(n.setText(r),await new Promise(e=>window.setTimeout(e,50)),(o=n.getState()).text!==r||!o.canSend););if(!o.canSend)throw Error("Composer is not ready to send the chat prompt.");let s=ZO(e);n.send({startRun:!0});let l=await function(e,t,r=1e4){let n=Date.now()+r;return new Promise((r,i)=>{let a=null,o=null,s=!1,l=()=>{null!==a&&window.clearInterval(a),a=null,o?.(),o=null},u=()=>{if(s)return;let a=ZO(e);if(a.isRunning||a.messageCount>t.messageCount){s=!0,l(),r(a);return}Date.now()>=n&&(s=!0,l(),i(Error("Timed out waiting for the assistant run to start.")))};try{o=e.thread().subscribe?.(u)??null}catch{o=null}u(),s||(a=window.setInterval(u,100))})}(e,s);return{type:"result",payload:{canSend:o.canSend,textLength:o.text.length,threadId:l.remoteId||l.threadId||t,remoteId:l.remoteId||void 0,messageCount:l.messageCount,isRunning:l.isRunning}}})().catch(e=>({type:"error",error:ZP(e)&&"string"==typeof e.code?{code:e.code,message:"string"==typeof e.message?e.message:"Chat message failed"}:{code:"internal_error",message:e instanceof Error?e.message:String(e)}}));o&&n.current.set(o,l);try{let e=await l;o&&r.current.set(o,e),"result"===e.type?ZM(i.source,o,e.payload):Zz(i.source,o,e.error)}finally{o&&n.current.delete(o)}};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,t]),null},ZU=new Set(["acp.context.add","acp.context.remove","acp.context.replace","acp.context.clear","acp.context.get"]);function ZL(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ZZ(e,t,r){if(void 0!==e){if("string"==typeof e)return e;r.push(`${t} must be a string`)}}function ZF(e,t,r){if(void 0!==e){if("number"==typeof e&&Number.isFinite(e))return e;r.push(`${t} must be a finite number`)}}function ZB(e,t,r){if(void 0!==e){if(ZL(e))return e;r.push(`${t} must be an object`)}}function ZV(e,t,r){if(void 0===e)return;if(!ZL(e))return void r.push(`${t} must be an object`);let n={};for(let i of["x","y","width","height","top","right","bottom","left"]){let a=ZF(e[i],`${t}.${i}`,r);void 0!==a&&(n[i]=a)}return n}function Zq(e){if(!ZL(e)||!Array.isArray(e.items))throw{code:"invalid_payload",message:"payload.items must be an array"};let t=[],r=e.items.map((e,r)=>(function(e,t,r){if(!ZL(e))return r.push(`items[${t}] must be an object`),null;if("file"===e.kind)return"string"==typeof e.path&&e.path.trim()?{kind:"file",id:ZZ(e.id,`items[${t}].id`,r),path:e.path,name:ZZ(e.name,`items[${t}].name`,r),mimeType:ZZ(e.mimeType,`items[${t}].mimeType`,r),range:function(e,t,r){if(void 0===e)return;if(!ZL(e))return void r.push(`${t} must be an object`);let n={};for(let i of["startLine","endLine","startColumn","endColumn"]){let a=ZF(e[i],`${t}.${i}`,r);void 0!==a&&(n[i]=a)}return n}(e.range,`items[${t}].range`,r),description:ZZ(e.description,`items[${t}].description`,r),metadata:ZB(e.metadata,`items[${t}].metadata`,r)}:(r.push(`items[${t}].path must be a non-empty string`),null);if("annotation"===e.kind){var n,i;if("string"!=typeof e.body||!e.body.trim())return r.push(`items[${t}].body must be a non-empty string`),null;if(!ZL(e.target))return r.push(`items[${t}].target must be an object`),null;let a=(n=e.target,i=`items[${t}].target`,"web-element"===n.type?{type:"web-element",url:ZZ(n.url,`${i}.url`,r),selector:ZZ(n.selector,`${i}.selector`,r),elementId:ZZ(n.elementId,`${i}.elementId`,r),label:ZZ(n.label,`${i}.label`,r),rect:ZV(n.rect,`${i}.rect`,r)}:"canvas-element"===n.type?{type:"canvas-element",filePath:ZZ(n.filePath,`${i}.filePath`,r),canvasId:ZZ(n.canvasId,`${i}.canvasId`,r),elementId:ZZ(n.elementId,`${i}.elementId`,r),elementType:ZZ(n.elementType,`${i}.elementType`,r),label:ZZ(n.label,`${i}.label`,r),rect:ZV(n.rect,`${i}.rect`,r),link:ZZ(n.link,`${i}.link`,r)}:"text"===n.type?{type:"text",filePath:ZZ(n.filePath,`${i}.filePath`,r),quote:ZZ(n.quote,`${i}.quote`,r),range:function(e,t,r){if(void 0===e)return;if(!ZL(e))return void r.push(`${t} must be an object`);let n={};for(let i of["startLine","endLine","startColumn","endColumn","startOffset","endOffset"]){let a=ZF(e[i],`${t}.${i}`,r);void 0!==a&&(n[i]=a)}return n}(n.range,`${i}.range`,r),label:ZZ(n.label,`${i}.label`,r)}:(r.push(`${i}.type must be "web-element", "canvas-element", or "text"`),null));if(!a)return null;let o=void 0===e.status||"open"===e.status||"resolved"===e.status?e.status:void 0;return void 0!==e.status&&void 0===o&&r.push(`items[${t}].status must be "open" or "resolved"`),{kind:"annotation",id:ZZ(e.id,`items[${t}].id`,r),body:e.body,target:a,title:ZZ(e.title,`items[${t}].title`,r),status:o,source:ZZ(e.source,`items[${t}].source`,r),metadata:ZB(e.metadata,`items[${t}].metadata`,r)}}return r.push(`items[${t}].kind must be "file" or "annotation"`),null})(e,r,t)).filter(e=>!!e);if(t.length>0)throw{code:"invalid_payload",message:t.join("; ")};return r}function ZW(e){return ZL(e)&&"artifacts"===(e.messageFilter??e.syncFilter??e.outputFilter??e.filter)?"artifacts":"snapshot"}function ZJ(e){if(void 0===e||!ZL(e)||void 0===e.kinds)return;if(!Array.isArray(e.kinds))throw{code:"invalid_payload",message:"payload.kinds must be an array"};let t=e.kinds.filter(iZ);if(t.length!==e.kinds.length)throw{code:"invalid_payload",message:'payload.kinds may only contain "file" or "annotation"'};return t}let ZH=()=>{let{addContextItems:e,removeContextItems:t,replaceContextItems:r,clearContextItems:n,getContextBundle:i}=ax();return(0,ek.useEffect)(()=>{let a=(e,t,r,n)=>{e&&"function"==typeof e.postMessage&&e.postMessage({type:"acp.context.result",requestId:t,payload:{ok:!0,context:r,change:n}},{targetOrigin:"*"})},o=e=>{let t=e.detail;t?.context&&t.change&&((e,t)=>{for(let r of new Set([window.parent,window.opener,window]))r&&"function"==typeof r.postMessage&&r.postMessage({type:"acp.context.changed",payload:{context:e,change:t}},{targetOrigin:"*"})})(t.context,t.change)},s=o=>{var s,l;if(o.source!==window&&o.source!==window.parent&&o.source!==window.opener)return;let u=o.data;if(ZL(u)&&"string"==typeof u.type&&ZU.has(u.type))try{let s="string"==typeof u.requestId?u.requestId:void 0;if("acp.context.add"===u.type){let t=Zq(u.payload),{context:r,change:n}=e(t);Zx({source:o.source,origin:o.origin,itemCount:t.length,filter:ZW(u.payload)}),a(o.source,s,r,n);return}if("acp.context.remove"===u.type){let{context:e,change:r}=t(function(e){if(!ZL(e)||!Array.isArray(e.ids))throw{code:"invalid_payload",message:"payload.ids must be an array"};let t=e.ids.map(e=>"string"==typeof e?e.trim():"").filter(Boolean);if(t.length!==e.ids.length)throw{code:"invalid_payload",message:"payload.ids must contain only non-empty strings"};return t}(u.payload));a(o.source,s,e,r);return}if("acp.context.replace"===u.type){let e=Zq(u.payload),{context:t,change:n}=r(e);Zx({source:o.source,origin:o.origin,itemCount:e.length,filter:ZW(u.payload)}),a(o.source,s,t,n);return}if("acp.context.clear"===u.type){let{context:e,change:t}=n(ZJ(u.payload));a(o.source,s,e,t);return}let l=ZJ(u.payload);a(o.source,s,iF(i(),l))}catch(t){let e="string"==typeof u.requestId?u.requestId:void 0;s=o.source,l=ZL(t)&&"string"==typeof t.code?{code:t.code,message:"string"==typeof t.message?t.message:"Context message failed"}:{code:"internal_error",message:t instanceof Error?t.message:String(t)},s&&"function"==typeof s.postMessage&&s.postMessage({type:"acp.context.error",requestId:e,payload:l},{targetOrigin:"*"})}};return window.addEventListener("message",s),window.addEventListener("acp.context.local-change",o),()=>{window.removeEventListener("message",s),window.removeEventListener("acp.context.local-change",o)}},[e,n,i,t,r]),null},ZK=({defaultWorkspacePath:e,workspaceName:t,initialThreadId:r})=>{let n=ax(),i=(0,rf.usePathname)(),a=function({context:e,threadId:t}={}){let r=e?.provider,n=e?.model,i=e?.modeId,a=e?.thoughtLevel,o=e?.explicitModel,s=e?.explicitModeId??iK[iG(r)].defaultModeId??null,l=e?.explicitThoughtLevel,u=e?.permissionMode,d=e?.workspacePath,c=e?.builtinToolSettings,p=e?.consumeContextBundle,m=(0,ek.useRef)({});m.current={model:n,modeId:i,thoughtLevel:a};let f=(0,ek.useMemo)(()=>({provider:r,permissionMode:u,workspacePath:d,getConversationMetadata:()=>m.current}),[r,u,d]);return h0({adapter:(0,ek.useMemo)(()=>(function(e={}){var t;let r=async(t,r={})=>{let n;await aT.upsertConversation({...(n=e.getConversationMetadata?.()??{},{threadId:t,provider:e.provider??Zn,model:n.model??null,modeId:n.modeId??null,thoughtLevel:n.thoughtLevel??null,permissionMode:e.permissionMode,workspacePath:e.workspacePath??void 0}),...r,threadId:t},e.workspacePath)};return{unstable_Provider:(t=e.workspacePath,({children:e})=>{let n=tU(),i=(0,ek.useMemo)(()=>new Zd(n,t,r),[n]),a=(0,ek.useMemo)(()=>({history:i}),[i]);return(0,e_.jsxs)(hG,{adapters:a,children:[(0,e_.jsx)(Zu,{}),e]})}),async list(t){let{threads:r,nextCursor:n}=await aT.listConversations(e.workspacePath,{after:t?.after,limit:50,refreshProvider:!1});return{threads:r.map(Zi),nextCursor:n}},async initialize(t){let r,n=e.provider??Zn;return{remoteId:t.startsWith("__LOCALID_")?(r="u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,`${n}-${r}`):t,externalId:void 0}},async rename(t,r){await aT.renameConversation(t,r,e.workspacePath)},async archive(t){await aT.archiveConversation(t,!0,e.workspacePath)},async unarchive(t){await aT.archiveConversation(t,!1,e.workspacePath)},async delete(t){await aT.deleteConversation(t,e.workspacePath)},async fetch(t){let{thread:r}=await aT.getConversation(t,e.workspacePath);return Zi(r)},async generateTitle(t,n){let i,a=Zl(n),o=a?"":await aT.getConversation(t,e.workspacePath).then(({thread:e})=>{let t;return"新对话"===(t=Zs(e.title))?"":t}).catch(()=>""),s=a||o||Zs(((i=n.find(e=>"user"===e.role&&Za(e)))?Za(i):"")||Za(n.find(e=>"system"!==e.role)??n[0]),48);return s?(await r(t,{title:s}),gu(e=>{e.appendText(s)})):gu(()=>{})}}})(f),[f]),allowNesting:!0,threadId:t,runtimeHook:function(){return(({cloud:e,...t}={})=>h0({runtimeHook:function(){return(e=>{var t;let r,{adapters:n,transport:i,toCreateMessage:a,onResume:o,suggestions:s,...l}=e??{},u=(t=i??new UY,r=(0,ek.useRef)(t),(0,ek.useEffect)(()=>{r.current=t}),(0,ek.useMemo)(()=>new Proxy(r.current,{get(e,t){let n=r.current[t];return"function"==typeof n?n.bind(r.current):n}}),[])),d=ij(e=>e.threadListItem.id),c=tU(),p=function({experimental_throttle:e,resume:t=!1,...r}={}){let n=(0,ek.useRef)("chat"in r?{}:{onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen});"chat"in r||(n.current={onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen});let i={...r,onToolCall:e=>{var t,r;return null==(r=(t=n.current).onToolCall)?void 0:r.call(t,e)},onData:e=>{var t,r;return null==(r=(t=n.current).onData)?void 0:r.call(t,e)},onFinish:e=>{var t,r;return null==(r=(t=n.current).onFinish)?void 0:r.call(t,e)},onError:e=>{var t,r;return null==(r=(t=n.current).onError)?void 0:r.call(t,e)},sendAutomaticallyWhen:e=>{var t,r,i;return null!=(i=null==(r=(t=n.current).sendAutomaticallyWhen)?void 0:r.call(t,e))&&i}},a=(0,ek.useRef)("chat"in r?r.chat:new LD(i));("chat"in r&&r.chat!==a.current||"id"in r&&a.current.id!==r.id)&&(a.current="chat"in r?r.chat:new LD(i));let o=(0,ek.useCallback)(t=>a.current["~registerMessagesCallback"](t,e),[e,a.current.id]),s=(0,ek.useSyncExternalStore)(o,()=>a.current.messages,()=>a.current.messages),l=(0,ek.useSyncExternalStore)(a.current["~registerStatusCallback"],()=>a.current.status,()=>a.current.status),u=(0,ek.useSyncExternalStore)(a.current["~registerErrorCallback"],()=>a.current.error,()=>a.current.error),d=(0,ek.useCallback)(e=>{"function"==typeof e&&(e=e(a.current.messages)),a.current.messages=e},[a]);return(0,ek.useEffect)(()=>{t&&a.current.resumeStream()},[t,a]),{id:a.current.id,messages:s,setMessages:d,sendMessage:a.current.sendMessage,regenerate:a.current.regenerate,clearError:a.current.clearError,stop:a.current.stop,error:u,resumeStream:a.current.resumeStream,status:l,addToolResult:a.current.addToolOutput,addToolOutput:a.current.addToolOutput,addToolApprovalResponse:a.current.addToolApprovalResponse}}({...l,id:d,transport:u}),m=((e,{adapters:t,toCreateMessage:r,cancelPendingToolCallsOnSend:n=!0,onResume:i,suggestions:a}={})=>{let o=hY(),[s,l]=(0,ek.useState)({}),u=(0,ek.useRef)(new Map),d=(0,ek.useRef)(new Map),c=(0,ek.useRef)(new Map),p=(0,ek.useRef)(void 0),m=Object.values(s).some(e=>e?.type==="executing"),f="submitted"===e.status||"streaming"===e.status||m,h=((e,t)=>{let[r,n]=(0,ek.useState)({}),i=(0,ek.useRef)(null);return(0,ek.useEffect)(()=>{let r=e.findLast(e=>"assistant"===e.role);if(t&&r){i.current&&i.current.messageId===r.id||(i.current={messageId:r.id,startTime:Date.now(),lastContentLength:0,totalChunks:0});let e=i.current,t=function(e){if(!e?.parts)return 0;let t=0;for(let r of e.parts)"text"===r.type&&(t+=r.text.length);return t}(r);t>e.lastContentLength&&(void 0===e.firstTokenTime&&(e.firstTokenTime=Date.now()-e.startTime),e.totalChunks++,e.lastContentLength=t)}else if(!t&&i.current){let e=i.current,t=Date.now()-e.startTime,a=Math.ceil(e.lastContentLength/4),o=function(e){if(!e?.parts)return 0;let t=0;for(let r of e.parts)UD(r)&&t++;return t}(r),s={streamStartTime:e.startTime,totalStreamTime:t,totalChunks:e.totalChunks,toolCallCount:o,...void 0!==e.firstTokenTime&&{firstTokenTime:e.firstTokenTime},...a>0&&{tokenCount:a},...t>0&&a>0&&{tokensPerSecond:a/(t/1e3)}};n(t=>({...t,[e.messageId]:s})),i.current=null}},[e,t]),r})(e.messages,f),g=L7.useThreadMessages({isRunning:f,messages:e.messages,metadata:(0,ek.useMemo)(()=>({toolStatuses:s,messageTiming:h,toolArgsKeyOrderCache:u.current,toolLastInputCache:d.current,mcpAppMetadataCache:c.current,...e.error&&{error:e.error.message}}),[s,h,e.error])}),[v]=(0,ek.useState)(()=>({get current(){return _}})),y=g0({state:{messages:g,isRunning:f},getTools:()=>v.current.thread.getModelContext().tools,onResult:t=>{if("add-tool-result"===t.type){var r;let n=void 0!==t.modelContent?(r=t.result,{[L9]:t.modelContent,value:r}):t.result;e.addToolResult({tool:t.toolName,toolCallId:t.toolCallId,output:n,options:{metadata:p.current}})}},setToolStatuses:l}),b=((e,t,r,n,i)=>{let a=(0,ek.useRef)(!1),o=tU(),s=(0,ek.useCallback)(()=>o.threadListItem.source?o.threadListItem():null,[o]),[l,u]=(0,ek.useState)(!1),d=(0,ek.useRef)(new Set),c=(0,ek.useRef)(i);(0,ek.useEffect)(()=>{c.current=i});let p=(0,ek.useMemo)(()=>{if(t){if(!t.withFormat)throw Error("useAISDKRuntime: ThreadHistoryAdapter is missing the required `withFormat` method.");return t.withFormat(n)}},[t,n]);(0,ek.useEffect)(()=>{if(!p||a.current)return;let t=async()=>{u(!0);try{let t=await p.load();if(t&&t.messages.length>0){let n=Zt(r,t);e.current.thread.import(n);let i=new f9;i.import(n);let a=i.getMessages();c.current(a.flatMap(hi)),d.current=new Set(n.messages.map(e=>e.message.id))}}catch(e){console.error("Failed to load message history:",e)}finally{u(!1)}};(a.current=!0,s()?.getState().remoteId)?t():u(!1)},[p,r,e,s]);let m=(0,ek.useRef)(null),f=(0,ek.useRef)(null),h=(0,ek.useRef)([]),g=(0,ek.useRef)(!1),v=(0,ek.useRef)(0);return(0,ek.useEffect)(()=>{if(!p)return;let t=e.current.thread.subscribe(()=>{let{isRunning:t}=e.current.thread.getState(),r=g.current;if(g.current=t,null!=m.current){let t=e.current.thread.getState().messages.at(-1);if(t?.role==="assistant"){let e=t.content.filter(e=>"tool-call"===e.type).length;for(;v.current<e;)h.current.push(Date.now()-m.current),v.current++}}if(t){null==m.current&&(m.current=Date.now(),h.current=[],v.current=0),f.current&&(clearTimeout(f.current),f.current=null);return}r&&(null!=m.current&&h.current.push(Date.now()-m.current),f.current&&clearTimeout(f.current),f.current=setTimeout(async()=>{f.current=null;let t=e.current.thread.getState();if(t.isRunning)return;let r=h.current,i=r.length>0?r.at(-1):void 0;if(1===r.length&&null!=i){let e=t.messages.findLast(e=>"assistant"===e.role);if(e){let t=e.content.filter(e=>"tool-call"===e.type).length;if(t>0){let e=t+1,n=i/e;r.length=0;for(let t=0;t<e;t++)r.push(Math.round((t+1)*n))}}}let a=r.length>1?r.map((e,t)=>({start_ms:0===t?0:r[t-1],end_ms:e})):void 0;m.current=null,h.current=[];let o={...null!=i?{durationMs:i}:void 0,...null!=a?{stepTimestamps:a}:void 0},{messages:s}=t,l=null,u=e=>e.length>0?n.getId(e.at(-1)):null,c=e=>e.map((t,r)=>({parentId:0===r?l:n.getId(e[r-1]),message:t}));for(let e of s){let t=hi(e);if(void 0!==e.status&&"complete"!==e.status.type&&"incomplete"!==e.status.type){l=u(t)??l;continue}if(d.current.has(e.id)){if(void 0!==i){let e=l;for(let r of t){try{await p.update?.({parentId:e,message:r},n.getId(r))}catch{}e=n.getId(r)}}l=u(t)??l;continue}d.current.add(e.id);let r=c(t);for(let e of r)await p.append(e);l=u(t)??l,p.reportTelemetry?.(r,o)}},0))});return()=>{t(),f.current&&(clearTimeout(f.current),f.current=null)}},[p,n,e]),l})(v,t?.history??o?.history,L7.toThreadMessages,Ze,t=>{e.setMessages(t)}),x=async()=>{n&&(await y.abort(),e.setMessages(e=>{let t=e.at(-1);if(t?.role!=="assistant")return e;let r=!1,n=t.parts?.map(e=>UD(e)&&"output-available"!==e.state&&"output-error"!==e.state?(r=!0,{...e,state:"output-error",errorText:"User cancelled tool call by sending a new message."}):e);return r?[...e.slice(0,-1),{...t,parts:n}]:e}))},_=(e=>{let[t]=(0,ek.useState)(()=>new LY(e));(0,ek.useEffect)(()=>{t.setAdapter(e)});let{modelContext:r}=hY()??{};return(0,ek.useEffect)(()=>{if(r)return t.registerModelContextProvider(r)},[r,t]),(0,ek.useMemo)(()=>new h$(t),[t])})({isRunning:f,messages:g,setMessages:t=>e.setMessages(t.map(L1).filter(Boolean).flat()),onImport:t=>e.setMessages(t.map(L1).filter(Boolean).flat()),onExportExternalState:()=>{let e=v.current.thread.export(),t=[],r=new Map;for(let n of e.messages){let e=hi(n.message),i=null!=n.parentId?r.get(n.parentId)??n.parentId:null;for(let r of e)t.push({parentId:i,message:r}),i=Ze.getId(r);e.length>0&&r.set(n.message.id,Ze.getId(e[e.length-1]))}let n={messages:t};return null!=e.headId&&(n.headId=r.get(e.headId)??e.headId),n},onLoadExternalState:e=>{let t=Zt(L7.toThreadMessages,e);v.current.thread.import(t)},onCancel:async()=>{e.stop(),await y.abort()},onNew:async t=>{let n=(r??LQ)(t);t.startRun??"user"===t.role?(p.current=t.runConfig,await x(),await e.sendMessage(n,{metadata:t.runConfig})):e.setMessages(e=>[...e,Zr(n,t.role)])},onEdit:async t=>{let n=(r??LQ)(t);t.startRun??"user"===t.role?(p.current=t.runConfig,e.setMessages(e=>LX(e,t.parentId)),await e.sendMessage(n,{metadata:t.runConfig})):e.setMessages(e=>[...LX(e,t.parentId),Zr(n,t.role)])},onReload:async(t,r)=>{p.current=r.runConfig;let n=LX(e.messages,t);e.setMessages(n),await e.regenerate({metadata:r.runConfig})},onAddToolResult:({toolCallId:t,result:r,isError:n})=>{let i={metadata:p.current};n?e.addToolOutput({state:"output-error",tool:t,toolCallId:t,errorText:"string"==typeof r?r:JSON.stringify(r),options:i}):e.addToolOutput({state:"output-available",tool:t,toolCallId:t,output:r,options:i})},onResumeToolCall:e=>y.resume(e.toolCallId,e.payload),...i&&{onResume:i},...a&&{suggestions:a},adapters:{attachments:L0,...o,...t},isLoading:b});return _})(p,{adapters:n,...a&&{toCreateMessage:a},...o&&{onResume:o},...s&&{suggestions:s}});u instanceof UY&&(u.setRuntime(m),u.__internal_setGetThreadListItem(()=>c.threadListItem.source?c.threadListItem():void 0));let f=(0,ek.useRef)(!1);return(0,ek.useEffect)(()=>{if(f.current)return;let e=(e=>{if(e instanceof UY)return e.getResumableAdapter();let t=e.getResumableAdapter;if("function"==typeof t)return t.call(e)})(u);!e||e.storage.getStreamId()&&(f.current=!0,p.resumeStream().catch(t=>{console.warn("[assistant-ui] resumable: resume failed; clearing stored stream id",t),e.storage.clear()}))},[u,p]),m})(t)},adapter:(e=>{let t=(0,ek.useRef)(e);(0,ek.useEffect)(()=>{t.current=e},[e]);let r=(0,ek.useCallback)(function({children:e}){let r=function(e){let t=tU(),[r]=(0,ek.useState)(()=>new gI(e,t));return r}({get current(){return t.current.cloud??gz}}),n=t.current.cloud??gz,i=(0,ek.useMemo)(()=>new gO(n),[n]),a=(0,ek.useMemo)(()=>({history:r,attachments:i}),[r,i]);return(0,e_.jsx)(hG,{adapters:a,children:e})},[]),n=e.cloud??gz;if(!n){let e=new gy;return e.initialize=async e=>{let r=await t.current.create?.();return{remoteId:e,externalId:r?.externalId}},e}return{list:async()=>{let{threads:e}=await n.threads.list();return{threads:e.map(e=>({status:e.is_archived?"archived":"regular",remoteId:e.id,title:e.title,externalId:e.external_id??void 0}))}},initialize:async()=>{let t=e.create?.()??Promise.resolve(),r=await t,i=r?r.externalId:void 0,{thread_id:a}=await n.threads.create({last_message_at:new Date,external_id:i});return{externalId:i,remoteId:a}},rename:async(e,t)=>n.threads.update(e,{title:t}),archive:async e=>n.threads.update(e,{is_archived:!0}),unarchive:async e=>n.threads.update(e,{is_archived:!1}),delete:async t=>(await e.delete?.(t),n.threads.delete(t)),generateTitle:async(e,t)=>{let r=t.map(e=>({...e,content:e.content.filter(e=>"text"===e.type||"tool-call"===e.type)}));return n.runs.stream({thread_id:e,assistant_id:"system/thread_title",messages:r})},fetch:async e=>{let t=await n.threads.get(e);return{status:t.is_archived?"archived":"regular",remoteId:t.id,title:t.title,externalId:t.external_id??void 0}},unstable_Provider:r}})({cloud:e}),allowNesting:!0}))({sendAutomaticallyWhen:UH,transport:new UY({api:aT.chatUrl(),fetch:async(e,t)=>{let n=await fetch(e,t),i=n.headers.get("x-acp-provider")??r??Zn,a=n.headers.get("x-acp-thread-id"),o=a?decodeURIComponent(a):null;return o&&function({provider:e,threadId:t,workspacePath:r}){window.dispatchEvent(new CustomEvent(lq,{detail:{provider:e,threadId:t,workspacePath:r??null}}))}({provider:i,threadId:o,workspacePath:d}),n},body:()=>{let e;return{provider:r??Zn,model:o??null,modeId:s,thoughtLevel:l??null,permissionMode:u,workspacePath:d??null,builtinTools:(e=ap(c),al.filter(t=>t.isEnabled?.(e[t.id])??!0).map(e=>e.id)),builtinToolSettings:c,context:p?.()??null}}})})}})}({context:n,threadId:r}),o=i.startsWith("/thread/");return(0,e_.jsxs)(rm,{runtime:a,children:[(0,e_.jsx)(ZS,{defaultWorkspacePath:e,initialThreadId:r}),(0,e_.jsx)(ZA,{}),(0,e_.jsx)(ZD,{}),(0,e_.jsx)(Z_,{}),(0,e_.jsx)(Zj,{}),(0,e_.jsx)(ZH,{}),(0,e_.jsx)(oz,{children:(0,e_.jsx)(IR,{children:(0,e_.jsxs)("div",{className:"flex h-dvh w-full pr-0.5",children:[(0,e_.jsx)(IV,{workspacePath:n.workspacePath,workspaceTitle:t}),(0,e_.jsxs)(Iz,{className:"relative",children:[(0,e_.jsxs)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-20 flex items-start justify-between px-3 pt-2 md:px-4 md:pt-3",children:[(0,e_.jsx)(IO,{className:"pointer-events-auto size-8 rounded-lg bg-background/80 backdrop-blur-sm hover:bg-accent [&_svg]:size-4"}),(0,e_.jsx)("div",{className:"pointer-events-auto",children:(0,e_.jsx)(oD,{})})]}),(0,e_.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,e_.jsx)(oU,{children:(0,e_.jsx)(wN,{isHistoryRoute:o})})})]})]})})})]})};e.s(["Assistant",0,({defaultWorkspacePath:e,workspaceName:t,defaultProvider:r,initialThreadId:n})=>{let i=(0,rf.useSearchParams)(),a=function(e){for(let t of Zc){let r=(function(e,t){if(!e)return null;if("get"in e&&"function"==typeof e.get)return e.get(t);let r=e[t];return Array.isArray(r)?r[0]??null:r??null})(e,t)?.trim();if(r)return r}return null}(i)??e,o=iG(r??i.get("provider"));return(0,e_.jsx)(ab,{workspacePath:a,defaultProvider:o,children:(0,e_.jsx)(ZK,{defaultWorkspacePath:e,workspaceName:t,initialThreadId:n})})}],63454)}]);