@hotmeshio/long-tail 0.4.17 → 0.4.19

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 (354) hide show
  1. package/README.md +0 -2
  2. package/build/adapters/express.js +4 -0
  3. package/build/api/auth-sso.d.ts +12 -0
  4. package/build/api/auth-sso.js +54 -0
  5. package/build/api/escalations/bulk.js +2 -2
  6. package/build/api/escalations/claim.js +3 -13
  7. package/build/api/escalations/create.js +3 -2
  8. package/build/api/escalations/helpers.d.ts +1 -0
  9. package/build/api/escalations/helpers.js +6 -4
  10. package/build/api/escalations/list.d.ts +1 -0
  11. package/build/api/escalations/list.js +1 -0
  12. package/build/api/escalations/metadata.js +4 -4
  13. package/build/api/escalations/single.js +3 -2
  14. package/build/api/settings.js +6 -1
  15. package/build/api/topics.d.ts +9 -0
  16. package/build/api/topics.js +31 -2
  17. package/build/lib/events/index.d.ts +1 -0
  18. package/build/lib/events/index.js +4 -0
  19. package/build/lib/events/nats.d.ts +5 -0
  20. package/build/lib/events/nats.js +9 -0
  21. package/build/lib/events/publish.d.ts +12 -9
  22. package/build/lib/events/publish.js +27 -17
  23. package/build/modules/auth.d.ts +7 -0
  24. package/build/modules/auth.js +104 -2
  25. package/build/modules/sso.d.ts +6 -0
  26. package/build/modules/sso.js +20 -0
  27. package/build/routes/auth-sso.d.ts +2 -0
  28. package/build/routes/auth-sso.js +51 -0
  29. package/build/routes/bot-accounts.js +1 -1
  30. package/build/routes/controlplane.js +6 -6
  31. package/build/routes/escalations/list.js +1 -0
  32. package/build/routes/index.js +2 -0
  33. package/build/routes/mcp-endpoint.d.ts +17 -0
  34. package/build/routes/mcp-endpoint.js +70 -0
  35. package/build/routes/nats-credentials.js +1 -1
  36. package/build/routes/roles.js +5 -5
  37. package/build/routes/topics.js +2 -0
  38. package/build/routes/users.js +31 -5
  39. package/build/sdk/index.d.ts +1 -0
  40. package/build/services/agent/input-mapper.js +17 -1
  41. package/build/services/escalation/crud.js +14 -1
  42. package/build/services/escalation/queries.d.ts +1 -0
  43. package/build/services/escalation/queries.js +7 -0
  44. package/build/services/mcp/exposure.d.ts +15 -0
  45. package/build/services/mcp/exposure.js +18 -0
  46. package/build/services/mcp/external-server.d.ts +15 -0
  47. package/build/services/mcp/external-server.js +125 -0
  48. package/build/services/mcp/seed-service-account.d.ts +11 -0
  49. package/build/services/mcp/seed-service-account.js +77 -0
  50. package/build/services/role/index.d.ts +1 -1
  51. package/build/services/role/index.js +2 -2
  52. package/build/services/topics/system-topics.js +29 -25
  53. package/build/services/user/index.d.ts +1 -1
  54. package/build/services/user/index.js +2 -1
  55. package/build/services/user/rbac.d.ts +11 -0
  56. package/build/services/user/rbac.js +17 -0
  57. package/build/services/user/sso-provision.d.ts +19 -0
  58. package/build/services/user/sso-provision.js +62 -0
  59. package/build/services/workflow-invocation.js +5 -3
  60. package/build/start/config.js +6 -0
  61. package/build/start/server.js +2 -0
  62. package/build/start/workers.js +15 -0
  63. package/build/system/index.js +53 -35
  64. package/build/system/mcp-servers/admin/agent-subscriptions.d.ts +5 -0
  65. package/build/system/mcp-servers/admin/agent-subscriptions.js +78 -0
  66. package/build/system/mcp-servers/admin/agents.d.ts +5 -0
  67. package/build/system/mcp-servers/admin/agents.js +103 -0
  68. package/build/system/mcp-servers/admin/bot-accounts.d.ts +5 -0
  69. package/build/system/mcp-servers/admin/bot-accounts.js +126 -0
  70. package/build/system/mcp-servers/admin/controlplane.d.ts +5 -0
  71. package/build/system/mcp-servers/admin/controlplane.js +107 -0
  72. package/build/system/mcp-servers/admin/escalations.js +88 -0
  73. package/build/system/mcp-servers/admin/exports.d.ts +5 -0
  74. package/build/system/mcp-servers/admin/exports.js +101 -0
  75. package/build/system/mcp-servers/admin/index.d.ts +16 -8
  76. package/build/system/mcp-servers/admin/index.js +36 -21
  77. package/build/system/mcp-servers/admin/pipelines.d.ts +5 -0
  78. package/build/system/mcp-servers/admin/pipelines.js +96 -0
  79. package/build/system/mcp-servers/admin/schemas.d.ts +614 -6
  80. package/build/system/mcp-servers/admin/schemas.js +239 -1
  81. package/build/system/mcp-servers/admin/settings.d.ts +5 -0
  82. package/build/system/mcp-servers/admin/settings.js +53 -0
  83. package/build/system/mcp-servers/admin/topics.d.ts +5 -0
  84. package/build/system/mcp-servers/admin/topics.js +101 -0
  85. package/build/system/seed/tool-manifests-admin.d.ts +5077 -188
  86. package/build/system/seed/tool-manifests-admin.js +79 -30
  87. package/build/system/seed/tool-manifests-data.d.ts +20 -0
  88. package/build/system/seed/tool-manifests-data.js +24 -6
  89. package/build/system/seed/tool-manifests-escalation.d.ts +5 -0
  90. package/build/system/seed/tool-manifests-escalation.js +5 -0
  91. package/build/system/seed/tool-manifests-events.d.ts +4 -0
  92. package/build/system/seed/tool-manifests-events.js +4 -0
  93. package/build/system/seed/tool-manifests-knowledge.d.ts +6 -0
  94. package/build/system/seed/tool-manifests-knowledge.js +7 -0
  95. package/build/system/seed/tool-manifests-workflows.d.ts +8 -0
  96. package/build/system/seed/tool-manifests-workflows.js +8 -0
  97. package/build/tsconfig.tsbuildinfo +1 -1
  98. package/build/types/auth.d.ts +71 -0
  99. package/build/types/events.d.ts +17 -6
  100. package/build/types/index.d.ts +1 -1
  101. package/build/types/startup.d.ts +22 -1
  102. package/dashboard/dist/assets/{AdminDashboard-Cfo0mwL2.js → AdminDashboard-BwUGcCxQ.js} +2 -2
  103. package/dashboard/dist/assets/{AdminDashboard-Cfo0mwL2.js.map → AdminDashboard-BwUGcCxQ.js.map} +1 -1
  104. package/dashboard/dist/assets/AgentConfigPage-DgrYzLwq.js +16 -0
  105. package/dashboard/dist/assets/AgentConfigPage-DgrYzLwq.js.map +1 -0
  106. package/dashboard/dist/assets/{AgentDetailPage-3mZA7SOb.js → AgentDetailPage-XJpl7wfJ.js} +4 -4
  107. package/dashboard/dist/assets/AgentDetailPage-XJpl7wfJ.js.map +1 -0
  108. package/dashboard/dist/assets/{AgentsPage-CTVocfBb.js → AgentsPage-CGpVG6r8.js} +2 -2
  109. package/dashboard/dist/assets/{AgentsPage-CTVocfBb.js.map → AgentsPage-CGpVG6r8.js.map} +1 -1
  110. package/dashboard/dist/assets/AvailableEscalationsPage-DR1e0TQZ.js +2 -0
  111. package/dashboard/dist/assets/{AvailableEscalationsPage-CA9x9o5s.js.map → AvailableEscalationsPage-DR1e0TQZ.js.map} +1 -1
  112. package/dashboard/dist/assets/BotPicker-BKtjl6IL.js +2 -0
  113. package/dashboard/dist/assets/{BotPicker-BQp_Vs73.js.map → BotPicker-BKtjl6IL.js.map} +1 -1
  114. package/dashboard/dist/assets/{CapabilitiesPage-wpVtkGeU.js → CapabilitiesPage-kCB8fyOj.js} +2 -2
  115. package/dashboard/dist/assets/{CapabilitiesPage-wpVtkGeU.js.map → CapabilitiesPage-kCB8fyOj.js.map} +1 -1
  116. package/dashboard/dist/assets/{CollapsibleSection-2eZMMZiG.js → CollapsibleSection-C3tU61hB.js} +2 -2
  117. package/dashboard/dist/assets/{CollapsibleSection-2eZMMZiG.js.map → CollapsibleSection-C3tU61hB.js.map} +1 -1
  118. package/dashboard/dist/assets/{CredentialsPage-DJGLssm0.js → CredentialsPage-Dt4nJs_B.js} +2 -2
  119. package/dashboard/dist/assets/{CredentialsPage-DJGLssm0.js.map → CredentialsPage-Dt4nJs_B.js.map} +1 -1
  120. package/dashboard/dist/assets/CronLabel-BdE6mHyA.js +2 -0
  121. package/dashboard/dist/assets/CronLabel-BdE6mHyA.js.map +1 -0
  122. package/dashboard/dist/assets/{CustomDurationPicker-DbyqfK35.js → CustomDurationPicker-B_Yxfb-u.js} +2 -2
  123. package/dashboard/dist/assets/{CustomDurationPicker-DbyqfK35.js.map → CustomDurationPicker-B_Yxfb-u.js.map} +1 -1
  124. package/dashboard/dist/assets/{DropZone-BkfRoUcm.js → DropZone-CptiQ0wc.js} +2 -2
  125. package/dashboard/dist/assets/{DropZone-BkfRoUcm.js.map → DropZone-CptiQ0wc.js.map} +1 -1
  126. package/dashboard/dist/assets/ElapsedCell-tcGx5PFI.js +2 -0
  127. package/dashboard/dist/assets/{ElapsedCell-BPYm8RA7.js.map → ElapsedCell-tcGx5PFI.js.map} +1 -1
  128. package/dashboard/dist/assets/{EscalationsOverview-kYGHfnLf.js → EscalationsOverview-1KO5dXzk.js} +2 -2
  129. package/dashboard/dist/assets/{EscalationsOverview-kYGHfnLf.js.map → EscalationsOverview-1KO5dXzk.js.map} +1 -1
  130. package/dashboard/dist/assets/{EventTable-DSDzJMer.js → EventTable-DnpsQ6Ew.js} +2 -2
  131. package/dashboard/dist/assets/{EventTable-DSDzJMer.js.map → EventTable-DnpsQ6Ew.js.map} +1 -1
  132. package/dashboard/dist/assets/HomePage-B2Jgo1J1.js +2 -0
  133. package/dashboard/dist/assets/HomePage-B2Jgo1J1.js.map +1 -0
  134. package/dashboard/dist/assets/ListToolbar-jrVba7QN.js +2 -0
  135. package/dashboard/dist/assets/{ListToolbar-DEef1_-T.js.map → ListToolbar-jrVba7QN.js.map} +1 -1
  136. package/dashboard/dist/assets/{McpOverview-CZFW5qMb.js → McpOverview-BzyxJyc9.js} +2 -2
  137. package/dashboard/dist/assets/{McpOverview-CZFW5qMb.js.map → McpOverview-BzyxJyc9.js.map} +1 -1
  138. package/dashboard/dist/assets/{McpQueryDetailPage-q9xH-QRo.js → McpQueryDetailPage-DXNseeKl.js} +2 -2
  139. package/dashboard/dist/assets/{McpQueryDetailPage-q9xH-QRo.js.map → McpQueryDetailPage-DXNseeKl.js.map} +1 -1
  140. package/dashboard/dist/assets/{McpQueryPage-D14466yi.js → McpQueryPage-WZfTY43_.js} +2 -2
  141. package/dashboard/dist/assets/{McpQueryPage-D14466yi.js.map → McpQueryPage-WZfTY43_.js.map} +1 -1
  142. package/dashboard/dist/assets/McpRunDetailPage-DKZp-p7S.js +2 -0
  143. package/dashboard/dist/assets/McpRunDetailPage-DKZp-p7S.js.map +1 -0
  144. package/dashboard/dist/assets/McpRunsPage-SXyiwc0d.js +2 -0
  145. package/dashboard/dist/assets/{McpRunsPage-aZg057y3.js.map → McpRunsPage-SXyiwc0d.js.map} +1 -1
  146. package/dashboard/dist/assets/OperatorDashboard-Cy7ySMXj.js +2 -0
  147. package/dashboard/dist/assets/OperatorDashboard-Cy7ySMXj.js.map +1 -0
  148. package/dashboard/dist/assets/{PageHeader-CR6TpJG_.js → PageHeader-BuJpMxyu.js} +2 -2
  149. package/dashboard/dist/assets/{PageHeader-CR6TpJG_.js.map → PageHeader-BuJpMxyu.js.map} +1 -1
  150. package/dashboard/dist/assets/{PageHeaderWithStats-CRcQEAO1.js → PageHeaderWithStats-yD_PTbOl.js} +2 -2
  151. package/dashboard/dist/assets/{PageHeaderWithStats-CRcQEAO1.js.map → PageHeaderWithStats-yD_PTbOl.js.map} +1 -1
  152. package/dashboard/dist/assets/{ProcessDetailPage-DyzNjwu8.js → ProcessDetailPage-DYIfvWyc.js} +2 -2
  153. package/dashboard/dist/assets/{ProcessDetailPage-DyzNjwu8.js.map → ProcessDetailPage-DYIfvWyc.js.map} +1 -1
  154. package/dashboard/dist/assets/{ProcessesListPage-CT_3b5Wt.js → ProcessesListPage-DR1RGaMl.js} +2 -2
  155. package/dashboard/dist/assets/{ProcessesListPage-CT_3b5Wt.js.map → ProcessesListPage-DR1RGaMl.js.map} +1 -1
  156. package/dashboard/dist/assets/{RolePill-BC54Vn-U.js → RolePill-SasQKc_B.js} +2 -2
  157. package/dashboard/dist/assets/{RolePill-BC54Vn-U.js.map → RolePill-SasQKc_B.js.map} +1 -1
  158. package/dashboard/dist/assets/{RolesPage-CpRJq-sg.js → RolesPage-pMERxj15.js} +2 -2
  159. package/dashboard/dist/assets/{RolesPage-CpRJq-sg.js.map → RolesPage-pMERxj15.js.map} +1 -1
  160. package/dashboard/dist/assets/{RunAsSelector-C20rdNsC.js → RunAsSelector-B-ksMoEj.js} +2 -2
  161. package/dashboard/dist/assets/{RunAsSelector-C20rdNsC.js.map → RunAsSelector-B-ksMoEj.js.map} +1 -1
  162. package/dashboard/dist/assets/ServerName-CHspudaC.js +2 -0
  163. package/dashboard/dist/assets/{ServerName-Q6okiv4f.js.map → ServerName-CHspudaC.js.map} +1 -1
  164. package/dashboard/dist/assets/{SwimlaneTimeline-CbFaU4bq.js → SwimlaneTimeline-Cr_K5qpu.js} +2 -2
  165. package/dashboard/dist/assets/{SwimlaneTimeline-CbFaU4bq.js.map → SwimlaneTimeline-Cr_K5qpu.js.map} +1 -1
  166. package/dashboard/dist/assets/{TagInput-D6l1SPWd.js → TagInput-DvF3j8MA.js} +2 -2
  167. package/dashboard/dist/assets/{TagInput-D6l1SPWd.js.map → TagInput-DvF3j8MA.js.map} +1 -1
  168. package/dashboard/dist/assets/{TaskDetailPage-22cJsFmM.js → TaskDetailPage-BO5p7AEe.js} +2 -2
  169. package/dashboard/dist/assets/{TaskDetailPage-22cJsFmM.js.map → TaskDetailPage-BO5p7AEe.js.map} +1 -1
  170. package/dashboard/dist/assets/{TaskQueuePill-iDBVCEQQ.js → TaskQueuePill-BCQrS2oK.js} +2 -2
  171. package/dashboard/dist/assets/{TaskQueuePill-iDBVCEQQ.js.map → TaskQueuePill-BCQrS2oK.js.map} +1 -1
  172. package/dashboard/dist/assets/{TasksListPage-BDmaUIKu.js → TasksListPage-BRg-uFtF.js} +2 -2
  173. package/dashboard/dist/assets/{TasksListPage-BDmaUIKu.js.map → TasksListPage-BRg-uFtF.js.map} +1 -1
  174. package/dashboard/dist/assets/{TimeAgo-7wqEp87-.js → TimeAgo-BSzN6rAH.js} +2 -2
  175. package/dashboard/dist/assets/{TimeAgo-7wqEp87-.js.map → TimeAgo-BSzN6rAH.js.map} +1 -1
  176. package/dashboard/dist/assets/{TimestampCell-BBCf8zsN.js → TimestampCell-DL6zMNEQ.js} +2 -2
  177. package/dashboard/dist/assets/{TimestampCell-BBCf8zsN.js.map → TimestampCell-DL6zMNEQ.js.map} +1 -1
  178. package/dashboard/dist/assets/{ToolPill-HcRTggHo.js → ToolPill-1aTqYtzp.js} +2 -2
  179. package/dashboard/dist/assets/{ToolPill-HcRTggHo.js.map → ToolPill-1aTqYtzp.js.map} +1 -1
  180. package/dashboard/dist/assets/{ToolTestPanel-Dosq1cqG.js → ToolTestPanel-fLzNp79U.js} +2 -2
  181. package/dashboard/dist/assets/{ToolTestPanel-Dosq1cqG.js.map → ToolTestPanel-fLzNp79U.js.map} +1 -1
  182. package/dashboard/dist/assets/TopicDetailPage-D7gCsPKB.js +9 -0
  183. package/dashboard/dist/assets/TopicDetailPage-D7gCsPKB.js.map +1 -0
  184. package/dashboard/dist/assets/{TopicsPage-tVPdz-k0.js → TopicsPage-B3Aa8Haz.js} +2 -2
  185. package/dashboard/dist/assets/{TopicsPage-tVPdz-k0.js.map → TopicsPage-B3Aa8Haz.js.map} +1 -1
  186. package/dashboard/dist/assets/{UserName-DX7IBjFn.js → UserName-BjHIJWgh.js} +2 -2
  187. package/dashboard/dist/assets/{UserName-DX7IBjFn.js.map → UserName-BjHIJWgh.js.map} +1 -1
  188. package/dashboard/dist/assets/{WorkflowExecutionPage-BjC0j9_L.js → WorkflowExecutionPage-BQ7AYlQA.js} +2 -2
  189. package/dashboard/dist/assets/{WorkflowExecutionPage-BjC0j9_L.js.map → WorkflowExecutionPage-BQ7AYlQA.js.map} +1 -1
  190. package/dashboard/dist/assets/{WorkflowPill-54px0YiY.js → WorkflowPill-Z-zHRKOK.js} +2 -2
  191. package/dashboard/dist/assets/{WorkflowPill-54px0YiY.js.map → WorkflowPill-Z-zHRKOK.js.map} +1 -1
  192. package/dashboard/dist/assets/WorkflowsDashboard-D-G8Xudz.js +2 -0
  193. package/dashboard/dist/assets/WorkflowsDashboard-D-G8Xudz.js.map +1 -0
  194. package/dashboard/dist/assets/{WorkflowsOverview-DaJRDkNy.js → WorkflowsOverview-B4DUcVxs.js} +2 -2
  195. package/dashboard/dist/assets/{WorkflowsOverview-DaJRDkNy.js.map → WorkflowsOverview-B4DUcVxs.js.map} +1 -1
  196. package/dashboard/dist/assets/{YamlWorkflowsPage-CkpQaUmz.js → YamlWorkflowsPage-CnTNOku0.js} +2 -2
  197. package/dashboard/dist/assets/{YamlWorkflowsPage-CkpQaUmz.js.map → YamlWorkflowsPage-CnTNOku0.js.map} +1 -1
  198. package/dashboard/dist/assets/{agents-B-P5MlEx.js → agents-CkvQDr9b.js} +2 -2
  199. package/dashboard/dist/assets/{agents-B-P5MlEx.js.map → agents-CkvQDr9b.js.map} +1 -1
  200. package/dashboard/dist/assets/{bots-CZz9iVys.js → bots-CzuMCVgU.js} +2 -2
  201. package/dashboard/dist/assets/{bots-CZz9iVys.js.map → bots-CzuMCVgU.js.map} +1 -1
  202. package/dashboard/dist/assets/{capabilities-DrZ8Vw_v.js → capabilities-CbGmS0ty.js} +2 -2
  203. package/dashboard/dist/assets/{capabilities-DrZ8Vw_v.js.map → capabilities-CbGmS0ty.js.map} +1 -1
  204. package/dashboard/dist/assets/{controlplane-cj-1c-1C.js → controlplane-DGvwkuYx.js} +2 -2
  205. package/dashboard/dist/assets/{controlplane-cj-1c-1C.js.map → controlplane-DGvwkuYx.js.map} +1 -1
  206. package/dashboard/dist/assets/{escalation-BEVFyQnE.js → escalation-B7ysVToF.js} +2 -2
  207. package/dashboard/dist/assets/{escalation-BEVFyQnE.js.map → escalation-B7ysVToF.js.map} +1 -1
  208. package/dashboard/dist/assets/{escalation-columns-Beox3TXH.js → escalation-columns-CHQEJU1j.js} +2 -2
  209. package/dashboard/dist/assets/{escalation-columns-Beox3TXH.js.map → escalation-columns-CHQEJU1j.js.map} +1 -1
  210. package/dashboard/dist/assets/{helpers-B4gzNq9h.js → helpers-BFOjXa4r.js} +2 -2
  211. package/dashboard/dist/assets/{helpers-B4gzNq9h.js.map → helpers-BFOjXa4r.js.map} +1 -1
  212. package/dashboard/dist/assets/index-B9_1AZaG.js +2 -0
  213. package/dashboard/dist/assets/{index-3n5VREXN.js.map → index-B9_1AZaG.js.map} +1 -1
  214. package/dashboard/dist/assets/{index-BCQ65lNu.js → index-BFaDxPxA.js} +2 -2
  215. package/dashboard/dist/assets/{index-BCQ65lNu.js.map → index-BFaDxPxA.js.map} +1 -1
  216. package/dashboard/dist/assets/index-BduDiGcw.js +15 -0
  217. package/dashboard/dist/assets/{index-UtAfnStw.js.map → index-BduDiGcw.js.map} +1 -1
  218. package/dashboard/dist/assets/{index-Bh-PnP17.js → index-BeLphL59.js} +2 -2
  219. package/dashboard/dist/assets/{index-Bh-PnP17.js.map → index-BeLphL59.js.map} +1 -1
  220. package/dashboard/dist/assets/index-C--SEsU7.css +1 -0
  221. package/dashboard/dist/assets/{index-_DfbFHXk.js → index-CRiBkHPb.js} +2 -2
  222. package/dashboard/dist/assets/{index-_DfbFHXk.js.map → index-CRiBkHPb.js.map} +1 -1
  223. package/dashboard/dist/assets/{index-DdKbIZNE.js → index-CbrMW-gM.js} +2 -2
  224. package/dashboard/dist/assets/{index-DdKbIZNE.js.map → index-CbrMW-gM.js.map} +1 -1
  225. package/dashboard/dist/assets/{index-aJRDh4zW.js → index-CvOGgvzP.js} +2 -2
  226. package/dashboard/dist/assets/{index-aJRDh4zW.js.map → index-CvOGgvzP.js.map} +1 -1
  227. package/dashboard/dist/assets/{index-D1MywQ2z.js → index-DDlrQeTj.js} +2 -2
  228. package/dashboard/dist/assets/{index-D1MywQ2z.js.map → index-DDlrQeTj.js.map} +1 -1
  229. package/dashboard/dist/assets/{index-BYXiz05a.js → index-DQHmfTPo.js} +2 -2
  230. package/dashboard/dist/assets/{index-BYXiz05a.js.map → index-DQHmfTPo.js.map} +1 -1
  231. package/dashboard/dist/assets/{index-BpN31nuC.js → index-_BRA9uFL.js} +25 -25
  232. package/dashboard/dist/assets/index-_BRA9uFL.js.map +1 -0
  233. package/dashboard/dist/assets/index-a98qWLB-.js +2 -0
  234. package/dashboard/dist/assets/index-a98qWLB-.js.map +1 -0
  235. package/dashboard/dist/assets/index-l_8R6U4r.js +6 -0
  236. package/dashboard/dist/assets/index-l_8R6U4r.js.map +1 -0
  237. package/dashboard/dist/assets/{index-D4KGadbW.js → index-v0OQpgXS.js} +2 -2
  238. package/dashboard/dist/assets/{index-D4KGadbW.js.map → index-v0OQpgXS.js.map} +1 -1
  239. package/dashboard/dist/assets/{knowledge-DhtKWMON.js → knowledge-BlF8UMrk.js} +2 -2
  240. package/dashboard/dist/assets/{knowledge-DhtKWMON.js.map → knowledge-BlF8UMrk.js.map} +1 -1
  241. package/dashboard/dist/assets/{mcp-BXN7-wGF.js → mcp-MtXuky8q.js} +2 -2
  242. package/dashboard/dist/assets/{mcp-BXN7-wGF.js.map → mcp-MtXuky8q.js.map} +1 -1
  243. package/dashboard/dist/assets/{mcp-query-BIJP4mQJ.js → mcp-query-DQ-J1Q0K.js} +2 -2
  244. package/dashboard/dist/assets/{mcp-query-BIJP4mQJ.js.map → mcp-query-DQ-J1Q0K.js.map} +1 -1
  245. package/dashboard/dist/assets/{namespaces-ne_yDQZX.js → namespaces-DtsT_GoV.js} +2 -2
  246. package/dashboard/dist/assets/{namespaces-ne_yDQZX.js.map → namespaces-DtsT_GoV.js.map} +1 -1
  247. package/dashboard/dist/assets/{pipelines-Bcz62DoS.js → pipelines-BjlCm9VH.js} +2 -2
  248. package/dashboard/dist/assets/{pipelines-Bcz62DoS.js.map → pipelines-BjlCm9VH.js.map} +1 -1
  249. package/dashboard/dist/assets/{roles-De2CzGCy.js → roles-D-LhJ82d.js} +2 -2
  250. package/dashboard/dist/assets/{roles-De2CzGCy.js.map → roles-D-LhJ82d.js.map} +1 -1
  251. package/dashboard/dist/assets/{tasks-4yL5EfxI.js → tasks-BrP_8uEN.js} +2 -2
  252. package/dashboard/dist/assets/{tasks-4yL5EfxI.js.map → tasks-BrP_8uEN.js.map} +1 -1
  253. package/dashboard/dist/assets/topics-DUk-zX5D.js +2 -0
  254. package/dashboard/dist/assets/{topics-DDKHpRwP.js.map → topics-DUk-zX5D.js.map} +1 -1
  255. package/dashboard/dist/assets/useEventHooks-XNNzwADV.js +2 -0
  256. package/dashboard/dist/assets/useEventHooks-XNNzwADV.js.map +1 -0
  257. package/dashboard/dist/assets/{useYamlActivityEvents-Dv6GhDkh.js → useYamlActivityEvents-DANQ5jIY.js} +2 -2
  258. package/dashboard/dist/assets/{useYamlActivityEvents-Dv6GhDkh.js.map → useYamlActivityEvents-DANQ5jIY.js.map} +1 -1
  259. package/dashboard/dist/assets/{users-pSMWP58G.js → users-vj0JgOkA.js} +2 -2
  260. package/dashboard/dist/assets/{users-pSMWP58G.js.map → users-vj0JgOkA.js.map} +1 -1
  261. package/dashboard/dist/assets/{vendor-icons-CrrAvF2g.js → vendor-icons-Doy0g69_.js} +116 -111
  262. package/dashboard/dist/assets/vendor-icons-Doy0g69_.js.map +1 -0
  263. package/dashboard/dist/assets/{workflows-COYPOe2I.js → workflows-CmqgGPzI.js} +2 -2
  264. package/dashboard/dist/assets/{workflows-COYPOe2I.js.map → workflows-CmqgGPzI.js.map} +1 -1
  265. package/dashboard/dist/assets/{yaml-workflows-1dF3ig6u.js → yaml-workflows-DNFyjBXH.js} +2 -2
  266. package/dashboard/dist/assets/{yaml-workflows-1dF3ig6u.js.map → yaml-workflows-DNFyjBXH.js.map} +1 -1
  267. package/dashboard/dist/index.html +3 -3
  268. package/docs/api/http/controlplane.md +1 -1
  269. package/docs/api/http/mcp-endpoint.md +133 -0
  270. package/docs/api/http/roles.md +46 -0
  271. package/docs/api/http/service-accounts.md +15 -0
  272. package/docs/api/http/settings.md +6 -0
  273. package/docs/api/mcp/admin.md +1187 -0
  274. package/docs/api/mcp/claude-code.md +47 -0
  275. package/docs/api/mcp/docs.md +54 -0
  276. package/docs/api/mcp/events.md +80 -0
  277. package/docs/api/mcp/file-storage.md +76 -0
  278. package/docs/api/mcp/http-fetch.md +64 -0
  279. package/docs/api/mcp/human-queue.md +101 -0
  280. package/docs/api/mcp/index.md +52 -0
  281. package/docs/api/mcp/knowledge.md +125 -0
  282. package/docs/api/mcp/oauth.md +62 -0
  283. package/docs/api/mcp/schema-exchange.md +56 -0
  284. package/docs/api/mcp/translation.md +28 -0
  285. package/docs/api/mcp/vision.md +46 -0
  286. package/docs/api/sdk/settings.md +3 -1
  287. package/docs/auth.md +109 -0
  288. package/docs/dashboard.md +1 -1
  289. package/package.json +1 -1
  290. package/build/system/mcp-servers/playwright/browser-lifecycle.d.ts +0 -26
  291. package/build/system/mcp-servers/playwright/browser-lifecycle.js +0 -125
  292. package/build/system/mcp-servers/playwright/index.d.ts +0 -25
  293. package/build/system/mcp-servers/playwright/index.js +0 -42
  294. package/build/system/mcp-servers/playwright/schemas.d.ts +0 -394
  295. package/build/system/mcp-servers/playwright/schemas.js +0 -90
  296. package/build/system/mcp-servers/playwright/tools-atomic.d.ts +0 -2
  297. package/build/system/mcp-servers/playwright/tools-atomic.js +0 -9
  298. package/build/system/mcp-servers/playwright/tools-navigation.d.ts +0 -2
  299. package/build/system/mcp-servers/playwright/tools-navigation.js +0 -153
  300. package/build/system/mcp-servers/playwright/tools-page-interaction.d.ts +0 -2
  301. package/build/system/mcp-servers/playwright/tools-page-interaction.js +0 -162
  302. package/build/system/mcp-servers/playwright/tools-run-script.d.ts +0 -2
  303. package/build/system/mcp-servers/playwright/tools-run-script.js +0 -207
  304. package/build/system/mcp-servers/playwright/types.d.ts +0 -8
  305. package/build/system/mcp-servers/playwright/types.js +0 -30
  306. package/build/system/mcp-servers/playwright/vision-helper.d.ts +0 -12
  307. package/build/system/mcp-servers/playwright/vision-helper.js +0 -81
  308. package/build/system/mcp-servers/playwright-cli/helpers.d.ts +0 -11
  309. package/build/system/mcp-servers/playwright-cli/helpers.js +0 -20
  310. package/build/system/mcp-servers/playwright-cli/index.d.ts +0 -4
  311. package/build/system/mcp-servers/playwright-cli/index.js +0 -15
  312. package/build/system/mcp-servers/playwright-cli/schemas.d.ts +0 -219
  313. package/build/system/mcp-servers/playwright-cli/schemas.js +0 -75
  314. package/build/system/mcp-servers/playwright-cli/tools-auth.d.ts +0 -2
  315. package/build/system/mcp-servers/playwright-cli/tools-auth.js +0 -183
  316. package/build/system/mcp-servers/playwright-cli/tools-capture.d.ts +0 -2
  317. package/build/system/mcp-servers/playwright-cli/tools-capture.js +0 -273
  318. package/build/system/seed/tool-manifests-browser.d.ts +0 -577
  319. package/build/system/seed/tool-manifests-browser.js +0 -158
  320. package/dashboard/dist/assets/AgentConfigPage-DBtvb2x5.js +0 -16
  321. package/dashboard/dist/assets/AgentConfigPage-DBtvb2x5.js.map +0 -1
  322. package/dashboard/dist/assets/AgentDetailPage-3mZA7SOb.js.map +0 -1
  323. package/dashboard/dist/assets/AvailableEscalationsPage-CA9x9o5s.js +0 -2
  324. package/dashboard/dist/assets/BotPicker-BQp_Vs73.js +0 -2
  325. package/dashboard/dist/assets/CronLabel-DY8VdTS9.js +0 -2
  326. package/dashboard/dist/assets/CronLabel-DY8VdTS9.js.map +0 -1
  327. package/dashboard/dist/assets/ElapsedCell-BPYm8RA7.js +0 -2
  328. package/dashboard/dist/assets/EventTopicPill-CCWCs07y.js +0 -2
  329. package/dashboard/dist/assets/EventTopicPill-CCWCs07y.js.map +0 -1
  330. package/dashboard/dist/assets/HomePage-CwRebzmO.js +0 -2
  331. package/dashboard/dist/assets/HomePage-CwRebzmO.js.map +0 -1
  332. package/dashboard/dist/assets/ListToolbar-DEef1_-T.js +0 -2
  333. package/dashboard/dist/assets/McpRunDetailPage-X0sfRFTk.js +0 -2
  334. package/dashboard/dist/assets/McpRunDetailPage-X0sfRFTk.js.map +0 -1
  335. package/dashboard/dist/assets/McpRunsPage-aZg057y3.js +0 -2
  336. package/dashboard/dist/assets/OperatorDashboard-iZEHnndU.js +0 -2
  337. package/dashboard/dist/assets/OperatorDashboard-iZEHnndU.js.map +0 -1
  338. package/dashboard/dist/assets/ServerName-Q6okiv4f.js +0 -2
  339. package/dashboard/dist/assets/TopicDetailPage-DW97-YHQ.js +0 -9
  340. package/dashboard/dist/assets/TopicDetailPage-DW97-YHQ.js.map +0 -1
  341. package/dashboard/dist/assets/WorkflowsDashboard-eCH4gpAk.js +0 -2
  342. package/dashboard/dist/assets/WorkflowsDashboard-eCH4gpAk.js.map +0 -1
  343. package/dashboard/dist/assets/index-3n5VREXN.js +0 -2
  344. package/dashboard/dist/assets/index-BAXzN-QB.js +0 -6
  345. package/dashboard/dist/assets/index-BAXzN-QB.js.map +0 -1
  346. package/dashboard/dist/assets/index-BpN31nuC.js.map +0 -1
  347. package/dashboard/dist/assets/index-C37LMzJa.css +0 -1
  348. package/dashboard/dist/assets/index-C5dHozmW.js +0 -2
  349. package/dashboard/dist/assets/index-C5dHozmW.js.map +0 -1
  350. package/dashboard/dist/assets/index-UtAfnStw.js +0 -15
  351. package/dashboard/dist/assets/topics-DDKHpRwP.js +0 -2
  352. package/dashboard/dist/assets/useEventHooks-NzIyvoGY.js +0 -2
  353. package/dashboard/dist/assets/useEventHooks-NzIyvoGY.js.map +0 -1
  354. package/dashboard/dist/assets/vendor-icons-CrrAvF2g.js.map +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CT_3b5Wt.js","./vendor-query-B2UbickB.js","./tasks-4yL5EfxI.js","./workflows-COYPOe2I.js","./useEventHooks-NzIyvoGY.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./DataTable-D9yuBv0w.js","./EmptyState-BcsfPq9T.js","./TimestampCell-BBCf8zsN.js","./StickyPagination-BWhFSr2d.js","./FilterBar-Ck4K4rzu.js","./PageHeader-CR6TpJG_.js","./vendor-icons-CrrAvF2g.js","./ListToolbar-DEef1_-T.js","./WorkflowPill-54px0YiY.js","./ProcessDetailPage-DyzNjwu8.js","./PageHeaderWithStats-CRcQEAO1.js","./StatusBadge-XQlNFwmH.js","./RolePill-BC54Vn-U.js","./UserName-DX7IBjFn.js","./users-pSMWP58G.js","./McpOverview-CZFW5qMb.js","./mcp-BXN7-wGF.js","./pipelines-Bcz62DoS.js","./yaml-workflows-1dF3ig6u.js","./namespaces-ne_yDQZX.js","./StatCard-DlgF0CJC.js","./McpRunsPage-aZg057y3.js","./ElapsedCell-BPYm8RA7.js","./RowActions-Dg-Fsm5O.js","./McpRunDetailPage-X0sfRFTk.js","./CopyableId-DaT0ZRHg.js","./CollapsibleSection-2eZMMZiG.js","./useCollapsedSections-BU5HULGs.js","./SwimlaneTimeline-CbFaU4bq.js","./EventTable-DSDzJMer.js","./McpQueryPage-D14466yi.js","./mcp-query-BIJP4mQJ.js","./McpQueryDetailPage-q9xH-QRo.js","./useYamlActivityEvents-Dv6GhDkh.js","./TagInput-D6l1SPWd.js","./ToolPill-HcRTggHo.js","./RunAsSelector-C20rdNsC.js","./BotPicker-BQp_Vs73.js","./bots-CZz9iVys.js","./TimeAgo-7wqEp87-.js","./EscalationsOverview-kYGHfnLf.js","./AvailableEscalationsPage-CA9x9o5s.js","./roles-De2CzGCy.js","./constants-BHkpVaqx.js","./CustomDurationPicker-DbyqfK35.js","./Modal-CSrxpXeM.js","./escalation-columns-Beox3TXH.js","./PriorityBadge-DfQY9St9.js","./escalation-BEVFyQnE.js","./OperatorDashboard-iZEHnndU.js","./index-BAXzN-QB.js","./WorkflowsOverview-DaJRDkNy.js","./index-BCQ65lNu.js","./helpers-B4gzNq9h.js","./WorkflowsDashboard-eCH4gpAk.js","./YamlWorkflowsPage-CkpQaUmz.js","./useExpandedRows-CkcEntB-.js","./ServerName-Q6okiv4f.js","./TasksListPage-BDmaUIKu.js","./TaskDetailPage-22cJsFmM.js","./WorkflowExecutionPage-BjC0j9_L.js","./AdminDashboard-Cfo0mwL2.js","./index-D4KGadbW.js","./TaskQueuePill-iDBVCEQQ.js","./index-UtAfnStw.js","./ConfirmDeleteModal-D9_1b4MW.js","./StepIndicator-CuUIGxKk.js","./index-DdKbIZNE.js","./ToolTestPanel-Dosq1cqG.js","./index-aJRDh4zW.js","./index-C5dHozmW.js","./RolesPage-CpRJq-sg.js","./index-BYXiz05a.js","./index-Bh-PnP17.js","./controlplane-cj-1c-1C.js","./index-D1MywQ2z.js","./CredentialsPage-DJGLssm0.js","./index-3n5VREXN.js","./DropZone-BkfRoUcm.js","./index-_DfbFHXk.js","./knowledge-DhtKWMON.js","./HomePage-CwRebzmO.js","./EventTopicPill-CCWCs07y.js","./AgentsPage-CTVocfBb.js","./agents-B-P5MlEx.js","./AgentDetailPage-3mZA7SOb.js","./CronLabel-DY8VdTS9.js","./AgentConfigPage-DBtvb2x5.js","./capabilities-DrZ8Vw_v.js","./topics-DDKHpRwP.js","./CapabilitiesPage-wpVtkGeU.js","./TopicsPage-tVPdz-k0.js","./TopicDetailPage-DW97-YHQ.js"])))=>i.map(i=>d[i]);
2
- var mx=Object.defineProperty;var px=(r,n,s)=>n in r?mx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>px(r,typeof n!="symbol"?n+"":n,s);import{r as gx,a as T,j as m,u as Hn,b as Nn,c as Pn,Q as yx,d as bx}from"./vendor-query-B2UbickB.js";import{r as xx,L as gr,u as Ws,N as No,a as ng,b as Fs,O as wo,c as sg,d as vx,R as _x}from"./vendor-react-CXumBFUA.js";import{C as wx,I as Sx,R as ig,B as rg,U as Ex,A as Ax,Z as Ox,a as jx,S as Tx,P as Nx,b as Cx,c as kx,G as Mx,L as Rx,W as Dx,d as zx,e as qx,F as Ux,f as Bx,g as Lx,T as Hx,h as Px,N as $x,i as Yx,D as Gx,j as Vx,M as ag,k as lg,l as Fx,m as Jx,n as Qx,E as Ix,X as Po,o as Xx,p as Kx,q as Zx,r as Kp,s as og,t as Wx,u as ev,v as tv,w as nv,x as sv}from"./vendor-icons-CrrAvF2g.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var rf={exports:{}},wa={},af={exports:{}},lf={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-DR1RGaMl.js","./vendor-query-B2UbickB.js","./tasks-BrP_8uEN.js","./workflows-CmqgGPzI.js","./useEventHooks-XNNzwADV.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./DataTable-D9yuBv0w.js","./EmptyState-BcsfPq9T.js","./TimestampCell-DL6zMNEQ.js","./StickyPagination-BWhFSr2d.js","./FilterBar-Ck4K4rzu.js","./PageHeader-BuJpMxyu.js","./vendor-icons-Doy0g69_.js","./ListToolbar-jrVba7QN.js","./WorkflowPill-Z-zHRKOK.js","./ProcessDetailPage-DYIfvWyc.js","./PageHeaderWithStats-yD_PTbOl.js","./StatusBadge-XQlNFwmH.js","./RolePill-SasQKc_B.js","./UserName-BjHIJWgh.js","./users-vj0JgOkA.js","./McpOverview-BzyxJyc9.js","./mcp-MtXuky8q.js","./pipelines-BjlCm9VH.js","./yaml-workflows-DNFyjBXH.js","./namespaces-DtsT_GoV.js","./StatCard-DlgF0CJC.js","./McpRunsPage-SXyiwc0d.js","./ElapsedCell-tcGx5PFI.js","./RowActions-Dg-Fsm5O.js","./McpRunDetailPage-DKZp-p7S.js","./CopyableId-DaT0ZRHg.js","./CollapsibleSection-C3tU61hB.js","./useCollapsedSections-BU5HULGs.js","./SwimlaneTimeline-Cr_K5qpu.js","./EventTable-DnpsQ6Ew.js","./McpQueryPage-WZfTY43_.js","./mcp-query-DQ-J1Q0K.js","./McpQueryDetailPage-DXNseeKl.js","./useYamlActivityEvents-DANQ5jIY.js","./TagInput-DvF3j8MA.js","./ToolPill-1aTqYtzp.js","./RunAsSelector-B-ksMoEj.js","./BotPicker-BKtjl6IL.js","./bots-CzuMCVgU.js","./TimeAgo-BSzN6rAH.js","./EscalationsOverview-1KO5dXzk.js","./AvailableEscalationsPage-DR1e0TQZ.js","./roles-D-LhJ82d.js","./constants-BHkpVaqx.js","./CustomDurationPicker-B_Yxfb-u.js","./Modal-CSrxpXeM.js","./escalation-columns-CHQEJU1j.js","./PriorityBadge-DfQY9St9.js","./escalation-B7ysVToF.js","./OperatorDashboard-Cy7ySMXj.js","./index-l_8R6U4r.js","./WorkflowsOverview-B4DUcVxs.js","./index-BFaDxPxA.js","./helpers-BFOjXa4r.js","./WorkflowsDashboard-D-G8Xudz.js","./YamlWorkflowsPage-CnTNOku0.js","./useExpandedRows-CkcEntB-.js","./ServerName-CHspudaC.js","./TasksListPage-BRg-uFtF.js","./TaskDetailPage-BO5p7AEe.js","./WorkflowExecutionPage-BQ7AYlQA.js","./AdminDashboard-BwUGcCxQ.js","./index-v0OQpgXS.js","./TaskQueuePill-BCQrS2oK.js","./index-BduDiGcw.js","./ConfirmDeleteModal-D9_1b4MW.js","./StepIndicator-CuUIGxKk.js","./index-CbrMW-gM.js","./ToolTestPanel-fLzNp79U.js","./index-CvOGgvzP.js","./index-a98qWLB-.js","./RolesPage-pMERxj15.js","./index-DQHmfTPo.js","./index-BeLphL59.js","./controlplane-DGvwkuYx.js","./index-DDlrQeTj.js","./CredentialsPage-Dt4nJs_B.js","./index-B9_1AZaG.js","./DropZone-CptiQ0wc.js","./index-CRiBkHPb.js","./knowledge-BlF8UMrk.js","./HomePage-B2Jgo1J1.js","./AgentsPage-CGpVG6r8.js","./agents-CkvQDr9b.js","./AgentDetailPage-XJpl7wfJ.js","./CronLabel-BdE6mHyA.js","./AgentConfigPage-DgrYzLwq.js","./capabilities-CbGmS0ty.js","./topics-DUk-zX5D.js","./CapabilitiesPage-kCB8fyOj.js","./TopicsPage-B3Aa8Haz.js","./TopicDetailPage-D7gCsPKB.js"])))=>i.map(i=>d[i]);
2
+ var yx=Object.defineProperty;var bx=(r,n,s)=>n in r?yx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>bx(r,typeof n!="symbol"?n+"":n,s);import{r as xx,a as T,j as m,u as Hn,b as Cn,c as Pn,Q as vx,d as _x}from"./vendor-query-B2UbickB.js";import{r as wx,L as gr,u as Ws,N as Co,a as ig,b as Fs,O as So,c as rg,d as Sx,R as Ex}from"./vendor-react-CXumBFUA.js";import{I as Zp,R as ag,B as lg,U as Ax,A as Ox,Z as jx,a as Tx,S as Nx,P as Cx,C as kx,b as Mx,G as Rx,L as Dx,W as zx,c as qx,d as Ux,F as Bx,e as Lx,f as Hx,T as Px,g as $x,N as Yx,h as Gx,D as Vx,i as Fx,M as og,j as cg,k as Jx,l as Qx,m as Ix,E as Xx,X as $o,n as Kx,o as Zx,p as Wx,q as Wp,r as ug,s as ev,t as tv,u as nv,v as sv,w as iv}from"./vendor-icons-Doy0g69_.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var af={exports:{}},wa={},lf={exports:{}},of={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -7,7 +7,7 @@ var mx=Object.defineProperty;var px=(r,n,s)=>n in r?mx(r,n,{enumerable:!0,config
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var Zp;function iv(){return Zp||(Zp=1,(function(r){function n($,te){var de=$.length;$.push(te);e:for(;0<de;){var ve=de-1>>>1,be=$[ve];if(0<o(be,te))$[ve]=te,$[de]=be,de=ve;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var te=$[0],de=$.pop();if(de!==te){$[0]=de;e:for(var ve=0,be=$.length,je=be>>>1;ve<je;){var _e=2*(ve+1)-1,Te=$[_e],lt=_e+1,Pt=$[lt];if(0>o(Te,de))lt<be&&0>o(Pt,Te)?($[ve]=Pt,$[lt]=de,ve=lt):($[ve]=Te,$[_e]=de,ve=_e);else if(lt<be&&0>o(Pt,de))$[ve]=Pt,$[lt]=de,ve=lt;else break e}}return te}function o($,te){var de=$.sortIndex-te.sortIndex;return de!==0?de:$.id-te.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,d=h.now();r.unstable_now=function(){return h.now()-d}}var g=[],y=[],E=1,w=null,j=3,q=!1,M=!1,z=!1,G=!1,ne=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,pe=typeof setImmediate<"u"?setImmediate:null;function ae($){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=$)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function k($){if(z=!1,ae($),!M)if(s(g)!==null)M=!0,X||(X=!0,re());else{var te=s(y);te!==null&&Le(k,te.startTime-$)}}var X=!1,se=-1,W=5,F=-1;function Z(){return G?!0:!(r.unstable_now()-F<W)}function le(){if(G=!1,X){var $=r.unstable_now();F=$;var te=!0;try{e:{M=!1,z&&(z=!1,ee(se),se=-1),q=!0;var de=j;try{t:{for(ae($),w=s(g);w!==null&&!(w.expirationTime>$&&Z());){var ve=w.callback;if(typeof ve=="function"){w.callback=null,j=w.priorityLevel;var be=ve(w.expirationTime<=$);if($=r.unstable_now(),typeof be=="function"){w.callback=be,ae($),te=!0;break t}w===s(g)&&a(g),ae($)}else a(g);w=s(g)}if(w!==null)te=!0;else{var je=s(y);je!==null&&Le(k,je.startTime-$),te=!1}}break e}finally{w=null,j=de,q=!1}te=void 0}}finally{te?re():X=!1}}}var re;if(typeof pe=="function")re=function(){pe(le)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,Ge=qe.port2;qe.port1.onmessage=le,re=function(){Ge.postMessage(null)}}else re=function(){ne(le,0)};function Le($,te){se=ne(function(){$(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function($){$.callback=null},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return j},r.unstable_next=function($){switch(j){case 1:case 2:case 3:var te=3;break;default:te=j}var de=j;j=te;try{return $()}finally{j=de}},r.unstable_requestPaint=function(){G=!0},r.unstable_runWithPriority=function($,te){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var de=j;j=$;try{return te()}finally{j=de}},r.unstable_scheduleCallback=function($,te,de){var ve=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?ve+de:ve):de=ve,$){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=de+be,$={id:E++,callback:te,priorityLevel:$,startTime:de,expirationTime:be,sortIndex:-1},de>ve?($.sortIndex=de,n(y,$),s(g)===null&&$===s(y)&&(z?(ee(se),se=-1):z=!0,Le(k,de-ve))):($.sortIndex=be,n(g,$),M||q||(M=!0,X||(X=!0,re()))),$},r.unstable_shouldYield=Z,r.unstable_wrapCallback=function($){var te=j;return function(){var de=j;j=te;try{return $.apply(this,arguments)}finally{j=de}}}})(lf)),lf}var Wp;function rv(){return Wp||(Wp=1,af.exports=iv()),af.exports}/**
10
+ */var e0;function rv(){return e0||(e0=1,(function(r){function n($,te){var de=$.length;$.push(te);e:for(;0<de;){var ve=de-1>>>1,be=$[ve];if(0<o(be,te))$[ve]=te,$[de]=be,de=ve;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var te=$[0],de=$.pop();if(de!==te){$[0]=de;e:for(var ve=0,be=$.length,je=be>>>1;ve<je;){var _e=2*(ve+1)-1,Te=$[_e],lt=_e+1,Pt=$[lt];if(0>o(Te,de))lt<be&&0>o(Pt,Te)?($[ve]=Pt,$[lt]=de,ve=lt):($[ve]=Te,$[_e]=de,ve=_e);else if(lt<be&&0>o(Pt,de))$[ve]=Pt,$[lt]=de,ve=lt;else break e}}return te}function o($,te){var de=$.sortIndex-te.sortIndex;return de!==0?de:$.id-te.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,d=h.now();r.unstable_now=function(){return h.now()-d}}var g=[],y=[],E=1,w=null,j=3,q=!1,M=!1,D=!1,W=!1,se=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;function re($){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=$)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function C($){if(D=!1,re($),!M)if(s(g)!==null)M=!0,X||(X=!0,ne());else{var te=s(y);te!==null&&Me(C,te.startTime-$)}}var X=!1,ce=-1,V=5,G=-1;function K(){return W?!0:!(r.unstable_now()-G<V)}function ae(){if(W=!1,X){var $=r.unstable_now();G=$;var te=!0;try{e:{M=!1,D&&(D=!1,ee(ce),ce=-1),q=!0;var de=j;try{t:{for(re($),w=s(g);w!==null&&!(w.expirationTime>$&&K());){var ve=w.callback;if(typeof ve=="function"){w.callback=null,j=w.priorityLevel;var be=ve(w.expirationTime<=$);if($=r.unstable_now(),typeof be=="function"){w.callback=be,re($),te=!0;break t}w===s(g)&&a(g),re($)}else a(g);w=s(g)}if(w!==null)te=!0;else{var je=s(y);je!==null&&Me(C,je.startTime-$),te=!1}}break e}finally{w=null,j=de,q=!1}te=void 0}}finally{te?ne():X=!1}}}var ne;if(typeof me=="function")ne=function(){me(ae)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,He=ke.port2;ke.port1.onmessage=ae,ne=function(){He.postMessage(null)}}else ne=function(){se(ae,0)};function Me($,te){ce=se(function(){$(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function($){$.callback=null},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return j},r.unstable_next=function($){switch(j){case 1:case 2:case 3:var te=3;break;default:te=j}var de=j;j=te;try{return $()}finally{j=de}},r.unstable_requestPaint=function(){W=!0},r.unstable_runWithPriority=function($,te){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var de=j;j=$;try{return te()}finally{j=de}},r.unstable_scheduleCallback=function($,te,de){var ve=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?ve+de:ve):de=ve,$){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=de+be,$={id:E++,callback:te,priorityLevel:$,startTime:de,expirationTime:be,sortIndex:-1},de>ve?($.sortIndex=de,n(y,$),s(g)===null&&$===s(y)&&(D?(ee(ce),ce=-1):D=!0,Me(C,de-ve))):($.sortIndex=be,n(g,$),M||q||(M=!0,X||(X=!0,ne()))),$},r.unstable_shouldYield=K,r.unstable_wrapCallback=function($){var te=j;return function(){var de=j;j=te;try{return $.apply(this,arguments)}finally{j=de}}}})(of)),of}var t0;function av(){return t0||(t0=1,lf.exports=rv()),lf.exports}/**
11
11
  * @license React
12
12
  * react-dom-client.production.js
13
13
  *
@@ -15,49 +15,49 @@ var mx=Object.defineProperty;var px=(r,n,s)=>n in r?mx(r,n,{enumerable:!0,config
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var e0;function av(){if(e0)return wa;e0=1;var r=rv(),n=gx(),s=xx();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var i=e,l=t;;){var c=i.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===i)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===i){p=!0,i=c,l=u;break}if(b===l){p=!0,l=c,i=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===i){p=!0,i=u,l=c;break}if(b===l){p=!0,l=u,i=c;break}b=b.sibling}if(!p)throw Error(a(189))}}if(i.alternate!==l)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?e:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,j=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),pe=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=le&&e[le]||e["@@iterator"],typeof e=="function"?e:null)}var qe=Symbol.for("react.client.reference");function Ge(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===qe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case z:return"Fragment";case ne:return"Profiler";case G:return"StrictMode";case k:return"Suspense";case X:return"SuspenseList";case F:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case pe:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return t=e.displayName||null,t!==null?t:Ge(e.type)||"Memo";case W:t=e._payload,e=e._init;try{return Ge(e(t))}catch{}}return null}var Le=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},ve=[],be=-1;function je(e){return{current:e}}function _e(e){0>be||(e.current=ve[be],ve[be]=null,be--)}function Te(e,t){be++,ve[be]=e.current,e.current=t}var lt=je(null),Pt=je(null),sn=je(null),Ot=je(null);function jt(e,t){switch(Te(sn,t),Te(Pt,e),Te(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?vp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=vp(t),e=_p(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_e(lt),Te(lt,e)}function we(){_e(lt),_e(Pt),_e(sn)}function Tt(e){e.memoizedState!==null&&Te(Ot,e);var t=lt.current,i=_p(t,e.type);t!==i&&(Te(Pt,e),Te(lt,i))}function ei(e){Pt.current===e&&(_e(lt),_e(Pt)),Ot.current===e&&(_e(Ot),ba._currentValue=de)}var Ti,ti;function rn(e){if(Ti===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ti=t&&t[1]||"",ti=-1<i.stack.indexOf(`
18
+ */var n0;function lv(){if(n0)return wa;n0=1;var r=av(),n=xx(),s=wx();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var i=e,l=t;;){var c=i.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===i)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===i){p=!0,i=c,l=u;break}if(b===l){p=!0,l=c,i=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===i){p=!0,i=u,l=c;break}if(b===l){p=!0,l=u,i=c;break}b=b.sibling}if(!p)throw Error(a(189))}}if(i.alternate!==l)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?e:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,j=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),se=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),me=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function ne(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var ke=Symbol.for("react.client.reference");function He(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ke?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case se:return"Profiler";case W:return"StrictMode";case C:return"Suspense";case X:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case me:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case re:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return t=e.displayName||null,t!==null?t:He(e.type)||"Memo";case V:t=e._payload,e=e._init;try{return He(e(t))}catch{}}return null}var Me=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},ve=[],be=-1;function je(e){return{current:e}}function _e(e){0>be||(e.current=ve[be],ve[be]=null,be--)}function Te(e,t){be++,ve[be]=e.current,e.current=t}var lt=je(null),Pt=je(null),rn=je(null),Ot=je(null);function jt(e,t){switch(Te(rn,t),Te(Pt,e),Te(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?_p(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=_p(t),e=wp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_e(lt),Te(lt,e)}function we(){_e(lt),_e(Pt),_e(rn)}function Tt(e){e.memoizedState!==null&&Te(Ot,e);var t=lt.current,i=wp(t,e.type);t!==i&&(Te(Pt,e),Te(lt,i))}function ei(e){Pt.current===e&&(_e(lt),_e(Pt)),Ot.current===e&&(_e(Ot),ba._currentValue=de)}var Ti,ti;function an(e){if(Ti===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ti=t&&t[1]||"",ti=-1<i.stack.indexOf(`
19
19
  at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
20
20
  `+Ti+e+ti}var Ni=!1;function ds(e,t){if(!e||Ni)return"";Ni=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(P){var L=P}Reflect.construct(e,[],I)}else{try{I.call()}catch(P){L=P}e.call(I.prototype)}}else{try{throw Error()}catch(P){L=P}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(P){if(P&&L&&typeof P.stack=="string")return[P.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var O=p.split(`
21
21
  `),B=b.split(`
22
22
  `);for(c=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;if(l===O.length||c===B.length)for(l=O.length-1,c=B.length-1;1<=l&&0<=c&&O[l]!==B[c];)c--;for(;1<=l&&0<=c;l--,c--)if(O[l]!==B[c]){if(l!==1||c!==1)do if(l--,c--,0>c||O[l]!==B[c]){var Y=`
23
- `+O[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=c);break}}}finally{Ni=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?rn(i):""}function Fa(e,t){switch(e.tag){case 26:case 27:case 5:return rn(e.type);case 16:return rn("Lazy");case 13:return e.child!==t&&t!==null?rn("Suspense Fallback"):rn("Suspense");case 19:return rn("SuspenseList");case 0:case 15:return ds(e.type,!1);case 11:return ds(e.type.render,!1);case 1:return ds(e.type,!0);case 31:return rn("Activity");default:return""}}function Ja(e){try{var t="",i=null;do t+=Fa(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
23
+ `+O[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=c);break}}}finally{Ni=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?an(i):""}function Fa(e,t){switch(e.tag){case 26:case 27:case 5:return an(e.type);case 16:return an("Lazy");case 13:return e.child!==t&&t!==null?an("Suspense Fallback"):an("Suspense");case 19:return an("SuspenseList");case 0:case 15:return ds(e.type,!1);case 11:return ds(e.type.render,!1);case 1:return ds(e.type,!0);case 31:return an("Activity");default:return""}}function Ja(e){try{var t="",i=null;do t+=Fa(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
24
24
  Error generating stack: `+l.message+`
25
- `+l.stack}}var Tr=Object.prototype.hasOwnProperty,Nr=r.unstable_scheduleCallback,$n=r.unstable_cancelCallback,Qa=r.unstable_shouldYield,Ci=r.unstable_requestPaint,et=r.unstable_now,Qo=r.unstable_getCurrentPriorityLevel,Ia=r.unstable_ImmediatePriority,Xa=r.unstable_UserBlockingPriority,ki=r.unstable_NormalPriority,Io=r.unstable_LowPriority,Ka=r.unstable_IdlePriority,Xo=r.log,Za=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Xo=="function"&&Za(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Mi,Cr=Math.log,kr=Math.LN2;function Mi(e){return e>>>=0,e===0?32:31-(Cr(e)/kr|0)|0}var ms=256,Yn=262144,ps=4194304;function xn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=xn(l):(p&=b,p!==0?c=xn(p):i||(i=b&~e,i!==0&&(c=xn(i))))):(b=l&~u,b!==0?c=xn(b):p!==0?c=xn(p):i||(i=l&~e,i!==0&&(c=xn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Mr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ri(){var e=ps;return ps<<=1,(ps&62914560)===0&&(ps=4194304),e}function gs(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function vn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ys(e,t,i,l,c,u){var p=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,B=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),I=1<<Y;b[Y]=0,O[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~I}l!==0&&bs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function bs(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function xs(e,t){var i=t&-t;return i=(i&42)!==0?1:Gn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Gp(e.type))}function Wa(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Cn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Cn,it="__reactProps$"+Cn,Yt="__reactContainer$"+Cn,li="__reactEvents$"+Cn,Dr="__reactListeners$"+Cn,el="__reactHandles$"+Cn,tl="__reactResources$"+Cn,yt="__reactMarker$"+Cn;function Di(e){delete e[Qe],delete e[it],delete e[li],delete e[Dr],delete e[el]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Tp(e);e!==null;){if(i=e[Qe])return i;e=Tp(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Qe]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[tl];return t||(t=e[tl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var D=new Set,Q={};function K(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(Q[e]=t,e=0;e<t.length;e++)D.add(t[e])}var J=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fe={},Oe={};function Ke(e){return Tr.call(Oe,e)?!0:Tr.call(fe,e)?!1:J.test(e)?Oe[e]=!0:(fe[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function _n(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Vn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function an(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ly(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ko(e){if(!e._valueTracker){var t=hh(e)?"checked":"value";e._valueTracker=ly(e,t,""+e[t])}}function dh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=hh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function nl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var oy=/[\n"\\]/g;function ln(e){return e.replace(oy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Zo(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+an(t)):e.value!==""+an(t)&&(e.value=""+an(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?Wo(e,p,an(t)):i!=null?Wo(e,p,an(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+an(b):e.removeAttribute("name")}function mh(e,t,i,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Ko(e);return}i=i!=null?""+an(i):"",t=t!=null?""+an(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Ko(e)}function Wo(e,t,i){t==="number"&&nl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function zi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+an(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function ph(e,t,i){if(t!=null&&(t=""+an(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+an(i):""}function gh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Le(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=an(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Ko(e)}function qi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var cy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function yh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||cy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function bh(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&yh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&yh(e,u,t[u])}function ec(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var uy=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),fy=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function sl(e){return fy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var tc=null;function nc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Bi=null;function xh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Zo(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+ln(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));Zo(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&dh(l)}break e;case"textarea":ph(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&zi(e,!!i.multiple,t,!1)}}}var sc=!1;function vh(e,t,i){if(sc)return e(t,i);sc=!0;try{var l=e(t);return l}finally{if(sc=!1,(Ui!==null||Bi!==null)&&(Gl(),Ui&&(t=Ui,e=Bi,Bi=Ui=null,xh(t),e)))for(t=0;t<e.length;t++)xh(e[t])}}function zr(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ic=!1;if(Jn)try{var qr={};Object.defineProperty(qr,"passive",{get:function(){ic=!0}}),window.addEventListener("test",qr,qr),window.removeEventListener("test",qr,qr)}catch{ic=!1}var vs=null,rc=null,il=null;function _h(){if(il)return il;var e,t=rc,i=t.length,l,c="value"in vs?vs.value:vs.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return il=c.slice(e,1<l?1-l:void 0)}function rl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function al(){return!0}function wh(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?al:wh,this.isPropagationStopped=wh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=al)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=al)},persist:function(){},isPersistent:al}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ll=zt(oi),Ur=w({},oi,{view:0,detail:0}),hy=zt(Ur),ac,lc,Br,ol=w({},Ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Br&&(Br&&e.type==="mousemove"?(ac=e.screenX-Br.screenX,lc=e.screenY-Br.screenY):lc=ac=0,Br=e),ac)},movementY:function(e){return"movementY"in e?e.movementY:lc}}),Sh=zt(ol),dy=w({},ol,{dataTransfer:0}),my=zt(dy),py=w({},Ur,{relatedTarget:0}),oc=zt(py),gy=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),yy=zt(gy),by=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),xy=zt(by),vy=w({},oi,{data:0}),Eh=zt(vy),_y={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wy={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Sy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ey(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sy[e])?!!t[e]:!1}function cc(){return Ey}var Ay=w({},Ur,{key:function(e){if(e.key){var t=_y[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=rl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cc,charCode:function(e){return e.type==="keypress"?rl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?rl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Oy=zt(Ay),jy=w({},ol,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ah=zt(jy),Ty=w({},Ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cc}),Ny=zt(Ty),Cy=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ky=zt(Cy),My=w({},ol,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ry=zt(My),Dy=w({},oi,{newState:0,oldState:0}),zy=zt(Dy),qy=[9,13,27,32],uc=Jn&&"CompositionEvent"in window,Lr=null;Jn&&"documentMode"in document&&(Lr=document.documentMode);var Uy=Jn&&"TextEvent"in window&&!Lr,Oh=Jn&&(!uc||Lr&&8<Lr&&11>=Lr),jh=" ",Th=!1;function Nh(e,t){switch(e){case"keyup":return qy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ch(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Li=!1;function By(e,t){switch(e){case"compositionend":return Ch(t);case"keypress":return t.which!==32?null:(Th=!0,jh);case"textInput":return e=t.data,e===jh&&Th?null:e;default:return null}}function Ly(e,t){if(Li)return e==="compositionend"||!uc&&Nh(e,t)?(e=_h(),il=rc=vs=null,Li=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Oh&&t.locale!=="ko"?null:t.data;default:return null}}var Hy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function kh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hy[e.type]:t==="textarea"}function Mh(e,t,i,l){Ui?Bi?Bi.push(l):Bi=[l]:Ui=l,t=Kl(t,"onChange"),0<t.length&&(i=new ll("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Hr=null,Pr=null;function Py(e){mp(e,0)}function cl(e){var t=_(e);if(dh(t))return e}function Rh(e,t){if(e==="change")return t}var Dh=!1;if(Jn){var fc;if(Jn){var hc="oninput"in document;if(!hc){var zh=document.createElement("div");zh.setAttribute("oninput","return;"),hc=typeof zh.oninput=="function"}fc=hc}else fc=!1;Dh=fc&&(!document.documentMode||9<document.documentMode)}function qh(){Hr&&(Hr.detachEvent("onpropertychange",Uh),Pr=Hr=null)}function Uh(e){if(e.propertyName==="value"&&cl(Pr)){var t=[];Mh(t,Pr,e,nc(e)),vh(Py,t)}}function $y(e,t,i){e==="focusin"?(qh(),Hr=t,Pr=i,Hr.attachEvent("onpropertychange",Uh)):e==="focusout"&&qh()}function Yy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cl(Pr)}function Gy(e,t){if(e==="click")return cl(t)}function Vy(e,t){if(e==="input"||e==="change")return cl(t)}function Fy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Fy;function $r(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Tr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function Bh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lh(e,t){var i=Bh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Bh(i)}}function Hh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ph(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=nl(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=nl(e.document)}return t}function dc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Jy=Jn&&"documentMode"in document&&11>=document.documentMode,Hi=null,mc=null,Yr=null,pc=!1;function $h(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;pc||Hi==null||Hi!==nl(l)||(l=Hi,"selectionStart"in l&&dc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Yr&&$r(Yr,l)||(Yr=l,l=Kl(mc,"onSelect"),0<l.length&&(t=new ll("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Hi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Pi={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},gc={},Yh={};Jn&&(Yh=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function ui(e){if(gc[e])return gc[e];if(!Pi[e])return e;var t=Pi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Yh)return gc[e]=t[i];return e}var Gh=ui("animationend"),Vh=ui("animationiteration"),Fh=ui("animationstart"),Qy=ui("transitionrun"),Iy=ui("transitionstart"),Xy=ui("transitioncancel"),Jh=ui("transitionend"),Qh=new Map,yc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");yc.push("scrollEnd");function wn(e,t){Qh.set(e,t),K(t,[e])}var ul=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},on=[],$i=0,bc=0;function fl(){for(var e=$i,t=bc=$i=0;t<e;){var i=on[t];on[t++]=null;var l=on[t];on[t++]=null;var c=on[t];on[t++]=null;var u=on[t];if(on[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&Ih(i,c,u)}}function hl(e,t,i,l){on[$i++]=e,on[$i++]=t,on[$i++]=i,on[$i++]=l,bc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function xc(e,t,i,l){return hl(e,t,i,l),dl(e)}function fi(e,t){return hl(e,null,null,t),dl(e)}function Ih(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function dl(e){if(50<fa)throw fa=0,Tu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function Ky(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new Ky(e,t,i,l)}function vc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Xh(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ml(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")vc(e)&&(p=1);else if(typeof e=="string")p=nx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case F:return e=Vt(31,i,t,c),e.elementType=F,e.lanes=u,e;case z:return hi(i.children,c,u,t);case G:p=8,c|=24;break;case ne:return e=Vt(12,i,t,c|2),e.elementType=ne,e.lanes=u,e;case k:return e=Vt(13,i,t,c),e.elementType=k,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pe:p=10;break e;case ee:p=9;break e;case ae:p=11;break e;case se:p=14;break e;case W:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function _c(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function Kh(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function wc(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Zh=new WeakMap;function cn(e,t){if(typeof e=="object"&&e!==null){var i=Zh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ja(t)},Zh.set(e,t),t)}return{value:e,source:t,stack:Ja(t)}}var Gi=[],Vi=0,pl=null,Gr=0,un=[],fn=0,_s=null,kn=1,Mn="";function In(e,t){Gi[Vi++]=Gr,Gi[Vi++]=pl,pl=e,Gr=t}function Wh(e,t,i){un[fn++]=kn,un[fn++]=Mn,un[fn++]=_s,_s=e;var l=kn;e=Mn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,kn=1<<32-Nt(t)+c|i<<c|l,Mn=u+e}else kn=1<<u|i<<c|l,Mn=e}function Sc(e){e.return!==null&&(In(e,1),Wh(e,1,0))}function Ec(e){for(;e===pl;)pl=Gi[--Vi],Gi[Vi]=null,Gr=Gi[--Vi],Gi[Vi]=null;for(;e===_s;)_s=un[--fn],un[fn]=null,Mn=un[--fn],un[fn]=null,kn=un[--fn],un[fn]=null}function ed(e,t){un[fn++]=kn,un[fn++]=Mn,un[fn++]=_s,kn=t.id,Mn=t.overflow,_s=e}var wt=null,Ze=null,Re=!1,ws=null,hn=!1,Ac=Error(a(519));function Ss(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vr(cn(t,e)),Ac}function td(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<da.length;i++)Ce(da[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),mh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),gh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||bp(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Fn),t=!0):t=!1,t||Ss(e,!0)}function nd(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:hn=!1;return;case 27:case 3:hn=!0;return;default:wt=wt.return}}function Fi(e){if(e!==wt)return!1;if(!Re)return nd(e),Re=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Yu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Ss(e),nd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=jp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=jp(e)}else t===27?(t=Ze,Us(e.type)?(e=Qu,Qu=null,Ze=e):Ze=t):Ze=wt?mn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,Re=!1}function Oc(){var e=ws;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),ws=null),e}function Vr(e){ws===null?ws=[e]:ws.push(e)}var jc=je(null),mi=null,Xn=null;function Es(e,t,i){Te(jc,t._currentValue),t._currentValue=i}function Kn(e){e._currentValue=jc.current,_e(jc)}function Tc(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function Nc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Tc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Tc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ji(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===Ot.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ba):e=[ba])}c=c.return}e!==null&&Nc(t,e,i,l),t.flags|=262144}function gl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Xn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return sd(mi,e)}function yl(e,t){return mi===null&&pi(e),sd(e,t)}function sd(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Xn===null){if(e===null)throw Error(a(308));Xn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xn=Xn.next=t;return i}var Zy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},Wy=r.unstable_scheduleCallback,eb=r.unstable_NormalPriority,ht={$$typeof:pe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cc(){return{controller:new Zy,data:new Map,refCount:0}}function Fr(e){e.refCount--,e.refCount===0&&Wy(eb,function(){e.controller.abort()})}var Jr=null,kc=0,Qi=0,Ii=null;function tb(e,t){if(Jr===null){var i=Jr=[];kc=0,Qi=Du(),Ii={status:"pending",value:void 0,then:function(l){i.push(l)}}}return kc++,t.then(id,id),t}function id(){if(--kc===0&&Jr!==null){Ii!==null&&(Ii.status="fulfilled");var e=Jr;Jr=null,Qi=0,Ii=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function nb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var rd=$.S;$.S=function(e,t){$m=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&tb(e,t),rd!==null&&rd(e,t)};var gi=je(null);function Mc(){var e=gi.current;return e!==null?e:Ie.pooledCache}function bl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function ad(){var e=Mc();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Rc=Error(a(474)),xl=Error(a(542)),vl={then:function(){}};function ld(e){return e=e.status,e==="fulfilled"||e==="rejected"}function od(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Fn,Fn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ud(e),e;default:if(typeof t.status=="string")t.then(Fn,Fn);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ud(e),e}throw bi=t,Xi}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Xi):i}}var bi=null;function cd(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function ud(e){if(e===Xi||e===xl)throw Error(a(483))}var Ki=null,Qr=0;function _l(e){var t=Qr;return Qr+=1,Ki===null&&(Ki=[]),od(Ki,e,t)}function Ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wl(e,t){throw t.$$typeof===j?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function fd(e){function t(R,C){if(e){var U=R.deletions;U===null?(R.deletions=[C],R.flags|=16):U.push(C)}}function i(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function l(R){for(var C=new Map;R!==null;)R.key!==null?C.set(R.key,R):C.set(R.index,R),R=R.sibling;return C}function c(R,C){return R=Qn(R,C),R.index=0,R.sibling=null,R}function u(R,C,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<C?(R.flags|=67108866,C):U):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,C,U,V){return C===null||C.tag!==6?(C=_c(U,R.mode,V),C.return=R,C):(C=c(C,U),C.return=R,C)}function O(R,C,U,V){var ge=U.type;return ge===z?Y(R,C,U.props.children,V,U.key):C!==null&&(C.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===W&&yi(ge)===C.type)?(C=c(C,U.props),Ir(C,U),C.return=R,C):(C=ml(U.type,U.key,U.props,null,R.mode,V),Ir(C,U),C.return=R,C)}function B(R,C,U,V){return C===null||C.tag!==4||C.stateNode.containerInfo!==U.containerInfo||C.stateNode.implementation!==U.implementation?(C=wc(U,R.mode,V),C.return=R,C):(C=c(C,U.children||[]),C.return=R,C)}function Y(R,C,U,V,ge){return C===null||C.tag!==7?(C=hi(U,R.mode,V,ge),C.return=R,C):(C=c(C,U),C.return=R,C)}function I(R,C,U){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=_c(""+C,R.mode,U),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case q:return U=ml(C.type,C.key,C.props,null,R.mode,U),Ir(U,C),U.return=R,U;case M:return C=wc(C,R.mode,U),C.return=R,C;case W:return C=yi(C),I(R,C,U)}if(Le(C)||re(C))return C=hi(C,R.mode,U,null),C.return=R,C;if(typeof C.then=="function")return I(R,_l(C),U);if(C.$$typeof===pe)return I(R,yl(R,C),U);wl(R,C)}return null}function L(R,C,U,V){var ge=C!==null?C.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:b(R,C,""+U,V);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case q:return U.key===ge?O(R,C,U,V):null;case M:return U.key===ge?B(R,C,U,V):null;case W:return U=yi(U),L(R,C,U,V)}if(Le(U)||re(U))return ge!==null?null:Y(R,C,U,V,null);if(typeof U.then=="function")return L(R,C,_l(U),V);if(U.$$typeof===pe)return L(R,C,yl(R,U),V);wl(R,U)}return null}function P(R,C,U,V,ge){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return R=R.get(U)||null,b(C,R,""+V,ge);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case q:return R=R.get(V.key===null?U:V.key)||null,O(C,R,V,ge);case M:return R=R.get(V.key===null?U:V.key)||null,B(C,R,V,ge);case W:return V=yi(V),P(R,C,U,V,ge)}if(Le(V)||re(V))return R=R.get(U)||null,Y(C,R,V,ge,null);if(typeof V.then=="function")return P(R,C,U,_l(V),ge);if(V.$$typeof===pe)return P(R,C,U,yl(C,V),ge);wl(C,V)}return null}function he(R,C,U,V){for(var ge=null,Ue=null,me=C,Ee=C=0,Me=null;me!==null&&Ee<U.length;Ee++){me.index>Ee?(Me=me,me=null):Me=me.sibling;var Be=L(R,me,U[Ee],V);if(Be===null){me===null&&(me=Me);break}e&&me&&Be.alternate===null&&t(R,me),C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be,me=Me}if(Ee===U.length)return i(R,me),Re&&In(R,Ee),ge;if(me===null){for(;Ee<U.length;Ee++)me=I(R,U[Ee],V),me!==null&&(C=u(me,C,Ee),Ue===null?ge=me:Ue.sibling=me,Ue=me);return Re&&In(R,Ee),ge}for(me=l(me);Ee<U.length;Ee++)Me=P(me,R,Ee,U[Ee],V),Me!==null&&(e&&Me.alternate!==null&&me.delete(Me.key===null?Ee:Me.key),C=u(Me,C,Ee),Ue===null?ge=Me:Ue.sibling=Me,Ue=Me);return e&&me.forEach(function($s){return t(R,$s)}),Re&&In(R,Ee),ge}function ye(R,C,U,V){if(U==null)throw Error(a(151));for(var ge=null,Ue=null,me=C,Ee=C=0,Me=null,Be=U.next();me!==null&&!Be.done;Ee++,Be=U.next()){me.index>Ee?(Me=me,me=null):Me=me.sibling;var $s=L(R,me,Be.value,V);if($s===null){me===null&&(me=Me);break}e&&me&&$s.alternate===null&&t(R,me),C=u($s,C,Ee),Ue===null?ge=$s:Ue.sibling=$s,Ue=$s,me=Me}if(Be.done)return i(R,me),Re&&In(R,Ee),ge;if(me===null){for(;!Be.done;Ee++,Be=U.next())Be=I(R,Be.value,V),Be!==null&&(C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be);return Re&&In(R,Ee),ge}for(me=l(me);!Be.done;Ee++,Be=U.next())Be=P(me,R,Ee,Be.value,V),Be!==null&&(e&&Be.alternate!==null&&me.delete(Be.key===null?Ee:Be.key),C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be);return e&&me.forEach(function(dx){return t(R,dx)}),Re&&In(R,Ee),ge}function Je(R,C,U,V){if(typeof U=="object"&&U!==null&&U.type===z&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case q:e:{for(var ge=U.key;C!==null;){if(C.key===ge){if(ge=U.type,ge===z){if(C.tag===7){i(R,C.sibling),V=c(C,U.props.children),V.return=R,R=V;break e}}else if(C.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===W&&yi(ge)===C.type){i(R,C.sibling),V=c(C,U.props),Ir(V,U),V.return=R,R=V;break e}i(R,C);break}else t(R,C);C=C.sibling}U.type===z?(V=hi(U.props.children,R.mode,V,U.key),V.return=R,R=V):(V=ml(U.type,U.key,U.props,null,R.mode,V),Ir(V,U),V.return=R,R=V)}return p(R);case M:e:{for(ge=U.key;C!==null;){if(C.key===ge)if(C.tag===4&&C.stateNode.containerInfo===U.containerInfo&&C.stateNode.implementation===U.implementation){i(R,C.sibling),V=c(C,U.children||[]),V.return=R,R=V;break e}else{i(R,C);break}else t(R,C);C=C.sibling}V=wc(U,R.mode,V),V.return=R,R=V}return p(R);case W:return U=yi(U),Je(R,C,U,V)}if(Le(U))return he(R,C,U,V);if(re(U)){if(ge=re(U),typeof ge!="function")throw Error(a(150));return U=ge.call(U),ye(R,C,U,V)}if(typeof U.then=="function")return Je(R,C,_l(U),V);if(U.$$typeof===pe)return Je(R,C,yl(R,U),V);wl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,C!==null&&C.tag===6?(i(R,C.sibling),V=c(C,U),V.return=R,R=V):(i(R,C),V=_c(U,R.mode,V),V.return=R,R=V),p(R)):i(R,C)}return function(R,C,U,V){try{Qr=0;var ge=Je(R,C,U,V);return Ki=null,ge}catch(me){if(me===Xi||me===xl)throw me;var Ue=Vt(29,me,null,R.mode);return Ue.lanes=V,Ue.return=R,Ue}finally{}}}var xi=fd(!0),hd=fd(!1),As=!1;function Dc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function js(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(He&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=dl(e),Ih(e,null,i),t}return hl(e,l,t,i),dl(e)}function Xr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}function qc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Uc=!1;function Kr(){if(Uc){var e=Ii;if(e!==null)throw e}}function Zr(e,t,i,l){Uc=!1;var c=e.updateQueue;As=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var O=b,B=O.next;O.next=null,p===null?u=B:p.next=B,p=O;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=B:b.next=B,Y.lastBaseUpdate=O))}if(u!==null){var I=c.baseState;p=0,Y=B=O=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(ke&L)===L:(l&L)===L){L!==0&&L===Qi&&(Uc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Je=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){I=he.call(Je,I,L);break e}I=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Je,I,L):he,L==null)break e;I=w({},I,L);break e;case 2:As=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(B=Y=P,O=I):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(O=I),c.baseState=O,c.firstBaseUpdate=B,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Ms|=p,e.lanes=p,e.memoizedState=I}}function dd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function md(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)dd(i[e],t)}var Zi=je(null),Sl=je(0);function pd(e,t){e=as,Te(Sl,e),Te(Zi,t),as=e|t.baseLanes}function Bc(){Te(Sl,as),Te(Zi,Zi.current)}function Lc(){as=Sl.current,_e(Zi),_e(Sl)}var Ft=je(null),dn=null;function Ts(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),dn===null&&(t===null||Zi.current!==null||t.memoizedState!==null)&&(dn=e)}function Hc(e){Te(ct,ct.current),Te(Ft,e),dn===null&&(dn=e)}function gd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),dn===null&&(dn=e)):Ns()}function Ns(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){_e(Ft),dn===e&&(dn=null),_e(ct)}var ct=je(0);function El(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Fu(i)||Ju(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Zn=0,Se=null,Ve=null,dt=null,Al=!1,Wi=!1,vi=!1,Ol=0,Wr=0,er=null,sb=0;function rt(){throw Error(a(321))}function Pc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function $c(e,t,i,l,c,u){return Zn=u,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?Wd:su,vi=!1,u=i(l,c),vi=!1,Wi&&(u=bd(t,i,l,c)),yd(e),u}function yd(e){$.H=na;var t=Ve!==null&&Ve.next!==null;if(Zn=0,dt=Ve=Se=null,Al=!1,Wr=0,er=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&gl(e)&&(mt=!0))}function bd(e,t,i,l){Se=e;var c=0;do{if(Wi&&(er=null),Wr=0,Wi=!1,25<=c)throw Error(a(301));if(c+=1,dt=Ve=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=em,u=t(i,l)}while(Wi);return u}function ib(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ea(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(Se.flags|=1024),t}function Yc(){var e=Ol!==0;return Ol=0,e}function Gc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Vc(e){if(Al){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Al=!1}Zn=0,dt=Ve=Se=null,Wi=!1,Wr=Ol=0,er=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Se.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Ve===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=dt===null?Se.memoizedState:dt.next;if(t!==null)dt=t,Ve=e;else{if(e===null)throw Se.alternate===null?Error(a(467)):Error(a(310));Ve=e,e={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},dt===null?Se.memoizedState=dt=e:dt=dt.next=e}return dt}function jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ea(e){var t=Wr;return Wr+=1,er===null&&(er=[]),e=od(er,e,t),t=Se,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?Wd:su),e}function Tl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ea(e);if(e.$$typeof===pe)return St(e)}throw Error(a(438,String(e)))}function Fc(e){var t=null,i=Se.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Se.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=jl(),Se.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=Z;return t.index++,i}function Wn(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=ut();return Jc(t,Ve,e)}function Jc(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,O=null,B=t,Y=!1;do{var I=B.lane&-536870913;if(I!==B.lane?(ke&I)===I:(Zn&I)===I){var L=B.revertLane;if(L===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),I===Qi&&(Y=!0);else if((Zn&L)===L){B=B.next,L===Qi&&(Y=!0);continue}else I={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=I,p=u):O=O.next=I,Se.lanes|=L,Ms|=L;I=B.action,vi&&i(u,I),u=B.hasEagerState?B.eagerState:i(u,I)}else L={lane:I,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=L,p=u):O=O.next=L,Se.lanes|=I,Ms|=I;B=B.next}while(B!==null&&B!==t);if(O===null?p=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Ii,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=O,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Qc(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function xd(e,t,i){var l=Se,c=ut(),u=Re;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Ve||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Kc(wd.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,tr(9,{destroy:void 0},_d.bind(null,l,c,i,t),null),Ie===null)throw Error(a(349));u||(Zn&127)!==0||vd(l,t,i)}return i}function vd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Se.updateQueue,t===null?(t=jl(),Se.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function _d(e,t,i,l){t.value=i,t.getSnapshot=l,Sd(t)&&Ed(e)}function wd(e,t,i){return i(function(){Sd(t)&&Ed(e)})}function Sd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Ed(e){var t=fi(e,2);t!==null&&Ht(t,e,2)}function Ic(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:e},t}function Ad(e,t,i,l){return e.baseState=i,Jc(e,Ve,typeof l=="function"?l:Wn)}function rb(e,t,i,l,c){if(Ml(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Od(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Od(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),O=$.S;O!==null&&O(p,b),jd(e,t,b)}catch(B){Xc(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),jd(e,t,u)}catch(B){Xc(e,t,B)}}function jd(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Td(e,t,l)},function(l){return Xc(e,t,l)}):Td(e,t,i)}function Td(e,t,i){t.status="fulfilled",t.value=i,Nd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Od(e,i)))}function Xc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Nd(t),t=t.next;while(t!==l)}e.action=null}function Nd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Cd(e,t){return t}function kd(e,t){if(Re){var i=Ie.formState;if(i!==null){e:{var l=Se;if(Re){if(Ze){t:{for(var c=Ze,u=hn;c.nodeType!==8;){if(!u){c=null;break t}if(c=mn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=mn(c.nextSibling),l=c.data==="F!";break e}}Ss(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cd,lastRenderedState:t},i.queue=l,i=Xd.bind(null,Se,l),l.dispatch=i,l=Ic(!1),u=nu.bind(null,Se,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=rb.bind(null,Se,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function Md(e){var t=ut();return Rd(t,Ve,e)}function Rd(e,t,i){if(t=Jc(e,t,Cd)[0],e=Nl(Wn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ea(t)}catch(p){throw p===Xi?xl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Se.flags|=2048,tr(9,{destroy:void 0},ab.bind(null,c,i),null)),[l,u,e]}function ab(e,t){e.action=t}function Dd(e){var t=ut(),i=Ve;if(i!==null)return Rd(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function tr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Se.updateQueue,t===null&&(t=jl(),Se.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function zd(){return ut().memoizedState}function Cl(e,t,i,l){var c=kt();Se.flags|=e,c.memoizedState=tr(1|t,{destroy:void 0},i,l===void 0?null:l)}function kl(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Ve!==null&&l!==null&&Pc(l,Ve.memoizedState.deps)?c.memoizedState=tr(t,u,i,l):(Se.flags|=e,c.memoizedState=tr(1|t,u,i,l))}function qd(e,t){Cl(8390656,8,e,t)}function Kc(e,t){kl(2048,8,e,t)}function lb(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=jl(),Se.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Ud(e){var t=ut().memoizedState;return lb({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Bd(e,t){return kl(4,2,e,t)}function Ld(e,t){return kl(4,4,e,t)}function Hd(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Pd(e,t,i){i=i!=null?i.concat([e]):null,kl(4,4,Hd.bind(null,t,e),i)}function Zc(){}function $d(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&Pc(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Yd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&Pc(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function Wc(e,t,i){return i===void 0||(Zn&1073741824)!==0&&(ke&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Gm(),Se.lanes|=e,Ms|=e,i)}function Gd(e,t,i,l){return Gt(i,t)?i:Zi.current!==null?(e=Wc(e,i,l),Gt(e,t)||(mt=!0),e):(Zn&42)===0||(Zn&1073741824)!==0&&(ke&261930)===0?(mt=!0,e.memoizedState=i):(e=Gm(),Se.lanes|=e,Ms|=e,t)}function Vd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,nu(e,!1,t,i);try{var O=c(),B=$.S;if(B!==null&&B(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=nb(O,l);ta(e,t,Y,Xt(e))}else ta(e,t,l,Xt(e))}catch(I){ta(e,t,{then:function(){},status:"rejected",reason:I},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function ob(){}function eu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Fd(e).queue;Vd(e,c,t,de,i===null?ob:function(){return Jd(e),i(l)})}function Fd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Jd(e){var t=Fd(e);t.next===null&&(t=e.alternate.memoizedState),ta(e,t.next.queue,{},Xt())}function tu(){return St(ba)}function Qd(){return ut().memoizedState}function Id(){return ut().memoizedState}function cb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=js(t,e,i);l!==null&&(Ht(l,t,i),Xr(l,t,i)),t={cache:Cc()},e.payload=t;return}t=t.return}}function ub(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ml(e)?Kd(t,i):(i=xc(e,t,i,l),i!==null&&(Ht(i,e,l),Zd(i,t,l)))}function Xd(e,t,i){var l=Xt();ta(e,t,i,l)}function ta(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Ml(e))Kd(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return hl(e,t,c,0),Ie===null&&fl(),!1}catch{}finally{}if(i=xc(e,t,c,l),i!==null)return Ht(i,e,l),Zd(i,t,l),!0}return!1}function nu(e,t,i,l){if(l={lane:2,revertLane:Du(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ml(e)){if(t)throw Error(a(479))}else t=xc(e,i,l,2),t!==null&&Ht(t,e,2)}function Ml(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Kd(e,t){Wi=Al=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Zd(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}var na={readContext:St,use:Tl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};na.useEffectEvent=rt;var Wd={readContext:St,use:Tl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:qd,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,Cl(4194308,4,Hd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){Cl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=ub.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ic(e);var t=e.queue,i=Xd.bind(null,Se,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Zc,useDeferredValue:function(e,t){var i=kt();return Wc(i,e,t)},useTransition:function(){var e=Ic(!1);return e=Vd.bind(null,Se,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Se,c=kt();if(Re){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Ie===null)throw Error(a(349));(ke&127)!==0||vd(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,qd(wd.bind(null,l,u,e),[e]),l.flags|=2048,tr(9,{destroy:void 0},_d.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Ie.identifierPrefix;if(Re){var i=Mn,l=kn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ol++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=sb++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:tu,useFormState:kd,useActionState:kd,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=nu.bind(null,Se,!0,i),i.dispatch=t,[e,t]},useMemoCache:Fc,useCacheRefresh:function(){return kt().memoizedState=cb.bind(null,Se)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((He&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},su={readContext:St,use:Tl,useCallback:$d,useContext:St,useEffect:Kc,useImperativeHandle:Pd,useInsertionEffect:Bd,useLayoutEffect:Ld,useMemo:Yd,useReducer:Nl,useRef:zd,useState:function(){return Nl(Wn)},useDebugValue:Zc,useDeferredValue:function(e,t){var i=ut();return Gd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Nl(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:xd,useId:Qd,useHostTransitionStatus:tu,useFormState:Md,useActionState:Md,useOptimistic:function(e,t){var i=ut();return Ad(i,Ve,e,t)},useMemoCache:Fc,useCacheRefresh:Id};su.useEffectEvent=Ud;var em={readContext:St,use:Tl,useCallback:$d,useContext:St,useEffect:Kc,useImperativeHandle:Pd,useInsertionEffect:Bd,useLayoutEffect:Ld,useMemo:Yd,useReducer:Qc,useRef:zd,useState:function(){return Qc(Wn)},useDebugValue:Zc,useDeferredValue:function(e,t){var i=ut();return Ve===null?Wc(i,e,t):Gd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Qc(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:xd,useId:Qd,useHostTransitionStatus:tu,useFormState:Dd,useActionState:Dd,useOptimistic:function(e,t){var i=ut();return Ve!==null?Ad(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Fc,useCacheRefresh:Id};em.useEffectEvent=Ud;function iu(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var ru={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=js(e,l,i),t!==null&&(Ht(t,e,i),Xr(t,e,i))}};function tm(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!$r(i,l)||!$r(c,u):!0}function nm(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&ru.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function sm(e){ul(e)}function im(e){console.error(e)}function rm(e){ul(e)}function Rl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function am(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function au(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){Rl(e,t)},i}function lm(e){return e=Os(e),e.tag=3,e}function om(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){am(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){am(t,i,l),typeof c!="function"&&(Rs===null?Rs=new Set([this]):Rs.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function fb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ji(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return dn===null?Vl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),ku(e,l,c)),!1;case 22:return i.flags|=65536,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),ku(e,l,c)),!1}throw Error(a(435,i.tag))}return ku(e,l,c),Vl(),!1}if(Re)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Ac&&(e=Error(a(422),{cause:l}),Vr(cn(e,i)))):(l!==Ac&&(t=Error(a(423),{cause:l}),Vr(cn(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=cn(l,i),c=au(e.stateNode,l,c),qc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=cn(u,i),ua===null?ua=[u]:ua.push(u),at!==4&&(at=2),t===null)return!0;l=cn(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=au(i.stateNode,l,e),qc(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Rs===null||!Rs.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=lm(c),om(c,e,i,l),qc(i,c),!1}i=i.return}while(i!==null);return!1}var lu=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?hd(t,null,i,l):xi(t,e.child,i,l)}function cm(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=$c(e,t,i,p,u,c),b=Yc(),e!==null&&!mt?(Gc(e,t,c),es(e,t,c)):(Re&&b&&Sc(t),t.flags|=1,Et(e,t,l,c),t.child)}function um(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!vc(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,fm(e,t,u,l,c)):(e=ml(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!pu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:$r,i(p,l)&&e.ref===t.ref)return es(e,t,c)}return t.flags|=1,e=Qn(u,l),e.ref=t.ref,e.return=t,t.child=e}function fm(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if($r(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,pu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,es(e,t,c)}return ou(e,t,i,l,c)}function hm(e,t,i,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return dm(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&bl(t,u!==null?u.cachePool:null),u!==null?pd(t,u):Bc(),gd(t);else return l=t.lanes=536870912,dm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(bl(t,u.cachePool),pd(t,u),Ns(),t.memoizedState=null):(e!==null&&bl(t,null),Bc(),Ns());return Et(e,t,c,i),t.child}function sa(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dm(e,t,i,l,c){var u=Mc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&bl(t,null),Bc(),gd(t),e!==null&&Ji(e,t,l,!0),t.childLanes=c,null}function Dl(e,t){return t=ql({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mm(e,t,i){return xi(t,e.child,null,i),e=Dl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function hb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(l.mode==="hidden")return e=Dl(t,l),t.lanes=536870912,sa(null,e);if(Hc(t),(e=Ze)?(e=Op(e,hn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Kh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return t.lanes=536870912,null}return Dl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Hc(t),c)if(t.flags&256)t.flags&=-257,t=mm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Ji(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Ie,l!==null&&(p=xs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),lu;Vl(),t=mm(e,t,i)}else e=u.treeContext,Ze=mn(p.nextSibling),wt=t,Re=!0,ws=null,hn=!1,e!==null&&ed(t,e),t=Dl(t,l),t.flags|=4096;return t}return e=Qn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zl(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function ou(e,t,i,l,c){return pi(t),i=$c(e,t,i,l,void 0,c),l=Yc(),e!==null&&!mt?(Gc(e,t,c),es(e,t,c)):(Re&&l&&Sc(t),t.flags|=1,Et(e,t,i,c),t.child)}function pm(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=bd(t,l,i,c),yd(e),l=Yc(),e!==null&&!mt?(Gc(e,t,u),es(e,t,u)):(Re&&l&&Sc(t),t.flags|=1,Et(e,t,i,u),t.child)}function gm(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Yi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=ru,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Dc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Yi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(iu(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&ru.enqueueReplaceState(u,u.state,null),Zr(t,l,u,c),Kr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=_i(i,b);u.props=O;var B=u.context,Y=i.contextType;p=Yi,typeof Y=="object"&&Y!==null&&(p=St(Y));var I=i.getDerivedStateFromProps;Y=typeof I=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&nm(t,u,l,p),As=!1;var L=t.memoizedState;u.state=L,Zr(t,l,u,c),Kr(),B=t.memoizedState,b||L!==B||As?(typeof I=="function"&&(iu(t,i,I,l),B=t.memoizedState),(O=As||tm(t,i,O,l,L,B,p))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=p,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,zc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,I=t.pendingProps,L=u.context,B=i.contextType,O=Yi,typeof B=="object"&&B!==null&&(O=St(B)),b=i.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==I||L!==O)&&nm(t,u,l,O),As=!1,L=t.memoizedState,u.state=L,Zr(t,l,u,c),Kr();var P=t.memoizedState;p!==I||L!==P||As||e!==null&&e.dependencies!==null&&gl(e.dependencies)?(typeof b=="function"&&(iu(t,i,b,l),P=t.memoizedState),(Y=As||tm(t,i,Y,l,L,P,O)||e!==null&&e.dependencies!==null&&gl(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,zl(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=es(e,t,c),e}function ym(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var cu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function uu(e){return{baseLanes:e,cachePool:ad()}}function fu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=It),e}function bm(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(c?Ts(t):Ns(),(e=Ze)?(e=Op(e,hn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Kh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return Ju(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Ns(),c=t.mode,b=ql({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=uu(i),l.childLanes=fu(e,p,i),t.memoizedState=cu,sa(null,l)):(Ts(t),hu(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(Ts(t),t.flags&=-257,t=du(e,t,i)):t.memoizedState!==null?(Ns(),t.child=e.child,t.flags|=128,t=null):(Ns(),b=l.fallback,c=t.mode,l=ql({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=uu(i),l.childLanes=fu(e,p,i),t.memoizedState=cu,t=sa(null,l));else if(Ts(t),Ju(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,Vr({value:l,source:null,stack:null}),t=du(e,t,i)}else if(mt||Ji(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Ie,p!==null&&(l=xs(p,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,fi(e,l),Ht(p,e,l),lu;Fu(b)||Vl(),t=du(e,t,i)}else Fu(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=mn(b.nextSibling),wt=t,Re=!0,ws=null,hn=!1,e!==null&&ed(t,e),t=hu(t,l.children),t.flags|=4096);return t}return c?(Ns(),b=l.fallback,c=t.mode,O=e.child,B=O.sibling,l=Qn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,B!==null?b=Qn(B,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,sa(null,l),l=t.child,b=e.child.memoizedState,b===null?b=uu(i):(c=b.cachePool,c!==null?(O=ht._currentValue,c=c.parent!==O?{parent:O,pool:O}:c):c=ad(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=fu(e,p,i),t.memoizedState=cu,sa(e.child,l)):(Ts(t),i=e.child,e=i.sibling,i=Qn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function hu(e,t){return t=ql({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ql(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function du(e,t,i){return xi(t,e.child,null,i),e=hu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Tc(e.return,t,i)}function mu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function vm(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=Re?Gr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xm(e,i,t);else if(e.tag===19)xm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&El(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),mu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&El(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}mu(t,!0,i,null,u,l);break;case"together":mu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function es(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Ms|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ji(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Qn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Qn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function pu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gl(e)))}function db(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),Es(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:Es(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Hc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ts(t),t.flags|=128,null):(i&t.child.childLanes)!==0?bm(e,t,i):(Ts(t),e=es(e,t,i),e!==null?e.sibling:null);Ts(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ji(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return vm(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,hm(e,t,i,t.pendingProps);case 24:Es(t,ht,e.memoizedState.cache)}return es(e,t,i)}function _m(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!pu(e,i)&&(t.flags&128)===0)return mt=!1,db(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,Re&&(t.flags&1048576)!==0&&Wh(t,Gr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")vc(e)?(l=_i(e,l),t.tag=1,t=gm(null,t,e,l,i)):(t.tag=0,t=ou(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===ae){t.tag=11,t=cm(null,t,e,l,i);break e}else if(c===se){t.tag=14,t=um(null,t,e,l,i);break e}}throw t=Ge(e)||e,Error(a(306,t,""))}}return t;case 0:return ou(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),gm(e,t,l,c,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,zc(e,t),Zr(t,l,null,i);var p=t.memoizedState;if(l=p.cache,Es(t,ht,l),l!==u.cache&&Nc(t,[ht],i,!0),Kr(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=ym(e,t,l,i);break e}else if(l!==c){c=cn(Error(a(424)),t),Vr(c),t=ym(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=mn(e.firstChild),wt=t,Re=!0,ws=null,hn=!0,i=hd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=es(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return zl(e,t),e===null?(i=Mp(t.type,null,t.pendingProps,null))?t.memoizedState=i:Re||(i=t.type,e=t.pendingProps,l=Zl(sn.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=Mp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Re&&(l=t.stateNode=Np(t.type,t.pendingProps,sn.current),wt=t,hn=!0,c=Ze,Us(t.type)?(Qu=c,Ze=mn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),zl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((c=l=Ze)&&(l=Yb(l,t.type,t.pendingProps,hn),l!==null?(t.stateNode=l,wt=t,Ze=mn(l.firstChild),hn=!1,c=!0):c=!1),c||Ss(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Yu(c,u)?l=null:p!==null&&Yu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=$c(e,t,ib,null,null,i),ba._currentValue=c),zl(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&Re&&((e=i=Ze)&&(i=Gb(i,t.pendingProps,hn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Ss(t)),null;case 13:return bm(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return cm(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,Es(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return um(e,t,t.type,t.pendingProps,i);case 15:return fm(e,t,t.type,t.pendingProps,i);case 19:return vm(e,t,i);case 31:return hb(e,t,i);case 22:return hm(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Mc(),c===null&&(c=Ie,u=Cc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},Dc(t),Es(t,ht,c)):((e.lanes&i)!==0&&(zc(e,t),Zr(t,null,null,i),Kr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Es(t,ht,l)):(l=u.cache,Es(t,ht,l),l!==c.cache&&Nc(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ts(e){e.flags|=4}function gu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Qm())e.flags|=8192;else throw bi=vl,Rc}else e.flags&=-16777217}function wm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Up(t))if(Qm())e.flags|=8192;else throw bi=vl,Rc}function Ul(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ri():536870912,e.lanes|=t,rr|=t)}function ia(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function mb(e,t,i){var l=t.pendingProps;switch(Ec(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Kn(ht),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?ts(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Oc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ts(t),u!==null?(We(t),wm(t,u)):(We(t),gu(t,c,null,l,i))):u?u!==e.memoizedState?(ts(t),We(t),wm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ts(t),We(t),gu(t,c,e,l,i)),null;case 27:if(ei(t),i=sn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Fi(t)?td(t):(e=Np(c,l,i),t.stateNode=e,ts(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Fi(t))td(t);else{var p=Zl(sn.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Qe]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ts(t)}}return We(t),gu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=sn.current,Fi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||bp(e.nodeValue,i)),e||Ss(t,!0)}else e=Zl(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Fi(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=Oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Ul(t,t.updateQueue),We(t),null);case 4:return we(),e===null&&Bu(t.stateNode.containerInfo),We(t),null;case 10:return Kn(t.type),We(t),null;case 19:if(_e(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ia(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=El(e),u!==null){for(t.flags|=128,ia(l,!1),e=u.updateQueue,t.updateQueue=e,Ul(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Xh(i,e),i=i.sibling;return Te(ct,ct.current&1|2),Re&&In(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>$l&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304)}else{if(!c)if(e=El(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Ul(t,e),ia(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Re)return We(t),null}else 2*et()-l.renderingStartTime>$l&&i!==536870912&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ct.current,Te(ct,c?i&1|2:i&1),Re&&In(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Lc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Ul(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&_e(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Kn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function pb(e,t){switch(Ec(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(ht),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(ct),null;case 4:return we(),null;case 10:return Kn(t.type),null;case 22:case 23:return Jt(t),Lc(),e!==null&&_e(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kn(ht),null;case 25:return null;default:return null}}function Sm(e,t){switch(Ec(t),t.tag){case 3:Kn(ht),we();break;case 26:case 27:case 5:ei(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:_e(ct);break;case 10:Kn(t.type);break;case 22:case 23:Jt(t),Lc(),e!==null&&_e(gi);break;case 24:Kn(ht)}}function ra(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){$e(t,t.return,b)}}function Cs(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var O=i,B=b;try{B()}catch(Y){$e(c,O,Y)}}}l=l.next}while(l!==u)}}catch(Y){$e(t,t.return,Y)}}function Em(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{md(t,i)}catch(l){$e(e,e.return,l)}}}function Am(e,t,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){$e(e,t,l)}}function aa(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(c){$e(e,t,c)}}function Rn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){$e(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){$e(e,t,c)}else i.current=null}function Om(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(c){$e(e,e.return,c)}}function yu(e,t,i){try{var l=e.stateNode;Ub(l,e.type,i,t),l[it]=t}catch(c){$e(e,e.return,c)}}function jm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Us(e.type)||e.tag===4}function bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Us(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function xu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Fn));else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(xu(e,t,i),e=e.sibling;e!==null;)xu(e,t,i),e=e.sibling}function Bl(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Bl(e,t,i),e=e.sibling;e!==null;)Bl(e,t,i),e=e.sibling}function Tm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){$e(e,e.return,u)}}var ns=!1,pt=!1,vu=!1,Nm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function gb(e,t){if(e=e.containerInfo,Pu=ro,e=Ph(e),dc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,O=-1,B=0,Y=0,I=e,L=null;t:for(;;){for(var P;I!==i||c!==0&&I.nodeType!==3||(b=p+c),I!==u||l!==0&&I.nodeType!==3||(O=p+l),I.nodeType===3&&(p+=I.nodeValue.length),(P=I.firstChild)!==null;)L=I,I=P;for(;;){if(I===e)break t;if(L===i&&++B===c&&(b=p),L===u&&++Y===l&&(O=p),(P=I.nextSibling)!==null)break;I=L,L=I.parentNode}I=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for($u={focusedElem:e,selectionRange:i},ro=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){$e(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Vu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Vu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function Cm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:is(e,i),l&4&&ra(5,i);break;case 1:if(is(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){$e(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){$e(i,i.return,p)}}l&64&&Em(i),l&512&&aa(i,i.return);break;case 3:if(is(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{md(e,t)}catch(p){$e(i,i.return,p)}}break;case 27:t===null&&l&4&&Tm(i);case 26:case 5:is(e,i),t===null&&l&4&&Om(i),l&512&&aa(i,i.return);break;case 12:is(e,i);break;case 31:is(e,i),l&4&&Rm(e,i);break;case 13:is(e,i),l&4&&Dm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Ab.bind(null,i),Vb(e,i))));break;case 22:if(l=i.memoizedState!==null||ns,!l){t=t!==null&&t.memoizedState!==null||pt,c=ns;var u=pt;ns=l,(pt=t)&&!u?rs(e,i,(i.subtreeFlags&8772)!==0):is(e,i),ns=c,pt=u}break;case 30:break;default:is(e,i)}}function km(e){var t=e.alternate;t!==null&&(e.alternate=null,km(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Di(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function ss(e,t,i){for(i=i.child;i!==null;)Mm(e,t,i),i=i.sibling}function Mm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||Rn(i,t),ss(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Rn(i,t);var l=tt,c=qt;Us(i.type)&&(tt=i.stateNode,qt=!1),ss(e,t,i),pa(i.stateNode),tt=l,qt=c;break;case 5:pt||Rn(i,t);case 6:if(l=tt,c=qt,tt=null,ss(e,t,i),tt=l,qt=c,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){$e(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){$e(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,Ep(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),dr(e)):Ep(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,ss(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:Cs(2,i,t),pt||Cs(4,i,t),ss(e,t,i);break;case 1:pt||(Rn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Am(i,t,l)),ss(e,t,i);break;case 21:ss(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ss(e,t,i),pt=l;break;default:ss(e,t,i)}}function Rm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dr(e)}catch(i){$e(t,t.return,i)}}}function Dm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dr(e)}catch(i){$e(t,t.return,i)}}function yb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Nm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Nm),t;default:throw Error(a(435,e.tag))}}function Ll(e,t){var i=yb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Ob.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Us(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Mm(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)zm(t,e),t=t.sibling}var Sn=null;function zm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(Cs(3,e,e.return),ra(3,e),Cs(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&64&&ns&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var c=Sn;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Qe]=e,N(u),l=u;break e;case"link":var p=zp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=zp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,N(u),l=u}e.stateNode=l}else qp(c,e.type,e.stateNode);else e.stateNode=Dp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?qp(c,e.type,e.stateNode):Dp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&yu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),i!==null&&l&4&&yu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),e.flags&32){c=e.stateNode;try{qi(c,"")}catch(he){$e(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,yu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(vu=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(he){$e(e,e.return,he)}}break;case 3:if(to=null,c=Sn,Sn=Wl(t.containerInfo),Ut(t,e),Sn=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{dr(t.containerInfo)}catch(he){$e(e,e.return,he)}vu&&(vu=!1,qm(e));break;case 4:l=Sn,Sn=Wl(e.stateNode.containerInfo),Ut(t,e),Bt(e),Sn=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Pl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 22:c=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,B=ns,Y=pt;if(ns=B||c,pt=Y||O,Ut(t,e),pt=Y,ns=B,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||O||ns||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=O.stateNode;var I=O.memoizedProps.style,L=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){$e(O,O.return,he)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(he){$e(O,O.return,he)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;c?Ap(P,!0):Ap(O.stateNode,!1)}catch(he){$e(O,O.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Ll(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(jm(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=bu(e);Bl(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(qi(p,""),i.flags&=-33);var b=bu(e);Bl(e,b,p);break;case 3:case 4:var O=i.stateNode.containerInfo,B=bu(e);xu(e,B,O);break;default:throw Error(a(161))}}catch(Y){$e(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function qm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;qm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function is(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Cm(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Cs(4,t,t.return),wi(t);break;case 1:Rn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Am(t,t.return,i),wi(t);break;case 27:pa(t.stateNode);case 26:case 5:Rn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function rs(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:rs(c,u,i),ra(4,u);break;case 1:if(rs(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){$e(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)dd(O[c],b)}catch(B){$e(l,l.return,B)}}i&&p&64&&Em(u),aa(u,u.return);break;case 27:Tm(u);case 26:case 5:rs(c,u,i),i&&l===null&&p&4&&Om(u),aa(u,u.return);break;case 12:rs(c,u,i);break;case 31:rs(c,u,i),i&&p&4&&Rm(c,u);break;case 13:rs(c,u,i),i&&p&4&&Dm(c,u);break;case 22:u.memoizedState===null&&rs(c,u,i),aa(u,u.return);break;case 30:break;default:rs(c,u,i)}t=t.sibling}}function _u(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Fr(i))}function wu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e))}function En(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Um(e,t,i,l),t=t.sibling}function Um(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:En(e,t,i,l),c&2048&&ra(9,t);break;case 1:En(e,t,i,l);break;case 3:En(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e)));break;case 12:if(c&2048){En(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){$e(t,t.return,O)}}else En(e,t,i,l);break;case 31:En(e,t,i,l);break;case 13:En(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?En(e,t,i,l):la(e,t):u._visibility&2?En(e,t,i,l):(u._visibility|=2,nr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&_u(p,t);break;case 24:En(e,t,i,l),c&2048&&wu(t.alternate,t);break;default:En(e,t,i,l)}}function nr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,O=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:nr(u,p,b,O,c),ra(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?nr(u,p,b,O,c):la(u,p):(Y._visibility|=2,nr(u,p,b,O,c)),c&&B&2048&&_u(p.alternate,p);break;case 24:nr(u,p,b,O,c),c&&B&2048&&wu(p.alternate,p);break;default:nr(u,p,b,O,c)}t=t.sibling}}function la(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:la(i,l),c&2048&&_u(l.alternate,l);break;case 24:la(i,l),c&2048&&wu(l.alternate,l);break;default:la(i,l)}t=t.sibling}}var oa=8192;function sr(e,t,i){if(e.subtreeFlags&oa)for(e=e.child;e!==null;)Bm(e,t,i),e=e.sibling}function Bm(e,t,i){switch(e.tag){case 26:sr(e,t,i),e.flags&oa&&e.memoizedState!==null&&sx(i,Sn,e.memoizedState,e.memoizedProps);break;case 5:sr(e,t,i);break;case 3:case 4:var l=Sn;Sn=Wl(e.stateNode.containerInfo),sr(e,t,i),Sn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=oa,oa=16777216,sr(e,t,i),oa=l):sr(e,t,i));break;default:sr(e,t,i)}}function Lm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ca(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Pm(l,e)}Lm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hm(e),e=e.sibling}function Hm(e){switch(e.tag){case 0:case 11:case 15:ca(e),e.flags&2048&&Cs(9,e,e.return);break;case 3:ca(e);break;case 12:ca(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hl(e)):ca(e);break;default:ca(e)}}function Hl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Pm(l,e)}Lm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cs(8,t,t.return),Hl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function Pm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:Cs(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Fr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(km(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var bb={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},xb=typeof WeakMap=="function"?WeakMap:Map,He=0,Ie=null,Ne=null,ke=0,Pe=0,Qt=null,ks=!1,ir=!1,Su=!1,as=0,at=0,Ms=0,Si=0,Eu=0,It=0,rr=0,ua=null,Lt=null,Au=!1,Pl=0,$m=0,$l=1/0,Yl=null,Rs=null,bt=0,Ds=null,ar=null,ls=0,Ou=0,ju=null,Ym=null,fa=0,Tu=null;function Xt(){return(He&2)!==0&&ke!==0?ke&-ke:$.T!==null?Du():Rr()}function Gm(){if(It===0)if((ke&536870912)===0||Re){var e=Yn;Yn<<=1,(Yn&3932160)===0&&(Yn=262144),It=e}else It=536870912;return e=Ft.current,e!==null&&(e.flags|=32),It}function Ht(e,t,i){(e===Ie&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(lr(e,0),zs(e,ke,It,!1)),vn(e,i),((He&2)===0||e!==Ie)&&(e===Ie&&((He&2)===0&&(Si|=i),at===4&&zs(e,ke,It,!1)),Dn(e))}function Vm(e,t,i){if((He&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?wb(e,t):Cu(e,t,!0),u=l;do{if(c===0){ir&&!l&&zs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!vb(i)){c=Cu(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=ua;var O=b.current.memoizedState.isDehydrated;if(O&&(lr(b,p).flags|=256),p=Cu(b,p,!1),p!==2){if(Su&&!O){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){lr(e,0),zs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:zs(l,t,It,!ks);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Pl+300-et(),10<c)){if(zs(l,t,It,!ks),si(l,0,!0)!==0)break e;ls=t,l.timeoutHandle=wp(Fm.bind(null,l,i,Lt,Yl,Au,t,It,Si,rr,ks,u,"Throttled",-0,0),c);break e}Fm(l,i,Lt,Yl,Au,t,It,Si,rr,ks,u,null,-0,0)}}break}while(!0);Dn(e)}function Fm(e,t,i,l,c,u,p,b,O,B,Y,I,L,P){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn},Bm(t,u,I);var he=(u&62914560)===u?Pl-et():(u&4194048)===u?$m-et():0;if(he=ix(I,he),he!==null){ls=u,e.cancelPendingCommit=he(ep.bind(null,e,t,u,i,l,c,p,b,O,Y,I,null,L,P)),zs(e,u,p,!B);return}}ep(e,t,u,i,l,c,p,b,O)}function vb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zs(e,t,i,l){t&=~Eu,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&bs(e,i,t)}function Gl(){return(He&6)===0?(ha(0),!1):!0}function Nu(){if(Ne!==null){if(Pe===0)var e=Ne.return;else e=Ne,Xn=mi=null,Vc(e),Ki=null,Qr=0,e=Ne;for(;e!==null;)Sm(e.alternate,e),e=e.return;Ne=null}}function lr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Hb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ls=0,Nu(),Ie=e,Ne=i=Qn(e.current,null),ke=t,Pe=0,Qt=null,ks=!1,ir=ii(e,t),Su=!1,rr=It=Eu=Si=Ms=at=0,Lt=ua=null,Au=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return as=t,fl(),i}function Jm(e,t){Se=null,$.H=na,t===Xi||t===xl?(t=cd(),Pe=3):t===Rc?(t=cd(),Pe=4):Pe=t===lu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Rl(e,cn(t,e.current)))}function Qm(){var e=Ft.current;return e===null?!0:(ke&4194048)===ke?dn===null:(ke&62914560)===ke||(ke&536870912)!==0?e===dn:!1}function Im(){var e=$.H;return $.H=na,e===null?na:e}function Xm(){var e=$.A;return $.A=bb,e}function Vl(){at=4,ks||(ke&4194048)!==ke&&Ft.current!==null||(ir=!0),(Ms&134217727)===0&&(Si&134217727)===0||Ie===null||zs(Ie,ke,It,!1)}function Cu(e,t,i){var l=He;He|=2;var c=Im(),u=Xm();(Ie!==e||ke!==t)&&(Yl=null,lr(e,t)),t=!1;var p=at;e:do try{if(Pe!==0&&Ne!==null){var b=Ne,O=Qt;switch(Pe){case 8:Nu(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var B=Pe;if(Pe=0,Qt=null,or(e,b,O,B),i&&ir){p=0;break e}break;default:B=Pe,Pe=0,Qt=null,or(e,b,O,B)}}_b(),p=at;break}catch(Y){Jm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Xn=mi=null,He=l,$.H=c,$.A=u,Ne===null&&(Ie=null,ke=0,fl()),p}function _b(){for(;Ne!==null;)Km(Ne)}function wb(e,t){var i=He;He|=2;var l=Im(),c=Xm();Ie!==e||ke!==t?(Yl=null,$l=et()+500,lr(e,t)):ir=ii(e,t);e:do try{if(Pe!==0&&Ne!==null){t=Ne;var u=Qt;t:switch(Pe){case 1:Pe=0,Qt=null,or(e,t,u,1);break;case 2:case 9:if(ld(u)){Pe=0,Qt=null,Zm(t);break}t=function(){Pe!==2&&Pe!==9||Ie!==e||(Pe=7),Dn(e)},u.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:ld(u)?(Pe=0,Qt=null,Zm(t)):(Pe=0,Qt=null,or(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Up(p):b.stateNode.complete){Pe=0,Qt=null;var O=b.sibling;if(O!==null)Ne=O;else{var B=b.return;B!==null?(Ne=B,Fl(B)):Ne=null}break t}}Pe=0,Qt=null,or(e,t,u,5);break;case 6:Pe=0,Qt=null,or(e,t,u,6);break;case 8:Nu(),at=6;break e;default:throw Error(a(462))}}Sb();break}catch(Y){Jm(e,Y)}while(!0);return Xn=mi=null,$.H=l,$.A=c,He=i,Ne!==null?0:(Ie=null,ke=0,fl(),at)}function Sb(){for(;Ne!==null&&!Qa();)Km(Ne)}function Km(e){var t=_m(e.alternate,e,as);e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function Zm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=pm(i,t,t.pendingProps,t.type,void 0,ke);break;case 11:t=pm(i,t,t.pendingProps,t.type.render,t.ref,ke);break;case 5:Vc(t);default:Sm(i,t),t=Ne=Xh(t,as),t=_m(i,t,as)}e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function or(e,t,i,l){Xn=mi=null,Vc(t),Ki=null,Qr=0;var c=t.return;try{if(fb(e,c,t,i,ke)){at=1,Rl(e,cn(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Rl(e,cn(i,e.current)),Ne=null;return}t.flags&32768?(Re||l===1?e=!0:ir||(ke&536870912)!==0?e=!1:(ks=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),Wm(t,e)):Fl(t)}function Fl(e){var t=e;do{if((t.flags&32768)!==0){Wm(t,ks);return}e=t.return;var i=mb(t.alternate,t,as);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function Wm(e,t){do{var i=pb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function ep(e,t,i,l,c,u,p,b,O){e.cancelPendingCommit=null;do Jl();while(bt!==0);if((He&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=bc,ys(e,i,u,p,b,O),e===Ie&&(Ne=Ie=null,ke=0),ar=t,Ds=e,ls=i,Ou=u,ju=c,Ym=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,jb(ki,function(){return rp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=He,He|=4;try{gb(e,t,i)}finally{He=p,te.p=c,$.T=l}}bt=1,tp(),np(),sp()}}function tp(){if(bt===1){bt=0;var e=Ds,t=ar,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=He;He|=4;try{zm(t,e);var u=$u,p=Ph(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Hh(b.ownerDocument.documentElement,b)){if(O!==null&&dc(b)){var B=O.start,Y=O.end;if(Y===void 0&&(Y=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(Y,b.value.length);else{var I=b.ownerDocument||document,L=I&&I.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(O.start,he),Je=O.end===void 0?ye:Math.min(O.end,he);!P.extend&&ye>Je&&(p=Je,Je=ye,ye=p);var R=Lh(b,ye),C=Lh(b,Je);if(R&&C&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==C.node||P.focusOffset!==C.offset)){var U=I.createRange();U.setStart(R.node,R.offset),P.removeAllRanges(),ye>Je?(P.addRange(U),P.extend(C.node,C.offset)):(U.setEnd(C.node,C.offset),P.addRange(U))}}}}for(I=[],P=b;P=P.parentNode;)P.nodeType===1&&I.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var V=I[b];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}ro=!!Pu,$u=Pu=null}finally{He=c,te.p=l,$.T=i}}e.current=t,bt=2}}function np(){if(bt===2){bt=0;var e=Ds,t=ar,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=He;He|=4;try{Cm(e,t.alternate,t)}finally{He=c,te.p=l,$.T=i}}bt=3}}function sp(){if(bt===4||bt===3){bt=0,Ci();var e=Ds,t=ar,i=ls,l=Ym;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,ar=Ds=null,ip(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Rs=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(ls&3)!==0&&Jl(),Dn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Tu?fa++:(fa=0,Tu=e):fa=0,ha(0)}}function ip(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Fr(t)))}function Jl(){return tp(),np(),sp(),rp()}function rp(){if(bt!==5)return!1;var e=Ds,t=Ou;Ou=0;var i=ai(ls),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=ju,ju=null;var u=Ds,p=ls;if(bt=0,ar=Ds=null,ls=0,(He&6)!==0)throw Error(a(331));var b=He;if(He|=4,Hm(u.current),Um(u,u.current,p,i),He=b,ha(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,ip(e,t)}}function ap(e,t,i){t=cn(i,t),t=au(e.stateNode,t,2),e=js(e,t,2),e!==null&&(vn(e,2),Dn(e))}function $e(e,t,i){if(e.tag===3)ap(e,e,i);else for(;t!==null;){if(t.tag===3){ap(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Rs===null||!Rs.has(l))){e=cn(i,e),i=lm(2),l=js(t,i,2),l!==null&&(om(i,l,t,e),vn(l,2),Dn(l));break}}t=t.return}}function ku(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new xb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Su=!0,c.add(i),e=Eb.bind(null,e,t,i),t.then(e,e))}function Eb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ie===e&&(ke&i)===i&&(at===4||at===3&&(ke&62914560)===ke&&300>et()-Pl?(He&2)===0&&lr(e,0):Eu|=i,rr===ke&&(rr=0)),Dn(e)}function lp(e,t){t===0&&(t=Ri()),e=fi(e,t),e!==null&&(vn(e,t),Dn(e))}function Ab(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),lp(e,i)}function Ob(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),lp(e,i)}function jb(e,t){return Nr(e,t)}var Ql=null,cr=null,Mu=!1,Il=!1,Ru=!1,qs=0;function Dn(e){e!==cr&&e.next===null&&(cr===null?Ql=cr=e:cr=cr.next=e),Il=!0,Mu||(Mu=!0,Nb())}function ha(e,t){if(!Ru&&Il){Ru=!0;do for(var i=!1,l=Ql;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,fp(l,u))}else u=ke,u=si(l,l===Ie?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,fp(l,u));l=l.next}while(i);Ru=!1}}function Tb(){op()}function op(){Il=Mu=!1;var e=0;qs!==0&&Lb()&&(e=qs);for(var t=et(),i=null,l=Ql;l!==null;){var c=l.next,u=cp(l,t);u===0?(l.next=null,i===null?Ql=c:i.next=c,c===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Il=!0)),l=c}bt!==0&&bt!==5||ha(e),qs!==0&&(qs=0)}function cp(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,O=c[p];O===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Mr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Ie,i=ke,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$n(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&$n(l),ai(i)){case 2:case 8:i=Xa;break;case 32:i=ki;break;case 268435456:i=Ka;break;default:i=ki}return l=up.bind(null,e),i=Nr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&$n(l),e.callbackPriority=2,e.callbackNode=null,2}function up(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Jl()&&e.callbackNode!==i)return null;var l=ke;return l=si(e,e===Ie?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Vm(e,l,t),cp(e,et()),e.callbackNode!=null&&e.callbackNode===i?up.bind(null,e):null)}function fp(e,t){if(Jl())return null;Vm(e,t,!0)}function Nb(){Pb(function(){(He&6)!==0?Nr(Ia,Tb):op()})}function Du(){if(qs===0){var e=Qi;e===0&&(e=ms,ms<<=1,(ms&261888)===0&&(ms=256)),qs=e}return qs}function hp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:sl(""+e)}function dp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Cb(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=hp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?hp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ll("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(qs!==0){var O=p?dp(c,p):new FormData(c);eu(i,{pending:!0,data:O,method:c.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=p?dp(c,p):new FormData(c),eu(i,{pending:!0,data:O,method:c.method,action:u},u,O))},currentTarget:c}]})}}for(var zu=0;zu<yc.length;zu++){var qu=yc[zu],kb=qu.toLowerCase(),Mb=qu[0].toUpperCase()+qu.slice(1);wn(kb,"on"+Mb)}wn(Gh,"onAnimationEnd"),wn(Vh,"onAnimationIteration"),wn(Fh,"onAnimationStart"),wn("dblclick","onDoubleClick"),wn("focusin","onFocus"),wn("focusout","onBlur"),wn(Qy,"onTransitionRun"),wn(Iy,"onTransitionStart"),wn(Xy,"onTransitionCancel"),wn(Jh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),K("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),K("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),K("onBeforeInput",["compositionend","keypress","textInput","paste"]),K("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),K("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),K("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var da="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Rb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(da));function mp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],O=b.instance,B=b.currentTarget;if(b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}else for(p=0;p<l.length;p++){if(b=l[p],O=b.instance,B=b.currentTarget,b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(pp(t,e,2,!1),i.add(l))}function Uu(e,t,i){var l=0;t&&(l|=4),pp(i,e,l,t)}var Xl="_reactListening"+Math.random().toString(36).slice(2);function Bu(e){if(!e[Xl]){e[Xl]=!0,D.forEach(function(i){i!=="selectionchange"&&(Rb.has(i)||Uu(i,!1,e),Uu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xl]||(t[Xl]=!0,Uu("selectionchange",!1,t))}}function pp(e,t,i,l){switch(Gp(t)){case 2:var c=lx;break;case 8:c=ox;break;default:c=Wu}i=c.bind(null,t,i,e),c=void 0,!ic||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Lu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var O=p.tag;if((O===3||O===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(O=p.tag,O===5||O===6||O===26||O===27){l=u=p;continue e}b=b.parentNode}}l=l.return}vh(function(){var B=u,Y=nc(i),I=[];e:{var L=Qh.get(e);if(L!==void 0){var P=ll,he=e;switch(e){case"keypress":if(rl(i)===0)break e;case"keydown":case"keyup":P=Oy;break;case"focusin":he="focus",P=oc;break;case"focusout":he="blur",P=oc;break;case"beforeblur":case"afterblur":P=oc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=Sh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=my;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=Ny;break;case Gh:case Vh:case Fh:P=yy;break;case Jh:P=ky;break;case"scroll":case"scrollend":P=hy;break;case"wheel":P=Ry;break;case"copy":case"cut":case"paste":P=xy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Ah;break;case"toggle":case"beforetoggle":P=zy}var ye=(t&4)!==0,Je=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var C=B,U;C!==null;){var V=C;if(U=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||U===null||R===null||(V=zr(C,R),V!=null&&ye.push(ma(C,V,U))),Je)break;C=C.return}0<ye.length&&(L=new P(L,he,null,i,Y),I.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==tc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=B,he=he?x(he):null,he!==null&&(Je=f(he),ye=he.tag,he!==Je||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=B),P!==he)){if(ye=Sh,V="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Ah,V="onPointerLeave",R="onPointerEnter",C="pointer"),Je=P==null?L:_(P),U=he==null?L:_(he),L=new ye(V,C+"leave",P,i,Y),L.target=Je,L.relatedTarget=U,V=null,x(Y)===B&&(ye=new ye(R,C+"enter",he,i,Y),ye.target=U,ye.relatedTarget=Je,V=ye),Je=V,P&&he)t:{for(ye=Db,R=P,C=he,U=0,V=R;V;V=ye(V))U++;V=0;for(var ge=C;ge;ge=ye(ge))V++;for(;0<U-V;)R=ye(R),U--;for(;0<V-U;)C=ye(C),V--;for(;U--;){if(R===C||C!==null&&R===C.alternate){ye=R;break t}R=ye(R),C=ye(C)}ye=null}else ye=null;P!==null&&gp(I,L,P,ye,!1),he!==null&&Je!==null&&gp(I,Je,he,ye,!0)}}e:{if(L=B?_(B):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Ue=Rh;else if(kh(L))if(Dh)Ue=Vy;else{Ue=Yy;var me=$y}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&ec(B.elementType)&&(Ue=Rh):Ue=Gy;if(Ue&&(Ue=Ue(e,B))){Mh(I,Ue,i,Y);break e}me&&me(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&Wo(L,"number",L.value)}switch(me=B?_(B):window,e){case"focusin":(kh(me)||me.contentEditable==="true")&&(Hi=me,mc=B,Yr=null);break;case"focusout":Yr=mc=Hi=null;break;case"mousedown":pc=!0;break;case"contextmenu":case"mouseup":case"dragend":pc=!1,$h(I,i,Y);break;case"selectionchange":if(Jy)break;case"keydown":case"keyup":$h(I,i,Y)}var Ee;if(uc)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Li?Nh(e,i)&&(Me="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Me="onCompositionStart");Me&&(Oh&&i.locale!=="ko"&&(Li||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Li&&(Ee=_h()):(vs=Y,rc="value"in vs?vs.value:vs.textContent,Li=!0)),me=Kl(B,Me),0<me.length&&(Me=new Eh(Me,e,null,i,Y),I.push({event:Me,listeners:me}),Ee?Me.data=Ee:(Ee=Ch(i),Ee!==null&&(Me.data=Ee)))),(Ee=Uy?By(e,i):Ly(e,i))&&(Me=Kl(B,"onBeforeInput"),0<Me.length&&(me=new Eh("onBeforeInput","beforeinput",null,i,Y),I.push({event:me,listeners:Me}),me.data=Ee)),Cb(I,e,B,i,Y)}mp(I,t)})}function ma(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Kl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=zr(e,i),c!=null&&l.unshift(ma(e,c,u)),c=zr(e,t),c!=null&&l.push(ma(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Db(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function gp(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,O=b.alternate,B=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||B===null||(O=B,c?(B=zr(i,u),B!=null&&p.unshift(ma(i,B,O))):c||(B=zr(i,u),B!=null&&p.push(ma(i,B,O)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var zb=/\r\n?/g,qb=/\u0000|\uFFFD/g;function yp(e){return(typeof e=="string"?e:""+e).replace(zb,`
26
- `).replace(qb,"")}function bp(e,t){return t=yp(t),yp(e)===t}function Fe(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&qi(e,""+l);break;case"className":_n(e,"class",l);break;case"tabIndex":_n(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":_n(e,i,l);break;case"style":bh(e,l,u);break;case"data":if(t!=="object"){_n(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&Fe(e,t,"name",c.name,c,null),Fe(e,t,"formEncType",c.formEncType,c,null),Fe(e,t,"formMethod",c.formMethod,c,null),Fe(e,t,"formTarget",c.formTarget,c,null)):(Fe(e,t,"encType",c.encType,c,null),Fe(e,t,"method",c.method,c,null),Fe(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=sl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=uy.get(i)||i,Ct(e,i,l))}}function Hu(e,t,i,l,c,u){switch(i){case"style":bh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Q.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,p,i,null)}}c&&Fe(e,t,"srcSet",i.srcSet,i,null),l&&Fe(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=p=c=null,O=null,B=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":O=Y;break;case"defaultChecked":B=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Fe(e,t,l,Y,i,null)}}mh(e,u,b,O,B,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Fe(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?zi(e,!!l,t,!1):i!=null&&zi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,p,b,i,null)}gh(e,l,c,u);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(l=i[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Fe(e,t,O,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<da.length;l++)Ce(da[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in i)if(i.hasOwnProperty(B)&&(l=i[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,B,l,i,null)}return;default:if(ec(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&Hu(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Fe(e,t,b,l,i,null))}function Ub(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,O=null,B=null,Y=null;for(P in i){var I=i[P];if(i.hasOwnProperty(P)&&I!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=I;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,I)}}for(var L in l){var P=l[L];if(I=i[L],l.hasOwnProperty(L)&&(P!=null||I!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":B=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==I&&Fe(e,t,L,P,l,I)}}Zo(e,p,b,O,B,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(O=i[u],i.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":P=O;default:l.hasOwnProperty(u)||Fe(e,t,u,null,l,O)}for(c in l)if(u=l[c],O=i[c],l.hasOwnProperty(c)&&(u!=null||O!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==O&&Fe(e,t,c,u,l,O)}t=b,i=p,l=P,L!=null?zi(e,!!i,L,!1):!!l!=!!i&&(t!=null?zi(e,!!i,t,!0):zi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Fe(e,t,p,c,l,u)}ph(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Fe(e,t,he,null,l,L)}for(O in l)if(L=l[O],P=i[O],l.hasOwnProperty(O)&&L!==P&&(L!=null||P!=null))switch(O){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Fe(e,t,O,L,l,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Fe(e,t,ye,null,l,L);for(B in l)if(L=l[B],P=i[B],l.hasOwnProperty(B)&&L!==P&&(L!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Fe(e,t,B,L,l,P)}return;default:if(ec(t)){for(var Je in i)L=i[Je],i.hasOwnProperty(Je)&&L!==void 0&&!l.hasOwnProperty(Je)&&Hu(e,t,Je,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||Hu(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Fe(e,t,R,null,l,L);for(I in l)L=l[I],P=i[I],!l.hasOwnProperty(I)||L===P||L==null&&P==null||Fe(e,t,I,L,l,P)}function xp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&xp(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var O=i[l],B=O.startTime;if(B>b)break;var Y=O.transferSize,I=O.initiatorType;Y&&xp(I)&&(O=O.responseEnd,p+=Y*(O<b?1:(b-B)/(O-B)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Pu=null,$u=null;function Zl(e){return e.nodeType===9?e:e.ownerDocument}function vp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _p(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Yu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Gu=null;function Lb(){var e=window.event;return e&&e.type==="popstate"?e===Gu?!1:(Gu=e,!0):(Gu=null,!1)}var wp=typeof setTimeout=="function"?setTimeout:void 0,Hb=typeof clearTimeout=="function"?clearTimeout:void 0,Sp=typeof Promise=="function"?Promise:void 0,Pb=typeof queueMicrotask=="function"?queueMicrotask:typeof Sp<"u"?function(e){return Sp.resolve(null).then(e).catch($b)}:wp;function $b(e){setTimeout(function(){throw e})}function Us(e){return e==="head"}function Ep(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),dr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")pa(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,pa(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&pa(e.ownerDocument.body);i=c}while(i);dr(t)}function Ap(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Vu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Vu(i),Di(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Yb(e,t,i,l){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=mn(e.nextSibling),e===null)break}return null}function Gb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=mn(e.nextSibling),e===null))return null;return e}function Op(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=mn(e.nextSibling),e===null))return null;return e}function Fu(e){return e.data==="$?"||e.data==="$~"}function Ju(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Vb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function mn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Qu=null;function jp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return mn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Tp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Np(e,t,i){switch(t=Zl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pa(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Di(e)}var pn=new Map,Cp=new Set;function Wl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var os=te.d;te.d={f:Fb,r:Jb,D:Qb,C:Ib,L:Xb,m:Kb,X:Wb,S:Zb,M:ex};function Fb(){var e=os.f(),t=Gl();return e||t}function Jb(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Jd(t):os.r(e)}var ur=typeof document>"u"?null:document;function kp(e,t,i){var l=ur;if(l&&typeof t=="string"&&t){var c=ln(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),Cp.has(c)||(Cp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function Qb(e){os.D(e),kp("dns-prefetch",e,null)}function Ib(e,t){os.C(e,t),kp("preconnect",e,t)}function Xb(e,t,i){os.L(e,t,i);var l=ur;if(l&&e&&t){var c='link[rel="preload"][as="'+ln(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+ln(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+ln(i.imageSizes)+'"]')):c+='[href="'+ln(e)+'"]';var u=c;switch(t){case"style":u=fr(e);break;case"script":u=hr(e)}pn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),pn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ga(u))||t==="script"&&l.querySelector(ya(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function Kb(e,t){os.m(e,t);var i=ur;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+ln(l)+'"][href="'+ln(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=hr(e)}if(!pn.has(u)&&(e=w({rel:"modulepreload",href:e},t),pn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ya(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function Zb(e,t,i){os.S(e,t,i);var l=ur;if(l&&e){var c=A(l).hoistableStyles,u=fr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ga(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=pn.get(u))&&Iu(e,i);var O=p=l.createElement("link");N(O),At(O,"link",e),O._p=new Promise(function(B,Y){O.onload=B,O.onerror=Y}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,eo(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function Wb(e,t){os.X(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0},t),(t=pn.get(c))&&Xu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function ex(e,t){os.M(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=pn.get(c))&&Xu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Mp(e,t,i,l){var c=(c=sn.current)?Wl(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=fr(i.href),i=A(c).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=fr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ga(e)))&&!u._p&&(p.instance=u,p.state.loading=5),pn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},pn.set(e,i),u||tx(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=hr(i),i=A(c).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function fr(e){return'href="'+ln(e)+'"'}function ga(e){return'link[rel="stylesheet"]['+e+"]"}function Rp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function tx(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),N(t),e.head.appendChild(t))}function hr(e){return'[src="'+ln(e)+'"]'}function ya(e){return"script[async]"+e}function Dp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+ln(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),eo(l,i.precedence,e),t.instance=l;case"stylesheet":c=fr(i.href);var u=e.querySelector(ga(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Rp(i),(c=pn.get(c))&&Iu(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),t.state.loading|=4,eo(u,i.precedence,e),t.instance=u;case"script":return u=hr(i.src),(c=e.querySelector(ya(u)))?(t.instance=c,N(c),c):(l=i,(c=pn.get(u))&&(l=w({},i),Xu(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,eo(l,i.precedence,e));return t.instance}function eo(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Iu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var to=null;function zp(e,t,i){if(to===null){var l=new Map,c=to=new Map;c.set(i,l)}else c=to,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function qp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function nx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Up(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function sx(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=fr(l.href),u=t.querySelector(ga(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=no.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Rp(l),(c=pn.get(c))&&Iu(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=no.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Ku=0;function ix(e,t){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Ku===0&&(Ku=62500*Bb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Ku?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function no(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var so=null;function io(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,so=new Map,t.forEach(rx,e),so=null,no.call(e))}function rx(e,t){if(!(t.state.loading&4)){var i=so.get(e);if(i)var l=i.get(null);else{i=new Map,so.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=no.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ba={$$typeof:pe,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function ax(e,t,i,l,c,u,p,b,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=gs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gs(0),this.hiddenUpdates=gs(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Bp(e,t,i,l,c,u,p,b,O,B,Y,I){return e=new ax(e,t,i,p,O,B,Y,I,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=Cc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},Dc(u),e}function Lp(e){return e?(e=Yi,e):Yi}function Hp(e,t,i,l,c,u){c=Lp(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=js(e,l,t),i!==null&&(Ht(i,e,t),Xr(i,e,t))}function Pp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Zu(e,t){Pp(e,t),(e=e.alternate)&&Pp(e,t)}function $p(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),Zu(e,67108864)}}function Yp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Gn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),Zu(e,t)}}var ro=!0;function lx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,Wu(e,t,i,l)}finally{te.p=u,$.T=c}}function ox(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,Wu(e,t,i,l)}finally{te.p=u,$.T=c}}function Wu(e,t,i,l){if(ro){var c=ef(l);if(c===null)Lu(e,t,l,ao,i),Vp(e,l);else if(ux(c,e,t,i,l))l.stopPropagation();else if(Vp(e,l),t&4&&-1<cx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=xn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var O=1<<31-Nt(p);b.entanglements[1]|=O,p&=~O}Dn(u),(He&6)===0&&($l=et()+500,ha(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Gl(),Zu(u,2)}if(u=ef(l),u===null&&Lu(e,t,l,ao,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Lu(e,t,l,null,i)}}function ef(e){return e=nc(e),tf(e)}var ao=null;function tf(e){if(ao=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=d(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ao=e,null}function Gp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Qo()){case Ia:return 2;case Xa:return 8;case ki:case Io:return 32;case Ka:return 268435456;default:return 32}default:return 32}}var nf=!1,Bs=null,Ls=null,Hs=null,xa=new Map,va=new Map,Ps=[],cx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Vp(e,t){switch(e){case"focusin":case"focusout":Bs=null;break;case"dragenter":case"dragleave":Ls=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":va.delete(t.pointerId)}}function _a(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&$p(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function ux(e,t,i,l,c){switch(t){case"focusin":return Bs=_a(Bs,e,t,i,l,c),!0;case"dragenter":return Ls=_a(Ls,e,t,i,l,c),!0;case"mouseover":return Hs=_a(Hs,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return xa.set(u,_a(xa.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,va.set(u,_a(va.get(u)||null,e,t,i,l,c)),!0}return!1}function Fp(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Wa(e.priority,function(){Yp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Wa(e.priority,function(){Yp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function lo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=ef(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);tc=l,i.target.dispatchEvent(l),tc=null}else return t=S(i),t!==null&&$p(t),e.blockedOn=i,!1;t.shift()}return!0}function Jp(e,t,i){lo(e)&&i.delete(t)}function fx(){nf=!1,Bs!==null&&lo(Bs)&&(Bs=null),Ls!==null&&lo(Ls)&&(Ls=null),Hs!==null&&lo(Hs)&&(Hs=null),xa.forEach(Jp),va.forEach(Jp)}function oo(e,t){e.blockedOn===t&&(e.blockedOn=null,nf||(nf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,fx)))}var co=null;function Qp(e){co!==e&&(co=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){co===e&&(co=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(tf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,eu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function dr(e){function t(O){return oo(O,e)}Bs!==null&&oo(Bs,e),Ls!==null&&oo(Ls,e),Hs!==null&&oo(Hs,e),xa.forEach(t),va.forEach(t);for(var i=0;i<Ps.length;i++){var l=Ps[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ps.length&&(i=Ps[0],i.blockedOn===null);)Fp(i),i.blockedOn===null&&Ps.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||Qp(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(tf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Qp(i)}}}function Ip(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function sf(e){this._internalRoot=e}uo.prototype.render=sf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Hp(i,l,e,t,null,null)},uo.prototype.unmount=sf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Hp(e.current,2,null,e,null,null),Gl(),t[Yt]=null}};function uo(e){this._internalRoot=e}uo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Ps.length&&t!==0&&t<Ps[i].priority;i++);Ps.splice(i,0,e),i===0&&Fp(e)}};var Xp=n.version;if(Xp!=="19.2.4")throw Error(a(527,Xp,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var hx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fo.isDisabled&&fo.supportsFiber)try{ni=fo.inject(hx),ot=fo}catch{}}return wa.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=sm,u=im,p=rm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Bp(e,1,!1,null,null,i,l,null,c,u,p,Ip),e[Yt]=t.current,Bu(e),new sf(t)},wa.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=sm,p=im,b=rm,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),t=Bp(e,1,!0,t,i??null,l,c,O,u,p,b,Ip),t.context=Lp(null),i=t.current,l=Xt(),l=Gn(l),c=Os(l),c.callback=null,js(i,c,l),i=l,t.current.lanes=i,vn(t,i),Dn(t),e[Yt]=t.current,Bu(e),new uo(t)},wa.version="19.2.4",wa}var t0;function lv(){if(t0)return rf.exports;t0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),rf.exports=av(),rf.exports}var ov=lv();const cv="modulepreload",uv=function(r,n){return new URL(r,n).href},n0={},Ae=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(j=>({status:"fulfilled",value:j}),j=>({status:"rejected",reason:j}))))};const d=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(s.map(E=>{if(E=uv(E,a),E in n0)return;n0[E]=!0;const w=E.endsWith(".css"),j=w?'[rel="stylesheet"]':"";if(!!a)for(let z=d.length-1;z>=0;z--){const G=d[z];if(G.href===E&&(!w||G.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${j}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":cv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((z,G)=>{M.addEventListener("load",z),M.addEventListener("error",()=>G(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return o.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function cg(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function ug(r){const n=cg(r);return!n||typeof n.exp!="number"?null:n.exp}function Qf(r,n=0){const s=ug(r);return s===null?!0:Date.now()/1e3>=s-n}const Bn=window.__LT_BASE__??"",Sf=`${Bn}/api`;let Vs=null;function ho(r){Vs=r}function fg(){return Vs}async function s0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${Sf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Ys=null;async function Xe(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Vs){if(Qf(Vs)){Ys||(Ys=s0().finally(()=>{Ys=null}));const o=await Ys;if(o)Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Vs}`}let a=await fetch(`${Sf}${r}`,{...n,headers:s});if(a.status===401&&Vs){Ys||(Ys=s0().finally(()=>{Ys=null}));const o=await Ys;if(o&&(Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${Sf}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const hg=T.createContext(null),fv=300;function of(r,n){if(Qf(r))return null;const s=cg(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function hv({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Qf(w)?(sessionStorage.removeItem("lt_token"),null):(ho(w),of(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const j=ug(w);if(!j)return;const q=(j-fv)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{const M=sessionStorage.getItem("lt_credentials");if(M)try{const{username:z,password:G}=JSON.parse(M),ne=await fetch(`${Bn}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:z,password:G})});if(!ne.ok)return;const ee=await ne.json();ee.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ee.token}}))}catch{}},q))},[]),f=T.useCallback((w,j,q)=>{const M={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(j==null?void 0:j.username)??null},z=of(w,M);z&&(ho(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(z),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current),ho(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),s(null)},[]);T.useEffect(()=>{const w=()=>h(),j=q=>{var G;const M=(G=q.detail)==null?void 0:G.token;if(!M)return;const z=of(M);z&&(ho(M),sessionStorage.setItem("lt_token",M),s(z),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",j)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return m.jsx(hg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=T.useContext(hg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const tn=new Uint8Array(0),ji=new TextEncoder,Wt=new TextDecoder;function dv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function ka(...r){const n=[];for(let s=0;s<r.length;s++)n.push(ji.encode(r[s]));return n.length===0?tn:n.length===1?n[0]:dv(...n)}function i0(r){return!r||r.length===0?"":Wt.decode(r)}const r0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",a0=36,mv=0xcfd41b9100000,l0=33,pv=333,o0=22;function gv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function yv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):gv(r)}class bv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(o0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*mv),this.inc=Math.floor(Math.random()*(pv-l0)+l0)}setPre(){const n=new Uint8Array(12);yv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=r0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=o0-1;s>=12;s--)this.buf[s]=r0.charCodeAt(n%a0),n=Math.floor(n/a0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Ks=new bv;var cs;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(cs||(cs={}));var br;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(br||(br={}));var ie;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(ie||(ie={}));function xv(r){return typeof r.code=="string"}class dg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return vv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const vv=new dg;class ue extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=dg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var jn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(jn||(jn={}));var Ma;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(Ma||(Ma={}));const Co="Nats-Service-Error",ko="Nats-Service-Error-Code";class Mo extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Mo.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(ko))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(Co))||"";return new Mo(h,d.length?d:a)}return null}}function us(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Ks.next()}`}const Ef="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function $o(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function mo(r){return Wt.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Sr(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,d)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{d(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Or(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function mg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function _v(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function If(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return _v(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Xf(r){return Math.floor(r/1e6)}function c0(r){let a=!0;const o=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function fs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Qs(r,n)}const cf="NATS/1.0";class Qs{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].sort();for(let d=0;d<f.length;d++)if(f[d]!==h[d])return!1}return!0}return!1}static decode(n){const s=new Qs,o=Wt.decode(n).split(`\r
27
- `),f=o[0];if(f!==cf){let h=f.replace(cf,"").trim();if(h.length>0){s._code=parseInt(h,10),isNaN(s._code)&&(s._code=0);const d=s._code.toString();h=h.replace(d,""),s._description=h.trim()}}return o.length>=1&&o.slice(1).map(h=>{if(h){const d=h.indexOf(":");if(d>-1){const g=h.slice(0,d),y=h.slice(d+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=cf;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)n=`${n}\r
25
+ `+l.stack}}var Tr=Object.prototype.hasOwnProperty,Nr=r.unstable_scheduleCallback,$n=r.unstable_cancelCallback,Qa=r.unstable_shouldYield,Ci=r.unstable_requestPaint,et=r.unstable_now,Io=r.unstable_getCurrentPriorityLevel,Ia=r.unstable_ImmediatePriority,Xa=r.unstable_UserBlockingPriority,ki=r.unstable_NormalPriority,Xo=r.unstable_LowPriority,Ka=r.unstable_IdlePriority,Ko=r.log,Za=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Ko=="function"&&Za(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Mi,Cr=Math.log,kr=Math.LN2;function Mi(e){return e>>>=0,e===0?32:31-(Cr(e)/kr|0)|0}var ms=256,Yn=262144,ps=4194304;function vn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=vn(l):(p&=b,p!==0?c=vn(p):i||(i=b&~e,i!==0&&(c=vn(i))))):(b=l&~u,b!==0?c=vn(b):p!==0?c=vn(p):i||(i=l&~e,i!==0&&(c=vn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Mr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ri(){var e=ps;return ps<<=1,(ps&62914560)===0&&(ps=4194304),e}function gs(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function _n(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ys(e,t,i,l,c,u){var p=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,B=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),I=1<<Y;b[Y]=0,O[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~I}l!==0&&bs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function bs(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function xs(e,t){var i=t&-t;return i=(i&42)!==0?1:Gn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Vp(e.type))}function Wa(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var kn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+kn,it="__reactProps$"+kn,Yt="__reactContainer$"+kn,li="__reactEvents$"+kn,Dr="__reactListeners$"+kn,el="__reactHandles$"+kn,tl="__reactResources$"+kn,yt="__reactMarker$"+kn;function Di(e){delete e[Qe],delete e[it],delete e[li],delete e[Dr],delete e[el]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Np(e);e!==null;){if(i=e[Qe])return i;e=Np(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Qe]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[tl];return t||(t=e[tl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var z=new Set,Q={};function Z(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(Q[e]=t,e=0;e<t.length;e++)z.add(t[e])}var J=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fe={},Oe={};function Ke(e){return Tr.call(Oe,e)?!0:Tr.call(fe,e)?!1:J.test(e)?Oe[e]=!0:(fe[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function wn(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Vn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function ln(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uy(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zo(e){if(!e._valueTracker){var t=dh(e)?"checked":"value";e._valueTracker=uy(e,t,""+e[t])}}function mh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=dh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function nl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var fy=/[\n"\\]/g;function on(e){return e.replace(fy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Wo(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ln(t)):e.value!==""+ln(t)&&(e.value=""+ln(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?ec(e,p,ln(t)):i!=null?ec(e,p,ln(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+ln(b):e.removeAttribute("name")}function ph(e,t,i,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Zo(e);return}i=i!=null?""+ln(i):"",t=t!=null?""+ln(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Zo(e)}function ec(e,t,i){t==="number"&&nl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function zi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+ln(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function gh(e,t,i){if(t!=null&&(t=""+ln(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+ln(i):""}function yh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Me(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=ln(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Zo(e)}function qi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var hy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function bh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||hy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function xh(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&bh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&bh(e,u,t[u])}function tc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var dy=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),my=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function sl(e){return my.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var nc=null;function sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Bi=null;function vh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Wo(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+on(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));Wo(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&mh(l)}break e;case"textarea":gh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&zi(e,!!i.multiple,t,!1)}}}var ic=!1;function _h(e,t,i){if(ic)return e(t,i);ic=!0;try{var l=e(t);return l}finally{if(ic=!1,(Ui!==null||Bi!==null)&&(Gl(),Ui&&(t=Ui,e=Bi,Bi=Ui=null,vh(t),e)))for(t=0;t<e.length;t++)vh(e[t])}}function zr(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rc=!1;if(Jn)try{var qr={};Object.defineProperty(qr,"passive",{get:function(){rc=!0}}),window.addEventListener("test",qr,qr),window.removeEventListener("test",qr,qr)}catch{rc=!1}var vs=null,ac=null,il=null;function wh(){if(il)return il;var e,t=ac,i=t.length,l,c="value"in vs?vs.value:vs.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return il=c.slice(e,1<l?1-l:void 0)}function rl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function al(){return!0}function Sh(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?al:Sh,this.isPropagationStopped=Sh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=al)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=al)},persist:function(){},isPersistent:al}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ll=zt(oi),Ur=w({},oi,{view:0,detail:0}),py=zt(Ur),lc,oc,Br,ol=w({},Ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Br&&(Br&&e.type==="mousemove"?(lc=e.screenX-Br.screenX,oc=e.screenY-Br.screenY):oc=lc=0,Br=e),lc)},movementY:function(e){return"movementY"in e?e.movementY:oc}}),Eh=zt(ol),gy=w({},ol,{dataTransfer:0}),yy=zt(gy),by=w({},Ur,{relatedTarget:0}),cc=zt(by),xy=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),vy=zt(xy),_y=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wy=zt(_y),Sy=w({},oi,{data:0}),Ah=zt(Sy),Ey={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ay={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Oy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Oy[e])?!!t[e]:!1}function uc(){return jy}var Ty=w({},Ur,{key:function(e){if(e.key){var t=Ey[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=rl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ay[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uc,charCode:function(e){return e.type==="keypress"?rl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?rl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ny=zt(Ty),Cy=w({},ol,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oh=zt(Cy),ky=w({},Ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uc}),My=zt(ky),Ry=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dy=zt(Ry),zy=w({},ol,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),qy=zt(zy),Uy=w({},oi,{newState:0,oldState:0}),By=zt(Uy),Ly=[9,13,27,32],fc=Jn&&"CompositionEvent"in window,Lr=null;Jn&&"documentMode"in document&&(Lr=document.documentMode);var Hy=Jn&&"TextEvent"in window&&!Lr,jh=Jn&&(!fc||Lr&&8<Lr&&11>=Lr),Th=" ",Nh=!1;function Ch(e,t){switch(e){case"keyup":return Ly.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Li=!1;function Py(e,t){switch(e){case"compositionend":return kh(t);case"keypress":return t.which!==32?null:(Nh=!0,Th);case"textInput":return e=t.data,e===Th&&Nh?null:e;default:return null}}function $y(e,t){if(Li)return e==="compositionend"||!fc&&Ch(e,t)?(e=wh(),il=ac=vs=null,Li=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return jh&&t.locale!=="ko"?null:t.data;default:return null}}var Yy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Mh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Yy[e.type]:t==="textarea"}function Rh(e,t,i,l){Ui?Bi?Bi.push(l):Bi=[l]:Ui=l,t=Kl(t,"onChange"),0<t.length&&(i=new ll("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Hr=null,Pr=null;function Gy(e){pp(e,0)}function cl(e){var t=_(e);if(mh(t))return e}function Dh(e,t){if(e==="change")return t}var zh=!1;if(Jn){var hc;if(Jn){var dc="oninput"in document;if(!dc){var qh=document.createElement("div");qh.setAttribute("oninput","return;"),dc=typeof qh.oninput=="function"}hc=dc}else hc=!1;zh=hc&&(!document.documentMode||9<document.documentMode)}function Uh(){Hr&&(Hr.detachEvent("onpropertychange",Bh),Pr=Hr=null)}function Bh(e){if(e.propertyName==="value"&&cl(Pr)){var t=[];Rh(t,Pr,e,sc(e)),_h(Gy,t)}}function Vy(e,t,i){e==="focusin"?(Uh(),Hr=t,Pr=i,Hr.attachEvent("onpropertychange",Bh)):e==="focusout"&&Uh()}function Fy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cl(Pr)}function Jy(e,t){if(e==="click")return cl(t)}function Qy(e,t){if(e==="input"||e==="change")return cl(t)}function Iy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Iy;function $r(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Tr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function Lh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hh(e,t){var i=Lh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Lh(i)}}function Ph(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ph(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $h(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=nl(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=nl(e.document)}return t}function mc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Xy=Jn&&"documentMode"in document&&11>=document.documentMode,Hi=null,pc=null,Yr=null,gc=!1;function Yh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;gc||Hi==null||Hi!==nl(l)||(l=Hi,"selectionStart"in l&&mc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Yr&&$r(Yr,l)||(Yr=l,l=Kl(pc,"onSelect"),0<l.length&&(t=new ll("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Hi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Pi={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},yc={},Gh={};Jn&&(Gh=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function ui(e){if(yc[e])return yc[e];if(!Pi[e])return e;var t=Pi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Gh)return yc[e]=t[i];return e}var Vh=ui("animationend"),Fh=ui("animationiteration"),Jh=ui("animationstart"),Ky=ui("transitionrun"),Zy=ui("transitionstart"),Wy=ui("transitioncancel"),Qh=ui("transitionend"),Ih=new Map,bc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");bc.push("scrollEnd");function Sn(e,t){Ih.set(e,t),Z(t,[e])}var ul=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},cn=[],$i=0,xc=0;function fl(){for(var e=$i,t=xc=$i=0;t<e;){var i=cn[t];cn[t++]=null;var l=cn[t];cn[t++]=null;var c=cn[t];cn[t++]=null;var u=cn[t];if(cn[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&Xh(i,c,u)}}function hl(e,t,i,l){cn[$i++]=e,cn[$i++]=t,cn[$i++]=i,cn[$i++]=l,xc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function vc(e,t,i,l){return hl(e,t,i,l),dl(e)}function fi(e,t){return hl(e,null,null,t),dl(e)}function Xh(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function dl(e){if(50<fa)throw fa=0,Nu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function eb(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new eb(e,t,i,l)}function _c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Kh(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ml(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")_c(e)&&(p=1);else if(typeof e=="string")p=rx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Vt(31,i,t,c),e.elementType=G,e.lanes=u,e;case D:return hi(i.children,c,u,t);case W:p=8,c|=24;break;case se:return e=Vt(12,i,t,c|2),e.elementType=se,e.lanes=u,e;case C:return e=Vt(13,i,t,c),e.elementType=C,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:p=10;break e;case ee:p=9;break e;case re:p=11;break e;case ce:p=14;break e;case V:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function wc(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function Zh(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Sc(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Wh=new WeakMap;function un(e,t){if(typeof e=="object"&&e!==null){var i=Wh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ja(t)},Wh.set(e,t),t)}return{value:e,source:t,stack:Ja(t)}}var Gi=[],Vi=0,pl=null,Gr=0,fn=[],hn=0,_s=null,Mn=1,Rn="";function In(e,t){Gi[Vi++]=Gr,Gi[Vi++]=pl,pl=e,Gr=t}function ed(e,t,i){fn[hn++]=Mn,fn[hn++]=Rn,fn[hn++]=_s,_s=e;var l=Mn;e=Rn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Mn=1<<32-Nt(t)+c|i<<c|l,Rn=u+e}else Mn=1<<u|i<<c|l,Rn=e}function Ec(e){e.return!==null&&(In(e,1),ed(e,1,0))}function Ac(e){for(;e===pl;)pl=Gi[--Vi],Gi[Vi]=null,Gr=Gi[--Vi],Gi[Vi]=null;for(;e===_s;)_s=fn[--hn],fn[hn]=null,Rn=fn[--hn],fn[hn]=null,Mn=fn[--hn],fn[hn]=null}function td(e,t){fn[hn++]=Mn,fn[hn++]=Rn,fn[hn++]=_s,Mn=t.id,Rn=t.overflow,_s=e}var wt=null,Ze=null,ze=!1,ws=null,dn=!1,Oc=Error(a(519));function Ss(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vr(un(t,e)),Oc}function nd(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<da.length;i++)Ce(da[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),ph(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),yh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||xp(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Fn),t=!0):t=!1,t||Ss(e,!0)}function sd(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:dn=!1;return;case 27:case 3:dn=!0;return;default:wt=wt.return}}function Fi(e){if(e!==wt)return!1;if(!ze)return sd(e),ze=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Gu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Ss(e),sd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Tp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Tp(e)}else t===27?(t=Ze,Us(e.type)?(e=Iu,Iu=null,Ze=e):Ze=t):Ze=wt?pn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,ze=!1}function jc(){var e=ws;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),ws=null),e}function Vr(e){ws===null?ws=[e]:ws.push(e)}var Tc=je(null),mi=null,Xn=null;function Es(e,t,i){Te(Tc,t._currentValue),t._currentValue=i}function Kn(e){e._currentValue=Tc.current,_e(Tc)}function Nc(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function Cc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Nc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Nc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ji(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===Ot.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ba):e=[ba])}c=c.return}e!==null&&Cc(t,e,i,l),t.flags|=262144}function gl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Xn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return id(mi,e)}function yl(e,t){return mi===null&&pi(e),id(e,t)}function id(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Xn===null){if(e===null)throw Error(a(308));Xn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xn=Xn.next=t;return i}var tb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},nb=r.unstable_scheduleCallback,sb=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kc(){return{controller:new tb,data:new Map,refCount:0}}function Fr(e){e.refCount--,e.refCount===0&&nb(sb,function(){e.controller.abort()})}var Jr=null,Mc=0,Qi=0,Ii=null;function ib(e,t){if(Jr===null){var i=Jr=[];Mc=0,Qi=zu(),Ii={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Mc++,t.then(rd,rd),t}function rd(){if(--Mc===0&&Jr!==null){Ii!==null&&(Ii.status="fulfilled");var e=Jr;Jr=null,Qi=0,Ii=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function rb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var ad=$.S;$.S=function(e,t){Ym=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ib(e,t),ad!==null&&ad(e,t)};var gi=je(null);function Rc(){var e=gi.current;return e!==null?e:Ie.pooledCache}function bl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function ld(){var e=Rc();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Dc=Error(a(474)),xl=Error(a(542)),vl={then:function(){}};function od(e){return e=e.status,e==="fulfilled"||e==="rejected"}function cd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Fn,Fn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fd(e),e;default:if(typeof t.status=="string")t.then(Fn,Fn);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fd(e),e}throw bi=t,Xi}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Xi):i}}var bi=null;function ud(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function fd(e){if(e===Xi||e===xl)throw Error(a(483))}var Ki=null,Qr=0;function _l(e){var t=Qr;return Qr+=1,Ki===null&&(Ki=[]),cd(Ki,e,t)}function Ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wl(e,t){throw t.$$typeof===j?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function hd(e){function t(R,k){if(e){var U=R.deletions;U===null?(R.deletions=[k],R.flags|=16):U.push(k)}}function i(R,k){if(!e)return null;for(;k!==null;)t(R,k),k=k.sibling;return null}function l(R){for(var k=new Map;R!==null;)R.key!==null?k.set(R.key,R):k.set(R.index,R),R=R.sibling;return k}function c(R,k){return R=Qn(R,k),R.index=0,R.sibling=null,R}function u(R,k,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<k?(R.flags|=67108866,k):U):(R.flags|=67108866,k)):(R.flags|=1048576,k)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,k,U,F){return k===null||k.tag!==6?(k=wc(U,R.mode,F),k.return=R,k):(k=c(k,U),k.return=R,k)}function O(R,k,U,F){var ge=U.type;return ge===D?Y(R,k,U.props.children,F,U.key):k!==null&&(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type)?(k=c(k,U.props),Ir(k,U),k.return=R,k):(k=ml(U.type,U.key,U.props,null,R.mode,F),Ir(k,U),k.return=R,k)}function B(R,k,U,F){return k===null||k.tag!==4||k.stateNode.containerInfo!==U.containerInfo||k.stateNode.implementation!==U.implementation?(k=Sc(U,R.mode,F),k.return=R,k):(k=c(k,U.children||[]),k.return=R,k)}function Y(R,k,U,F,ge){return k===null||k.tag!==7?(k=hi(U,R.mode,F,ge),k.return=R,k):(k=c(k,U),k.return=R,k)}function I(R,k,U){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=wc(""+k,R.mode,U),k.return=R,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case q:return U=ml(k.type,k.key,k.props,null,R.mode,U),Ir(U,k),U.return=R,U;case M:return k=Sc(k,R.mode,U),k.return=R,k;case V:return k=yi(k),I(R,k,U)}if(Me(k)||ne(k))return k=hi(k,R.mode,U,null),k.return=R,k;if(typeof k.then=="function")return I(R,_l(k),U);if(k.$$typeof===me)return I(R,yl(R,k),U);wl(R,k)}return null}function L(R,k,U,F){var ge=k!==null?k.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:b(R,k,""+U,F);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case q:return U.key===ge?O(R,k,U,F):null;case M:return U.key===ge?B(R,k,U,F):null;case V:return U=yi(U),L(R,k,U,F)}if(Me(U)||ne(U))return ge!==null?null:Y(R,k,U,F,null);if(typeof U.then=="function")return L(R,k,_l(U),F);if(U.$$typeof===me)return L(R,k,yl(R,U),F);wl(R,U)}return null}function P(R,k,U,F,ge){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return R=R.get(U)||null,b(k,R,""+F,ge);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case q:return R=R.get(F.key===null?U:F.key)||null,O(k,R,F,ge);case M:return R=R.get(F.key===null?U:F.key)||null,B(k,R,F,ge);case V:return F=yi(F),P(R,k,U,F,ge)}if(Me(F)||ne(F))return R=R.get(U)||null,Y(k,R,F,ge,null);if(typeof F.then=="function")return P(R,k,U,_l(F),ge);if(F.$$typeof===me)return P(R,k,U,yl(k,F),ge);wl(k,F)}return null}function he(R,k,U,F){for(var ge=null,Be=null,pe=k,Ee=k=0,De=null;pe!==null&&Ee<U.length;Ee++){pe.index>Ee?(De=pe,pe=null):De=pe.sibling;var Le=L(R,pe,U[Ee],F);if(Le===null){pe===null&&(pe=De);break}e&&pe&&Le.alternate===null&&t(R,pe),k=u(Le,k,Ee),Be===null?ge=Le:Be.sibling=Le,Be=Le,pe=De}if(Ee===U.length)return i(R,pe),ze&&In(R,Ee),ge;if(pe===null){for(;Ee<U.length;Ee++)pe=I(R,U[Ee],F),pe!==null&&(k=u(pe,k,Ee),Be===null?ge=pe:Be.sibling=pe,Be=pe);return ze&&In(R,Ee),ge}for(pe=l(pe);Ee<U.length;Ee++)De=P(pe,R,Ee,U[Ee],F),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?Ee:De.key),k=u(De,k,Ee),Be===null?ge=De:Be.sibling=De,Be=De);return e&&pe.forEach(function($s){return t(R,$s)}),ze&&In(R,Ee),ge}function ye(R,k,U,F){if(U==null)throw Error(a(151));for(var ge=null,Be=null,pe=k,Ee=k=0,De=null,Le=U.next();pe!==null&&!Le.done;Ee++,Le=U.next()){pe.index>Ee?(De=pe,pe=null):De=pe.sibling;var $s=L(R,pe,Le.value,F);if($s===null){pe===null&&(pe=De);break}e&&pe&&$s.alternate===null&&t(R,pe),k=u($s,k,Ee),Be===null?ge=$s:Be.sibling=$s,Be=$s,pe=De}if(Le.done)return i(R,pe),ze&&In(R,Ee),ge;if(pe===null){for(;!Le.done;Ee++,Le=U.next())Le=I(R,Le.value,F),Le!==null&&(k=u(Le,k,Ee),Be===null?ge=Le:Be.sibling=Le,Be=Le);return ze&&In(R,Ee),ge}for(pe=l(pe);!Le.done;Ee++,Le=U.next())Le=P(pe,R,Ee,Le.value,F),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ee:Le.key),k=u(Le,k,Ee),Be===null?ge=Le:Be.sibling=Le,Be=Le);return e&&pe.forEach(function(gx){return t(R,gx)}),ze&&In(R,Ee),ge}function Je(R,k,U,F){if(typeof U=="object"&&U!==null&&U.type===D&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case q:e:{for(var ge=U.key;k!==null;){if(k.key===ge){if(ge=U.type,ge===D){if(k.tag===7){i(R,k.sibling),F=c(k,U.props.children),F.return=R,R=F;break e}}else if(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type){i(R,k.sibling),F=c(k,U.props),Ir(F,U),F.return=R,R=F;break e}i(R,k);break}else t(R,k);k=k.sibling}U.type===D?(F=hi(U.props.children,R.mode,F,U.key),F.return=R,R=F):(F=ml(U.type,U.key,U.props,null,R.mode,F),Ir(F,U),F.return=R,R=F)}return p(R);case M:e:{for(ge=U.key;k!==null;){if(k.key===ge)if(k.tag===4&&k.stateNode.containerInfo===U.containerInfo&&k.stateNode.implementation===U.implementation){i(R,k.sibling),F=c(k,U.children||[]),F.return=R,R=F;break e}else{i(R,k);break}else t(R,k);k=k.sibling}F=Sc(U,R.mode,F),F.return=R,R=F}return p(R);case V:return U=yi(U),Je(R,k,U,F)}if(Me(U))return he(R,k,U,F);if(ne(U)){if(ge=ne(U),typeof ge!="function")throw Error(a(150));return U=ge.call(U),ye(R,k,U,F)}if(typeof U.then=="function")return Je(R,k,_l(U),F);if(U.$$typeof===me)return Je(R,k,yl(R,U),F);wl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,k!==null&&k.tag===6?(i(R,k.sibling),F=c(k,U),F.return=R,R=F):(i(R,k),F=wc(U,R.mode,F),F.return=R,R=F),p(R)):i(R,k)}return function(R,k,U,F){try{Qr=0;var ge=Je(R,k,U,F);return Ki=null,ge}catch(pe){if(pe===Xi||pe===xl)throw pe;var Be=Vt(29,pe,null,R.mode);return Be.lanes=F,Be.return=R,Be}finally{}}}var xi=hd(!0),dd=hd(!1),As=!1;function zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function js(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Pe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=dl(e),Xh(e,null,i),t}return hl(e,l,t,i),dl(e)}function Xr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}function Uc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Bc=!1;function Kr(){if(Bc){var e=Ii;if(e!==null)throw e}}function Zr(e,t,i,l){Bc=!1;var c=e.updateQueue;As=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var O=b,B=O.next;O.next=null,p===null?u=B:p.next=B,p=O;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=B:b.next=B,Y.lastBaseUpdate=O))}if(u!==null){var I=c.baseState;p=0,Y=B=O=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(Re&L)===L:(l&L)===L){L!==0&&L===Qi&&(Bc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Je=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){I=he.call(Je,I,L);break e}I=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Je,I,L):he,L==null)break e;I=w({},I,L);break e;case 2:As=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(B=Y=P,O=I):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(O=I),c.baseState=O,c.firstBaseUpdate=B,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Ms|=p,e.lanes=p,e.memoizedState=I}}function md(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function pd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)md(i[e],t)}var Zi=je(null),Sl=je(0);function gd(e,t){e=as,Te(Sl,e),Te(Zi,t),as=e|t.baseLanes}function Lc(){Te(Sl,as),Te(Zi,Zi.current)}function Hc(){as=Sl.current,_e(Zi),_e(Sl)}var Ft=je(null),mn=null;function Ts(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),mn===null&&(t===null||Zi.current!==null||t.memoizedState!==null)&&(mn=e)}function Pc(e){Te(ct,ct.current),Te(Ft,e),mn===null&&(mn=e)}function yd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),mn===null&&(mn=e)):Ns()}function Ns(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){_e(Ft),mn===e&&(mn=null),_e(ct)}var ct=je(0);function El(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Ju(i)||Qu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Zn=0,Se=null,Ve=null,dt=null,Al=!1,Wi=!1,vi=!1,Ol=0,Wr=0,er=null,ab=0;function rt(){throw Error(a(321))}function $c(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Yc(e,t,i,l,c,u){return Zn=u,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?em:iu,vi=!1,u=i(l,c),vi=!1,Wi&&(u=xd(t,i,l,c)),bd(e),u}function bd(e){$.H=na;var t=Ve!==null&&Ve.next!==null;if(Zn=0,dt=Ve=Se=null,Al=!1,Wr=0,er=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&gl(e)&&(mt=!0))}function xd(e,t,i,l){Se=e;var c=0;do{if(Wi&&(er=null),Wr=0,Wi=!1,25<=c)throw Error(a(301));if(c+=1,dt=Ve=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=tm,u=t(i,l)}while(Wi);return u}function lb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ea(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(Se.flags|=1024),t}function Gc(){var e=Ol!==0;return Ol=0,e}function Vc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Fc(e){if(Al){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Al=!1}Zn=0,dt=Ve=Se=null,Wi=!1,Wr=Ol=0,er=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Se.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Ve===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=dt===null?Se.memoizedState:dt.next;if(t!==null)dt=t,Ve=e;else{if(e===null)throw Se.alternate===null?Error(a(467)):Error(a(310));Ve=e,e={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},dt===null?Se.memoizedState=dt=e:dt=dt.next=e}return dt}function jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ea(e){var t=Wr;return Wr+=1,er===null&&(er=[]),e=cd(er,e,t),t=Se,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?em:iu),e}function Tl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ea(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Jc(e){var t=null,i=Se.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Se.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=jl(),Se.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=K;return t.index++,i}function Wn(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=ut();return Qc(t,Ve,e)}function Qc(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,O=null,B=t,Y=!1;do{var I=B.lane&-536870913;if(I!==B.lane?(Re&I)===I:(Zn&I)===I){var L=B.revertLane;if(L===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),I===Qi&&(Y=!0);else if((Zn&L)===L){B=B.next,L===Qi&&(Y=!0);continue}else I={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=I,p=u):O=O.next=I,Se.lanes|=L,Ms|=L;I=B.action,vi&&i(u,I),u=B.hasEagerState?B.eagerState:i(u,I)}else L={lane:I,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=L,p=u):O=O.next=L,Se.lanes|=I,Ms|=I;B=B.next}while(B!==null&&B!==t);if(O===null?p=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Ii,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=O,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ic(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function vd(e,t,i){var l=Se,c=ut(),u=ze;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Ve||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Zc(Sd.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,tr(9,{destroy:void 0},wd.bind(null,l,c,i,t),null),Ie===null)throw Error(a(349));u||(Zn&127)!==0||_d(l,t,i)}return i}function _d(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Se.updateQueue,t===null?(t=jl(),Se.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function wd(e,t,i,l){t.value=i,t.getSnapshot=l,Ed(t)&&Ad(e)}function Sd(e,t,i){return i(function(){Ed(t)&&Ad(e)})}function Ed(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Ad(e){var t=fi(e,2);t!==null&&Ht(t,e,2)}function Xc(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:e},t}function Od(e,t,i,l){return e.baseState=i,Qc(e,Ve,typeof l=="function"?l:Wn)}function ob(e,t,i,l,c){if(Ml(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,jd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function jd(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),O=$.S;O!==null&&O(p,b),Td(e,t,b)}catch(B){Kc(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),Td(e,t,u)}catch(B){Kc(e,t,B)}}function Td(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Nd(e,t,l)},function(l){return Kc(e,t,l)}):Nd(e,t,i)}function Nd(e,t,i){t.status="fulfilled",t.value=i,Cd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,jd(e,i)))}function Kc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Cd(t),t=t.next;while(t!==l)}e.action=null}function Cd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function kd(e,t){return t}function Md(e,t){if(ze){var i=Ie.formState;if(i!==null){e:{var l=Se;if(ze){if(Ze){t:{for(var c=Ze,u=dn;c.nodeType!==8;){if(!u){c=null;break t}if(c=pn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=pn(c.nextSibling),l=c.data==="F!";break e}}Ss(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kd,lastRenderedState:t},i.queue=l,i=Kd.bind(null,Se,l),l.dispatch=i,l=Xc(!1),u=su.bind(null,Se,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=ob.bind(null,Se,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function Rd(e){var t=ut();return Dd(t,Ve,e)}function Dd(e,t,i){if(t=Qc(e,t,kd)[0],e=Nl(Wn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ea(t)}catch(p){throw p===Xi?xl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Se.flags|=2048,tr(9,{destroy:void 0},cb.bind(null,c,i),null)),[l,u,e]}function cb(e,t){e.action=t}function zd(e){var t=ut(),i=Ve;if(i!==null)return Dd(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function tr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Se.updateQueue,t===null&&(t=jl(),Se.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function qd(){return ut().memoizedState}function Cl(e,t,i,l){var c=kt();Se.flags|=e,c.memoizedState=tr(1|t,{destroy:void 0},i,l===void 0?null:l)}function kl(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Ve!==null&&l!==null&&$c(l,Ve.memoizedState.deps)?c.memoizedState=tr(t,u,i,l):(Se.flags|=e,c.memoizedState=tr(1|t,u,i,l))}function Ud(e,t){Cl(8390656,8,e,t)}function Zc(e,t){kl(2048,8,e,t)}function ub(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=jl(),Se.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Bd(e){var t=ut().memoizedState;return ub({ref:t,nextImpl:e}),function(){if((Pe&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Ld(e,t){return kl(4,2,e,t)}function Hd(e,t){return kl(4,4,e,t)}function Pd(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $d(e,t,i){i=i!=null?i.concat([e]):null,kl(4,4,Pd.bind(null,t,e),i)}function Wc(){}function Yd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&$c(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Gd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&$c(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function eu(e,t,i){return i===void 0||(Zn&1073741824)!==0&&(Re&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Vm(),Se.lanes|=e,Ms|=e,i)}function Vd(e,t,i,l){return Gt(i,t)?i:Zi.current!==null?(e=eu(e,i,l),Gt(e,t)||(mt=!0),e):(Zn&42)===0||(Zn&1073741824)!==0&&(Re&261930)===0?(mt=!0,e.memoizedState=i):(e=Vm(),Se.lanes|=e,Ms|=e,t)}function Fd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,su(e,!1,t,i);try{var O=c(),B=$.S;if(B!==null&&B(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=rb(O,l);ta(e,t,Y,Xt(e))}else ta(e,t,l,Xt(e))}catch(I){ta(e,t,{then:function(){},status:"rejected",reason:I},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function fb(){}function tu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Jd(e).queue;Fd(e,c,t,de,i===null?fb:function(){return Qd(e),i(l)})}function Jd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Qd(e){var t=Jd(e);t.next===null&&(t=e.alternate.memoizedState),ta(e,t.next.queue,{},Xt())}function nu(){return St(ba)}function Id(){return ut().memoizedState}function Xd(){return ut().memoizedState}function hb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=js(t,e,i);l!==null&&(Ht(l,t,i),Xr(l,t,i)),t={cache:kc()},e.payload=t;return}t=t.return}}function db(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ml(e)?Zd(t,i):(i=vc(e,t,i,l),i!==null&&(Ht(i,e,l),Wd(i,t,l)))}function Kd(e,t,i){var l=Xt();ta(e,t,i,l)}function ta(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Ml(e))Zd(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return hl(e,t,c,0),Ie===null&&fl(),!1}catch{}finally{}if(i=vc(e,t,c,l),i!==null)return Ht(i,e,l),Wd(i,t,l),!0}return!1}function su(e,t,i,l){if(l={lane:2,revertLane:zu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ml(e)){if(t)throw Error(a(479))}else t=vc(e,i,l,2),t!==null&&Ht(t,e,2)}function Ml(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Zd(e,t){Wi=Al=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Wd(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}var na={readContext:St,use:Tl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};na.useEffectEvent=rt;var em={readContext:St,use:Tl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Ud,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,Cl(4194308,4,Pd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){Cl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=db.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Xc(e);var t=e.queue,i=Kd.bind(null,Se,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Wc,useDeferredValue:function(e,t){var i=kt();return eu(i,e,t)},useTransition:function(){var e=Xc(!1);return e=Fd.bind(null,Se,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Se,c=kt();if(ze){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Ie===null)throw Error(a(349));(Re&127)!==0||_d(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,Ud(Sd.bind(null,l,u,e),[e]),l.flags|=2048,tr(9,{destroy:void 0},wd.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Ie.identifierPrefix;if(ze){var i=Rn,l=Mn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ol++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=ab++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nu,useFormState:Md,useActionState:Md,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=su.bind(null,Se,!0,i),i.dispatch=t,[e,t]},useMemoCache:Jc,useCacheRefresh:function(){return kt().memoizedState=hb.bind(null,Se)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((Pe&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},iu={readContext:St,use:Tl,useCallback:Yd,useContext:St,useEffect:Zc,useImperativeHandle:$d,useInsertionEffect:Ld,useLayoutEffect:Hd,useMemo:Gd,useReducer:Nl,useRef:qd,useState:function(){return Nl(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Vd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Nl(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:vd,useId:Id,useHostTransitionStatus:nu,useFormState:Rd,useActionState:Rd,useOptimistic:function(e,t){var i=ut();return Od(i,Ve,e,t)},useMemoCache:Jc,useCacheRefresh:Xd};iu.useEffectEvent=Bd;var tm={readContext:St,use:Tl,useCallback:Yd,useContext:St,useEffect:Zc,useImperativeHandle:$d,useInsertionEffect:Ld,useLayoutEffect:Hd,useMemo:Gd,useReducer:Ic,useRef:qd,useState:function(){return Ic(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Ve===null?eu(i,e,t):Vd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Ic(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:vd,useId:Id,useHostTransitionStatus:nu,useFormState:zd,useActionState:zd,useOptimistic:function(e,t){var i=ut();return Ve!==null?Od(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Jc,useCacheRefresh:Xd};tm.useEffectEvent=Bd;function ru(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var au={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=js(e,l,i),t!==null&&(Ht(t,e,i),Xr(t,e,i))}};function nm(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!$r(i,l)||!$r(c,u):!0}function sm(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&au.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function im(e){ul(e)}function rm(e){console.error(e)}function am(e){ul(e)}function Rl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function lm(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function lu(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){Rl(e,t)},i}function om(e){return e=Os(e),e.tag=3,e}function cm(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){lm(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){lm(t,i,l),typeof c!="function"&&(Rs===null?Rs=new Set([this]):Rs.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function mb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ji(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return mn===null?Vl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Mu(e,l,c)),!1;case 22:return i.flags|=65536,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Mu(e,l,c)),!1}throw Error(a(435,i.tag))}return Mu(e,l,c),Vl(),!1}if(ze)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Oc&&(e=Error(a(422),{cause:l}),Vr(un(e,i)))):(l!==Oc&&(t=Error(a(423),{cause:l}),Vr(un(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=un(l,i),c=lu(e.stateNode,l,c),Uc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=un(u,i),ua===null?ua=[u]:ua.push(u),at!==4&&(at=2),t===null)return!0;l=un(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=lu(i.stateNode,l,e),Uc(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Rs===null||!Rs.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=om(c),cm(c,e,i,l),Uc(i,c),!1}i=i.return}while(i!==null);return!1}var ou=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?dd(t,null,i,l):xi(t,e.child,i,l)}function um(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=Yc(e,t,i,p,u,c),b=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(ze&&b&&Ec(t),t.flags|=1,Et(e,t,l,c),t.child)}function fm(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!_c(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,hm(e,t,u,l,c)):(e=ml(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!gu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:$r,i(p,l)&&e.ref===t.ref)return es(e,t,c)}return t.flags|=1,e=Qn(u,l),e.ref=t.ref,e.return=t,t.child=e}function hm(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if($r(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,gu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,es(e,t,c)}return cu(e,t,i,l,c)}function dm(e,t,i,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return mm(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&bl(t,u!==null?u.cachePool:null),u!==null?gd(t,u):Lc(),yd(t);else return l=t.lanes=536870912,mm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(bl(t,u.cachePool),gd(t,u),Ns(),t.memoizedState=null):(e!==null&&bl(t,null),Lc(),Ns());return Et(e,t,c,i),t.child}function sa(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function mm(e,t,i,l,c){var u=Rc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&bl(t,null),Lc(),yd(t),e!==null&&Ji(e,t,l,!0),t.childLanes=c,null}function Dl(e,t){return t=ql({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pm(e,t,i){return xi(t,e.child,null,i),e=Dl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function pb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=Dl(t,l),t.lanes=536870912,sa(null,e);if(Pc(t),(e=Ze)?(e=jp(e,dn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:Mn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},i=Zh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return t.lanes=536870912,null}return Dl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Pc(t),c)if(t.flags&256)t.flags&=-257,t=pm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Ji(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Ie,l!==null&&(p=xs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),ou;Vl(),t=pm(e,t,i)}else e=u.treeContext,Ze=pn(p.nextSibling),wt=t,ze=!0,ws=null,dn=!1,e!==null&&td(t,e),t=Dl(t,l),t.flags|=4096;return t}return e=Qn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zl(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function cu(e,t,i,l,c){return pi(t),i=Yc(e,t,i,l,void 0,c),l=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(ze&&l&&Ec(t),t.flags|=1,Et(e,t,i,c),t.child)}function gm(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=xd(t,l,i,c),bd(e),l=Gc(),e!==null&&!mt?(Vc(e,t,u),es(e,t,u)):(ze&&l&&Ec(t),t.flags|=1,Et(e,t,i,u),t.child)}function ym(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Yi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=au,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},zc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Yi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(ru(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&au.enqueueReplaceState(u,u.state,null),Zr(t,l,u,c),Kr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=_i(i,b);u.props=O;var B=u.context,Y=i.contextType;p=Yi,typeof Y=="object"&&Y!==null&&(p=St(Y));var I=i.getDerivedStateFromProps;Y=typeof I=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&sm(t,u,l,p),As=!1;var L=t.memoizedState;u.state=L,Zr(t,l,u,c),Kr(),B=t.memoizedState,b||L!==B||As?(typeof I=="function"&&(ru(t,i,I,l),B=t.memoizedState),(O=As||nm(t,i,O,l,L,B,p))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=p,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,qc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,I=t.pendingProps,L=u.context,B=i.contextType,O=Yi,typeof B=="object"&&B!==null&&(O=St(B)),b=i.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==I||L!==O)&&sm(t,u,l,O),As=!1,L=t.memoizedState,u.state=L,Zr(t,l,u,c),Kr();var P=t.memoizedState;p!==I||L!==P||As||e!==null&&e.dependencies!==null&&gl(e.dependencies)?(typeof b=="function"&&(ru(t,i,b,l),P=t.memoizedState),(Y=As||nm(t,i,Y,l,L,P,O)||e!==null&&e.dependencies!==null&&gl(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,zl(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=es(e,t,c),e}function bm(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var uu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:ld()}}function hu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=It),e}function xm(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(c?Ts(t):Ns(),(e=Ze)?(e=jp(e,dn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:Mn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},i=Zh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return Qu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Ns(),c=t.mode,b=ql({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,sa(null,l)):(Ts(t),du(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(Ts(t),t.flags&=-257,t=mu(e,t,i)):t.memoizedState!==null?(Ns(),t.child=e.child,t.flags|=128,t=null):(Ns(),b=l.fallback,c=t.mode,l=ql({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,t=sa(null,l));else if(Ts(t),Qu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,Vr({value:l,source:null,stack:null}),t=mu(e,t,i)}else if(mt||Ji(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Ie,p!==null&&(l=xs(p,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,fi(e,l),Ht(p,e,l),ou;Ju(b)||Vl(),t=mu(e,t,i)}else Ju(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=pn(b.nextSibling),wt=t,ze=!0,ws=null,dn=!1,e!==null&&td(t,e),t=du(t,l.children),t.flags|=4096);return t}return c?(Ns(),b=l.fallback,c=t.mode,O=e.child,B=O.sibling,l=Qn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,B!==null?b=Qn(B,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,sa(null,l),l=t.child,b=e.child.memoizedState,b===null?b=fu(i):(c=b.cachePool,c!==null?(O=ht._currentValue,c=c.parent!==O?{parent:O,pool:O}:c):c=ld(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=hu(e,p,i),t.memoizedState=uu,sa(e.child,l)):(Ts(t),i=e.child,e=i.sibling,i=Qn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function du(e,t){return t=ql({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ql(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function mu(e,t,i){return xi(t,e.child,null,i),e=du(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function vm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Nc(e.return,t,i)}function pu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function _m(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=ze?Gr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vm(e,i,t);else if(e.tag===19)vm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&El(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),pu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&El(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}pu(t,!0,i,null,u,l);break;case"together":pu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function es(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Ms|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ji(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Qn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Qn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function gu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gl(e)))}function gb(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),Es(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:Es(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Pc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ts(t),t.flags|=128,null):(i&t.child.childLanes)!==0?xm(e,t,i):(Ts(t),e=es(e,t,i),e!==null?e.sibling:null);Ts(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ji(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return _m(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,dm(e,t,i,t.pendingProps);case 24:Es(t,ht,e.memoizedState.cache)}return es(e,t,i)}function wm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!gu(e,i)&&(t.flags&128)===0)return mt=!1,gb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,ze&&(t.flags&1048576)!==0&&ed(t,Gr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")_c(e)?(l=_i(e,l),t.tag=1,t=ym(null,t,e,l,i)):(t.tag=0,t=cu(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===re){t.tag=11,t=um(null,t,e,l,i);break e}else if(c===ce){t.tag=14,t=fm(null,t,e,l,i);break e}}throw t=He(e)||e,Error(a(306,t,""))}}return t;case 0:return cu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),ym(e,t,l,c,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,qc(e,t),Zr(t,l,null,i);var p=t.memoizedState;if(l=p.cache,Es(t,ht,l),l!==u.cache&&Cc(t,[ht],i,!0),Kr(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=bm(e,t,l,i);break e}else if(l!==c){c=un(Error(a(424)),t),Vr(c),t=bm(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=pn(e.firstChild),wt=t,ze=!0,ws=null,dn=!0,i=dd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=es(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return zl(e,t),e===null?(i=Rp(t.type,null,t.pendingProps,null))?t.memoizedState=i:ze||(i=t.type,e=t.pendingProps,l=Zl(rn.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=Rp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ze&&(l=t.stateNode=Cp(t.type,t.pendingProps,rn.current),wt=t,dn=!0,c=Ze,Us(t.type)?(Iu=c,Ze=pn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),zl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((c=l=Ze)&&(l=Fb(l,t.type,t.pendingProps,dn),l!==null?(t.stateNode=l,wt=t,Ze=pn(l.firstChild),dn=!1,c=!0):c=!1),c||Ss(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Gu(c,u)?l=null:p!==null&&Gu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Yc(e,t,lb,null,null,i),ba._currentValue=c),zl(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&ze&&((e=i=Ze)&&(i=Jb(i,t.pendingProps,dn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Ss(t)),null;case 13:return xm(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return um(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,Es(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return fm(e,t,t.type,t.pendingProps,i);case 15:return hm(e,t,t.type,t.pendingProps,i);case 19:return _m(e,t,i);case 31:return pb(e,t,i);case 22:return dm(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Rc(),c===null&&(c=Ie,u=kc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},zc(t),Es(t,ht,c)):((e.lanes&i)!==0&&(qc(e,t),Zr(t,null,null,i),Kr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Es(t,ht,l)):(l=u.cache,Es(t,ht,l),l!==c.cache&&Cc(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ts(e){e.flags|=4}function yu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Im())e.flags|=8192;else throw bi=vl,Dc}else e.flags&=-16777217}function Sm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Bp(t))if(Im())e.flags|=8192;else throw bi=vl,Dc}function Ul(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ri():536870912,e.lanes|=t,rr|=t)}function ia(e,t){if(!ze)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function yb(e,t,i){var l=t.pendingProps;switch(Ac(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Kn(ht),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?ts(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,jc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ts(t),u!==null?(We(t),Sm(t,u)):(We(t),yu(t,c,null,l,i))):u?u!==e.memoizedState?(ts(t),We(t),Sm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ts(t),We(t),yu(t,c,e,l,i)),null;case 27:if(ei(t),i=rn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Fi(t)?nd(t):(e=Cp(c,l,i),t.stateNode=e,ts(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Fi(t))nd(t);else{var p=Zl(rn.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Qe]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ts(t)}}return We(t),yu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=rn.current,Fi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||xp(e.nodeValue,i)),e||Ss(t,!0)}else e=Zl(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Fi(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Ul(t,t.updateQueue),We(t),null);case 4:return we(),e===null&&Lu(t.stateNode.containerInfo),We(t),null;case 10:return Kn(t.type),We(t),null;case 19:if(_e(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ia(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=El(e),u!==null){for(t.flags|=128,ia(l,!1),e=u.updateQueue,t.updateQueue=e,Ul(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Kh(i,e),i=i.sibling;return Te(ct,ct.current&1|2),ze&&In(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>$l&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304)}else{if(!c)if(e=El(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Ul(t,e),ia(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!ze)return We(t),null}else 2*et()-l.renderingStartTime>$l&&i!==536870912&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ct.current,Te(ct,c?i&1|2:i&1),ze&&In(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Hc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Ul(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&_e(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Kn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function bb(e,t){switch(Ac(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(ht),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(ct),null;case 4:return we(),null;case 10:return Kn(t.type),null;case 22:case 23:return Jt(t),Hc(),e!==null&&_e(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kn(ht),null;case 25:return null;default:return null}}function Em(e,t){switch(Ac(t),t.tag){case 3:Kn(ht),we();break;case 26:case 27:case 5:ei(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:_e(ct);break;case 10:Kn(t.type);break;case 22:case 23:Jt(t),Hc(),e!==null&&_e(gi);break;case 24:Kn(ht)}}function ra(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){Ye(t,t.return,b)}}function Cs(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var O=i,B=b;try{B()}catch(Y){Ye(c,O,Y)}}}l=l.next}while(l!==u)}}catch(Y){Ye(t,t.return,Y)}}function Am(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{pd(t,i)}catch(l){Ye(e,e.return,l)}}}function Om(e,t,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ye(e,t,l)}}function aa(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(c){Ye(e,t,c)}}function Dn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){Ye(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){Ye(e,t,c)}else i.current=null}function jm(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(c){Ye(e,e.return,c)}}function bu(e,t,i){try{var l=e.stateNode;Hb(l,e.type,i,t),l[it]=t}catch(c){Ye(e,e.return,c)}}function Tm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Us(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Us(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function vu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Fn));else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(vu(e,t,i),e=e.sibling;e!==null;)vu(e,t,i),e=e.sibling}function Bl(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Bl(e,t,i),e=e.sibling;e!==null;)Bl(e,t,i),e=e.sibling}function Nm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){Ye(e,e.return,u)}}var ns=!1,pt=!1,_u=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function xb(e,t){if(e=e.containerInfo,$u=ro,e=$h(e),mc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,O=-1,B=0,Y=0,I=e,L=null;t:for(;;){for(var P;I!==i||c!==0&&I.nodeType!==3||(b=p+c),I!==u||l!==0&&I.nodeType!==3||(O=p+l),I.nodeType===3&&(p+=I.nodeValue.length),(P=I.firstChild)!==null;)L=I,I=P;for(;;){if(I===e)break t;if(L===i&&++B===c&&(b=p),L===u&&++Y===l&&(O=p),(P=I.nextSibling)!==null)break;I=L,L=I.parentNode}I=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Yu={focusedElem:e,selectionRange:i},ro=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ye(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Fu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function km(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:is(e,i),l&4&&ra(5,i);break;case 1:if(is(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){Ye(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ye(i,i.return,p)}}l&64&&Am(i),l&512&&aa(i,i.return);break;case 3:if(is(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{pd(e,t)}catch(p){Ye(i,i.return,p)}}break;case 27:t===null&&l&4&&Nm(i);case 26:case 5:is(e,i),t===null&&l&4&&jm(i),l&512&&aa(i,i.return);break;case 12:is(e,i);break;case 31:is(e,i),l&4&&Dm(e,i);break;case 13:is(e,i),l&4&&zm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Tb.bind(null,i),Qb(e,i))));break;case 22:if(l=i.memoizedState!==null||ns,!l){t=t!==null&&t.memoizedState!==null||pt,c=ns;var u=pt;ns=l,(pt=t)&&!u?rs(e,i,(i.subtreeFlags&8772)!==0):is(e,i),ns=c,pt=u}break;case 30:break;default:is(e,i)}}function Mm(e){var t=e.alternate;t!==null&&(e.alternate=null,Mm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Di(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function ss(e,t,i){for(i=i.child;i!==null;)Rm(e,t,i),i=i.sibling}function Rm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||Dn(i,t),ss(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Dn(i,t);var l=tt,c=qt;Us(i.type)&&(tt=i.stateNode,qt=!1),ss(e,t,i),pa(i.stateNode),tt=l,qt=c;break;case 5:pt||Dn(i,t);case 6:if(l=tt,c=qt,tt=null,ss(e,t,i),tt=l,qt=c,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){Ye(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){Ye(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,Ap(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),dr(e)):Ap(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,ss(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:Cs(2,i,t),pt||Cs(4,i,t),ss(e,t,i);break;case 1:pt||(Dn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Om(i,t,l)),ss(e,t,i);break;case 21:ss(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ss(e,t,i),pt=l;break;default:ss(e,t,i)}}function Dm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dr(e)}catch(i){Ye(t,t.return,i)}}}function zm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dr(e)}catch(i){Ye(t,t.return,i)}}function vb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Cm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Cm),t;default:throw Error(a(435,e.tag))}}function Ll(e,t){var i=vb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Nb.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Us(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Rm(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)qm(t,e),t=t.sibling}var En=null;function qm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(Cs(3,e,e.return),ra(3,e),Cs(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),l&64&&ns&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var c=En;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Qe]=e,N(u),l=u;break e;case"link":var p=qp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=qp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,N(u),l=u}e.stateNode=l}else Up(c,e.type,e.stateNode);else e.stateNode=zp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Up(c,e.type,e.stateNode):zp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&bu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),i!==null&&l&4&&bu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Dn(i,i.return)),e.flags&32){c=e.stateNode;try{qi(c,"")}catch(he){Ye(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,bu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(_u=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(he){Ye(e,e.return,he)}}break;case 3:if(to=null,c=En,En=Wl(t.containerInfo),Ut(t,e),En=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{dr(t.containerInfo)}catch(he){Ye(e,e.return,he)}_u&&(_u=!1,Um(e));break;case 4:l=En,En=Wl(e.stateNode.containerInfo),Ut(t,e),Bt(e),En=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Pl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 22:c=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,B=ns,Y=pt;if(ns=B||c,pt=Y||O,Ut(t,e),pt=Y,ns=B,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||O||ns||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=O.stateNode;var I=O.memoizedProps.style,L=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){Ye(O,O.return,he)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(he){Ye(O,O.return,he)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;c?Op(P,!0):Op(O.stateNode,!1)}catch(he){Ye(O,O.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Ll(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(Tm(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=xu(e);Bl(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(qi(p,""),i.flags&=-33);var b=xu(e);Bl(e,b,p);break;case 3:case 4:var O=i.stateNode.containerInfo,B=xu(e);vu(e,B,O);break;default:throw Error(a(161))}}catch(Y){Ye(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Um(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Um(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function is(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)km(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Cs(4,t,t.return),wi(t);break;case 1:Dn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Om(t,t.return,i),wi(t);break;case 27:pa(t.stateNode);case 26:case 5:Dn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function rs(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:rs(c,u,i),ra(4,u);break;case 1:if(rs(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ye(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)md(O[c],b)}catch(B){Ye(l,l.return,B)}}i&&p&64&&Am(u),aa(u,u.return);break;case 27:Nm(u);case 26:case 5:rs(c,u,i),i&&l===null&&p&4&&jm(u),aa(u,u.return);break;case 12:rs(c,u,i);break;case 31:rs(c,u,i),i&&p&4&&Dm(c,u);break;case 13:rs(c,u,i),i&&p&4&&zm(c,u);break;case 22:u.memoizedState===null&&rs(c,u,i),aa(u,u.return);break;case 30:break;default:rs(c,u,i)}t=t.sibling}}function wu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Fr(i))}function Su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e))}function An(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Bm(e,t,i,l),t=t.sibling}function Bm(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:An(e,t,i,l),c&2048&&ra(9,t);break;case 1:An(e,t,i,l);break;case 3:An(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e)));break;case 12:if(c&2048){An(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Ye(t,t.return,O)}}else An(e,t,i,l);break;case 31:An(e,t,i,l);break;case 13:An(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?An(e,t,i,l):la(e,t):u._visibility&2?An(e,t,i,l):(u._visibility|=2,nr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&wu(p,t);break;case 24:An(e,t,i,l),c&2048&&Su(t.alternate,t);break;default:An(e,t,i,l)}}function nr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,O=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:nr(u,p,b,O,c),ra(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?nr(u,p,b,O,c):la(u,p):(Y._visibility|=2,nr(u,p,b,O,c)),c&&B&2048&&wu(p.alternate,p);break;case 24:nr(u,p,b,O,c),c&&B&2048&&Su(p.alternate,p);break;default:nr(u,p,b,O,c)}t=t.sibling}}function la(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:la(i,l),c&2048&&wu(l.alternate,l);break;case 24:la(i,l),c&2048&&Su(l.alternate,l);break;default:la(i,l)}t=t.sibling}}var oa=8192;function sr(e,t,i){if(e.subtreeFlags&oa)for(e=e.child;e!==null;)Lm(e,t,i),e=e.sibling}function Lm(e,t,i){switch(e.tag){case 26:sr(e,t,i),e.flags&oa&&e.memoizedState!==null&&ax(i,En,e.memoizedState,e.memoizedProps);break;case 5:sr(e,t,i);break;case 3:case 4:var l=En;En=Wl(e.stateNode.containerInfo),sr(e,t,i),En=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=oa,oa=16777216,sr(e,t,i),oa=l):sr(e,t,i));break;default:sr(e,t,i)}}function Hm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ca(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,$m(l,e)}Hm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Pm(e),e=e.sibling}function Pm(e){switch(e.tag){case 0:case 11:case 15:ca(e),e.flags&2048&&Cs(9,e,e.return);break;case 3:ca(e);break;case 12:ca(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hl(e)):ca(e);break;default:ca(e)}}function Hl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,$m(l,e)}Hm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cs(8,t,t.return),Hl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function $m(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:Cs(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Fr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(Mm(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var _b={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},wb=typeof WeakMap=="function"?WeakMap:Map,Pe=0,Ie=null,Ne=null,Re=0,$e=0,Qt=null,ks=!1,ir=!1,Eu=!1,as=0,at=0,Ms=0,Si=0,Au=0,It=0,rr=0,ua=null,Lt=null,Ou=!1,Pl=0,Ym=0,$l=1/0,Yl=null,Rs=null,bt=0,Ds=null,ar=null,ls=0,ju=0,Tu=null,Gm=null,fa=0,Nu=null;function Xt(){return(Pe&2)!==0&&Re!==0?Re&-Re:$.T!==null?zu():Rr()}function Vm(){if(It===0)if((Re&536870912)===0||ze){var e=Yn;Yn<<=1,(Yn&3932160)===0&&(Yn=262144),It=e}else It=536870912;return e=Ft.current,e!==null&&(e.flags|=32),It}function Ht(e,t,i){(e===Ie&&($e===2||$e===9)||e.cancelPendingCommit!==null)&&(lr(e,0),zs(e,Re,It,!1)),_n(e,i),((Pe&2)===0||e!==Ie)&&(e===Ie&&((Pe&2)===0&&(Si|=i),at===4&&zs(e,Re,It,!1)),zn(e))}function Fm(e,t,i){if((Pe&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?Ab(e,t):ku(e,t,!0),u=l;do{if(c===0){ir&&!l&&zs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!Sb(i)){c=ku(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=ua;var O=b.current.memoizedState.isDehydrated;if(O&&(lr(b,p).flags|=256),p=ku(b,p,!1),p!==2){if(Eu&&!O){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){lr(e,0),zs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:zs(l,t,It,!ks);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Pl+300-et(),10<c)){if(zs(l,t,It,!ks),si(l,0,!0)!==0)break e;ls=t,l.timeoutHandle=Sp(Jm.bind(null,l,i,Lt,Yl,Ou,t,It,Si,rr,ks,u,"Throttled",-0,0),c);break e}Jm(l,i,Lt,Yl,Ou,t,It,Si,rr,ks,u,null,-0,0)}}break}while(!0);zn(e)}function Jm(e,t,i,l,c,u,p,b,O,B,Y,I,L,P){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn},Lm(t,u,I);var he=(u&62914560)===u?Pl-et():(u&4194048)===u?Ym-et():0;if(he=lx(I,he),he!==null){ls=u,e.cancelPendingCommit=he(tp.bind(null,e,t,u,i,l,c,p,b,O,Y,I,null,L,P)),zs(e,u,p,!B);return}}tp(e,t,u,i,l,c,p,b,O)}function Sb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zs(e,t,i,l){t&=~Au,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&bs(e,i,t)}function Gl(){return(Pe&6)===0?(ha(0),!1):!0}function Cu(){if(Ne!==null){if($e===0)var e=Ne.return;else e=Ne,Xn=mi=null,Fc(e),Ki=null,Qr=0,e=Ne;for(;e!==null;)Em(e.alternate,e),e=e.return;Ne=null}}function lr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Yb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ls=0,Cu(),Ie=e,Ne=i=Qn(e.current,null),Re=t,$e=0,Qt=null,ks=!1,ir=ii(e,t),Eu=!1,rr=It=Au=Si=Ms=at=0,Lt=ua=null,Ou=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return as=t,fl(),i}function Qm(e,t){Se=null,$.H=na,t===Xi||t===xl?(t=ud(),$e=3):t===Dc?(t=ud(),$e=4):$e=t===ou?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Rl(e,un(t,e.current)))}function Im(){var e=Ft.current;return e===null?!0:(Re&4194048)===Re?mn===null:(Re&62914560)===Re||(Re&536870912)!==0?e===mn:!1}function Xm(){var e=$.H;return $.H=na,e===null?na:e}function Km(){var e=$.A;return $.A=_b,e}function Vl(){at=4,ks||(Re&4194048)!==Re&&Ft.current!==null||(ir=!0),(Ms&134217727)===0&&(Si&134217727)===0||Ie===null||zs(Ie,Re,It,!1)}function ku(e,t,i){var l=Pe;Pe|=2;var c=Xm(),u=Km();(Ie!==e||Re!==t)&&(Yl=null,lr(e,t)),t=!1;var p=at;e:do try{if($e!==0&&Ne!==null){var b=Ne,O=Qt;switch($e){case 8:Cu(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var B=$e;if($e=0,Qt=null,or(e,b,O,B),i&&ir){p=0;break e}break;default:B=$e,$e=0,Qt=null,or(e,b,O,B)}}Eb(),p=at;break}catch(Y){Qm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Xn=mi=null,Pe=l,$.H=c,$.A=u,Ne===null&&(Ie=null,Re=0,fl()),p}function Eb(){for(;Ne!==null;)Zm(Ne)}function Ab(e,t){var i=Pe;Pe|=2;var l=Xm(),c=Km();Ie!==e||Re!==t?(Yl=null,$l=et()+500,lr(e,t)):ir=ii(e,t);e:do try{if($e!==0&&Ne!==null){t=Ne;var u=Qt;t:switch($e){case 1:$e=0,Qt=null,or(e,t,u,1);break;case 2:case 9:if(od(u)){$e=0,Qt=null,Wm(t);break}t=function(){$e!==2&&$e!==9||Ie!==e||($e=7),zn(e)},u.then(t,t);break e;case 3:$e=7;break e;case 4:$e=5;break e;case 7:od(u)?($e=0,Qt=null,Wm(t)):($e=0,Qt=null,or(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Bp(p):b.stateNode.complete){$e=0,Qt=null;var O=b.sibling;if(O!==null)Ne=O;else{var B=b.return;B!==null?(Ne=B,Fl(B)):Ne=null}break t}}$e=0,Qt=null,or(e,t,u,5);break;case 6:$e=0,Qt=null,or(e,t,u,6);break;case 8:Cu(),at=6;break e;default:throw Error(a(462))}}Ob();break}catch(Y){Qm(e,Y)}while(!0);return Xn=mi=null,$.H=l,$.A=c,Pe=i,Ne!==null?0:(Ie=null,Re=0,fl(),at)}function Ob(){for(;Ne!==null&&!Qa();)Zm(Ne)}function Zm(e){var t=wm(e.alternate,e,as);e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function Wm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=gm(i,t,t.pendingProps,t.type,void 0,Re);break;case 11:t=gm(i,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:Fc(t);default:Em(i,t),t=Ne=Kh(t,as),t=wm(i,t,as)}e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function or(e,t,i,l){Xn=mi=null,Fc(t),Ki=null,Qr=0;var c=t.return;try{if(mb(e,c,t,i,Re)){at=1,Rl(e,un(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Rl(e,un(i,e.current)),Ne=null;return}t.flags&32768?(ze||l===1?e=!0:ir||(Re&536870912)!==0?e=!1:(ks=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),ep(t,e)):Fl(t)}function Fl(e){var t=e;do{if((t.flags&32768)!==0){ep(t,ks);return}e=t.return;var i=yb(t.alternate,t,as);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function ep(e,t){do{var i=bb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function tp(e,t,i,l,c,u,p,b,O){e.cancelPendingCommit=null;do Jl();while(bt!==0);if((Pe&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=xc,ys(e,i,u,p,b,O),e===Ie&&(Ne=Ie=null,Re=0),ar=t,Ds=e,ls=i,ju=u,Tu=c,Gm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cb(ki,function(){return ap(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=Pe,Pe|=4;try{xb(e,t,i)}finally{Pe=p,te.p=c,$.T=l}}bt=1,np(),sp(),ip()}}function np(){if(bt===1){bt=0;var e=Ds,t=ar,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{qm(t,e);var u=Yu,p=$h(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Ph(b.ownerDocument.documentElement,b)){if(O!==null&&mc(b)){var B=O.start,Y=O.end;if(Y===void 0&&(Y=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(Y,b.value.length);else{var I=b.ownerDocument||document,L=I&&I.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(O.start,he),Je=O.end===void 0?ye:Math.min(O.end,he);!P.extend&&ye>Je&&(p=Je,Je=ye,ye=p);var R=Hh(b,ye),k=Hh(b,Je);if(R&&k&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==k.node||P.focusOffset!==k.offset)){var U=I.createRange();U.setStart(R.node,R.offset),P.removeAllRanges(),ye>Je?(P.addRange(U),P.extend(k.node,k.offset)):(U.setEnd(k.node,k.offset),P.addRange(U))}}}}for(I=[],P=b;P=P.parentNode;)P.nodeType===1&&I.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var F=I[b];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}ro=!!$u,Yu=$u=null}finally{Pe=c,te.p=l,$.T=i}}e.current=t,bt=2}}function sp(){if(bt===2){bt=0;var e=Ds,t=ar,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{km(e,t.alternate,t)}finally{Pe=c,te.p=l,$.T=i}}bt=3}}function ip(){if(bt===4||bt===3){bt=0,Ci();var e=Ds,t=ar,i=ls,l=Gm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,ar=Ds=null,rp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Rs=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(ls&3)!==0&&Jl(),zn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Nu?fa++:(fa=0,Nu=e):fa=0,ha(0)}}function rp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Fr(t)))}function Jl(){return np(),sp(),ip(),ap()}function ap(){if(bt!==5)return!1;var e=Ds,t=ju;ju=0;var i=ai(ls),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=Tu,Tu=null;var u=Ds,p=ls;if(bt=0,ar=Ds=null,ls=0,(Pe&6)!==0)throw Error(a(331));var b=Pe;if(Pe|=4,Pm(u.current),Bm(u,u.current,p,i),Pe=b,ha(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,rp(e,t)}}function lp(e,t,i){t=un(i,t),t=lu(e.stateNode,t,2),e=js(e,t,2),e!==null&&(_n(e,2),zn(e))}function Ye(e,t,i){if(e.tag===3)lp(e,e,i);else for(;t!==null;){if(t.tag===3){lp(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Rs===null||!Rs.has(l))){e=un(i,e),i=om(2),l=js(t,i,2),l!==null&&(cm(i,l,t,e),_n(l,2),zn(l));break}}t=t.return}}function Mu(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new wb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Eu=!0,c.add(i),e=jb.bind(null,e,t,i),t.then(e,e))}function jb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ie===e&&(Re&i)===i&&(at===4||at===3&&(Re&62914560)===Re&&300>et()-Pl?(Pe&2)===0&&lr(e,0):Au|=i,rr===Re&&(rr=0)),zn(e)}function op(e,t){t===0&&(t=Ri()),e=fi(e,t),e!==null&&(_n(e,t),zn(e))}function Tb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),op(e,i)}function Nb(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),op(e,i)}function Cb(e,t){return Nr(e,t)}var Ql=null,cr=null,Ru=!1,Il=!1,Du=!1,qs=0;function zn(e){e!==cr&&e.next===null&&(cr===null?Ql=cr=e:cr=cr.next=e),Il=!0,Ru||(Ru=!0,Mb())}function ha(e,t){if(!Du&&Il){Du=!0;do for(var i=!1,l=Ql;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,hp(l,u))}else u=Re,u=si(l,l===Ie?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,hp(l,u));l=l.next}while(i);Du=!1}}function kb(){cp()}function cp(){Il=Ru=!1;var e=0;qs!==0&&$b()&&(e=qs);for(var t=et(),i=null,l=Ql;l!==null;){var c=l.next,u=up(l,t);u===0?(l.next=null,i===null?Ql=c:i.next=c,c===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Il=!0)),l=c}bt!==0&&bt!==5||ha(e),qs!==0&&(qs=0)}function up(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,O=c[p];O===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Mr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Ie,i=Re,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&($e===2||$e===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$n(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&$n(l),ai(i)){case 2:case 8:i=Xa;break;case 32:i=ki;break;case 268435456:i=Ka;break;default:i=ki}return l=fp.bind(null,e),i=Nr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&$n(l),e.callbackPriority=2,e.callbackNode=null,2}function fp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Jl()&&e.callbackNode!==i)return null;var l=Re;return l=si(e,e===Ie?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Fm(e,l,t),up(e,et()),e.callbackNode!=null&&e.callbackNode===i?fp.bind(null,e):null)}function hp(e,t){if(Jl())return null;Fm(e,t,!0)}function Mb(){Gb(function(){(Pe&6)!==0?Nr(Ia,kb):cp()})}function zu(){if(qs===0){var e=Qi;e===0&&(e=ms,ms<<=1,(ms&261888)===0&&(ms=256)),qs=e}return qs}function dp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:sl(""+e)}function mp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Rb(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=dp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?dp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ll("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(qs!==0){var O=p?mp(c,p):new FormData(c);tu(i,{pending:!0,data:O,method:c.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=p?mp(c,p):new FormData(c),tu(i,{pending:!0,data:O,method:c.method,action:u},u,O))},currentTarget:c}]})}}for(var qu=0;qu<bc.length;qu++){var Uu=bc[qu],Db=Uu.toLowerCase(),zb=Uu[0].toUpperCase()+Uu.slice(1);Sn(Db,"on"+zb)}Sn(Vh,"onAnimationEnd"),Sn(Fh,"onAnimationIteration"),Sn(Jh,"onAnimationStart"),Sn("dblclick","onDoubleClick"),Sn("focusin","onFocus"),Sn("focusout","onBlur"),Sn(Ky,"onTransitionRun"),Sn(Zy,"onTransitionStart"),Sn(Wy,"onTransitionCancel"),Sn(Qh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),Z("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Z("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Z("onBeforeInput",["compositionend","keypress","textInput","paste"]),Z("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var da="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),qb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(da));function pp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],O=b.instance,B=b.currentTarget;if(b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}else for(p=0;p<l.length;p++){if(b=l[p],O=b.instance,B=b.currentTarget,b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(gp(t,e,2,!1),i.add(l))}function Bu(e,t,i){var l=0;t&&(l|=4),gp(i,e,l,t)}var Xl="_reactListening"+Math.random().toString(36).slice(2);function Lu(e){if(!e[Xl]){e[Xl]=!0,z.forEach(function(i){i!=="selectionchange"&&(qb.has(i)||Bu(i,!1,e),Bu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xl]||(t[Xl]=!0,Bu("selectionchange",!1,t))}}function gp(e,t,i,l){switch(Vp(t)){case 2:var c=ux;break;case 8:c=fx;break;default:c=ef}i=c.bind(null,t,i,e),c=void 0,!rc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Hu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var O=p.tag;if((O===3||O===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(O=p.tag,O===5||O===6||O===26||O===27){l=u=p;continue e}b=b.parentNode}}l=l.return}_h(function(){var B=u,Y=sc(i),I=[];e:{var L=Ih.get(e);if(L!==void 0){var P=ll,he=e;switch(e){case"keypress":if(rl(i)===0)break e;case"keydown":case"keyup":P=Ny;break;case"focusin":he="focus",P=cc;break;case"focusout":he="blur",P=cc;break;case"beforeblur":case"afterblur":P=cc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=Eh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=yy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=My;break;case Vh:case Fh:case Jh:P=vy;break;case Qh:P=Dy;break;case"scroll":case"scrollend":P=py;break;case"wheel":P=qy;break;case"copy":case"cut":case"paste":P=wy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Oh;break;case"toggle":case"beforetoggle":P=By}var ye=(t&4)!==0,Je=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var k=B,U;k!==null;){var F=k;if(U=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||U===null||R===null||(F=zr(k,R),F!=null&&ye.push(ma(k,F,U))),Je)break;k=k.return}0<ye.length&&(L=new P(L,he,null,i,Y),I.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==nc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=B,he=he?x(he):null,he!==null&&(Je=f(he),ye=he.tag,he!==Je||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=B),P!==he)){if(ye=Eh,F="onMouseLeave",R="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Oh,F="onPointerLeave",R="onPointerEnter",k="pointer"),Je=P==null?L:_(P),U=he==null?L:_(he),L=new ye(F,k+"leave",P,i,Y),L.target=Je,L.relatedTarget=U,F=null,x(Y)===B&&(ye=new ye(R,k+"enter",he,i,Y),ye.target=U,ye.relatedTarget=Je,F=ye),Je=F,P&&he)t:{for(ye=Ub,R=P,k=he,U=0,F=R;F;F=ye(F))U++;F=0;for(var ge=k;ge;ge=ye(ge))F++;for(;0<U-F;)R=ye(R),U--;for(;0<F-U;)k=ye(k),F--;for(;U--;){if(R===k||k!==null&&R===k.alternate){ye=R;break t}R=ye(R),k=ye(k)}ye=null}else ye=null;P!==null&&yp(I,L,P,ye,!1),he!==null&&Je!==null&&yp(I,Je,he,ye,!0)}}e:{if(L=B?_(B):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Be=Dh;else if(Mh(L))if(zh)Be=Qy;else{Be=Fy;var pe=Vy}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&tc(B.elementType)&&(Be=Dh):Be=Jy;if(Be&&(Be=Be(e,B))){Rh(I,Be,i,Y);break e}pe&&pe(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&ec(L,"number",L.value)}switch(pe=B?_(B):window,e){case"focusin":(Mh(pe)||pe.contentEditable==="true")&&(Hi=pe,pc=B,Yr=null);break;case"focusout":Yr=pc=Hi=null;break;case"mousedown":gc=!0;break;case"contextmenu":case"mouseup":case"dragend":gc=!1,Yh(I,i,Y);break;case"selectionchange":if(Xy)break;case"keydown":case"keyup":Yh(I,i,Y)}var Ee;if(fc)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else Li?Ch(e,i)&&(De="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(De="onCompositionStart");De&&(jh&&i.locale!=="ko"&&(Li||De!=="onCompositionStart"?De==="onCompositionEnd"&&Li&&(Ee=wh()):(vs=Y,ac="value"in vs?vs.value:vs.textContent,Li=!0)),pe=Kl(B,De),0<pe.length&&(De=new Ah(De,e,null,i,Y),I.push({event:De,listeners:pe}),Ee?De.data=Ee:(Ee=kh(i),Ee!==null&&(De.data=Ee)))),(Ee=Hy?Py(e,i):$y(e,i))&&(De=Kl(B,"onBeforeInput"),0<De.length&&(pe=new Ah("onBeforeInput","beforeinput",null,i,Y),I.push({event:pe,listeners:De}),pe.data=Ee)),Rb(I,e,B,i,Y)}pp(I,t)})}function ma(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Kl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=zr(e,i),c!=null&&l.unshift(ma(e,c,u)),c=zr(e,t),c!=null&&l.push(ma(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Ub(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function yp(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,O=b.alternate,B=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||B===null||(O=B,c?(B=zr(i,u),B!=null&&p.unshift(ma(i,B,O))):c||(B=zr(i,u),B!=null&&p.push(ma(i,B,O)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var Bb=/\r\n?/g,Lb=/\u0000|\uFFFD/g;function bp(e){return(typeof e=="string"?e:""+e).replace(Bb,`
26
+ `).replace(Lb,"")}function xp(e,t){return t=bp(t),bp(e)===t}function Fe(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&qi(e,""+l);break;case"className":wn(e,"class",l);break;case"tabIndex":wn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":wn(e,i,l);break;case"style":xh(e,l,u);break;case"data":if(t!=="object"){wn(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&Fe(e,t,"name",c.name,c,null),Fe(e,t,"formEncType",c.formEncType,c,null),Fe(e,t,"formMethod",c.formMethod,c,null),Fe(e,t,"formTarget",c.formTarget,c,null)):(Fe(e,t,"encType",c.encType,c,null),Fe(e,t,"method",c.method,c,null),Fe(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=sl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=dy.get(i)||i,Ct(e,i,l))}}function Pu(e,t,i,l,c,u){switch(i){case"style":xh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Q.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,p,i,null)}}c&&Fe(e,t,"srcSet",i.srcSet,i,null),l&&Fe(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=p=c=null,O=null,B=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":O=Y;break;case"defaultChecked":B=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Fe(e,t,l,Y,i,null)}}ph(e,u,b,O,B,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Fe(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?zi(e,!!l,t,!1):i!=null&&zi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,p,b,i,null)}yh(e,l,c,u);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(l=i[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Fe(e,t,O,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<da.length;l++)Ce(da[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in i)if(i.hasOwnProperty(B)&&(l=i[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,B,l,i,null)}return;default:if(tc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&Pu(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Fe(e,t,b,l,i,null))}function Hb(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,O=null,B=null,Y=null;for(P in i){var I=i[P];if(i.hasOwnProperty(P)&&I!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=I;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,I)}}for(var L in l){var P=l[L];if(I=i[L],l.hasOwnProperty(L)&&(P!=null||I!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":B=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==I&&Fe(e,t,L,P,l,I)}}Wo(e,p,b,O,B,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(O=i[u],i.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":P=O;default:l.hasOwnProperty(u)||Fe(e,t,u,null,l,O)}for(c in l)if(u=l[c],O=i[c],l.hasOwnProperty(c)&&(u!=null||O!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==O&&Fe(e,t,c,u,l,O)}t=b,i=p,l=P,L!=null?zi(e,!!i,L,!1):!!l!=!!i&&(t!=null?zi(e,!!i,t,!0):zi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Fe(e,t,p,c,l,u)}gh(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Fe(e,t,he,null,l,L)}for(O in l)if(L=l[O],P=i[O],l.hasOwnProperty(O)&&L!==P&&(L!=null||P!=null))switch(O){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Fe(e,t,O,L,l,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Fe(e,t,ye,null,l,L);for(B in l)if(L=l[B],P=i[B],l.hasOwnProperty(B)&&L!==P&&(L!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Fe(e,t,B,L,l,P)}return;default:if(tc(t)){for(var Je in i)L=i[Je],i.hasOwnProperty(Je)&&L!==void 0&&!l.hasOwnProperty(Je)&&Pu(e,t,Je,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||Pu(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Fe(e,t,R,null,l,L);for(I in l)L=l[I],P=i[I],!l.hasOwnProperty(I)||L===P||L==null&&P==null||Fe(e,t,I,L,l,P)}function vp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Pb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&vp(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var O=i[l],B=O.startTime;if(B>b)break;var Y=O.transferSize,I=O.initiatorType;Y&&vp(I)&&(O=O.responseEnd,p+=Y*(O<b?1:(b-B)/(O-B)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var $u=null,Yu=null;function Zl(e){return e.nodeType===9?e:e.ownerDocument}function _p(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function wp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Gu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Vu=null;function $b(){var e=window.event;return e&&e.type==="popstate"?e===Vu?!1:(Vu=e,!0):(Vu=null,!1)}var Sp=typeof setTimeout=="function"?setTimeout:void 0,Yb=typeof clearTimeout=="function"?clearTimeout:void 0,Ep=typeof Promise=="function"?Promise:void 0,Gb=typeof queueMicrotask=="function"?queueMicrotask:typeof Ep<"u"?function(e){return Ep.resolve(null).then(e).catch(Vb)}:Sp;function Vb(e){setTimeout(function(){throw e})}function Us(e){return e==="head"}function Ap(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),dr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")pa(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,pa(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&pa(e.ownerDocument.body);i=c}while(i);dr(t)}function Op(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Fu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Fu(i),Di(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Fb(e,t,i,l){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=pn(e.nextSibling),e===null)break}return null}function Jb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=pn(e.nextSibling),e===null))return null;return e}function jp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=pn(e.nextSibling),e===null))return null;return e}function Ju(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Qb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function pn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Iu=null;function Tp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return pn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Np(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Cp(e,t,i){switch(t=Zl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pa(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Di(e)}var gn=new Map,kp=new Set;function Wl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var os=te.d;te.d={f:Ib,r:Xb,D:Kb,C:Zb,L:Wb,m:ex,X:nx,S:tx,M:sx};function Ib(){var e=os.f(),t=Gl();return e||t}function Xb(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Qd(t):os.r(e)}var ur=typeof document>"u"?null:document;function Mp(e,t,i){var l=ur;if(l&&typeof t=="string"&&t){var c=on(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),kp.has(c)||(kp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function Kb(e){os.D(e),Mp("dns-prefetch",e,null)}function Zb(e,t){os.C(e,t),Mp("preconnect",e,t)}function Wb(e,t,i){os.L(e,t,i);var l=ur;if(l&&e&&t){var c='link[rel="preload"][as="'+on(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+on(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+on(i.imageSizes)+'"]')):c+='[href="'+on(e)+'"]';var u=c;switch(t){case"style":u=fr(e);break;case"script":u=hr(e)}gn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),gn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ga(u))||t==="script"&&l.querySelector(ya(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function ex(e,t){os.m(e,t);var i=ur;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+on(l)+'"][href="'+on(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=hr(e)}if(!gn.has(u)&&(e=w({rel:"modulepreload",href:e},t),gn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ya(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function tx(e,t,i){os.S(e,t,i);var l=ur;if(l&&e){var c=A(l).hoistableStyles,u=fr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ga(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=gn.get(u))&&Xu(e,i);var O=p=l.createElement("link");N(O),At(O,"link",e),O._p=new Promise(function(B,Y){O.onload=B,O.onerror=Y}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,eo(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function nx(e,t){os.X(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0},t),(t=gn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function sx(e,t){os.M(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=gn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Rp(e,t,i,l){var c=(c=rn.current)?Wl(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=fr(i.href),i=A(c).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=fr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ga(e)))&&!u._p&&(p.instance=u,p.state.loading=5),gn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},gn.set(e,i),u||ix(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=hr(i),i=A(c).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function fr(e){return'href="'+on(e)+'"'}function ga(e){return'link[rel="stylesheet"]['+e+"]"}function Dp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function ix(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),N(t),e.head.appendChild(t))}function hr(e){return'[src="'+on(e)+'"]'}function ya(e){return"script[async]"+e}function zp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+on(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),eo(l,i.precedence,e),t.instance=l;case"stylesheet":c=fr(i.href);var u=e.querySelector(ga(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Dp(i),(c=gn.get(c))&&Xu(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),t.state.loading|=4,eo(u,i.precedence,e),t.instance=u;case"script":return u=hr(i.src),(c=e.querySelector(ya(u)))?(t.instance=c,N(c),c):(l=i,(c=gn.get(u))&&(l=w({},i),Ku(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,eo(l,i.precedence,e));return t.instance}function eo(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var to=null;function qp(e,t,i){if(to===null){var l=new Map,c=to=new Map;c.set(i,l)}else c=to,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function Up(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function rx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Bp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ax(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=fr(l.href),u=t.querySelector(ga(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=no.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Dp(l),(c=gn.get(c))&&Xu(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=no.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Zu=0;function lx(e,t){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Zu===0&&(Zu=62500*Pb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Zu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function no(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var so=null;function io(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,so=new Map,t.forEach(ox,e),so=null,no.call(e))}function ox(e,t){if(!(t.state.loading&4)){var i=so.get(e);if(i)var l=i.get(null);else{i=new Map,so.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=no.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ba={$$typeof:me,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function cx(e,t,i,l,c,u,p,b,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=gs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gs(0),this.hiddenUpdates=gs(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Lp(e,t,i,l,c,u,p,b,O,B,Y,I){return e=new cx(e,t,i,p,O,B,Y,I,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=kc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},zc(u),e}function Hp(e){return e?(e=Yi,e):Yi}function Pp(e,t,i,l,c,u){c=Hp(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=js(e,l,t),i!==null&&(Ht(i,e,t),Xr(i,e,t))}function $p(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Wu(e,t){$p(e,t),(e=e.alternate)&&$p(e,t)}function Yp(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),Wu(e,67108864)}}function Gp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Gn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),Wu(e,t)}}var ro=!0;function ux(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function fx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function ef(e,t,i,l){if(ro){var c=tf(l);if(c===null)Hu(e,t,l,ao,i),Fp(e,l);else if(dx(c,e,t,i,l))l.stopPropagation();else if(Fp(e,l),t&4&&-1<hx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=vn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var O=1<<31-Nt(p);b.entanglements[1]|=O,p&=~O}zn(u),(Pe&6)===0&&($l=et()+500,ha(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Gl(),Wu(u,2)}if(u=tf(l),u===null&&Hu(e,t,l,ao,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Hu(e,t,l,null,i)}}function tf(e){return e=sc(e),nf(e)}var ao=null;function nf(e){if(ao=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=d(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ao=e,null}function Vp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Io()){case Ia:return 2;case Xa:return 8;case ki:case Xo:return 32;case Ka:return 268435456;default:return 32}default:return 32}}var sf=!1,Bs=null,Ls=null,Hs=null,xa=new Map,va=new Map,Ps=[],hx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Fp(e,t){switch(e){case"focusin":case"focusout":Bs=null;break;case"dragenter":case"dragleave":Ls=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":va.delete(t.pointerId)}}function _a(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&Yp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function dx(e,t,i,l,c){switch(t){case"focusin":return Bs=_a(Bs,e,t,i,l,c),!0;case"dragenter":return Ls=_a(Ls,e,t,i,l,c),!0;case"mouseover":return Hs=_a(Hs,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return xa.set(u,_a(xa.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,va.set(u,_a(va.get(u)||null,e,t,i,l,c)),!0}return!1}function Jp(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Wa(e.priority,function(){Gp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Wa(e.priority,function(){Gp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function lo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=tf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);nc=l,i.target.dispatchEvent(l),nc=null}else return t=S(i),t!==null&&Yp(t),e.blockedOn=i,!1;t.shift()}return!0}function Qp(e,t,i){lo(e)&&i.delete(t)}function mx(){sf=!1,Bs!==null&&lo(Bs)&&(Bs=null),Ls!==null&&lo(Ls)&&(Ls=null),Hs!==null&&lo(Hs)&&(Hs=null),xa.forEach(Qp),va.forEach(Qp)}function oo(e,t){e.blockedOn===t&&(e.blockedOn=null,sf||(sf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,mx)))}var co=null;function Ip(e){co!==e&&(co=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){co===e&&(co=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(nf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,tu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function dr(e){function t(O){return oo(O,e)}Bs!==null&&oo(Bs,e),Ls!==null&&oo(Ls,e),Hs!==null&&oo(Hs,e),xa.forEach(t),va.forEach(t);for(var i=0;i<Ps.length;i++){var l=Ps[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ps.length&&(i=Ps[0],i.blockedOn===null);)Jp(i),i.blockedOn===null&&Ps.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||Ip(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(nf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Ip(i)}}}function Xp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function rf(e){this._internalRoot=e}uo.prototype.render=rf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Pp(i,l,e,t,null,null)},uo.prototype.unmount=rf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Pp(e.current,2,null,e,null,null),Gl(),t[Yt]=null}};function uo(e){this._internalRoot=e}uo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Ps.length&&t!==0&&t<Ps[i].priority;i++);Ps.splice(i,0,e),i===0&&Jp(e)}};var Kp=n.version;if(Kp!=="19.2.4")throw Error(a(527,Kp,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var px={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fo.isDisabled&&fo.supportsFiber)try{ni=fo.inject(px),ot=fo}catch{}}return wa.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=im,u=rm,p=am;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Lp(e,1,!1,null,null,i,l,null,c,u,p,Xp),e[Yt]=t.current,Lu(e),new rf(t)},wa.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=im,p=rm,b=am,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),t=Lp(e,1,!0,t,i??null,l,c,O,u,p,b,Xp),t.context=Hp(null),i=t.current,l=Xt(),l=Gn(l),c=Os(l),c.callback=null,js(i,c,l),i=l,t.current.lanes=i,_n(t,i),zn(t),e[Yt]=t.current,Lu(e),new uo(t)},wa.version="19.2.4",wa}var s0;function ov(){if(s0)return af.exports;s0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),af.exports=lv(),af.exports}var cv=ov();const uv="modulepreload",fv=function(r,n){return new URL(r,n).href},i0={},Ae=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(j=>({status:"fulfilled",value:j}),j=>({status:"rejected",reason:j}))))};const d=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(s.map(E=>{if(E=fv(E,a),E in i0)return;i0[E]=!0;const w=E.endsWith(".css"),j=w?'[rel="stylesheet"]':"";if(!!a)for(let D=d.length-1;D>=0;D--){const W=d[D];if(W.href===E&&(!w||W.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${j}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":uv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((D,W)=>{M.addEventListener("load",D),M.addEventListener("error",()=>W(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return o.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function Qf(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function fg(r){const n=Qf(r);return!n||typeof n.exp!="number"?null:n.exp}function If(r,n=0){const s=fg(r);return s===null?!0:Date.now()/1e3>=s-n}const Wt=window.__LT_BASE__??"",Sf=`${Wt}/api`;let Vs=null;function ho(r){Vs=r}function hg(){return Vs}async function r0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${Sf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Ys=null;async function Xe(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Vs){if(If(Vs)){Ys||(Ys=r0().finally(()=>{Ys=null}));const o=await Ys;if(o)Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Vs}`}let a=await fetch(`${Sf}${r}`,{...n,headers:s});if(a.status===401&&Vs){Ys||(Ys=r0().finally(()=>{Ys=null}));const o=await Ys;if(o&&(Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${Sf}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const dg=T.createContext(null),hv=300;function cf(r,n){if(If(r))return null;const s=Qf(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function dv({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?If(w)?(sessionStorage.removeItem("lt_token"),null):(ho(w),cf(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const j=fg(w);if(!j)return;const q=(j-hv)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{try{const M=Qf(w);if(M!=null&&M.sso){const re=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const C=await re.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const D=sessionStorage.getItem("lt_credentials");if(!D)return;const{username:W,password:se}=JSON.parse(D),ee=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:W,password:se})});if(!ee.ok)return;const me=await ee.json();me.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:me.token}}))}catch{}},q))},[]),f=T.useCallback((w,j,q)=>{const M={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(j==null?void 0:j.username)??null},D=cf(w,M);D&&(ho(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(D),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");ho(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),w&&(window.location.href=w)},[]);T.useEffect(()=>{const w=()=>h(),j=q=>{var W;const M=(W=q.detail)==null?void 0:W.token;if(!M)return;const D=cf(M);D&&(ho(M),sessionStorage.setItem("lt_token",M),s(D),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",j)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return m.jsx(dg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=T.useContext(dg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const nn=new Uint8Array(0),ji=new TextEncoder,en=new TextDecoder;function mv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function ka(...r){const n=[];for(let s=0;s<r.length;s++)n.push(ji.encode(r[s]));return n.length===0?nn:n.length===1?n[0]:mv(...n)}function a0(r){return!r||r.length===0?"":en.decode(r)}const l0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",o0=36,pv=0xcfd41b9100000,c0=33,gv=333,u0=22;function yv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function bv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):yv(r)}class xv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(u0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*pv),this.inc=Math.floor(Math.random()*(gv-c0)+c0)}setPre(){const n=new Uint8Array(12);bv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=l0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=u0-1;s>=12;s--)this.buf[s]=l0.charCodeAt(n%o0),n=Math.floor(n/o0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Ks=new xv;var cs;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(cs||(cs={}));var br;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(br||(br={}));var ie;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(ie||(ie={}));function vv(r){return typeof r.code=="string"}class mg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return _v.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const _v=new mg;class ue extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=mg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var Tn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Tn||(Tn={}));var Ma;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(Ma||(Ma={}));const ko="Nats-Service-Error",Mo="Nats-Service-Error-Code";class Ro extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Ro.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Mo))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(ko))||"";return new Ro(h,d.length?d:a)}return null}}function us(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Ks.next()}`}const Ef="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function Yo(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function mo(r){return en.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Sr(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,d)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{d(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Or(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function pg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function wv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Xf(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return wv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Kf(r){return Math.floor(r/1e6)}function f0(r){let a=!0;const o=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function fs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Qs(r,n)}const uf="NATS/1.0";class Qs{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].sort();for(let d=0;d<f.length;d++)if(f[d]!==h[d])return!1}return!0}return!1}static decode(n){const s=new Qs,o=en.decode(n).split(`\r
27
+ `),f=o[0];if(f!==uf){let h=f.replace(uf,"").trim();if(h.length>0){s._code=parseInt(h,10),isNaN(s._code)&&(s._code=0);const d=s._code.toString();h=h.replace(d,""),s._description=h.trim()}}return o.length>=1&&o.slice(1).map(h=>{if(h){const d=h.indexOf(":");if(d>-1){const g=h.slice(0,d),y=h.slice(d+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=uf;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)n=`${n}\r
28
28
  ${s}: ${a[o]}`;return`${n}\r
29
29
  \r
30
- `}encode(){return ji.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(o=>o===n);case Kt.CanonicalMIME:return n=c0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,s=Kt.Exact){return this.findKeys(n,s).length>0}set(n,s,a=Kt.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=Kt.Exact){const o=c0(n);a===Kt.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Qs.validHeaderValue(s);let d=this.headers.get(n);d||(d=[],this.headers.set(n,d)),d.push(h)}values(n,s=Kt.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const h=this.headers.get(f);h&&a.push(...h)}),a}delete(n,s=Kt.Exact){this.findKeys(n,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new Qs;for(const a in n)s.headers.set(a,n[a]);return s}}function Af(){return{encode(r){return ji.encode(r)},decode(r){return Wt.decode(r)}}}function Tn(r){return{encode(n){try{return n===void 0&&(n=null),ji.encode(JSON.stringify(n))}catch(s){throw ue.errorForCode(ie.BadJson,s)}},decode(n){try{return JSON.parse(Wt.decode(n),r)}catch(s){throw ue.errorForCode(ie.BadJson,s)}}}}function pg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?ue.errorForCode(ie.NoResponders):null}class Kf{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=Wt.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Wt.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Qs.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=tn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(Kf,"jc");function xr(r){return Yo("durable",r)}function Mt(r){return Yo("stream",r)}function Yo(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
30
+ `}encode(){return ji.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(o=>o===n);case Kt.CanonicalMIME:return n=f0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,s=Kt.Exact){return this.findKeys(n,s).length>0}set(n,s,a=Kt.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=Kt.Exact){const o=f0(n);a===Kt.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Qs.validHeaderValue(s);let d=this.headers.get(n);d||(d=[],this.headers.set(n,d)),d.push(h)}values(n,s=Kt.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const h=this.headers.get(f);h&&a.push(...h)}),a}delete(n,s=Kt.Exact){this.findKeys(n,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new Qs;for(const a in n)s.headers.set(a,n[a]);return s}}function Af(){return{encode(r){return ji.encode(r)},decode(r){return en.decode(r)}}}function Nn(r){return{encode(n){try{return n===void 0&&(n=null),ji.encode(JSON.stringify(n))}catch(s){throw ue.errorForCode(ie.BadJson,s)}},decode(n){try{return JSON.parse(en.decode(n),r)}catch(s){throw ue.errorForCode(ie.BadJson,s)}}}}function gg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?ue.errorForCode(ie.NoResponders):null}class Zf{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=en.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=en.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Qs.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=nn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return Nn(n).decode(this.data)}string(){return en.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(Zf,"jc");function xr(r){return Go("durable",r)}function Mt(r){return Go("stream",r)}function Go(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
31
31
  `,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
32
- `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Ta(r,n=""){if(n==="")throw Error(`${r} name required`);const s=wv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function wv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Of(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function jf(r){var n;return Of(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function Sv(r,n,s){const a=fs(r,n),o={hdr:1,sid:0,size:0},f=new Kf(o,tn,{});return f._headers=a,f._subject=s,f}function vr(r){if(r.data.length!==0)return null;const n=r.headers;return n?gg(n.code,n.description):null}var yn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(yn||(yn={}));function Ev(r){return r.code!==ie.JetStream409?!1:[yn.MaxBatchExceeded,yn.MaxExpiresExceeded,yn.MaxBytesExceeded,yn.MaxMessageSizeExceeded,yn.PushConsumer,yn.IdleHeartbeatMissed,yn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function gg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(yn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Zf{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Tf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Tf||(Tf={}));var qa;(function(r){r.Old="old",r.New="new"})(qa||(qa={}));var Nf;(function(r){r.File="file",r.Memory="memory"})(Nf||(Nf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var Er;(function(r){r.Instant="instant",r.Original="original"})(Er||(Er={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Ro;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Ro||(Ro={}));function Av(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},n)}var u0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(u0||(u0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var An;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(An||(An={}));var yr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(yr||(yr={}));var f0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(f0||(f0={}));const Zt="KV_";class Ov{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=Av("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return xr(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Er.Instant,this}replayOriginal(){return this.config.replay_policy=Er.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Is(r){return new Ov(r)}function h0(r){return typeof r.getOpts=="function"}class jv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class _r{static encode(n){return _r.toB64URLEncoding(jv.encode(n))}static decode(n,s=!1){return _r.decode(_r.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Ar{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),ji.encode(n)}static toAscii(n){return Wt.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Tv(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var Nv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Sa=Nv.performance||{};Sa.now||Sa.mozNow||Sa.msNow||Sa.oNow||Sa.webkitNow;var d0={versions:{}},Cv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kv(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var uf,Go={exports:{}},m0={},p0=kv(Tv({__proto__:null,default:m0},[m0]));uf=Go,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&d0.versions&&d0.versions.node;o?s=Cv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&uf.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var q=function(k,X){return function(se){return new ee(X,!0).update(se)[k]()}},M=function(k){var X=q("hex",k);o&&(X=z(X,k)),X.create=function(){return new ee(k)},X.update=function(F){return X.create().update(F)};for(var se=0;se<w.length;++se){var W=w[se];X[W]=q(W,k)}return X},z=function(k,X){var se,W=p0,F=p0.Buffer,Z=X?"sha224":"sha256";return se=F.from&&!s.JS_SHA256_NO_BUFFER_FROM?F.from:function(le){return new F(le)},function(le){if(typeof le=="string")return W.createHash(Z).update(le,"utf8").digest("hex");if(le==null)throw new Error(r);return le.constructor===ArrayBuffer&&(le=new Uint8Array(le)),Array.isArray(le)||ArrayBuffer.isView(le)||le.constructor===F?W.createHash(Z).update(se(le)).digest("hex"):k(le)}},G=function(k,X){return function(se,W){return new pe(se,X,!0).update(W)[k]()}},ne=function(k){var X=G("hex",k);X.create=function(F){return new pe(F,k)},X.update=function(F,Z){return X.create(F).update(Z)};for(var se=0;se<w.length;++se){var W=w[se];X[W]=G(W,k)}return X};function ee(k,X){X?(j[0]=j[16]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=j[9]=j[10]=j[11]=j[12]=j[13]=j[14]=j[15]=0,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=k}function pe(k,X,se){var W,F=typeof k;if(F==="string"){var Z,le=[],re=k.length,qe=0;for(W=0;W<re;++W)(Z=k.charCodeAt(W))<128?le[qe++]=Z:Z<2048?(le[qe++]=192|Z>>>6,le[qe++]=128|63&Z):Z<55296||Z>=57344?(le[qe++]=224|Z>>>12,le[qe++]=128|Z>>>6&63,le[qe++]=128|63&Z):(Z=65536+((1023&Z)<<10|1023&k.charCodeAt(++W)),le[qe++]=240|Z>>>18,le[qe++]=128|Z>>>12&63,le[qe++]=128|Z>>>6&63,le[qe++]=128|63&Z);k=le}else{if(F!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r)}k.length>64&&(k=new ee(X,!0).update(k).array());var Ge=[],Le=[];for(W=0;W<64;++W){var $=k[W]||0;Ge[W]=92^$,Le[W]=54^$}ee.call(this,X,se),this.update(Le),this.oKeyPad=Ge,this.inner=!0,this.sharedMemory=se}ee.prototype.update=function(k){if(!this.finalized){var X,se=typeof k;if(se!=="string"){if(se!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r);X=!0}for(var W,F,Z=0,le=k.length,re=this.blocks;Z<le;){if(this.hashed&&(this.hashed=!1,re[0]=this.block,this.block=re[16]=re[1]=re[2]=re[3]=re[4]=re[5]=re[6]=re[7]=re[8]=re[9]=re[10]=re[11]=re[12]=re[13]=re[14]=re[15]=0),X)for(F=this.start;Z<le&&F<64;++Z)re[F>>>2]|=k[Z]<<y[3&F++];else for(F=this.start;Z<le&&F<64;++Z)(W=k.charCodeAt(Z))<128?re[F>>>2]|=W<<y[3&F++]:W<2048?(re[F>>>2]|=(192|W>>>6)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]):W<55296||W>=57344?(re[F>>>2]|=(224|W>>>12)<<y[3&F++],re[F>>>2]|=(128|W>>>6&63)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]):(W=65536+((1023&W)<<10|1023&k.charCodeAt(++Z)),re[F>>>2]|=(240|W>>>18)<<y[3&F++],re[F>>>2]|=(128|W>>>12&63)<<y[3&F++],re[F>>>2]|=(128|W>>>6&63)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]);this.lastByteIndex=F,this.bytes+=F-this.start,F>=64?(this.block=re[16],this.start=F-64,this.hash(),this.hashed=!0):this.start=F}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,X=this.lastByteIndex;k[16]=this.block,k[X>>>2]|=g[3&X],this.block=k[16],X>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var k,X,se,W,F,Z,le,re,qe,Ge=this.h0,Le=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,je=this.h7,_e=this.blocks;for(k=16;k<64;++k)X=((F=_e[k-15])>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,se=((F=_e[k-2])>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,_e[k]=_e[k-16]+X+_e[k-7]+se|0;for(qe=Le&$,k=0;k<64;k+=4)this.first?(this.is224?(Z=300032,je=(F=_e[0]-1413257819)-150054599|0,te=F+24177077|0):(Z=704751109,je=(F=_e[0]-210244248)-1521486534|0,te=F+143694565|0),this.first=!1):(X=(Ge>>>2|Ge<<30)^(Ge>>>13|Ge<<19)^(Ge>>>22|Ge<<10),W=(Z=Ge&Le)^Ge&$^qe,je=te+(F=je+(se=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[k]+_e[k])|0,te=F+(X+W)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),W=(le=te&Ge)^te&Le^Z,be=$+(F=be+(se=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&ve)+E[k+1]+_e[k+1])|0,X=(($=F+(X+W)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),W=(re=$&te)^$&Ge^le,ve=Le+(F=ve+(se=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&je^~be&de)+E[k+2]+_e[k+2])|0,X=((Le=F+(X+W)|0)>>>2|Le<<30)^(Le>>>13|Le<<19)^(Le>>>22|Le<<10),W=(qe=Le&$)^Le&te^re,de=Ge+(F=de+(se=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&je)+E[k+3]+_e[k+3])|0,Ge=F+(X+W)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Ge|0,this.h1=this.h1+Le|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+je|0},ee.prototype.hex=function(){this.finalize();var k=this.h0,X=this.h1,se=this.h2,W=this.h3,F=this.h4,Z=this.h5,le=this.h6,re=this.h7,qe=d[k>>>28&15]+d[k>>>24&15]+d[k>>>20&15]+d[k>>>16&15]+d[k>>>12&15]+d[k>>>8&15]+d[k>>>4&15]+d[15&k]+d[X>>>28&15]+d[X>>>24&15]+d[X>>>20&15]+d[X>>>16&15]+d[X>>>12&15]+d[X>>>8&15]+d[X>>>4&15]+d[15&X]+d[se>>>28&15]+d[se>>>24&15]+d[se>>>20&15]+d[se>>>16&15]+d[se>>>12&15]+d[se>>>8&15]+d[se>>>4&15]+d[15&se]+d[W>>>28&15]+d[W>>>24&15]+d[W>>>20&15]+d[W>>>16&15]+d[W>>>12&15]+d[W>>>8&15]+d[W>>>4&15]+d[15&W]+d[F>>>28&15]+d[F>>>24&15]+d[F>>>20&15]+d[F>>>16&15]+d[F>>>12&15]+d[F>>>8&15]+d[F>>>4&15]+d[15&F]+d[Z>>>28&15]+d[Z>>>24&15]+d[Z>>>20&15]+d[Z>>>16&15]+d[Z>>>12&15]+d[Z>>>8&15]+d[Z>>>4&15]+d[15&Z]+d[le>>>28&15]+d[le>>>24&15]+d[le>>>20&15]+d[le>>>16&15]+d[le>>>12&15]+d[le>>>8&15]+d[le>>>4&15]+d[15&le];return this.is224||(qe+=d[re>>>28&15]+d[re>>>24&15]+d[re>>>20&15]+d[re>>>16&15]+d[re>>>12&15]+d[re>>>8&15]+d[re>>>4&15]+d[15&re]),qe},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var k=this.h0,X=this.h1,se=this.h2,W=this.h3,F=this.h4,Z=this.h5,le=this.h6,re=this.h7,qe=[k>>>24&255,k>>>16&255,k>>>8&255,255&k,X>>>24&255,X>>>16&255,X>>>8&255,255&X,se>>>24&255,se>>>16&255,se>>>8&255,255&se,W>>>24&255,W>>>16&255,W>>>8&255,255&W,F>>>24&255,F>>>16&255,F>>>8&255,255&F,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,le>>>24&255,le>>>16&255,le>>>8&255,255&le];return this.is224||qe.push(re>>>24&255,re>>>16&255,re>>>8&255,255&re),qe},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),X=new DataView(k);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),k},pe.prototype=new ee,pe.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),ee.prototype.finalize.call(this)}};var ae=M();ae.sha256=ae,ae.sha224=M(!0),ae.sha256.hmac=ne(),ae.sha224.hmac=ne(!0),f?uf.exports=ae:(s.sha256=ae.sha256,s.sha224=ae.sha224)})();Go.exports;Go.exports.sha224;var g0=Go.exports.sha256;function Cf(r){return Uv(r)}function Mv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function Rv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Dv(r){return Mv(r)?"hex":Rv(r)?"b64":""}function zv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function qv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Uv(r){switch(Dv(r)){case"hex":return zv(r);case"b64":return qv(r)}return null}function Bv(r,n){const s=typeof r=="string"?Cf(r):r,a=typeof n=="string"?Cf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class yg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Ks.next(),a&&(this.ctx=new Error)}}class Lv extends yg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
32
+ `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Ta(r,n=""){if(n==="")throw Error(`${r} name required`);const s=Sv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function Sv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Of(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function jf(r){var n;return Of(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function Ev(r,n,s){const a=fs(r,n),o={hdr:1,sid:0,size:0},f=new Zf(o,nn,{});return f._headers=a,f._subject=s,f}function vr(r){if(r.data.length!==0)return null;const n=r.headers;return n?yg(n.code,n.description):null}var bn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(bn||(bn={}));function Av(r){return r.code!==ie.JetStream409?!1:[bn.MaxBatchExceeded,bn.MaxExpiresExceeded,bn.MaxBytesExceeded,bn.MaxMessageSizeExceeded,bn.PushConsumer,bn.IdleHeartbeatMissed,bn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function yg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(bn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Wf{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Tf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Tf||(Tf={}));var qa;(function(r){r.Old="old",r.New="new"})(qa||(qa={}));var Nf;(function(r){r.File="file",r.Memory="memory"})(Nf||(Nf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var Er;(function(r){r.Instant="instant",r.Original="original"})(Er||(Er={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Do;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Do||(Do={}));function Ov(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},n)}var h0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(h0||(h0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var On;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(On||(On={}));var yr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(yr||(yr={}));var d0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(d0||(d0={}));const Zt="KV_";class jv{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=Ov("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return xr(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Er.Instant,this}replayOriginal(){return this.config.replay_policy=Er.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Is(r){return new jv(r)}function m0(r){return typeof r.getOpts=="function"}class Tv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class _r{static encode(n){return _r.toB64URLEncoding(Tv.encode(n))}static decode(n,s=!1){return _r.decode(_r.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Ar{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),ji.encode(n)}static toAscii(n){return en.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Nv(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var Cv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Sa=Cv.performance||{};Sa.now||Sa.mozNow||Sa.msNow||Sa.oNow||Sa.webkitNow;var p0={versions:{}},kv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mv(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var ff,Vo={exports:{}},g0={},y0=Mv(Nv({__proto__:null,default:g0},[g0]));ff=Vo,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&p0.versions&&p0.versions.node;o?s=kv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&ff.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var q=function(C,X){return function(ce){return new ee(X,!0).update(ce)[C]()}},M=function(C){var X=q("hex",C);o&&(X=D(X,C)),X.create=function(){return new ee(C)},X.update=function(G){return X.create().update(G)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=q(V,C)}return X},D=function(C,X){var ce,V=y0,G=y0.Buffer,K=X?"sha224":"sha256";return ce=G.from&&!s.JS_SHA256_NO_BUFFER_FROM?G.from:function(ae){return new G(ae)},function(ae){if(typeof ae=="string")return V.createHash(K).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===G?V.createHash(K).update(ce(ae)).digest("hex"):C(ae)}},W=function(C,X){return function(ce,V){return new me(ce,X,!0).update(V)[C]()}},se=function(C){var X=W("hex",C);X.create=function(G){return new me(G,C)},X.update=function(G,K){return X.create(G).update(K)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=W(V,C)}return X};function ee(C,X){X?(j[0]=j[16]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=j[9]=j[10]=j[11]=j[12]=j[13]=j[14]=j[15]=0,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function me(C,X,ce){var V,G=typeof C;if(G==="string"){var K,ae=[],ne=C.length,ke=0;for(V=0;V<ne;++V)(K=C.charCodeAt(V))<128?ae[ke++]=K:K<2048?(ae[ke++]=192|K>>>6,ae[ke++]=128|63&K):K<55296||K>=57344?(ae[ke++]=224|K>>>12,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++V)),ae[ke++]=240|K>>>18,ae[ke++]=128|K>>>12&63,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K);C=ae}else{if(G!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new ee(X,!0).update(C).array());var He=[],Me=[];for(V=0;V<64;++V){var $=C[V]||0;He[V]=92^$,Me[V]=54^$}ee.call(this,X,ce),this.update(Me),this.oKeyPad=He,this.inner=!0,this.sharedMemory=ce}ee.prototype.update=function(C){if(!this.finalized){var X,ce=typeof C;if(ce!=="string"){if(ce!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r);X=!0}for(var V,G,K=0,ae=C.length,ne=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,ne[0]=this.block,this.block=ne[16]=ne[1]=ne[2]=ne[3]=ne[4]=ne[5]=ne[6]=ne[7]=ne[8]=ne[9]=ne[10]=ne[11]=ne[12]=ne[13]=ne[14]=ne[15]=0),X)for(G=this.start;K<ae&&G<64;++K)ne[G>>>2]|=C[K]<<y[3&G++];else for(G=this.start;K<ae&&G<64;++K)(V=C.charCodeAt(K))<128?ne[G>>>2]|=V<<y[3&G++]:V<2048?(ne[G>>>2]|=(192|V>>>6)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):V<55296||V>=57344?(ne[G>>>2]|=(224|V>>>12)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):(V=65536+((1023&V)<<10|1023&C.charCodeAt(++K)),ne[G>>>2]|=(240|V>>>18)<<y[3&G++],ne[G>>>2]|=(128|V>>>12&63)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]);this.lastByteIndex=G,this.bytes+=G-this.start,G>=64?(this.block=ne[16],this.start=G-64,this.hash(),this.hashed=!0):this.start=G}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,X=this.lastByteIndex;C[16]=this.block,C[X>>>2]|=g[3&X],this.block=C[16],X>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var C,X,ce,V,G,K,ae,ne,ke,He=this.h0,Me=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,je=this.h7,_e=this.blocks;for(C=16;C<64;++C)X=((G=_e[C-15])>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,ce=((G=_e[C-2])>>>17|G<<15)^(G>>>19|G<<13)^G>>>10,_e[C]=_e[C-16]+X+_e[C-7]+ce|0;for(ke=Me&$,C=0;C<64;C+=4)this.first?(this.is224?(K=300032,je=(G=_e[0]-1413257819)-150054599|0,te=G+24177077|0):(K=704751109,je=(G=_e[0]-210244248)-1521486534|0,te=G+143694565|0),this.first=!1):(X=(He>>>2|He<<30)^(He>>>13|He<<19)^(He>>>22|He<<10),V=(K=He&Me)^He&$^ke,je=te+(G=je+(ce=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[C]+_e[C])|0,te=G+(X+V)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),V=(ae=te&He)^te&Me^K,be=$+(G=be+(ce=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&ve)+E[C+1]+_e[C+1])|0,X=(($=G+(X+V)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),V=(ne=$&te)^$&He^ae,ve=Me+(G=ve+(ce=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&je^~be&de)+E[C+2]+_e[C+2])|0,X=((Me=G+(X+V)|0)>>>2|Me<<30)^(Me>>>13|Me<<19)^(Me>>>22|Me<<10),V=(ke=Me&$)^Me&te^ne,de=He+(G=de+(ce=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&je)+E[C+3]+_e[C+3])|0,He=G+(X+V)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+He|0,this.h1=this.h1+Me|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+je|0},ee.prototype.hex=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=d[C>>>28&15]+d[C>>>24&15]+d[C>>>20&15]+d[C>>>16&15]+d[C>>>12&15]+d[C>>>8&15]+d[C>>>4&15]+d[15&C]+d[X>>>28&15]+d[X>>>24&15]+d[X>>>20&15]+d[X>>>16&15]+d[X>>>12&15]+d[X>>>8&15]+d[X>>>4&15]+d[15&X]+d[ce>>>28&15]+d[ce>>>24&15]+d[ce>>>20&15]+d[ce>>>16&15]+d[ce>>>12&15]+d[ce>>>8&15]+d[ce>>>4&15]+d[15&ce]+d[V>>>28&15]+d[V>>>24&15]+d[V>>>20&15]+d[V>>>16&15]+d[V>>>12&15]+d[V>>>8&15]+d[V>>>4&15]+d[15&V]+d[G>>>28&15]+d[G>>>24&15]+d[G>>>20&15]+d[G>>>16&15]+d[G>>>12&15]+d[G>>>8&15]+d[G>>>4&15]+d[15&G]+d[K>>>28&15]+d[K>>>24&15]+d[K>>>20&15]+d[K>>>16&15]+d[K>>>12&15]+d[K>>>8&15]+d[K>>>4&15]+d[15&K]+d[ae>>>28&15]+d[ae>>>24&15]+d[ae>>>20&15]+d[ae>>>16&15]+d[ae>>>12&15]+d[ae>>>8&15]+d[ae>>>4&15]+d[15&ae];return this.is224||(ke+=d[ne>>>28&15]+d[ne>>>24&15]+d[ne>>>20&15]+d[ne>>>16&15]+d[ne>>>12&15]+d[ne>>>8&15]+d[ne>>>4&15]+d[15&ne]),ke},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,X>>>24&255,X>>>16&255,X>>>8&255,255&X,ce>>>24&255,ce>>>16&255,ce>>>8&255,255&ce,V>>>24&255,V>>>16&255,V>>>8&255,255&V,G>>>24&255,G>>>16&255,G>>>8&255,255&G,K>>>24&255,K>>>16&255,K>>>8&255,255&K,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||ke.push(ne>>>24&255,ne>>>16&255,ne>>>8&255,255&ne),ke},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),X=new DataView(C);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),C},me.prototype=new ee,me.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),ee.prototype.finalize.call(this)}};var re=M();re.sha256=re,re.sha224=M(!0),re.sha256.hmac=se(),re.sha224.hmac=se(!0),f?ff.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();Vo.exports;Vo.exports.sha224;var b0=Vo.exports.sha256;function Cf(r){return Bv(r)}function Rv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function Dv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function zv(r){return Rv(r)?"hex":Dv(r)?"b64":""}function qv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function Uv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Bv(r){switch(zv(r)){case"hex":return qv(r);case"b64":return Uv(r)}return null}function Lv(r,n){const s=typeof r=="string"?Cf(r):r,a=typeof n=="string"?Cf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class bg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Ks.next(),a&&(this.ctx=new Error)}}class Hv extends bg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
33
33
 
34
- ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===jn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===jn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===jn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class bg extends yg{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=Sr(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
34
+ ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===Tn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Tn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Tn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class xg extends bg{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=Sr(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
35
 
36
- ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const Hv="$JS.API";function Pv(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),$o({apiPrefix:Hv,timeout:5e3},r)}class Pa{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=Pv(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Tn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let o=tn;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=If();for(let d=0;d<f;d++)try{const g=await this.nc.request(n,o,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===ie.Timeout)&&d+1<f)await Or(h.backoff(d));else throw g}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=gg(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Na{constructor(n,s,a,o){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,o;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((o=n.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Ai(r=""){const n=r.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${r}' is not a semver value`)}function kf(r,n){return r.major<n.major?-1:r.major>n.major?1:r.minor<n.minor?-1:r.minor>n.minor?1:r.micro<n.micro?-1:r.micro>n.micro?1:0}var ze;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(ze||(ze={}));class $v{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Ai(n)),this.server=n,this.set(ze.JS_KV,"2.6.2"),this.set(ze.JS_OBJECTSTORE,"2.6.3"),this.set(ze.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ze.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ze.JS_ALLOW_DIRECT,"2.9.0"),this.set(ze.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ze.JS_SIMPLIFICATION,"2.9.4"),this.set(ze.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ze.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ze.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ze.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ze.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ze.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ze.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:kf(this.server,Ai(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Ai(n)),kf(this.server,n)>=0}}class Do extends Pa{constructor(n,s){super(n,s)}async add(n,s,a=Ro.Create){if(Mt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&xr(o.config.durable_name);const f=this.nc;let{min:h,ok:d}=f.features.get(ze.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!d)throw new Error(`consumer 'name' requires server ${h}`);if(g)try{Yo("name",g)}catch(j){const q=j.message,M=q.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${q.substring(M)}`):j}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:j,ok:q}=f.features.get(ze.JS_MULTIPLE_CONSUMER_FILTER);if(!q)throw new Error(`consumer 'filter_subjects' requires server ${j}`);d=!1}if(s.metadata){const{min:j,ok:q}=f.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!q)throw new Error(`consumer 'metadata' requires server ${j}`)}if(d&&(E=s.name??s.durable_name??""),E!==""){let j=s.filter_subject??void 0;j===">"&&(j=void 0),y=j!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${E}.${j}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Ro.Update)}async info(n,s){return Mt(n),xr(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),xr(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Na(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function mr(r,n,s=!1){if(s===!0&&!r)throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`))}class Yv extends _t{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");mr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&mr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(mr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(mr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(mr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&mr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,j)=>{const[q,M]=this.adapter(w,j);if(q){E(q,null);return}const{ingest:z}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};z&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(q,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:h,queue:d,timeout:g}=o,y={queue:d,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async E=>{await E.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[o,f]=this.adapter(s,a);o&&this.stop(o),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let en;function Gv(r){en=r}function xg(){return en!==void 0&&en.defaultPort!==void 0?en.defaultPort:4222}function ff(){return en!==void 0&&en.urlParseFn?en.urlParseFn:void 0}function Vv(){if(!en||typeof en.factory!="function")throw new Error("transport fn is not set");return en.factory()}function Mf(){return en!==void 0&&en.dnsResolveFn?en.dnsResolveFn:void 0}const So=`\r
37
- `,zo=Ar.fromAscii(So),Fv=new Uint8Array(zo)[0],Jv=new Uint8Array(zo)[1];function Qv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Fv&&r[s]===Jv)return s+1}return 0}function Iv(r){const n=Qv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return Wt.decode(a)}return""}const Xv=4,vg=48,Kv=65,Zv=97;function Wv(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{o[d]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function Rf(r){return e1(r)!==void 0}function e1(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return _g(r);case":":return t1(r)}}function _g(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c:o,ok:f}=n1(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return Wv(n[0],n[1],n[2],n[3])}function t1(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:h}=s1(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=_g(r);if(d===void 0)return;n[a]=d[12],n[a+1]=d[13],n[a+2]=d[14],n[a+3]=d[15],r="",a+=Xv;break}if(n[a]=o>>8,n[a+1]=o,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function n1(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-vg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function s1(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-vg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Zv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Kv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function i1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Df(r){return!i1(r)}function r1(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function a1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=r1(r),Df(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Df(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class Ra{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=a1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(Rf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Df(o)?"["+o+"]":o}`);h.port=`${this.port}`;const d=new Ra(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&mg(s),this.resolves=s,s}}class l1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=ff();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new Ra(o))}),this.randomize&&(this.servers=mg(this.servers))),this.servers.length===0&&this.addServer(`${Ef}:${xg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Rf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=ff();n=a?a(n):n;const o=new Ra(n,s);Rf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let o=[];const f=ff(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Ra(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&d.push(y),h.delete(E)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class o1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${us(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=pg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class c1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:br.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class u1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function f1(r,n="Assertion failed."){if(!r)throw new u1(n)}const y0=32*1024,hf=2**32-2;function po(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class df{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){f1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=po(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(ji.encode(n))}write(n){const s=this._grow(n.byteLength);return po(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)po(this._buf.subarray(this._off),this._buf);else{if(o+n>hf)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,hf));po(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,hf)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(y0);for(;;){const o=this.capacity-this.length<y0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function b0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const h1=48;class x0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=oe.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case oe.OP_START:switch(a){case ce.M:case ce.m:this.state=oe.OP_M,this.hdr=-1,this.ma=b0();break;case ce.H:case ce.h:this.state=oe.OP_H,this.hdr=0,this.ma=b0();break;case ce.P:case ce.p:this.state=oe.OP_P;break;case ce.PLUS:this.state=oe.OP_PLUS;break;case ce.MINUS:this.state=oe.OP_MINUS;break;case ce.I:case ce.i:this.state=oe.OP_I;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_H:switch(a){case ce.M:case ce.m:this.state=oe.OP_M;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_M:switch(a){case ce.S:case ce.s:this.state=oe.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MS:switch(a){case ce.G:case ce.g:this.state=oe.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MSG:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MSG_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.MSG_ARG,this.as=s}break;case oe.MSG_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=oe.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case oe.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=oe.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=oe.MSG_END);break;case oe.MSG_END:switch(a){case ce.NL:this.drop=0,this.as=s+1,this.state=oe.OP_START;break;default:continue}break;case oe.OP_PLUS:switch(a){case ce.O:case ce.o:this.state=oe.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PLUS_O:switch(a){case ce.K:case ce.k:this.state=oe.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PLUS_OK:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_MINUS:switch(a){case ce.E:case ce.e:this.state=oe.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_E:switch(a){case ce.R:case ce.r:this.state=oe.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ER:switch(a){case ce.R:case ce.r:this.state=oe.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ERR:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ERR_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.MINUS_ERR_ARG,this.as=s}break;case oe.MINUS_ERR_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=oe.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case oe.OP_P:switch(a){case ce.I:case ce.i:this.state=oe.OP_PI;break;case ce.O:case ce.o:this.state=oe.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PO:switch(a){case ce.N:case ce.n:this.state=oe.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PON:switch(a){case ce.G:case ce.g:this.state=oe.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PONG:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_PI:switch(a){case ce.N:case ce.n:this.state=oe.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PIN:switch(a){case ce.G:case ce.g:this.state=oe.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PING:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_I:switch(a){case ce.N:case ce.n:this.state=oe.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_IN:switch(a){case ce.F:case ce.f:this.state=oe.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INF:switch(a){case ce.O:case ce.o:this.state=oe.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INFO:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INFO_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.INFO_ARG,this.as=s}break;case oe.INFO_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=oe.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===oe.MSG_ARG||this.state===oe.MINUS_ERR_ARG||this.state===oe.INFO_ARG)&&!this.argBuf&&(this.argBuf=new df(n.subarray(this.as,s-this.drop))),this.state===oe.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new df(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new df(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${Wt.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-h1)}return s}}var oe;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(oe||(oe={}));var ce;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(ce||(ce={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),d=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),q=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function z(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function G(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function ne(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function pe(x,S,_,A,N){var D,Q=0;for(D=0;D<N;D++)Q|=x[S+D]^_[A+D];return(1&Q-1>>>8)-1}function ae(x,S,_,A){return pe(x,S,_,A,16)}function k(x,S,_,A){return pe(x,S,_,A,32)}function X(x,S,_,A,N){var D=new Uint32Array(16),Q=new Uint32Array(16),K=new Uint32Array(16),H=new Uint32Array(4),J,fe,Oe;for(J=0;J<4;J++)Q[5*J]=z(A,4*J),Q[1+J]=z(_,4*J),Q[6+J]=z(S,4*J),Q[11+J]=z(_,16+4*J);for(J=0;J<16;J++)K[J]=Q[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(Oe=0;Oe<4;Oe++)H[Oe]=Q[(5*fe+4*Oe)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),Oe=0;Oe<4;Oe++)D[4*fe+(fe+Oe)%4]=H[Oe]}for(Oe=0;Oe<16;Oe++)Q[Oe]=D[Oe]}if(N){for(J=0;J<16;J++)Q[J]=Q[J]+K[J]|0;for(J=0;J<4;J++)Q[5*J]=Q[5*J]-z(A,4*J)|0,Q[6+J]=Q[6+J]-z(S,4*J)|0;for(J=0;J<4;J++)ne(x,4*J,Q[5*J]),ne(x,16+4*J,Q[6+J])}else for(J=0;J<16;J++)ne(x,4*J,Q[J]+K[J]|0)}function se(x,S,_,A){return X(x,S,_,A,!1),0}function W(x,S,_,A){return X(x,S,_,A,!0),0}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Z(x,S,_,A,N,D,Q){var K=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)K[fe]=0;for(fe=0;fe<8;fe++)K[fe]=D[fe];for(;N>=64;){for(se(H,K,Q,F),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(K[fe]&255)|0,K[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(se(H,K,Q,F),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function le(x,S,_,A,N){return Z(x,S,null,0,_,A,N)}function re(x,S,_,A,N){var D=new Uint8Array(32);return W(D,A,N,F),le(x,S,_,A.subarray(16),D)}function qe(x,S,_,A,N,D,Q){var K=new Uint8Array(32);return W(K,D,Q,F),Z(x,S,_,A,N,D.subarray(16),K)}function Ge(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Le=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,D){var Q,K,H,J,fe=new Uint32Array(17),Oe=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),_n=new Uint32Array(17);for(H=0;H<17;H++)Oe[H]=Ke[H]=0;for(H=0;H<16;H++)Oe[H]=D[H];for(Oe[3]&=15,Oe[4]&=252,Oe[7]&=15,Oe[8]&=252,Oe[11]&=15,Oe[12]&=252,Oe[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,Ge(Ke,Ct),K=0;K<17;K++)for(fe[K]=0,H=0;H<17;H++)fe[K]=fe[K]+Ke[H]*(H<=K?Oe[K-H]:320*Oe[K+17-H]|0)|0|0;for(K=0;K<17;K++)Ke[K]=fe[K];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)_n[H]=Ke[H];for(Ge(Ke,Le),Q=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=Q&(_n[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=D[H+16];for(Ct[16]=0,Ge(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,D){var Q=new Uint8Array(16);return $(Q,0,_,A,N,D),ae(x,S,Q,0)}function de(x,S,_,A,N){var D;if(_<32)return-1;for(qe(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function ve(x,S,_,A,N){var D,Q=new Uint8Array(32);if(_<32||(re(Q,0,32,A,N),te(S,16,S,32,_-32,Q)!==0))return-1;for(qe(x,0,S,0,_,A,N),D=0;D<32;D++)x[D]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function je(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function _e(x,S,_){for(var A,N=~(_-1),D=0;D<16;D++)A=N&(x[D]^S[D]),x[D]^=A,S[D]^=A}function Te(x,S){var _,A,N,D=s(),Q=s();for(_=0;_<16;_++)Q[_]=S[_];for(je(Q),je(Q),je(Q),A=0;A<2;A++){for(D[0]=Q[0]-65517,_=1;_<15;_++)D[_]=Q[_]-65535-(D[_-1]>>16&1),D[_-1]&=65535;D[15]=Q[15]-32767-(D[14]>>16&1),N=D[15]>>16&1,D[14]&=65535,_e(Q,D,1-N)}for(_=0;_<16;_++)x[2*_]=Q[_]&255,x[2*_+1]=Q[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),k(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function sn(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function we(x,S,_){var A,N,D=new Float64Array(31);for(A=0;A<31;A++)D[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)D[A+N]+=S[A]*_[N];for(A=0;A<15;A++)D[A]+=38*D[A+16];for(A=0;A<16;A++)x[A]=D[A];je(x),je(x)}function Tt(x,S){we(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ti(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),D,Q,K=s(),H=s(),J=s(),fe=s(),Oe=s(),Ke=s();for(Q=0;Q<31;Q++)A[Q]=S[Q];for(A[31]=S[31]&127|64,A[0]&=248,sn(N,_),Q=0;Q<16;Q++)H[Q]=N[Q],fe[Q]=K[Q]=J[Q]=0;for(K[0]=fe[0]=1,Q=254;Q>=0;--Q)D=A[Q>>>3]>>>(Q&7)&1,_e(K,H,D),_e(J,fe,D),Ot(Oe,K,J),jt(K,K,J),Ot(J,H,fe),jt(H,H,fe),Tt(fe,Oe),Tt(Ke,K),we(K,J,K),we(J,H,Oe),Ot(Oe,K,J),jt(K,K,J),Tt(H,K),jt(J,fe,Ke),we(K,J,g),Ot(K,K,fe),we(J,J,K),we(K,fe,Ke),we(fe,H,N),Tt(H,Oe),_e(K,H,D),_e(J,fe,D);for(Q=0;Q<16;Q++)N[Q+16]=K[Q],N[Q+32]=J[Q],N[Q+48]=H[Q],N[Q+64]=fe[Q];var Ct=N.subarray(32),_n=N.subarray(16);return ei(Ct,Ct),we(_n,_n,Ct),Te(x,_n),0}function rn(x,S){return ti(x,S,f)}function Ni(x,S){return a(S,32),rn(x,S)}function ds(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),W(x,o,A,F)}var Fa=de,Ja=ve;function Tr(x,S,_,A,N,D){var Q=new Uint8Array(32);return ds(Q,N,D),Fa(x,S,_,A,Q)}function Nr(x,S,_,A,N,D){var Q=new Uint8Array(32);return ds(Q,N,D),Ja(x,S,_,A,Q)}function $n(){var x=0,S=0,_=0,A=0,N=65535,D,Q,K;for(K=0;K<arguments.length;K++)D=arguments[K].lo,Q=arguments[K].hi,x+=D&N,S+=D>>>16,_+=Q&N,A+=Q>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Qa(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ci(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Qo(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Ia(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Xa(x){return Ci(et(x,28),et(x,34),et(x,39))}function ki(x){return Ci(et(x,14),et(x,18),et(x,41))}function Io(x){return Ci(et(x,1),et(x,8),Qa(x,7))}function Ka(x){return Ci(et(x,19),et(x,61),Qa(x,6))}var Xo=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Za(x,S,_){var A=[],N=[],D=[],Q=[],K,H,J;for(H=0;H<8;H++)A[H]=D[H]=G(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)Q[H]=G(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=D[J];for(K=$n(D[7],ki(D[4]),Qo(D[4],D[5],D[6]),Xo[H],Q[H%16]),N[7]=$n(K,Xa(D[0]),Ia(D[0],D[1],D[2])),N[3]=$n(N[3],K),J=0;J<8;J++)D[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)Q[J]=$n(Q[J],Q[(J+9)%16],Io(Q[(J+1)%16]),Ka(Q[(J+14)%16]))}for(H=0;H<8;H++)D[H]=$n(D[H],A[H]),A[H]=D[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),D,Q=_;for(D=0;D<64;D++)A[D]=ni[D];for(Za(A,S,_),_%=128,D=0;D<256;D++)N[D]=0;for(D=0;D<_;D++)N[D]=S[Q-_+D];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(Q/536870912|0,Q<<3)),Za(A,N,_),D=0;D<64;D++)x[D]=A[D];return 0}function $t(x,S){var _=s(),A=s(),N=s(),D=s(),Q=s(),K=s(),H=s(),J=s(),fe=s();jt(_,x[1],x[0]),jt(fe,S[1],S[0]),we(_,_,fe),Ot(A,x[0],x[1]),Ot(fe,S[0],S[1]),we(A,A,fe),we(N,x[3],S[3]),we(N,N,E),we(D,x[2],S[2]),Ot(D,D,D),jt(Q,A,_),jt(K,D,N),Ot(H,D,N),Ot(J,A,_),we(x[0],Q,K),we(x[1],J,H),we(x[2],H,K),we(x[3],Q,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)_e(x[A],S[A],_)}function Cr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),we(_,S[0],N),we(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function kr(x,S,_){var A,N;for(be(x[0],h),be(x[1],d),be(x[2],d),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Mi(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],j),be(_[2],d),we(_[3],w,j),kr(x,_,S)}function ms(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],D;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Mi(N,A),Cr(x,N),D=0;D<32;D++)S[D+32]=x[D];return 0}var Yn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ps(x,S){var _,A,N,D;for(A=63;A>=32;--A){for(_=0,N=A-32,D=A-12;N<D;++N)S[N]+=_-16*S[A]*Yn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Yn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Yn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function xn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;ps(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),D=new Uint8Array(64),Q=new Uint8Array(64),K,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var Oe=_+64;for(K=0;K<_;K++)x[64+K]=S[K];for(K=0;K<32;K++)x[32+K]=N[32+K];for(ot(Q,x.subarray(32),_+32),xn(Q),Mi(fe,Q),Cr(x,fe),K=32;K<64;K++)x[K]=A[K];for(ot(D,x,_+64),xn(D),K=0;K<64;K++)J[K]=0;for(K=0;K<32;K++)J[K]=Q[K];for(K=0;K<32;K++)for(H=0;H<32;H++)J[K+H]+=D[K]*N[H];return ps(x.subarray(32),J),Oe}function ii(x,S){var _=s(),A=s(),N=s(),D=s(),Q=s(),K=s(),H=s();return be(x[2],d),sn(x[1],S),Tt(N,x[1]),we(D,N,y),jt(N,N,x[2]),Ot(D,x[2],D),Tt(Q,D),Tt(K,Q),we(H,K,Q),we(_,H,N),we(_,_,D),Ti(_,_),we(_,_,N),we(_,_,D),we(_,_,D),we(x[0],_,D),Tt(A,x[0]),we(A,A,D),lt(A,N)&&we(x[0],x[0],q),Tt(A,x[0]),we(A,A,D),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&jt(x[0],h,x[0]),we(x[3],x[0],x[1]),0)}function Mr(x,S,_,A){var N,D=new Uint8Array(32),Q=new Uint8Array(64),K=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(Q,x,_),xn(Q),kr(K,H,Q),Mi(H,S.subarray(32)),$t(K,H),Cr(D,K),_-=64,k(S,0,D,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Ri=32,gs=24,vn=32,ys=16,bs=32,ri=32,xs=32,Gn=32,ai=32,Rr=gs,Wa=vn,Cn=ys,Qe=64,it=32,Yt=64,li=32,Dr=64;r.lowlevel={crypto_core_hsalsa20:W,crypto_stream_xor:qe,crypto_stream:re,crypto_stream_salsa20_xor:Z,crypto_stream_salsa20:le,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:ae,crypto_verify_32:k,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:rn,crypto_box_beforenm:ds,crypto_box_afternm:Fa,crypto_box:Tr,crypto_box_open:Nr,crypto_box_keypair:Ni,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ms,crypto_sign_open:Mr,crypto_secretbox_KEYBYTES:Ri,crypto_secretbox_NONCEBYTES:gs,crypto_secretbox_ZEROBYTES:vn,crypto_secretbox_BOXZEROBYTES:ys,crypto_scalarmult_BYTES:bs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:xs,crypto_box_SECRETKEYBYTES:Gn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:Rr,crypto_box_ZEROBYTES:Wa,crypto_box_BOXZEROBYTES:Cn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:Dr,gf:s,D:y,L:Yn,pack25519:Te,unpack25519:sn,M:we,A:Ot,S:Tt,Z:jt,pow2523:Ti,add:$t,set25519:be,modL:ps,scalarmult:kr,scalarbase:Mi};function el(x,S){if(x.length!==Ri)throw new Error("bad key size");if(S.length!==gs)throw new Error("bad nonce size")}function tl(x,S){if(x.length!==xs)throw new Error("bad public key size");if(S.length!==Gn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Di(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(vn+x.length),N=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+vn]=x[D];return de(N,A,A.length,S,_),N.subarray(ys)},r.secretbox.open=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(ys+x.length),N=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+ys]=x[D];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(vn)},r.secretbox.keyLength=Ri,r.secretbox.nonceLength=gs,r.secretbox.overheadLength=ys,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==bs)throw new Error("bad p size");var _=new Uint8Array(bs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(bs);return rn(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=bs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),tl(x,S);var _=new Uint8Array(ai);return ds(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(xs),S=new Uint8Array(Gn);return Ni(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Gn)throw new Error("bad secret key size");var S=new Uint8Array(xs);return rn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=xs,r.box.secretKeyLength=Gn,r.box.sharedKeyLength=ai,r.box.nonceLength=Rr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Mr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),D=0;D<N.length;D++)N[D]=_[D];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Qe),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Qe+x.length),N=new Uint8Array(Qe+x.length),D;for(D=0;D<Qe;D++)A[D]=S[D];for(D=0;D<x.length;D++)A[D+Qe]=x[D];return Mr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ms(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ms(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(Dr);return ot(S,x,x.length),S},r.hash.hashLength=Dr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:pe(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,D=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(D.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=D[N];Di(D)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,D=x.randomBytes(A);for(N=0;N<A;N++)_[N]=D[N];Di(D)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const go=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;go.sign.keyPair.fromSeed,go.sign.detached,go.sign.detached.verify,go.randomBytes;var v0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(v0||(v0={}));var _0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(_0||(_0={}));function d1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function m1(){return()=>{}}function p1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function g1(r){return()=>({auth_token:typeof r=="function"?r():r})}const wg=120*1e3,y1=2,Sg=2*1e3;function b1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:wg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Sg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function x1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(g1(r.token)),r.user&&n.push(p1(r.user,r.pass)),n.length===0?m1():d1(n)}function v1(r){const n=`${Ef}:${xg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Ef}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=$o(b1(),r);if(s.authenticator=x1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{us(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Mf()=="function"),s.resolve&&typeof Mf()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function _1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const w1=1024*32,S1=/^INFO\s+([^\r\n]+)\r\n/i,E1=ka(`PONG\r
38
- `),w0=ka(`PING\r
39
- `);class A1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};$o(this,o)}}class Eg extends _t{constructor(s,a,o={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");$o(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Sr(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(d=>{this.stop(d),this.noIterator&&this.callback(d,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(d,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(d,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class O1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class qo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=w1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new O1,this.muxSubscriptions=new o1,this.outbound=new Ar,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new $v({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new l1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new x0(this),this.heartbeats=new c1(this,this.options.pingInterval||wg,this.options.maxPingOut||y1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new x0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Vv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:br.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:br.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:cs.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:cs.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Sr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Mf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:br.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Sg;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&o.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Or(a)}}static async connect(n,s){const a=new qo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new Kf(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=i0(n),a=qo.toError(s),o={type:cs.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(E1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(i0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new A1({version:f,lang:h},this.options,s.nonce);s.headers&&(d.headers=!0,d.no_responders=!0);const g=JSON.stringify(d);this.transport.send(ka(`CONNECT ${g}${So}`)),this.transport.send(w0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:cs.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:cs.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=ka(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=tn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ji.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=tn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=o.length+d}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
36
+ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const Pv="$JS.API";function $v(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Yo({apiPrefix:Pv,timeout:5e3},r)}class Pa{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=$v(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Nn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let o=nn;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=Xf();for(let d=0;d<f;d++)try{const g=await this.nc.request(n,o,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===ie.Timeout)&&d+1<f)await Or(h.backoff(d));else throw g}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=yg(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Na{constructor(n,s,a,o){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,o;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((o=n.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Ai(r=""){const n=r.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${r}' is not a semver value`)}function kf(r,n){return r.major<n.major?-1:r.major>n.major?1:r.minor<n.minor?-1:r.minor>n.minor?1:r.micro<n.micro?-1:r.micro>n.micro?1:0}var Ue;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ue||(Ue={}));class Yv{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Ai(n)),this.server=n,this.set(Ue.JS_KV,"2.6.2"),this.set(Ue.JS_OBJECTSTORE,"2.6.3"),this.set(Ue.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ue.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ue.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ue.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ue.JS_SIMPLIFICATION,"2.9.4"),this.set(Ue.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ue.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ue.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ue.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ue.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ue.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:kf(this.server,Ai(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Ai(n)),kf(this.server,n)>=0}}class zo extends Pa{constructor(n,s){super(n,s)}async add(n,s,a=Do.Create){if(Mt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&xr(o.config.durable_name);const f=this.nc;let{min:h,ok:d}=f.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!d)throw new Error(`consumer 'name' requires server ${h}`);if(g)try{Go("name",g)}catch(j){const q=j.message,M=q.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${q.substring(M)}`):j}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:j,ok:q}=f.features.get(Ue.JS_MULTIPLE_CONSUMER_FILTER);if(!q)throw new Error(`consumer 'filter_subjects' requires server ${j}`);d=!1}if(s.metadata){const{min:j,ok:q}=f.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!q)throw new Error(`consumer 'metadata' requires server ${j}`)}if(d&&(E=s.name??s.durable_name??""),E!==""){let j=s.filter_subject??void 0;j===">"&&(j=void 0),y=j!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${E}.${j}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Do.Update)}async info(n,s){return Mt(n),xr(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),xr(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Na(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function mr(r,n,s=!1){if(s===!0&&!r)throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`))}class Gv extends _t{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");mr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&mr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(mr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(mr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(mr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&mr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,j)=>{const[q,M]=this.adapter(w,j);if(q){E(q,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};D&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(q,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:h,queue:d,timeout:g}=o,y={queue:d,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async E=>{await E.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[o,f]=this.adapter(s,a);o&&this.stop(o),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let tn;function Vv(r){tn=r}function vg(){return tn!==void 0&&tn.defaultPort!==void 0?tn.defaultPort:4222}function hf(){return tn!==void 0&&tn.urlParseFn?tn.urlParseFn:void 0}function Fv(){if(!tn||typeof tn.factory!="function")throw new Error("transport fn is not set");return tn.factory()}function Mf(){return tn!==void 0&&tn.dnsResolveFn?tn.dnsResolveFn:void 0}const Eo=`\r
37
+ `,qo=Ar.fromAscii(Eo),Jv=new Uint8Array(qo)[0],Qv=new Uint8Array(qo)[1];function Iv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Jv&&r[s]===Qv)return s+1}return 0}function Xv(r){const n=Iv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return en.decode(a)}return""}const Kv=4,_g=48,Zv=65,Wv=97;function e1(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{o[d]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function Rf(r){return t1(r)!==void 0}function t1(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return wg(r);case":":return n1(r)}}function wg(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c:o,ok:f}=s1(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return e1(n[0],n[1],n[2],n[3])}function n1(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:h}=i1(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=wg(r);if(d===void 0)return;n[a]=d[12],n[a+1]=d[13],n[a+2]=d[14],n[a+3]=d[15],r="",a+=Kv;break}if(n[a]=o>>8,n[a+1]=o,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function s1(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-_g),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function i1(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-_g;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Wv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Zv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function r1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Df(r){return!r1(r)}function a1(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function l1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=a1(r),Df(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Df(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class Ra{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=l1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(Rf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Df(o)?"["+o+"]":o}`);h.port=`${this.port}`;const d=new Ra(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&pg(s),this.resolves=s,s}}class o1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=hf();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new Ra(o))}),this.randomize&&(this.servers=pg(this.servers))),this.servers.length===0&&this.addServer(`${Ef}:${vg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Rf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=hf();n=a?a(n):n;const o=new Ra(n,s);Rf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let o=[];const f=hf(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Ra(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&d.push(y),h.delete(E)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class c1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${us(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=gg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class u1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:br.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class f1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function h1(r,n="Assertion failed."){if(!r)throw new f1(n)}const x0=32*1024,df=2**32-2;function po(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class mf{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){h1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=po(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(ji.encode(n))}write(n){const s=this._grow(n.byteLength);return po(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)po(this._buf.subarray(this._off),this._buf);else{if(o+n>df)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,df));po(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,df)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(x0);for(;;){const o=this.capacity-this.length<x0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function v0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const d1=48;class _0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=le.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case le.OP_START:switch(a){case oe.M:case oe.m:this.state=le.OP_M,this.hdr=-1,this.ma=v0();break;case oe.H:case oe.h:this.state=le.OP_H,this.hdr=0,this.ma=v0();break;case oe.P:case oe.p:this.state=le.OP_P;break;case oe.PLUS:this.state=le.OP_PLUS;break;case oe.MINUS:this.state=le.OP_MINUS;break;case oe.I:case oe.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case oe.M:case oe.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case oe.S:case oe.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case oe.G:case oe.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=le.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case le.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END);break;case le.MSG_END:switch(a){case oe.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case oe.O:case oe.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case oe.K:case oe.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case oe.E:case oe.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case le.OP_P:switch(a){case oe.I:case oe.i:this.state=le.OP_PI;break;case oe.O:case oe.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case oe.N:case oe.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case oe.G:case oe.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case oe.N:case oe.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case oe.G:case oe.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case oe.N:case oe.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case oe.F:case oe.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case oe.O:case oe.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===le.MSG_ARG||this.state===le.MINUS_ERR_ARG||this.state===le.INFO_ARG)&&!this.argBuf&&(this.argBuf=new mf(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new mf(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new mf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${en.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-d1)}return s}}var le;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(le||(le={}));var oe;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(oe||(oe={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),d=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),q=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function D(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function W(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function se(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,A,N){var z,Q=0;for(z=0;z<N;z++)Q|=x[S+z]^_[A+z];return(1&Q-1>>>8)-1}function re(x,S,_,A){return me(x,S,_,A,16)}function C(x,S,_,A){return me(x,S,_,A,32)}function X(x,S,_,A,N){var z=new Uint32Array(16),Q=new Uint32Array(16),Z=new Uint32Array(16),H=new Uint32Array(4),J,fe,Oe;for(J=0;J<4;J++)Q[5*J]=D(A,4*J),Q[1+J]=D(_,4*J),Q[6+J]=D(S,4*J),Q[11+J]=D(_,16+4*J);for(J=0;J<16;J++)Z[J]=Q[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(Oe=0;Oe<4;Oe++)H[Oe]=Q[(5*fe+4*Oe)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),Oe=0;Oe<4;Oe++)z[4*fe+(fe+Oe)%4]=H[Oe]}for(Oe=0;Oe<16;Oe++)Q[Oe]=z[Oe]}if(N){for(J=0;J<16;J++)Q[J]=Q[J]+Z[J]|0;for(J=0;J<4;J++)Q[5*J]=Q[5*J]-D(A,4*J)|0,Q[6+J]=Q[6+J]-D(S,4*J)|0;for(J=0;J<4;J++)se(x,4*J,Q[5*J]),se(x,16+4*J,Q[6+J])}else for(J=0;J<16;J++)se(x,4*J,Q[J]+Z[J]|0)}function ce(x,S,_,A){return X(x,S,_,A,!1),0}function V(x,S,_,A){return X(x,S,_,A,!0),0}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,A,N,z,Q){var Z=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)Z[fe]=0;for(fe=0;fe<8;fe++)Z[fe]=z[fe];for(;N>=64;){for(ce(H,Z,Q,G),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(Z[fe]&255)|0,Z[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(ce(H,Z,Q,G),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function ae(x,S,_,A,N){return K(x,S,null,0,_,A,N)}function ne(x,S,_,A,N){var z=new Uint8Array(32);return V(z,A,N,G),ae(x,S,_,A.subarray(16),z)}function ke(x,S,_,A,N,z,Q){var Z=new Uint8Array(32);return V(Z,z,Q,G),K(x,S,_,A,N,z.subarray(16),Z)}function He(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Me=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,z){var Q,Z,H,J,fe=new Uint32Array(17),Oe=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),wn=new Uint32Array(17);for(H=0;H<17;H++)Oe[H]=Ke[H]=0;for(H=0;H<16;H++)Oe[H]=z[H];for(Oe[3]&=15,Oe[4]&=252,Oe[7]&=15,Oe[8]&=252,Oe[11]&=15,Oe[12]&=252,Oe[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,He(Ke,Ct),Z=0;Z<17;Z++)for(fe[Z]=0,H=0;H<17;H++)fe[Z]=fe[Z]+Ke[H]*(H<=Z?Oe[Z-H]:320*Oe[Z+17-H]|0)|0|0;for(Z=0;Z<17;Z++)Ke[Z]=fe[Z];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)wn[H]=Ke[H];for(He(Ke,Me),Q=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=Q&(wn[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=z[H+16];for(Ct[16]=0,He(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,z){var Q=new Uint8Array(16);return $(Q,0,_,A,N,z),re(x,S,Q,0)}function de(x,S,_,A,N){var z;if(_<32)return-1;for(ke(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),z=0;z<16;z++)x[z]=0;return 0}function ve(x,S,_,A,N){var z,Q=new Uint8Array(32);if(_<32||(ne(Q,0,32,A,N),te(S,16,S,32,_-32,Q)!==0))return-1;for(ke(x,0,S,0,_,A,N),z=0;z<32;z++)x[z]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function je(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function _e(x,S,_){for(var A,N=~(_-1),z=0;z<16;z++)A=N&(x[z]^S[z]),x[z]^=A,S[z]^=A}function Te(x,S){var _,A,N,z=s(),Q=s();for(_=0;_<16;_++)Q[_]=S[_];for(je(Q),je(Q),je(Q),A=0;A<2;A++){for(z[0]=Q[0]-65517,_=1;_<15;_++)z[_]=Q[_]-65535-(z[_-1]>>16&1),z[_-1]&=65535;z[15]=Q[15]-32767-(z[14]>>16&1),N=z[15]>>16&1,z[14]&=65535,_e(Q,z,1-N)}for(_=0;_<16;_++)x[2*_]=Q[_]&255,x[2*_+1]=Q[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),C(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function rn(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function we(x,S,_){var A,N,z=new Float64Array(31);for(A=0;A<31;A++)z[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)z[A+N]+=S[A]*_[N];for(A=0;A<15;A++)z[A]+=38*z[A+16];for(A=0;A<16;A++)x[A]=z[A];je(x),je(x)}function Tt(x,S){we(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ti(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),z,Q,Z=s(),H=s(),J=s(),fe=s(),Oe=s(),Ke=s();for(Q=0;Q<31;Q++)A[Q]=S[Q];for(A[31]=S[31]&127|64,A[0]&=248,rn(N,_),Q=0;Q<16;Q++)H[Q]=N[Q],fe[Q]=Z[Q]=J[Q]=0;for(Z[0]=fe[0]=1,Q=254;Q>=0;--Q)z=A[Q>>>3]>>>(Q&7)&1,_e(Z,H,z),_e(J,fe,z),Ot(Oe,Z,J),jt(Z,Z,J),Ot(J,H,fe),jt(H,H,fe),Tt(fe,Oe),Tt(Ke,Z),we(Z,J,Z),we(J,H,Oe),Ot(Oe,Z,J),jt(Z,Z,J),Tt(H,Z),jt(J,fe,Ke),we(Z,J,g),Ot(Z,Z,fe),we(J,J,Z),we(Z,fe,Ke),we(fe,H,N),Tt(H,Oe),_e(Z,H,z),_e(J,fe,z);for(Q=0;Q<16;Q++)N[Q+16]=Z[Q],N[Q+32]=J[Q],N[Q+48]=H[Q],N[Q+64]=fe[Q];var Ct=N.subarray(32),wn=N.subarray(16);return ei(Ct,Ct),we(wn,wn,Ct),Te(x,wn),0}function an(x,S){return ti(x,S,f)}function Ni(x,S){return a(S,32),an(x,S)}function ds(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),V(x,o,A,G)}var Fa=de,Ja=ve;function Tr(x,S,_,A,N,z){var Q=new Uint8Array(32);return ds(Q,N,z),Fa(x,S,_,A,Q)}function Nr(x,S,_,A,N,z){var Q=new Uint8Array(32);return ds(Q,N,z),Ja(x,S,_,A,Q)}function $n(){var x=0,S=0,_=0,A=0,N=65535,z,Q,Z;for(Z=0;Z<arguments.length;Z++)z=arguments[Z].lo,Q=arguments[Z].hi,x+=z&N,S+=z>>>16,_+=Q&N,A+=Q>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Qa(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ci(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Io(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Ia(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Xa(x){return Ci(et(x,28),et(x,34),et(x,39))}function ki(x){return Ci(et(x,14),et(x,18),et(x,41))}function Xo(x){return Ci(et(x,1),et(x,8),Qa(x,7))}function Ka(x){return Ci(et(x,19),et(x,61),Qa(x,6))}var Ko=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Za(x,S,_){var A=[],N=[],z=[],Q=[],Z,H,J;for(H=0;H<8;H++)A[H]=z[H]=W(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)Q[H]=W(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=z[J];for(Z=$n(z[7],ki(z[4]),Io(z[4],z[5],z[6]),Ko[H],Q[H%16]),N[7]=$n(Z,Xa(z[0]),Ia(z[0],z[1],z[2])),N[3]=$n(N[3],Z),J=0;J<8;J++)z[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)Q[J]=$n(Q[J],Q[(J+9)%16],Xo(Q[(J+1)%16]),Ka(Q[(J+14)%16]))}for(H=0;H<8;H++)z[H]=$n(z[H],A[H]),A[H]=z[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),z,Q=_;for(z=0;z<64;z++)A[z]=ni[z];for(Za(A,S,_),_%=128,z=0;z<256;z++)N[z]=0;for(z=0;z<_;z++)N[z]=S[Q-_+z];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(Q/536870912|0,Q<<3)),Za(A,N,_),z=0;z<64;z++)x[z]=A[z];return 0}function $t(x,S){var _=s(),A=s(),N=s(),z=s(),Q=s(),Z=s(),H=s(),J=s(),fe=s();jt(_,x[1],x[0]),jt(fe,S[1],S[0]),we(_,_,fe),Ot(A,x[0],x[1]),Ot(fe,S[0],S[1]),we(A,A,fe),we(N,x[3],S[3]),we(N,N,E),we(z,x[2],S[2]),Ot(z,z,z),jt(Q,A,_),jt(Z,z,N),Ot(H,z,N),Ot(J,A,_),we(x[0],Q,Z),we(x[1],J,H),we(x[2],H,Z),we(x[3],Q,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)_e(x[A],S[A],_)}function Cr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),we(_,S[0],N),we(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function kr(x,S,_){var A,N;for(be(x[0],h),be(x[1],d),be(x[2],d),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Mi(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],j),be(_[2],d),we(_[3],w,j),kr(x,_,S)}function ms(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],z;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Mi(N,A),Cr(x,N),z=0;z<32;z++)S[z+32]=x[z];return 0}var Yn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ps(x,S){var _,A,N,z;for(A=63;A>=32;--A){for(_=0,N=A-32,z=A-12;N<z;++N)S[N]+=_-16*S[A]*Yn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Yn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Yn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function vn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;ps(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),z=new Uint8Array(64),Q=new Uint8Array(64),Z,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var Oe=_+64;for(Z=0;Z<_;Z++)x[64+Z]=S[Z];for(Z=0;Z<32;Z++)x[32+Z]=N[32+Z];for(ot(Q,x.subarray(32),_+32),vn(Q),Mi(fe,Q),Cr(x,fe),Z=32;Z<64;Z++)x[Z]=A[Z];for(ot(z,x,_+64),vn(z),Z=0;Z<64;Z++)J[Z]=0;for(Z=0;Z<32;Z++)J[Z]=Q[Z];for(Z=0;Z<32;Z++)for(H=0;H<32;H++)J[Z+H]+=z[Z]*N[H];return ps(x.subarray(32),J),Oe}function ii(x,S){var _=s(),A=s(),N=s(),z=s(),Q=s(),Z=s(),H=s();return be(x[2],d),rn(x[1],S),Tt(N,x[1]),we(z,N,y),jt(N,N,x[2]),Ot(z,x[2],z),Tt(Q,z),Tt(Z,Q),we(H,Z,Q),we(_,H,N),we(_,_,z),Ti(_,_),we(_,_,N),we(_,_,z),we(_,_,z),we(x[0],_,z),Tt(A,x[0]),we(A,A,z),lt(A,N)&&we(x[0],x[0],q),Tt(A,x[0]),we(A,A,z),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&jt(x[0],h,x[0]),we(x[3],x[0],x[1]),0)}function Mr(x,S,_,A){var N,z=new Uint8Array(32),Q=new Uint8Array(64),Z=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(Q,x,_),vn(Q),kr(Z,H,Q),Mi(H,S.subarray(32)),$t(Z,H),Cr(z,Z),_-=64,C(S,0,z,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Ri=32,gs=24,_n=32,ys=16,bs=32,ri=32,xs=32,Gn=32,ai=32,Rr=gs,Wa=_n,kn=ys,Qe=64,it=32,Yt=64,li=32,Dr=64;r.lowlevel={crypto_core_hsalsa20:V,crypto_stream_xor:ke,crypto_stream:ne,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:re,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:an,crypto_box_beforenm:ds,crypto_box_afternm:Fa,crypto_box:Tr,crypto_box_open:Nr,crypto_box_keypair:Ni,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ms,crypto_sign_open:Mr,crypto_secretbox_KEYBYTES:Ri,crypto_secretbox_NONCEBYTES:gs,crypto_secretbox_ZEROBYTES:_n,crypto_secretbox_BOXZEROBYTES:ys,crypto_scalarmult_BYTES:bs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:xs,crypto_box_SECRETKEYBYTES:Gn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:Rr,crypto_box_ZEROBYTES:Wa,crypto_box_BOXZEROBYTES:kn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:Dr,gf:s,D:y,L:Yn,pack25519:Te,unpack25519:rn,M:we,A:Ot,S:Tt,Z:jt,pow2523:Ti,add:$t,set25519:be,modL:ps,scalarmult:kr,scalarbase:Mi};function el(x,S){if(x.length!==Ri)throw new Error("bad key size");if(S.length!==gs)throw new Error("bad nonce size")}function tl(x,S){if(x.length!==xs)throw new Error("bad public key size");if(S.length!==Gn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Di(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(_n+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+_n]=x[z];return de(N,A,A.length,S,_),N.subarray(ys)},r.secretbox.open=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(ys+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+ys]=x[z];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(_n)},r.secretbox.keyLength=Ri,r.secretbox.nonceLength=gs,r.secretbox.overheadLength=ys,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==bs)throw new Error("bad p size");var _=new Uint8Array(bs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(bs);return an(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=bs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),tl(x,S);var _=new Uint8Array(ai);return ds(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(xs),S=new Uint8Array(Gn);return Ni(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Gn)throw new Error("bad secret key size");var S=new Uint8Array(xs);return an(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=xs,r.box.secretKeyLength=Gn,r.box.sharedKeyLength=ai,r.box.nonceLength=Rr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Mr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),z=0;z<N.length;z++)N[z]=_[z];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Qe),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Qe+x.length),N=new Uint8Array(Qe+x.length),z;for(z=0;z<Qe;z++)A[z]=S[z];for(z=0;z<x.length;z++)A[z+Qe]=x[z];return Mr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ms(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ms(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(Dr);return ot(S,x,x.length),S},r.hash.hashLength=Dr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,z=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(z.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=z[N];Di(z)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,z=x.randomBytes(A);for(N=0;N<A;N++)_[N]=z[N];Di(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const go=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;go.sign.keyPair.fromSeed,go.sign.detached,go.sign.detached.verify,go.randomBytes;var w0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(w0||(w0={}));var S0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(S0||(S0={}));function m1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function p1(){return()=>{}}function g1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function y1(r){return()=>({auth_token:typeof r=="function"?r():r})}const Sg=120*1e3,b1=2,Eg=2*1e3;function x1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Sg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Eg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function v1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(y1(r.token)),r.user&&n.push(g1(r.user,r.pass)),n.length===0?p1():m1(n)}function _1(r){const n=`${Ef}:${vg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Ef}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Yo(x1(),r);if(s.authenticator=v1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{us(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Mf()=="function"),s.resolve&&typeof Mf()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function w1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const S1=1024*32,E1=/^INFO\s+([^\r\n]+)\r\n/i,A1=ka(`PONG\r
38
+ `),E0=ka(`PING\r
39
+ `);class O1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Yo(this,o)}}class Ag extends _t{constructor(s,a,o={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");Yo(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Sr(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(d=>{this.stop(d),this.noIterator&&this.callback(d,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(d,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(d,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class j1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Uo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=S1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new j1,this.muxSubscriptions=new c1,this.outbound=new Ar,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Yv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new o1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new _0(this),this.heartbeats=new u1(this,this.options.pingInterval||Sg,this.options.maxPingOut||b1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new _0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Fv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:br.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:br.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:cs.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:cs.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Sr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Mf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:br.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Eg;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&o.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Or(a)}}static async connect(n,s){const a=new Uo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new Zf(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=a0(n),a=Uo.toError(s),o={type:cs.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(A1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(a0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new O1({version:f,lang:h},this.options,s.nonce);s.headers&&(d.headers=!0,d.no_responders=!0);const g=JSON.stringify(d);this.transport.send(ka(`CONNECT ${g}${Eo}`)),this.transport.send(E0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:cs.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:cs.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=ka(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=nn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ji.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=nn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=o.length+d}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
40
40
  `:g=`HPUB ${n} ${d} ${f}\r
41
- `,this.sendCommand(g,h,o,zo)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
41
+ `,this.sendCommand(g,h,o,qo)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
42
42
  `:g=`PUB ${n} ${f}\r
43
- `,this.sendCommand(g,o,zo))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
43
+ `,this.sendCommand(g,o,qo))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
44
44
  `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
45
45
  `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
46
46
  `):this.sendCommand(`UNSUB ${n.sid}\r
47
- `),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(w0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${So}`):n.push(`SUB ${a.subject} ${a.sid}${So}`)}),n.length&&this.transport.send(ka(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Eg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const j1="$SRV";class S0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,h;return o=o||{},o.headers=o.headers||fs(),(f=o.headers)==null||f.set(ko,`${n}`),(h=o.headers)==null||h.set(Co,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Ua{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&N1("service group",s);let o="";if(n instanceof $a)this.srv=n,o="";else if(n instanceof Ua){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;Ta("endpoint",n);let{subject:o,handler:f,metadata:h,queue:d}=a;o=o||n,d=d||this.queue,T1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new Ua(this,n,s)}}function T1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function N1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class $a{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Ta("name",this.config.name),Ta("queue",this.config.queue),Ai(this.config.version),this._id=Ks.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??j1;return s===""&&a===""?`${f}.${n}`:(Ta("control subject name",s),a!==""?(Ta("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=fs();if(n instanceof Mo){const a=n;s.set(Co,a.message),s.set(ko,`${a.code}`)}else s.set(Co,n.message),s.set(ko,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new C1(o,f,a),d.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new S0(E))}catch(j){d.stats.countError(j),E==null||E.respond(tn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),d}info(){return{type:Ma.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Ma.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const h={};h.name=n,h.subject=$a.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Tn(),s=(h,d)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(d==null||d.respond(n.encode(g)),Promise.resolve())),a=(h,d)=>h?(this.close(h),Promise.reject(h)):(d==null||d.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.INFO,a),this.handlers.forEach(h=>{const{subject:d}=h;typeof d=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Ma.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new Ua(this,n,s)}addEndpoint(n,s){return new Ua(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new S0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class C1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class k1{constructor(n,s={strategy:jn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=Tn(),h=$a.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,tn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Ag(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function M1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ag(),storage:Nf.File}}const Uo="KV-Operation",E0="$KV",R1=/^[-/=.\w]+$/,D1=/^[-/=.>*\w]+$/,z1=/^[-\w]+$/;function q1(r){if(r.startsWith(".")||r.endsWith(".")||!R1.test(r))throw new Error(`invalid key: ${r}`)}function U1(r){if(r.startsWith(".")||r.endsWith(".")||!D1.test(r))throw new Error(`invalid key: ${r}`)}function B1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Eo(r){if(!z1.test(r))throw new Error(`invalid bucket name: ${r}`)}var zn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(zn||(zn={}));class Ba{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",q1);v(this,"validateSearchKey",U1);v(this,"hasWildcards",B1);Eo(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=E0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Eo(s);const o=await n.jetstreamManager(),f=new Ba(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Eo(s);const h=new Ba(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Ag(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(M1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Tf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(j=>{const q=Object.assign({},j),M=q.name.startsWith(Zt)?q.name.substring(Zt.length):q.name;return q.name.startsWith(Zt)||(q.name=`${Zt}${q.name}`),!j.external&&M!==this.bucket&&(q.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),d=h?kf(h,Ai("2.7.2"))>=0:!1;a.discard=d?qa.New:qa.Old;const{ok:g,min:y}=f.features.get(ze.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${E0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new W1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new e_(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,d;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=fs();f.headers=g,g.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(d=y.api_error)==null?void 0:d.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),d=await Promise.all(h);return d.unshift({success:!0,purged:0}),d.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const h of o)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=fs();f.set(Uo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),tn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===An.AllHistory&&(h=ft.All),s===An.UpdatesOnly&&(h=ft.New);let d;return f.length===1&&(d=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:d,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,An.AllHistory,o),g=d.filter_subject,y=Is(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,j)=>{if(w){a.stop(w);return}if(j){const q=this.jmToEntry(j);a.push(q),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,j=w.num_pending+w.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(q){a.stop(q)}finally{f=void 0}else h=j}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(ze.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=An.LastValue;n.include===An.AllHistory?f=An.AllHistory:n.include===An.UpdatesOnly&&(f=An.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Is(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((q,M)=>{if(q){a.stop(q);return}if(M){const z=this.jmToEntry(M);if(h&&z.operation==="DEL")return;a.push(z),a.received++,d&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(E,w);if(d){const{info:{last:q}}=j,M=q.num_pending+q.delivered.consumer_seq;if(M===0||a.received>=M)try{d()}catch(z){a.stop(z)}finally{d=void 0}else g=M}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,An.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Is(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Uo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Og(o,s)}}class Og{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Xf(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}const Wf="OBJ_",A0="SHA-256=";function L1(r){return Eo(r),`${Wf}${r}`}function H1(r){return r.startsWith(Wf)?r.substring(4):r}class zf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return H1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}function yo(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var gn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(gn||(gn={}));var qn;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(qn||(qn={}));var wr;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(wr||(wr={}));const O0=Uint8Array.of(43,65,67,75),P1=Uint8Array.of(45,78,65,75),Ea=Uint8Array.of(43,87,80,73),$1=Uint8Array.of(43,78,88,84),Y1=Uint8Array.of(43,84,69,82,77),G1=Uint8Array.of(32);function La(r,n=5e3){return new l_(r,n)}class mf extends _t{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=us(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,j,q,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(jf(y))return;const z=(j=y.headers)==null?void 0:j.code,G=((M=(q=y.headers)==null?void 0:q.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:ne,bytesLeft:ee}=this.parseDiscard(y.headers);if(ne>0||ee>0)this.pending.msgs-=ne,this.pending.bytes-=ee,this.pending.requests--,this.notify(wr.Discard,{msgsLeft:ne,bytesLeft:ee});else if(z===400){this.stop(new ue(G,`${z}`));return}else if(z===409&&G==="consumer deleted"){if(this.notify(qn.ConsumerDeleted,`${z} ${G}`),!this.refilling||this.abortOnMissingResource){const pe=new ue(G,`${z}`);this.stop(pe);return}}else if(z===503){if(this.notify(qn.NoResponders,`${z} No Responders`),!this.refilling||this.abortOnMissingResource){const pe=new ue("no responders",`${z}`);this.stop(pe);return}}else this.notify(wr.DebugEvent,`${z} ${G}`)}else this._push(La(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const z=this.pullOptions();this.pull(z)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new Zf(o,g=>(this.notify(qn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case cs.Disconnect:(y=this.monitor)==null||y.cancel();break;case cs.Reconnect:this.resetPending().then(w=>{var j;w&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const o=If([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(qn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(qn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const d=o.backoff(f),g=Or(d);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(wr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class V1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class qf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new mf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new mf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Sr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new mf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await o.status())if(d.type===qn.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of o){s.resolve(d);break}})().catch(()=>{});const h=Sr(f);return o.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),o.close().catch()}),o.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class F1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ks.next(),typeof a.name_prefix=="string"&&(Yo("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=gn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,d,g,y,E;Ks.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=If([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(qn.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(qn.StreamNotFound,w),this.type===gn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(j),Promise.reject(j);if(s&&w>=this.maxInitialReset)throw j;await Or(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===gn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new V1),this.consumer=new qf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===gn.Fetch&&a?h=await this.consumer.fetch(n):this.type===gn.Consume&&(h=await this.consumer.consume(n));const d=h;d.forOrderedConsumer=!0,d.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(d)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(wr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Uf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ze.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new qf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new qf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new eh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new F1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Vo{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Vo(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Uf(new Do(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Uf(new Do(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class eh extends Pa{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(ze.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var d;if((((d=f==null?void 0:f.subject_transforms)==null?void 0:d.length)||0)>0){const{min:g,ok:y}=s.features.get(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=yo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(yo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var d;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=yo(o.mirror),o.sources=(d=o.sources)==null?void 0:d.map(yo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:d}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],E=s||{};let w=0;for(;h>g;){w++,E.offset=d*w;const q=await this._request(a,E);h=q.total,y.push(q);const M=Object.getOwnPropertyNames(q.state.subjects).length;if(g+=M,M<d)break}let j={};for(let q=0;q<y.length;q++)f=y[q],f.state.subjects&&(j=Object.assign(j,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=j}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(d=>{this._fixInfo(d)}),h.streams},o=`${this.prefix}.STREAM.LIST`;return new Na(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new jg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Og(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Na(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(Wf));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new zf(d))},s=`${this.prefix}.STREAM.LIST`;return new Na(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Na(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Vo(this,s))}}class J1 extends Pa{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):tn,h=this.opts.apiPrefix||"$JS.API",d=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=vr(g);if(y)return Promise.reject(y);const E=new Bf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,d=await this.nc.requestMany(o,f,{strategy:jn.SentinelMsg});return(async()=>{var w,j,q;let g=!1,y=!1,E;for await(const M of d){if(!g){g=!0;const z=((w=M.headers)==null?void 0:w.code)||0;if(z!==0&&z<200||z>299){E=(j=M.headers)==null?void 0:j.description.toLowerCase();break}if(((q=M.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Bf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Bf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(yr.Subject)}get seq(){const n=this.header.last(yr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(yr.TimeStamp)}get stream(){return this.header.last(yr.Stream)}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(Bf,"jc");class Q1 extends Pa{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new eh(s,a),this.consumers=new Do(s,a),this.direct=new J1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class jg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):tn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Qs.decode(n)}else this._header=fs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(jg,"jc");class I1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Vo(this.api,s))}}class pf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Qs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function j0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function X1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Da{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new pf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),d=Tn().decode(f.data);return d.revision=f.seq,d}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new zf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new zf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var ae;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,d=this.js.nc.info,g=(d==null?void 0:d.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((ae=n.options)==null?void 0:ae.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const q=Ks.next(),M=this._chunkSubject(q),z=this._metaSubject(w),G=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},j0(n)),ne=st(),ee=[],pe=new Ar;try{const k=s?s.getReader():null,X=g0.create();for(;;){const{done:se,value:W}=k?await k.read():{done:!0,value:void 0};if(se){if(pe.size()>0){const re=pe.drain();X.update(re),G.chunks++,G.size+=re.length,ee.push(this.js.publish(M,re,{timeout:f}))}await Promise.all(ee),ee.length=0,G.mtime=new Date().toISOString();const F=_r.encode(X.digest());G.digest=`${A0}${F}`,G.deleted=!1;const Z=fs();typeof h=="number"&&Z.set(zn.ExpectedLastSubjectSequenceHdr,`${h}`),Z.set(Dt.RollupHdr,Dt.RollupValueSubject);const le=await this.js.publish(z,Tn().encode(G),{headers:Z,timeout:f});if(G.revision=le.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}ne.resolve(new pf(G));break}if(W)for(pe.fill(W);pe.size()>y;){G.chunks++,G.size+=y;const F=pe.drain(n.options.max_chunk_size);X.update(F),ee.push(this.js.publish(M,F,{timeout:f}))}}}catch(k){await this.jsm.streams.purge(this.stream,{filter:M}),ne.reject(k)}return ne}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Ar,d=f.getReader();for(;;){const{done:g,value:y}=await d.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Da.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(A0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Cf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new pf(s),error:o};if(s.size===0)return f.data=X1(),o.resolve(null),Promise.resolve(f);let h;const d=Is();d.orderedConsumer();const g=g0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,d);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(Bv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Da))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},d={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(d));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=Tn(),o=fs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const h=Object.assign({},a,j0(s)),d=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(d)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Tn(),h=Is();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(o,h);return a._data=d,a.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${_r.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=L1(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=qa.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new Da(s,o,n);return await f.init(a),Promise.resolve(f)}}class K1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(ze.JS_KV);return o?s.bindOnly?Ba.bind(this.js,n,s):Ba.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(ze.JS_OBJECTSTORE);return o?Da.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class th extends Pa{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new Do(s,a),this.streamAPI=new eh(s,a),this.consumers=new Uf(this.consumerAPI),this.streams=new I1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new K1(this)}async publish(s,a=tn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||fs();o&&(o.msgID&&f.set(zn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(zn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(zn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(zn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,d={};h&&(d.timeout=h),o&&(d.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let j=0;j<g;j++)try{E=await this.nc.request(s,a,d);break}catch(q){if(q.code==="503"&&j+1<g)await Or(y);else throw q}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),xr(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=vr(d);if(g)throw g;return La(d,this.timeout)}fetch(s,a,o={}){Mt(s),xr(a);let f=null;const h=(o.max_bytes??0)>0;let d=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const j=o.idle_heartbeat||0;j&&(E.idle_heartbeat=nt(j),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(j*4)));const q=new _t,M=E.batch;let z=0;q.protocolFilterFn=(ee,pe=!1)=>jf(ee.msg)?(y==null||y.work(),!1):!0,q.dispatchedFn=ee=>{if(ee){if(h&&(d+=ee.data.length),z++,f&&ee.info.pending===0)return;(q.getPending()===1&&ee.info.pending===0||M===z||g>0&&d>=g)&&q.stop()}};const G=us(this.nc.options.inboxPrefix),ne=this.nc.subscribe(G,{max:o.batch,callback:(ee,pe)=>{ee===null&&(ee=vr(pe)),ee!==null?(f&&(f.cancel(),f=null),xv(ee)?q.stop(Ng(ee)===null?void 0:ee):q.stop(ee)):(y==null||y.work(),q.received++,q.push(La(pe,this.timeout)))}});return w&&(f=Sr(w),f.catch(()=>{ne.isClosed()||(ne.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new Zf(j,ee=>(q.push(()=>{q.err=new ue(`${yn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await ne.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:G}),q}async pullSubscribe(s,a=Is()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(o),d=new t_(this,o.deliver,h);d.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Is()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new Tg(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Is()){const o=h0(a)?a.getOpts():a;if(o.isBind=h0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=us(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=o.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const d=f.config.deliver_group??"";if(h!==d)throw d===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${d}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||us(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=n_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=th.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Of(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=r_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(vr(h.msg)||(g=f.monitor)==null||g.work(),jf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Of(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class nh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=v1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new nh(n);qo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(d=>{d.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Eg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=tn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||jn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function d(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(us(this.options.inboxPrefix),{callback:(M,z)=>{var G,ne;if(((G=z==null?void 0:z.data)==null?void 0:G.length)===0&&((ne=z==null?void 0:z.headers)==null?void 0:ne.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
47
+ `),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(E0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${Eo}`):n.push(`SUB ${a.subject} ${a.sid}${Eo}`)}),n.length&&this.transport.send(ka(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Ag(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const T1="$SRV";class A0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,h;return o=o||{},o.headers=o.headers||fs(),(f=o.headers)==null||f.set(Mo,`${n}`),(h=o.headers)==null||h.set(ko,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Ua{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&C1("service group",s);let o="";if(n instanceof $a)this.srv=n,o="";else if(n instanceof Ua){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;Ta("endpoint",n);let{subject:o,handler:f,metadata:h,queue:d}=a;o=o||n,d=d||this.queue,N1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new Ua(this,n,s)}}function N1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function C1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class $a{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Ta("name",this.config.name),Ta("queue",this.config.queue),Ai(this.config.version),this._id=Ks.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??T1;return s===""&&a===""?`${f}.${n}`:(Ta("control subject name",s),a!==""?(Ta("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=fs();if(n instanceof Ro){const a=n;s.set(ko,a.message),s.set(Mo,`${a.code}`)}else s.set(ko,n.message),s.set(Mo,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new k1(o,f,a),d.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new A0(E))}catch(j){d.stats.countError(j),E==null||E.respond(nn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),d}info(){return{type:Ma.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Ma.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const h={};h.name=n,h.subject=$a.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Nn(),s=(h,d)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(d==null||d.respond(n.encode(g)),Promise.resolve())),a=(h,d)=>h?(this.close(h),Promise.reject(h)):(d==null||d.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.INFO,a),this.handlers.forEach(h=>{const{subject:d}=h;typeof d=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Ma.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new Ua(this,n,s)}addEndpoint(n,s){return new Ua(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new A0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class k1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class M1{constructor(n,s={strategy:Tn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=Nn(),h=$a.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,nn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Og(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function R1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Og(),storage:Nf.File}}const Bo="KV-Operation",O0="$KV",D1=/^[-/=.\w]+$/,z1=/^[-/=.>*\w]+$/,q1=/^[-\w]+$/;function U1(r){if(r.startsWith(".")||r.endsWith(".")||!D1.test(r))throw new Error(`invalid key: ${r}`)}function B1(r){if(r.startsWith(".")||r.endsWith(".")||!z1.test(r))throw new Error(`invalid key: ${r}`)}function L1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Ao(r){if(!q1.test(r))throw new Error(`invalid bucket name: ${r}`)}var qn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(qn||(qn={}));class Ba{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",U1);v(this,"validateSearchKey",B1);v(this,"hasWildcards",L1);Ao(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=O0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Ao(s);const o=await n.jetstreamManager(),f=new Ba(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Ao(s);const h=new Ba(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Og(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(R1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Tf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(j=>{const q=Object.assign({},j),M=q.name.startsWith(Zt)?q.name.substring(Zt.length):q.name;return q.name.startsWith(Zt)||(q.name=`${Zt}${q.name}`),!j.external&&M!==this.bucket&&(q.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),d=h?kf(h,Ai("2.7.2"))>=0:!1;a.discard=d?qa.New:qa.Old;const{ok:g,min:y}=f.features.get(Ue.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${O0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new e_(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new t_(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,d;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=fs();f.headers=g,g.set(qn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(d=y.api_error)==null?void 0:d.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),d=await Promise.all(h);return d.unshift({success:!0,purged:0}),d.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const h of o)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=fs();f.set(Bo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(qn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),nn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===On.AllHistory&&(h=ft.All),s===On.UpdatesOnly&&(h=ft.New);let d;return f.length===1&&(d=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:d,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,On.AllHistory,o),g=d.filter_subject,y=Is(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,j)=>{if(w){a.stop(w);return}if(j){const q=this.jmToEntry(j);a.push(q),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,j=w.num_pending+w.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(q){a.stop(q)}finally{f=void 0}else h=j}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=On.LastValue;n.include===On.AllHistory?f=On.AllHistory:n.include===On.UpdatesOnly&&(f=On.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Is(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((q,M)=>{if(q){a.stop(q);return}if(M){const D=this.jmToEntry(M);if(h&&D.operation==="DEL")return;a.push(D),a.received++,d&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(E,w);if(d){const{info:{last:q}}=j,M=q.num_pending+q.delivered.consumer_seq;if(M===0||a.received>=M)try{d()}catch(D){a.stop(D)}finally{d=void 0}else g=M}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,On.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Is(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Bo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new jg(o,s)}}class jg{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Kf(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}const eh="OBJ_",j0="SHA-256=";function H1(r){return Ao(r),`${eh}${r}`}function P1(r){return r.startsWith(eh)?r.substring(4):r}class zf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return P1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}function yo(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var yn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(yn||(yn={}));var Un;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(Un||(Un={}));var wr;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(wr||(wr={}));const T0=Uint8Array.of(43,65,67,75),$1=Uint8Array.of(45,78,65,75),Ea=Uint8Array.of(43,87,80,73),Y1=Uint8Array.of(43,78,88,84),G1=Uint8Array.of(43,84,69,82,77),V1=Uint8Array.of(32);function La(r,n=5e3){return new o_(r,n)}class pf extends _t{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=us(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,j,q,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(jf(y))return;const D=(j=y.headers)==null?void 0:j.code,W=((M=(q=y.headers)==null?void 0:q.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:se,bytesLeft:ee}=this.parseDiscard(y.headers);if(se>0||ee>0)this.pending.msgs-=se,this.pending.bytes-=ee,this.pending.requests--,this.notify(wr.Discard,{msgsLeft:se,bytesLeft:ee});else if(D===400){this.stop(new ue(W,`${D}`));return}else if(D===409&&W==="consumer deleted"){if(this.notify(Un.ConsumerDeleted,`${D} ${W}`),!this.refilling||this.abortOnMissingResource){const me=new ue(W,`${D}`);this.stop(me);return}}else if(D===503){if(this.notify(Un.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new ue("no responders",`${D}`);this.stop(me);return}}else this.notify(wr.DebugEvent,`${D} ${W}`)}else this._push(La(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new Wf(o,g=>(this.notify(Un.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case cs.Disconnect:(y=this.monitor)==null||y.cancel();break;case cs.Reconnect:this.resetPending().then(w=>{var j;w&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const o=Xf([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(Un.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(Un.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const d=o.backoff(f),g=Or(d);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(wr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class F1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class qf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new pf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new pf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Sr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new pf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await o.status())if(d.type===Un.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of o){s.resolve(d);break}})().catch(()=>{});const h=Sr(f);return o.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),o.close().catch()}),o.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class J1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ks.next(),typeof a.name_prefix=="string"&&(Go("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=yn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,d,g,y,E;Ks.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=Xf([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(Un.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(Un.StreamNotFound,w),this.type===yn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(j),Promise.reject(j);if(s&&w>=this.maxInitialReset)throw j;await Or(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===yn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new F1),this.consumer=new qf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===yn.Fetch&&a?h=await this.consumer.fetch(n):this.type===yn.Consume&&(h=await this.consumer.consume(n));const d=h;d.forOrderedConsumer=!0,d.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(d)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(wr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===yn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===yn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=yn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===yn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=yn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Uf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(Ue.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new qf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new qf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new th(a.nc,a.opts).info(n).then(f=>Promise.resolve(new J1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Fo{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Fo(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Uf(new zo(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Uf(new zo(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class th extends Pa{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Ue.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var d;if((((d=f==null?void 0:f.subject_transforms)==null?void 0:d.length)||0)>0){const{min:g,ok:y}=s.features.get(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=yo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(yo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var d;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=yo(o.mirror),o.sources=(d=o.sources)==null?void 0:d.map(yo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:d}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],E=s||{};let w=0;for(;h>g;){w++,E.offset=d*w;const q=await this._request(a,E);h=q.total,y.push(q);const M=Object.getOwnPropertyNames(q.state.subjects).length;if(g+=M,M<d)break}let j={};for(let q=0;q<y.length;q++)f=y[q],f.state.subjects&&(j=Object.assign(j,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=j}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(d=>{this._fixInfo(d)}),h.streams},o=`${this.prefix}.STREAM.LIST`;return new Na(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Tg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new jg(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Na(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(eh));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new zf(d))},s=`${this.prefix}.STREAM.LIST`;return new Na(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Na(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Fo(this,s))}}class Q1 extends Pa{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):nn,h=this.opts.apiPrefix||"$JS.API",d=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=vr(g);if(y)return Promise.reject(y);const E=new Bf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,d=await this.nc.requestMany(o,f,{strategy:Tn.SentinelMsg});return(async()=>{var w,j,q;let g=!1,y=!1,E;for await(const M of d){if(!g){g=!0;const D=((w=M.headers)==null?void 0:w.code)||0;if(D!==0&&D<200||D>299){E=(j=M.headers)==null?void 0:j.description.toLowerCase();break}if(((q=M.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Bf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Bf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(yr.Subject)}get seq(){const n=this.header.last(yr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(yr.TimeStamp)}get stream(){return this.header.last(yr.Stream)}json(n){return Nn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Bf,"jc");class I1 extends Pa{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new th(s,a),this.consumers=new zo(s,a),this.direct=new Q1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class Tg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Qs.decode(n)}else this._header=fs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return Nn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Tg,"jc");class X1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Fo(this.api,s))}}class gf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Qs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function N0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function K1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Da{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new gf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),d=Nn().decode(f.data);return d.revision=f.seq,d}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new zf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new zf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var re;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,d=this.js.nc.info,g=(d==null?void 0:d.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((re=n.options)==null?void 0:re.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const q=Ks.next(),M=this._chunkSubject(q),D=this._metaSubject(w),W=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},N0(n)),se=st(),ee=[],me=new Ar;try{const C=s?s.getReader():null,X=b0.create();for(;;){const{done:ce,value:V}=C?await C.read():{done:!0,value:void 0};if(ce){if(me.size()>0){const ne=me.drain();X.update(ne),W.chunks++,W.size+=ne.length,ee.push(this.js.publish(M,ne,{timeout:f}))}await Promise.all(ee),ee.length=0,W.mtime=new Date().toISOString();const G=_r.encode(X.digest());W.digest=`${j0}${G}`,W.deleted=!1;const K=fs();typeof h=="number"&&K.set(qn.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(D,Nn().encode(W),{headers:K,timeout:f});if(W.revision=ae.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}se.resolve(new gf(W));break}if(V)for(me.fill(V);me.size()>y;){W.chunks++,W.size+=y;const G=me.drain(n.options.max_chunk_size);X.update(G),ee.push(this.js.publish(M,G,{timeout:f}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:M}),se.reject(C)}return se}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Ar,d=f.getReader();for(;;){const{done:g,value:y}=await d.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Da.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(j0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Cf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new gf(s),error:o};if(s.size===0)return f.data=K1(),o.resolve(null),Promise.resolve(f);let h;const d=Is();d.orderedConsumer();const g=b0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,d);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(Lv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Da))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},d={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(d));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=Nn(),o=fs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const h=Object.assign({},a,N0(s)),d=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(d)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Nn(),h=Is();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(o,h);return a._data=d,a.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${_r.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=H1(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=qa.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new Da(s,o,n);return await f.init(a),Promise.resolve(f)}}class Z1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_KV);return o?s.bindOnly?Ba.bind(this.js,n,s):Ba.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_OBJECTSTORE);return o?Da.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class nh extends Pa{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new zo(s,a),this.streamAPI=new th(s,a),this.consumers=new Uf(this.consumerAPI),this.streams=new X1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new Z1(this)}async publish(s,a=nn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||fs();o&&(o.msgID&&f.set(qn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(qn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(qn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(qn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(qn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,d={};h&&(d.timeout=h),o&&(d.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let j=0;j<g;j++)try{E=await this.nc.request(s,a,d);break}catch(q){if(q.code==="503"&&j+1<g)await Or(y);else throw q}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),xr(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=vr(d);if(g)throw g;return La(d,this.timeout)}fetch(s,a,o={}){Mt(s),xr(a);let f=null;const h=(o.max_bytes??0)>0;let d=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const j=o.idle_heartbeat||0;j&&(E.idle_heartbeat=nt(j),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(j*4)));const q=new _t,M=E.batch;let D=0;q.protocolFilterFn=(ee,me=!1)=>jf(ee.msg)?(y==null||y.work(),!1):!0,q.dispatchedFn=ee=>{if(ee){if(h&&(d+=ee.data.length),D++,f&&ee.info.pending===0)return;(q.getPending()===1&&ee.info.pending===0||M===D||g>0&&d>=g)&&q.stop()}};const W=us(this.nc.options.inboxPrefix),se=this.nc.subscribe(W,{max:o.batch,callback:(ee,me)=>{ee===null&&(ee=vr(me)),ee!==null?(f&&(f.cancel(),f=null),vv(ee)?q.stop(Cg(ee)===null?void 0:ee):q.stop(ee)):(y==null||y.work(),q.received++,q.push(La(me,this.timeout)))}});return w&&(f=Sr(w),f.catch(()=>{se.isClosed()||(se.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new Wf(j,ee=>(q.push(()=>{q.err=new ue(`${bn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await se.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:W}),q}async pullSubscribe(s,a=Is()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(o),d=new n_(this,o.deliver,h);d.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Is()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new Ng(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Is()){const o=m0(a)?a.getOpts():a;if(o.isBind=m0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=us(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=o.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const d=f.config.deliver_group??"";if(h!==d)throw d===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${d}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||us(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=s_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=nh.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Of(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=a_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(vr(h.msg)||(g=f.monitor)==null||g.work(),jf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Of(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class sh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=_1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new sh(n);Uo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(d=>{d.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Ag(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=nn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||Tn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function d(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(us(this.options.inboxPrefix),{callback:(M,D)=>{var W,se;if(((W=D==null?void 0:D.data)==null?void 0:W.length)===0&&((se=D==null?void 0:D.headers)==null?void 0:se.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
48
48
 
49
- ${g}`),w(M);return}d(null,z),a.strategy===jn.Count&&(y--,y===0&&w()),a.strategy===jn.JitterTimer&&(q(),j=setTimeout(()=>{w()},300)),a.strategy===jn.SentinelMsg&&z&&z.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{h()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),q(),E.drain().then(()=>{h()}).catch(z=>{h()})};f.iterClosed.then(()=>{q(),E==null||E.unsubscribe()}).catch(M=>{q(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let j=setTimeout(()=>{w()},a.maxWait);const q=()=>{j&&clearTimeout(j)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new Lv(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(E){y.cancel(E)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new ue("timeout",ie.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new ue("reply can only be used with noMux",ie.InvalidOption));if(a.noMux){const f=a.reply?a.reply:us(this.options.inboxPrefix),h=st(),d=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(d&&y.code!==ie.Timeout&&(y.stack+=`
49
+ ${g}`),w(M);return}d(null,D),a.strategy===Tn.Count&&(y--,y===0&&w()),a.strategy===Tn.JitterTimer&&(q(),j=setTimeout(()=>{w()},300)),a.strategy===Tn.SentinelMsg&&D&&D.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{h()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),q(),E.drain().then(()=>{h()}).catch(D=>{h()})};f.iterClosed.then(()=>{q(),E==null||E.unsubscribe()}).catch(M=>{q(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let j=setTimeout(()=>{w()},a.maxWait);const q=()=>{j&&clearTimeout(j)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new Hv(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(E){y.cancel(E)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new ue("timeout",ie.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new ue("reply can only be used with noMux",ie.InvalidOption));if(a.noMux){const f=a.reply?a.reply:us(this.options.inboxPrefix),h=st(),d=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(d&&y.code!==ie.Timeout&&(y.stack+=`
50
50
 
51
- ${d.stack}`),g.unsubscribe(),h.reject(y)):(y=pg(E),y?(d&&(y.stack+=`
51
+ ${d.stack}`),g.unsubscribe(),h.reject(y)):(y=gg(E),y?(d&&(y.stack+=`
52
52
 
53
- ${d.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new bg(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(d){f.cancel(d)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new Q1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new th(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new Z1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class Z1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new $a(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new k1(this.nc,n,s)}}class W1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Uo)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class e_{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Xf(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Uo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Tg extends Yv{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=us(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const d=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(d,h,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(Xf(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=d=>{var E,w,j,q;const g=Sv(409,`${yn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((j=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(M+1),(q=this.monitor)==null||q.restart(),!1}return!f.noIterator};this.monitor=new Zf(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class t_ extends Tg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let d=0;n.expires&&n.expires>0&&(d=n.expires,h.expires=nt(d));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&d===0)throw new Error("idle_heartbeat requires expires");if(g>d)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),d&&g&&(this.monitor?this.monitor._change(g,d):this._setupHbMonitoring(g,d));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(h),{reply:w})}}}function n_(r,n){return r?i_(n):s_(n)}function s_(r){return(n,s)=>n?[n,null]:(n=vr(s),n?[n,null]:[null,La(s,r)])}function i_(r){return(n,s)=>{if(n)return[n,null];const a=vr(s);return a!==null?[Ng(a),null]:[null,La(s,r)]}}function Ng(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return Ev(r)?r:null;default:return r}return null}function r_(r){r&&r.ack()}function a_(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class l_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=a_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Ea[0]&&n[1]===Ea[1]&&n[2]===Ea[2]&&n[3]===Ea[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),d=new bg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,O0,{reply:`${f.muxSubscriptions.baseInbox}${d.token}`})}catch(g){d.cancel(g)}try{await Promise.race([d.timer,d.deferred]),s.resolve(!0)}catch(g){d.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(O0)}nak(n){let s=P1;n&&(s=Af().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Ea)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=Tn().encode(a),f=Ar.concat($1,G1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=Y1;(n==null?void 0:n.length)>0&&(s=Af().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const o_="1.30.3",c_="nats.ws";class u_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=o_,this.lang=c_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new ue("tls",ie.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Ar.concat(...this.yields),d=Iv(h);if(d!==""){const g=S1.exec(d);if(!g){s.debug&&console.error("!!!",mo(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);_1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,d=new ue(h.message,ie.Unknown,new Error(h.error));a.reject(d)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Or(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${mo(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${mo(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${mo(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function f_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const d=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${d}:${h}${g}${y}`}function h_(r={}){return Gv({defaultPort:443,urlParseFn:f_,factory:()=>new u_}),nh.connect(r)}const d_=null,m_=null,p_="lt.events";function Cg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Ya=T.createContext({connected:!1,subscribe:()=>()=>{}});function g_(){const{connected:r}=T.useContext(Ya);return{connected:r}}function y_(r,n){const{subscribe:s}=T.useContext(Ya),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const b_=T.createContext({connected:!1,subscribe:()=>()=>{}}),x_=Af();function v_({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),d=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((j,q)=>{const M=g.current;return M.has(j)||M.set(j,new Set),M.get(j).add(q),()=>{const z=M.get(j);z&&(z.delete(q),z.size===0&&M.delete(j))}},[]),E=T.useCallback((j,q)=>{for(const[M,z]of g.current)if(Cg(j,M))for(const G of z)try{G(q)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const j=n||d_;if(!j){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await h_({servers:j,token:s||m_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,h(!0);const M=q.subscribe("lt.>");o.current=M,(async()=>{for await(const z of M)try{const G=JSON.parse(x_.decode(z.data));E(z.subject,G)}catch{}})(),(async()=>{for await(const z of q.status())z.type==="disconnect"||z.type==="error"?h(!1):z.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),m.jsx(b_.Provider,{value:{connected:f,subscribe:y},children:m.jsx(Ya.Provider,{value:{connected:f,subscribe:y},children:r})})}const Ln=Object.create(null);Ln.open="0";Ln.close="1";Ln.ping="2";Ln.pong="3";Ln.message="4";Ln.upgrade="5";Ln.noop="6";const Ao=Object.create(null);Object.keys(Ln).forEach(r=>{Ao[Ln[r]]=r});const Lf={type:"error",data:"parser error"},kg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mg=typeof ArrayBuffer=="function",Rg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,sh=({type:r,data:n},s,a)=>kg&&n instanceof Blob?s?a(n):T0(n,a):Mg&&(n instanceof ArrayBuffer||Rg(n))?s?a(n):T0(new Blob([n]),a):a(Ln[r]+(n||"")),T0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function N0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let gf;function __(r,n){if(kg&&r.data instanceof Blob)return r.data.arrayBuffer().then(N0).then(n);if(Mg&&(r.data instanceof ArrayBuffer||Rg(r.data)))return n(N0(r.data));sh(r,!1,s=>{gf||(gf=new TextEncoder),n(gf.encode(s))})}const C0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ca=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<C0.length;r++)Ca[C0.charCodeAt(r)]=r;const w_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ca[r.charCodeAt(a)],h=Ca[r.charCodeAt(a+1)],d=Ca[r.charCodeAt(a+2)],g=Ca[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|d>>2,E[o++]=(d&3)<<6|g&63;return y},S_=typeof ArrayBuffer=="function",ih=(r,n)=>{if(typeof r!="string")return{type:"message",data:Dg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:E_(r.substring(1),n)}:Ao[s]?r.length>1?{type:Ao[s],data:r.substring(1)}:{type:Ao[s]}:Lf},E_=(r,n)=>{if(S_){const s=w_(r);return Dg(s,n)}else return{base64:!0,data:r}},Dg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},zg="",A_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{sh(f,!1,d=>{a[h]=d,++o===s&&n(a.join(zg))})})},O_=(r,n)=>{const s=r.split(zg),a=[];for(let o=0;o<s.length;o++){const f=ih(s[o],n);if(a.push(f),f.type==="error")break}return a};function j_(){return new TransformStream({transform(r,n){__(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let yf;function bo(r){return r.reduce((n,s)=>n+s.length,0)}function xo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function T_(r,n){yf||(yf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(bo(s)<1)break;const g=xo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(bo(s)<2)break;const g=xo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(bo(s)<8)break;const g=xo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){d.enqueue(Lf);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(bo(s)<o)break;const g=xo(s,o);d.enqueue(ih(f?g:yf.decode(g),n)),a=0}if(o===0||o>r){d.enqueue(Lf);break}}}})}const qg=4;function gt(r){if(r)return N_(r)}function N_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Fo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),bn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),C_="arraybuffer";function Ug(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const k_=bn.setTimeout,M_=bn.clearTimeout;function Jo(r,n){n.useNativeTimers?(r.setTimeoutFn=k_.bind(bn),r.clearTimeoutFn=M_.bind(bn)):(r.setTimeoutFn=bn.setTimeout.bind(bn),r.clearTimeoutFn=bn.clearTimeout.bind(bn))}const R_=1.33;function D_(r){return typeof r=="string"?z_(r):Math.ceil((r.byteLength||r.size)*R_)}function z_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Bg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function q_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function U_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class B_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class rh extends gt{constructor(n){super(),this.writable=!1,Jo(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new B_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=ih(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=q_(n);return s.length?"?"+s:""}}class L_ extends rh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};O_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,A_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Bg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Lg=!1;try{Lg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const H_=Lg;function P_(){}class $_ extends L_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Un extends gt{constructor(n,s,a){super(),this.createRequest=n,Jo(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Ug(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Un.requestsCount++,Un.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=P_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Un.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Un.requestsCount=0;Un.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",k0);else if(typeof addEventListener=="function"){const r="onpagehide"in bn?"pagehide":"unload";addEventListener(r,k0,!1)}}function k0(){for(let r in Un.requests)Un.requests.hasOwnProperty(r)&&Un.requests[r].abort()}const Y_=(function(){const r=Hg({xdomain:!1});return r&&r.responseType!==null})();class G_ extends $_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=Y_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Un(Hg,this.uri(),n)}}function Hg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||H_))return new XMLHttpRequest}catch{}if(!n)try{return new bn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Pg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class V_ extends rh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Pg?{}:Ug(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;sh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Fo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Bg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const bf=bn.WebSocket||bn.MozWebSocket;class F_ extends V_{createSocket(n,s,a){return Pg?new bf(n,s,a):s?new bf(n,s):new bf(n)}doWrite(n,s){this.ws.send(s)}}class J_ extends rh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=T_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=j_();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:d,value:g})=>{d||(this.onPacket(g),f())}).catch(d=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Fo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const Q_={websocket:F_,webtransport:J_,polling:G_},I_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,X_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Hf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let o=I_.exec(r||""),f={},h=14;for(;h--;)f[X_[h]]=o[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=K_(f,f.path),f.queryKey=Z_(f,f.query),f}function K_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function Z_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Pf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oo=[];Pf&&addEventListener("offline",()=>{Oo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=C_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Hf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Hf(s.host).host);Jo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=U_(this.opts.query)),Pf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Oo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=qg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=D_(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Fo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Pf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Oo.indexOf(this._offlineEventListener);a!==-1&&Oo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=qg;class W_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=s.name,this.emitReserved("upgradeError",j)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const j=new Error("probe error: "+w);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",h),s.once("close",d),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let ew=class extends W_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>Q_[o]).filter(o=>!!o)),super(n,a)}};function tw(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Hf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const nw=typeof ArrayBuffer=="function",sw=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,$g=Object.prototype.toString,iw=typeof Blob=="function"||typeof Blob<"u"&&$g.call(Blob)==="[object BlobConstructor]",rw=typeof File=="function"||typeof File<"u"&&$g.call(File)==="[object FileConstructor]";function ah(r){return nw&&(r instanceof ArrayBuffer||sw(r))||iw&&r instanceof Blob||rw&&r instanceof File}function jo(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(jo(r[s]))return!0;return!1}if(ah(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return jo(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&jo(r[s]))return!0;return!1}function aw(r){const n=[],s=r.data,a=r;return a.data=$f(s,n),a.attachments=n.length,{packet:a,buffers:n}}function $f(r,n){if(!r)return r;if(ah(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=$f(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=$f(r[a],n));return s}return r}function lw(r,n){return r.data=Yf(r.data,n),delete r.attachments,r}function Yf(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Yf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Yf(r[s],n));return r}const ow=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var De;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(De||(De={}));class cw{constructor(n){this.replacer=n}encode(n){return(n.type===De.EVENT||n.type===De.ACK)&&jo(n)?this.encodeAsBinary({type:n.type===De.EVENT?De.BINARY_EVENT:De.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===De.BINARY_EVENT||n.type===De.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=aw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class lh extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===De.BINARY_EVENT;a||s.type===De.BINARY_ACK?(s.type=a?De.EVENT:De.ACK,this.reconstructor=new uw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(ah(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(De[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===De.BINARY_EVENT||a.type===De.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const d=Number(h);if(!fw(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=d}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(lh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case De.CONNECT:return M0(s);case De.DISCONNECT:return s===void 0;case De.CONNECT_ERROR:return typeof s=="string"||M0(s);case De.EVENT:case De.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&ow.indexOf(s[0])===-1);case De.ACK:case De.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class uw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=lw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const fw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function M0(r){return Object.prototype.toString.call(r)==="[object Object]"}const hw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:lh,Encoder:cw,get PacketType(){return De}},Symbol.toStringTag,{value:"Module"}));function On(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const dw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Yg extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[On(n,"open",this.onopen.bind(this)),On(n,"packet",this.onpacket.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(dw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:De.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const d=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!d||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===n&&this.sendBuffer.splice(d,1);s.call(this,new Error("operation has timed out"))},o),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,d)=>h?o(h):a(d);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:De.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case De.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case De.EVENT:case De.BINARY_EVENT:this.onevent(n);break;case De.ACK:case De.BINARY_ACK:this.onack(n);break;case De.DISCONNECT:this.ondisconnect();break;case De.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:De.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:De.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function jr(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}jr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};jr.prototype.reset=function(){this.attempts=0};jr.prototype.setMin=function(r){this.ms=r};jr.prototype.setMax=function(r){this.max=r};jr.prototype.setJitter=function(r){this.jitter=r};class Gf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Jo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new jr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||hw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new ew(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=On(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=On(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(On(n,"ping",this.onping.bind(this)),On(n,"data",this.ondata.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this)),On(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){Fo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Yg(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Aa={};function To(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=tw(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Aa[o]&&f in Aa[o].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Gf(a,n):(Aa[o]||(Aa[o]=new Gf(a,n)),g=Aa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(To,{Manager:Gf,Socket:Yg,io:To,connect:To});const mw=T.createContext({connected:!1,subscribe:()=>()=>{}});function pw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.useCallback((d,g)=>{const y=o.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const E=y.get(d);E&&(E.delete(g),E.size===0&&y.delete(d))}},[]),h=T.useCallback((d,g)=>{for(const[y,E]of o.current)if(Cg(d,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const d=fg(),g=To({path:`${Bn}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...d?{auth:{token:d}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),m.jsx(mw.Provider,{value:{connected:s,subscribe:f},children:m.jsx(Ya.Provider,{value:{connected:s,subscribe:f},children:r})})}function gw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Bn}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,j=null;const q=fg();if(q)try{const M=await fetch(`${Bn}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(M.ok){const z=await M.json();w=z.natsWsUrl??w,j=z.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:j})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?m.jsx(v_,{url:a.url,token:a.token,children:r}):n==="socketio"?m.jsx(pw,{children:r}):m.jsx(m.Fragment,{children:r})}const Vf="lt_ai_override";function yw(){return Xe("/settings")}function Ff(){try{if(localStorage.getItem(Vf)==="off")return!1}catch{}return null}function bw(){var s;const r=Hn({queryKey:["settings"],queryFn:yw,staleTime:1/0}),n=Ff();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function xw(){const[r,n]=T.useState(()=>Ff()===!1),s=T.useCallback(()=>{const a=Ff()===!1;try{a?localStorage.removeItem(Vf):localStorage.setItem(Vf,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Gg=T.createContext(null),R0="lt_sidebar_collapsed";function vw({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(R0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(R0,String(f))}catch{}return f})},[]);return m.jsx(Gg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Vg(){const r=T.useContext(Gg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function RE(r){const n=r?`?period=${r}`:"";return Hn({queryKey:["escalationStats",r],queryFn:()=>Xe(`/escalations/stats${n}`)})}function DE(){return Hn({queryKey:["escalationTypes"],queryFn:()=>Xe("/escalations/types")})}function _w(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.status&&a.set("status",s.status),s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.assigned_to&&a.set("assigned_to",s.assigned_to),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),Hn({queryKey:["escalations",s],queryFn:()=>Xe(`/escalations?${a}`),enabled:n})}function ww(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),Hn({queryKey:["escalations","available",s],queryFn:()=>Xe(`/escalations/available?${a}`),enabled:n})}function zE(r){return Hn({queryKey:["escalations","by-workflow",r],queryFn:()=>Xe(`/escalations/by-workflow/${r}`),enabled:!!r})}function qE(r){return Hn({queryKey:["escalations",r],queryFn:()=>Xe(`/escalations/${r}`),enabled:!!r})}function UE(){const r=Nn();return Pn({mutationFn:({id:n,durationMinutes:s})=>Xe(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function BE(){const r=Nn();return Pn({mutationFn:n=>Xe(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function LE(){const r=Nn();return Pn({mutationFn:({id:n,resolverPayload:s})=>Xe(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"}),r.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),r.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function HE(){const r=Nn();return Pn({mutationFn:({id:n,targetRole:s})=>Xe(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function PE(){const r=Nn();return Pn({mutationFn:({ids:n,priority:s})=>Xe("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function $E(){const r=Nn();return Pn({mutationFn:({ids:n,durationMinutes:s})=>Xe("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function YE(){const r=Nn();return Pn({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Xe("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function GE(){const r=Nn();return Pn({mutationFn:({ids:n,targetRole:s})=>Xe("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function VE(){const r=Nn();return Pn({mutationFn:({ids:n,hint:s})=>Xe("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Sw(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=Nn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);y_(`${p_}.escalation.>`,o);const{data:f}=ww({limit:1}),{data:h}=_w({assigned_to:n,status:"pending",limit:200}),d=new Date,g=((h==null?void 0:h.escalations)??[]).filter(y=>y.assigned_until&&new Date(y.assigned_until)>d);return{available:(f==null?void 0:f.total)??0,mine:g.length}}function oh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return m.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[m.jsx("img",{src:`${Bn}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),m.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function Ew({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{available:o,mine:f}=Sw(),{connected:h}=g_(),{toggleAIOverride:d}=xw(),[g,y]=T.useState(!1),E=T.useRef(null);return T.useEffect(()=>{if(!g)return;const w=j=>{E.current&&!E.current.contains(j.target)&&y(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[g]),m.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[m.jsx("div",{className:"flex items-center gap-4",children:m.jsx(gr,{to:"/","aria-label":"Home",onClick:w=>{(w.ctrlKey||w.metaKey)&&(w.preventDefault(),d())},children:m.jsx(oh,{})})}),m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsxs(gr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${o>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[m.jsx(wx,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"all",o>0&&m.jsx("span",{className:"tabular-nums font-medium",children:o})]}),m.jsxs(gr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[m.jsx(Sx,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",f>0&&m.jsx("span",{className:"tabular-nums font-medium",children:f})]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),m.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1.5 text-[11px] transition-colors ${h?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:h?"Live events — click to toggle feed":"Events disconnected",children:[m.jsx(ig,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),m.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[m.jsx(rg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&m.jsxs("div",{className:"relative",ref:E,children:[m.jsxs("button",{onClick:()=>y(w=>!w),className:"btn-ghost text-xs flex items-center gap-1",children:[m.jsx(Ex,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,m.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),g&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[m.jsx(gr,{to:"/credentials",onClick:()=>y(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),m.jsx("button",{onClick:()=>{y(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function ch({open:r,children:n}){const[s,a]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),m.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:m.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function Jf(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function Aw(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function Ow({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(d=>s.startsWith(d)),[o,f]=T.useState(a),h=o||a;return n?m.jsx(m.Fragment,{children:r.items.map(d=>m.jsx(No,{to:d.to,className:Jf(!0),title:d.label,children:d.icon&&m.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>f(d=>!d),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[m.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:r.label})]}),m.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m.jsx(ch,{open:h,children:r.items.map(d=>m.jsxs(No,{to:d.to,end:d.end,className:Aw(),children:[d.icon&&m.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:d.label})]},d.to))})]})}function jw(r){return r.kind==="group"}function Tw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=Jf(n)({isActive:d});return m.jsxs(No,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}return m.jsxs(No,{to:r.to,end:r.end,className:Jf(n),title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}function Ga({heading:r,entries:n}){const{collapsed:s}=Vg();return m.jsxs("div",{className:"space-y-1",children:[s?m.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):m.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>jw(a)?m.jsx(Ow,{group:a,collapsed:s},a.label):m.jsx(Tw,{entry:a,collapsed:s},a.to))]})}function Nw({aiEnabled:r=!1}){const n=[{to:"/",label:"Recent Activity",icon:Ax,end:!0},{to:"/capabilities",label:"Capabilities",icon:Ox},{to:"/agents",label:r?"Agents":"Automations",icon:jx},{to:"/topics",label:"Topics",icon:ig}];return m.jsx(Ga,{heading:"Work",entries:n})}function Cw(){const r=[{kind:"group",label:"Durable Workflows",icon:Cx,matchPaths:["/workflows/registry","/workflows/start","/workflows/workers"],items:[{to:"/workflows/registry",label:"Configure",icon:Tx},{to:"/workflows/start",label:"Invoke",icon:Nx}]},{kind:"group",label:"Executions",icon:Rx,matchPaths:["/workflows/executions","/mcp/executions"],items:[{to:"/workflows/executions",label:"Workflow",icon:kx},{to:"/mcp/executions",label:"Pipelines",icon:Mx}]}];return m.jsx(Ga,{heading:"Build",entries:r})}const kw=[{to:"/mcp/queries",label:"Designer",icon:Dx},{to:"/mcp/servers",label:"Servers & Tools",icon:zx},{to:"/mcp/workflows",label:"Pipeline Tools",icon:qx}];function Mw(){return m.jsx(Ga,{heading:"Design",entries:kw})}const Rw=[{to:"/files",label:"Files",icon:Ux},{to:"/knowledge",label:"Knowledge",icon:Bx}];function Dw(){return m.jsx(Ga,{heading:"Storage",entries:Rw})}const zw=[{kind:"group",label:"Identity & Access",icon:Px,matchPaths:["/admin/users","/admin/roles"],items:[{to:"/admin/users",label:"Accounts",icon:Lx},{to:"/admin/roles",label:"Roles & Permissions",icon:Hx}]},{kind:"group",label:"Infrastructure",icon:Vx,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:$x},{to:"/admin/streams",label:"Messages",icon:Yx},{to:"/admin/maintenance",label:"DB Maintenance",icon:Gx}]}];function qw(){return m.jsx(Ga,{heading:"Admin",entries:zw})}const Fg="lt_event_feed_patterns";function Uw(r){if(r.startsWith("/topics/")){const n=decodeURIComponent(r.replace("/topics/",""));if(n&&!n.includes("/"))return`lt.events.${n}`}return r.startsWith("/escalations")?"lt.events.escalation.>":r.startsWith("/workflows")?"lt.events.workflow.>":r.startsWith("/agents")?"lt.events.agent.>":r.startsWith("/knowledge")?"lt.events.knowledge.>":r.startsWith("/files")?"lt.events.file.>":r==="/"?"lt.events.>":r.startsWith("/mcp")?"lt.events.activity.>":"lt.events.>"}function Bw(){try{const r=localStorage.getItem(Fg);return r?JSON.parse(r):[]}catch{return[]}}function xf(r){try{localStorage.setItem(Fg,JSON.stringify(r))}catch{}}function Lw(){const{pathname:r}=Ws(),[n,s]=T.useState(Bw),a=T.useMemo(()=>Uw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return xf(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return xf(E),E})},[]),d=T.useCallback(()=>{s([]),xf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:d}}function Hw({children:r,className:n=""}){return m.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const vf=280,D0="cubic-bezier(0.4, 0, 0.2, 1)",vo=40;function Pw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-vo*2,o=s-vo*2,f=r.width/a,h=r.height/o,d=r.left+r.width/2-(vo+a/2),g=r.top+r.height/2-(vo+o/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Jg({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),d=T.useRef(!1);T.useEffect(()=>{var j,q;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&o==="open"&&(h.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const j=q=>{q.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o,n]);const g=T.useCallback(j=>{j.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const j=setTimeout(()=>f(null),vf+50);return()=>clearTimeout(j)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?Pw(h.current):"none",w=y?0:1;return ng.createPortal(m.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${vf}ms ${D0}, opacity ${vf}ms ${D0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function $w({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Yw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Gw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function Vw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Fw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function Jw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function Qw(r){const n=r.trim().split(`
53
+ ${d.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new xg(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(d){f.cancel(d)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new I1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new nh(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new W1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class W1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new $a(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new M1(this.nc,n,s)}}class e_{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Bo)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class t_{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Kf(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Bo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ng extends Gv{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=us(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const d=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(d,h,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(Kf(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=d=>{var E,w,j,q;const g=Ev(409,`${bn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((j=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(M+1),(q=this.monitor)==null||q.restart(),!1}return!f.noIterator};this.monitor=new Wf(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class n_ extends Ng{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let d=0;n.expires&&n.expires>0&&(d=n.expires,h.expires=nt(d));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&d===0)throw new Error("idle_heartbeat requires expires");if(g>d)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),d&&g&&(this.monitor?this.monitor._change(g,d):this._setupHbMonitoring(g,d));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(h),{reply:w})}}}function s_(r,n){return r?r_(n):i_(n)}function i_(r){return(n,s)=>n?[n,null]:(n=vr(s),n?[n,null]:[null,La(s,r)])}function r_(r){return(n,s)=>{if(n)return[n,null];const a=vr(s);return a!==null?[Cg(a),null]:[null,La(s,r)]}}function Cg(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return Av(r)?r:null;default:return r}return null}function a_(r){r&&r.ack()}function l_(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class o_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=l_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Ea[0]&&n[1]===Ea[1]&&n[2]===Ea[2]&&n[3]===Ea[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),d=new xg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,T0,{reply:`${f.muxSubscriptions.baseInbox}${d.token}`})}catch(g){d.cancel(g)}try{await Promise.race([d.timer,d.deferred]),s.resolve(!0)}catch(g){d.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(T0)}nak(n){let s=$1;n&&(s=Af().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Ea)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=Nn().encode(a),f=Ar.concat(Y1,V1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=G1;(n==null?void 0:n.length)>0&&(s=Af().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const c_="1.30.3",u_="nats.ws";class f_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=c_,this.lang=u_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new ue("tls",ie.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Ar.concat(...this.yields),d=Xv(h);if(d!==""){const g=E1.exec(d);if(!g){s.debug&&console.error("!!!",mo(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);w1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,d=new ue(h.message,ie.Unknown,new Error(h.error));a.reject(d)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Or(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${mo(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${mo(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${mo(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function h_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const d=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${d}:${h}${g}${y}`}function d_(r={}){return Vv({defaultPort:443,urlParseFn:h_,factory:()=>new f_}),sh.connect(r)}const m_=null,p_=null,g_="lt.events";function kg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Ya=T.createContext({connected:!1,subscribe:()=>()=>{}});function y_(){const{connected:r}=T.useContext(Ya);return{connected:r}}function b_(r,n){const{subscribe:s}=T.useContext(Ya),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const x_=T.createContext({connected:!1,subscribe:()=>()=>{}}),v_=Af();function __({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),d=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((j,q)=>{const M=g.current;return M.has(j)||M.set(j,new Set),M.get(j).add(q),()=>{const D=M.get(j);D&&(D.delete(q),D.size===0&&M.delete(j))}},[]),E=T.useCallback((j,q)=>{for(const[M,D]of g.current)if(kg(j,M))for(const W of D)try{W(q)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const j=n||m_;if(!j){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await d_({servers:j,token:s||p_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,h(!0);const M=q.subscribe("lt.>");o.current=M,(async()=>{for await(const D of M)try{const W=JSON.parse(v_.decode(D.data));E(D.subject,W)}catch{}})(),(async()=>{for await(const D of q.status())D.type==="disconnect"||D.type==="error"?h(!1):D.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),m.jsx(x_.Provider,{value:{connected:f,subscribe:y},children:m.jsx(Ya.Provider,{value:{connected:f,subscribe:y},children:r})})}const Ln=Object.create(null);Ln.open="0";Ln.close="1";Ln.ping="2";Ln.pong="3";Ln.message="4";Ln.upgrade="5";Ln.noop="6";const Oo=Object.create(null);Object.keys(Ln).forEach(r=>{Oo[Ln[r]]=r});const Lf={type:"error",data:"parser error"},Mg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Rg=typeof ArrayBuffer=="function",Dg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,ih=({type:r,data:n},s,a)=>Mg&&n instanceof Blob?s?a(n):C0(n,a):Rg&&(n instanceof ArrayBuffer||Dg(n))?s?a(n):C0(new Blob([n]),a):a(Ln[r]+(n||"")),C0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function k0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let yf;function w_(r,n){if(Mg&&r.data instanceof Blob)return r.data.arrayBuffer().then(k0).then(n);if(Rg&&(r.data instanceof ArrayBuffer||Dg(r.data)))return n(k0(r.data));ih(r,!1,s=>{yf||(yf=new TextEncoder),n(yf.encode(s))})}const M0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ca=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<M0.length;r++)Ca[M0.charCodeAt(r)]=r;const S_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ca[r.charCodeAt(a)],h=Ca[r.charCodeAt(a+1)],d=Ca[r.charCodeAt(a+2)],g=Ca[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|d>>2,E[o++]=(d&3)<<6|g&63;return y},E_=typeof ArrayBuffer=="function",rh=(r,n)=>{if(typeof r!="string")return{type:"message",data:zg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:A_(r.substring(1),n)}:Oo[s]?r.length>1?{type:Oo[s],data:r.substring(1)}:{type:Oo[s]}:Lf},A_=(r,n)=>{if(E_){const s=S_(r);return zg(s,n)}else return{base64:!0,data:r}},zg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},qg="",O_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{ih(f,!1,d=>{a[h]=d,++o===s&&n(a.join(qg))})})},j_=(r,n)=>{const s=r.split(qg),a=[];for(let o=0;o<s.length;o++){const f=rh(s[o],n);if(a.push(f),f.type==="error")break}return a};function T_(){return new TransformStream({transform(r,n){w_(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let bf;function bo(r){return r.reduce((n,s)=>n+s.length,0)}function xo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function N_(r,n){bf||(bf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(bo(s)<1)break;const g=xo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(bo(s)<2)break;const g=xo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(bo(s)<8)break;const g=xo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){d.enqueue(Lf);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(bo(s)<o)break;const g=xo(s,o);d.enqueue(rh(f?g:bf.decode(g),n)),a=0}if(o===0||o>r){d.enqueue(Lf);break}}}})}const Ug=4;function gt(r){if(r)return C_(r)}function C_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Jo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),xn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),k_="arraybuffer";function Bg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const M_=xn.setTimeout,R_=xn.clearTimeout;function Qo(r,n){n.useNativeTimers?(r.setTimeoutFn=M_.bind(xn),r.clearTimeoutFn=R_.bind(xn)):(r.setTimeoutFn=xn.setTimeout.bind(xn),r.clearTimeoutFn=xn.clearTimeout.bind(xn))}const D_=1.33;function z_(r){return typeof r=="string"?q_(r):Math.ceil((r.byteLength||r.size)*D_)}function q_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Lg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function U_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function B_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class L_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class ah extends gt{constructor(n){super(),this.writable=!1,Qo(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new L_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=rh(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=U_(n);return s.length?"?"+s:""}}class H_ extends ah{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};j_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,O_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Lg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Hg=!1;try{Hg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const P_=Hg;function $_(){}class Y_ extends H_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Bn extends gt{constructor(n,s,a){super(),this.createRequest=n,Qo(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Bg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Bn.requestsCount++,Bn.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=$_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Bn.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Bn.requestsCount=0;Bn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",R0);else if(typeof addEventListener=="function"){const r="onpagehide"in xn?"pagehide":"unload";addEventListener(r,R0,!1)}}function R0(){for(let r in Bn.requests)Bn.requests.hasOwnProperty(r)&&Bn.requests[r].abort()}const G_=(function(){const r=Pg({xdomain:!1});return r&&r.responseType!==null})();class V_ extends Y_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=G_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Bn(Pg,this.uri(),n)}}function Pg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||P_))return new XMLHttpRequest}catch{}if(!n)try{return new xn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const $g=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class F_ extends ah{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=$g?{}:Bg(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;ih(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Lg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const xf=xn.WebSocket||xn.MozWebSocket;class J_ extends F_{createSocket(n,s,a){return $g?new xf(n,s,a):s?new xf(n,s):new xf(n)}doWrite(n,s){this.ws.send(s)}}class Q_ extends ah{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=N_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=T_();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:d,value:g})=>{d||(this.onPacket(g),f())}).catch(d=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const I_={websocket:J_,webtransport:Q_,polling:V_},X_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,K_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Hf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let o=X_.exec(r||""),f={},h=14;for(;h--;)f[K_[h]]=o[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=Z_(f,f.path),f.queryKey=W_(f,f.query),f}function Z_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function W_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Pf=typeof addEventListener=="function"&&typeof removeEventListener=="function",jo=[];Pf&&addEventListener("offline",()=>{jo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=k_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Hf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Hf(s.host).host);Qo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=B_(this.opts.query)),Pf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},jo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Ug,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=z_(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Jo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Pf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=jo.indexOf(this._offlineEventListener);a!==-1&&jo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=Ug;class ew extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=s.name,this.emitReserved("upgradeError",j)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const j=new Error("probe error: "+w);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",h),s.once("close",d),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let tw=class extends ew{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>I_[o]).filter(o=>!!o)),super(n,a)}};function nw(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Hf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const sw=typeof ArrayBuffer=="function",iw=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Yg=Object.prototype.toString,rw=typeof Blob=="function"||typeof Blob<"u"&&Yg.call(Blob)==="[object BlobConstructor]",aw=typeof File=="function"||typeof File<"u"&&Yg.call(File)==="[object FileConstructor]";function lh(r){return sw&&(r instanceof ArrayBuffer||iw(r))||rw&&r instanceof Blob||aw&&r instanceof File}function To(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(To(r[s]))return!0;return!1}if(lh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return To(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&To(r[s]))return!0;return!1}function lw(r){const n=[],s=r.data,a=r;return a.data=$f(s,n),a.attachments=n.length,{packet:a,buffers:n}}function $f(r,n){if(!r)return r;if(lh(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=$f(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=$f(r[a],n));return s}return r}function ow(r,n){return r.data=Yf(r.data,n),delete r.attachments,r}function Yf(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Yf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Yf(r[s],n));return r}const cw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var qe;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(qe||(qe={}));class uw{constructor(n){this.replacer=n}encode(n){return(n.type===qe.EVENT||n.type===qe.ACK)&&To(n)?this.encodeAsBinary({type:n.type===qe.EVENT?qe.BINARY_EVENT:qe.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===qe.BINARY_EVENT||n.type===qe.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=lw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class oh extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===qe.BINARY_EVENT;a||s.type===qe.BINARY_ACK?(s.type=a?qe.EVENT:qe.ACK,this.reconstructor=new fw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(lh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(qe[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===qe.BINARY_EVENT||a.type===qe.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const d=Number(h);if(!hw(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=d}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(oh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case qe.CONNECT:return D0(s);case qe.DISCONNECT:return s===void 0;case qe.CONNECT_ERROR:return typeof s=="string"||D0(s);case qe.EVENT:case qe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&cw.indexOf(s[0])===-1);case qe.ACK:case qe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class fw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=ow(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const hw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function D0(r){return Object.prototype.toString.call(r)==="[object Object]"}const dw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:oh,Encoder:uw,get PacketType(){return qe}},Symbol.toStringTag,{value:"Module"}));function jn(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const mw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Gg extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[jn(n,"open",this.onopen.bind(this)),jn(n,"packet",this.onpacket.bind(this)),jn(n,"error",this.onerror.bind(this)),jn(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(mw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:qe.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const d=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!d||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===n&&this.sendBuffer.splice(d,1);s.call(this,new Error("operation has timed out"))},o),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,d)=>h?o(h):a(d);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:qe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case qe.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case qe.EVENT:case qe.BINARY_EVENT:this.onevent(n);break;case qe.ACK:case qe.BINARY_ACK:this.onack(n);break;case qe.DISCONNECT:this.ondisconnect();break;case qe.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:qe.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:qe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function jr(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}jr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};jr.prototype.reset=function(){this.attempts=0};jr.prototype.setMin=function(r){this.ms=r};jr.prototype.setMax=function(r){this.max=r};jr.prototype.setJitter=function(r){this.jitter=r};class Gf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Qo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new jr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||dw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new tw(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=jn(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=jn(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(jn(n,"ping",this.onping.bind(this)),jn(n,"data",this.ondata.bind(this)),jn(n,"error",this.onerror.bind(this)),jn(n,"close",this.onclose.bind(this)),jn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){Jo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Gg(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Aa={};function No(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=nw(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Aa[o]&&f in Aa[o].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Gf(a,n):(Aa[o]||(Aa[o]=new Gf(a,n)),g=Aa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(No,{Manager:Gf,Socket:Gg,io:No,connect:No});const pw=T.createContext({connected:!1,subscribe:()=>()=>{}});function gw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.useCallback((d,g)=>{const y=o.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const E=y.get(d);E&&(E.delete(g),E.size===0&&y.delete(d))}},[]),h=T.useCallback((d,g)=>{for(const[y,E]of o.current)if(kg(d,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const d=hg(),g=No({path:`${Wt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...d?{auth:{token:d}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),m.jsx(pw.Provider,{value:{connected:s,subscribe:f},children:m.jsx(Ya.Provider,{value:{connected:s,subscribe:f},children:r})})}function yw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Wt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,j=null;const q=hg();if(q)try{const M=await fetch(`${Wt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(M.ok){const D=await M.json();w=D.natsWsUrl??w,j=D.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:j})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?m.jsx(__,{url:a.url,token:a.token,children:r}):n==="socketio"?m.jsx(gw,{children:r}):m.jsx(m.Fragment,{children:r})}function Vg(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),a=r||s("engineer"),o=n("admin"),f=r||n("admin");return{isBuilder:a,isOps:o,canBulk:f}}const Vf="lt_ai_override";function bw(){return Xe("/settings")}function Ff(){try{if(localStorage.getItem(Vf)==="off")return!1}catch{}return null}function xw(){var s;const r=Hn({queryKey:["settings"],queryFn:bw,staleTime:1/0}),n=Ff();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function vw(){const[r,n]=T.useState(()=>Ff()===!1),s=T.useCallback(()=>{const a=Ff()===!1;try{a?localStorage.removeItem(Vf):localStorage.setItem(Vf,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Fg=T.createContext(null),z0="lt_sidebar_collapsed";function _w({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(z0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(z0,String(f))}catch{}return f})},[]);return m.jsx(Fg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Jg(){const r=T.useContext(Fg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function RE(r){const n=r?`?period=${r}`:"";return Hn({queryKey:["escalationStats",r],queryFn:()=>Xe(`/escalations/stats${n}`)})}function DE(){return Hn({queryKey:["escalationTypes"],queryFn:()=>Xe("/escalations/types")})}function ww(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),Hn({queryKey:["escalations",a],queryFn:()=>Xe(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function Sw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),Hn({queryKey:["escalations","available",a],queryFn:()=>Xe(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function zE(r){return Hn({queryKey:["escalations","by-workflow",r],queryFn:()=>Xe(`/escalations/by-workflow/${r}`),enabled:!!r})}function qE(r){return Hn({queryKey:["escalations",r],queryFn:()=>Xe(`/escalations/${r}`),enabled:!!r})}function UE(){const r=Cn();return Pn({mutationFn:({id:n,durationMinutes:s})=>Xe(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function BE(){const r=Cn();return Pn({mutationFn:n=>Xe(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function LE(){const r=Cn();return Pn({mutationFn:({id:n,resolverPayload:s})=>Xe(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function HE(){const r=Cn();return Pn({mutationFn:({id:n,targetRole:s})=>Xe(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function PE(){const r=Cn();return Pn({mutationFn:({ids:n,priority:s})=>Xe("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function $E(){const r=Cn();return Pn({mutationFn:({ids:n,durationMinutes:s})=>Xe("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function YE(){const r=Cn();return Pn({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Xe("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function GE(){const r=Cn();return Pn({mutationFn:({ids:n,targetRole:s})=>Xe("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function VE(){const r=Cn();return Pn({mutationFn:({ids:n,hint:s})=>Xe("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Ew(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=Cn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);b_(`${g_}.system.escalation.>`,o);const{data:f}=Sw({limit:1}),{data:h}=ww({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(h==null?void 0:h.total)??0}}function ch({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return m.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[m.jsx("img",{src:`${Wt}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),m.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function Aw({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{isBuilder:o}=Vg(),{available:f,mine:h}=Ew(),{connected:d}=y_(),{toggleAIOverride:g}=vw(),[y,E]=T.useState(!1),w=T.useRef(null);return T.useEffect(()=>{if(!y)return;const j=q=>{w.current&&!w.current.contains(q.target)&&E(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[y]),m.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[m.jsx("div",{className:"flex items-center gap-4",children:m.jsx(gr,{to:"/","aria-label":"Home",onClick:j=>{(j.ctrlKey||j.metaKey)&&(j.preventDefault(),g())},children:m.jsx(ch,{})})}),m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsxs(gr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[m.jsx(Zp,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"available",f>0&&m.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),m.jsxs(gr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${h>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[m.jsx(Zp,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",h>0&&m.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:h})]}),o&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"w-px h-4 bg-surface-border"}),m.jsxs("button",{type:"button",onClick:()=>{d?r==null||r():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${d?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:d?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[m.jsx(ag,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),m.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[m.jsx(lg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&m.jsxs("div",{className:"relative",ref:w,children:[m.jsxs("button",{onClick:()=>E(j=>!j),className:"btn-ghost text-xs flex items-center gap-1",children:[m.jsx(Ax,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,m.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[m.jsx(gr,{to:"/credentials",onClick:()=>E(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),m.jsx("button",{onClick:()=>{E(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function uh({open:r,children:n}){const[s,a]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),m.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:m.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function Jf(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function Ow(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function jw({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(d=>s.startsWith(d)),[o,f]=T.useState(a),h=o||a;return n?m.jsx(m.Fragment,{children:r.items.map(d=>m.jsx(Co,{to:d.to,className:Jf(!0),title:d.label,children:d.icon&&m.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>f(d=>!d),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[m.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:r.label})]}),m.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m.jsx(uh,{open:h,children:r.items.map(d=>m.jsxs(Co,{to:d.to,end:d.end,className:Ow(),children:[d.icon&&m.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:d.label})]},d.to))})]})}function Tw(r){return r.kind==="group"}function Nw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=Jf(n)({isActive:d});return m.jsxs(Co,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}return m.jsxs(Co,{to:r.to,end:r.end,className:Jf(n),title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}function Ga({heading:r,entries:n}){const{collapsed:s}=Jg();return m.jsxs("div",{className:"space-y-1",children:[s?m.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):m.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>Tw(a)?m.jsx(jw,{group:a,collapsed:s},a.label):m.jsx(Nw,{entry:a,collapsed:s},a.to))]})}function Cw({aiEnabled:r=!1,isBuilder:n=!1}){const s=[{to:"/",label:"Recent Activity",icon:Ox,end:!0}];return n&&s.push({to:"/capabilities",label:"Capabilities",icon:jx},{to:"/agents",label:r?"Agents":"Automations",icon:Tx},{to:"/topics",label:"Topics",icon:ag}),m.jsx(Ga,{heading:"Work",entries:s})}function kw(){const r=[{kind:"group",label:"Workflows",icon:kx,matchPaths:["/workflows/registry","/workflows/start","/workflows/workers"],items:[{to:"/workflows/registry",label:"Configure",icon:Nx},{to:"/workflows/start",label:"Invoke",icon:Cx}]},{kind:"group",label:"Executions",icon:Dx,matchPaths:["/workflows/executions","/mcp/executions"],items:[{to:"/workflows/executions",label:"Workflows",icon:Mx},{to:"/mcp/executions",label:"Pipelines",icon:Rx}]}];return m.jsx(Ga,{heading:"Build",entries:r})}const Mw=[{to:"/mcp/queries",label:"Designer",icon:zx},{to:"/mcp/servers",label:"Servers & Tools",icon:qx},{to:"/mcp/workflows",label:"Pipeline Tools",icon:Ux}];function Rw(){return m.jsx(Ga,{heading:"Design",entries:Mw})}const Dw=[{to:"/files",label:"Files",icon:Bx},{to:"/knowledge",label:"Knowledge",icon:Lx}];function zw(){return m.jsx(Ga,{heading:"Storage",entries:Dw})}function qw({isBuilder:r=!1}){const n=[{to:"/admin/users",label:"Accounts",icon:Hx},...r?[{to:"/admin/roles",label:"Roles & Permissions",icon:Px}]:[]],s=[{kind:"group",label:"Identity & Access",icon:$x,matchPaths:n.map(a=>a.to),items:n}];return r&&s.push({kind:"group",label:"Infrastructure",icon:Fx,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:Yx},{to:"/admin/streams",label:"Messages",icon:Gx},{to:"/admin/maintenance",label:"DB Maintenance",icon:Vx}]}),m.jsx(Ga,{heading:"Admin",entries:s})}const Qg="lt_event_feed_patterns";function Uw(r){if(r.startsWith("/topics/")){const f=decodeURIComponent(r.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=r.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(r.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=r.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const o=r.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.activity.${o[1]}.>`:r.startsWith("/mcp")?"lt.events.system.activity.>":"lt.events.system.>"}function Bw(){try{const r=localStorage.getItem(Qg);return r?JSON.parse(r):[]}catch{return[]}}function vf(r){try{localStorage.setItem(Qg,JSON.stringify(r))}catch{}}function Lw(){const{pathname:r}=Ws(),[n,s]=T.useState(Bw),a=T.useMemo(()=>Uw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return vf(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return vf(E),E})},[]),d=T.useCallback(()=>{s([]),vf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:d}}function Hw({children:r,className:n=""}){return m.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const _f=280,q0="cubic-bezier(0.4, 0, 0.2, 1)",vo=40;function Pw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-vo*2,o=s-vo*2,f=r.width/a,h=r.height/o,d=r.left+r.width/2-(vo+a/2),g=r.top+r.height/2-(vo+o/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Ig({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),d=T.useRef(!1);T.useEffect(()=>{var j,q;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&o==="open"&&(h.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const j=q=>{q.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o,n]);const g=T.useCallback(j=>{j.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const j=setTimeout(()=>f(null),_f+50);return()=>clearTimeout(j)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?Pw(h.current):"none",w=y?0:1;return ig.createPortal(m.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${_f}ms ${q0}, opacity ${_f}ms ${q0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function $w({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Yw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Gw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function Vw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Fw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function Jw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function Qw(r){const n=r.trim().split(`
54
54
  `);if(n.length<2)return r;const s=d=>d.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),o=n.slice(2),f=a.map(d=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${d}</th>`).join(""),h=o.map(d=>`<tr class="border-t border-surface-border">${s(d).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${h}</tbody></table>`}function _o(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Iw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,w)=>Qw(`${y}
55
55
  ${E}
56
- ${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${_o(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${_o(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${_o(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${_o(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",d=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let w=y,j;for(;(j=d.exec(w))!==null;){const q=j.index+j[0].length;E.push(w.slice(0,q)),w=w.slice(q).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&E.push(w),E.map(q=>{const M=q.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Xw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Kw(r){return Xw.test(r)}function uh({content:r,className:n,onClick:s}){const a=T.useMemo(()=>Iw(r),[r]);return m.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Bo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[d,g]=T.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return m.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>m.jsxs("div",{children:[m.jsx(Bo,{data:y,depth:n+1,generation:s}),E<r.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?m.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],j)=>m.jsxs("div",{children:[m.jsx("span",{className:"text-text-secondary",children:E}),m.jsx("span",{className:"text-text-tertiary",children:": "}),m.jsx(Bo,{data:w,depth:n+1,generation:s}),j<y.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return m.jsx("span",{children:String(r)})}function za({data:r,depth:n=0}){if(r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Kw(r)?m.jsx(uh,{content:r}):m.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):m.jsx("div",{className:"space-y-2",children:r.map((s,a)=>m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),m.jsx("div",{className:"flex-1",children:m.jsx(za,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):m.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return m.jsxs("div",{children:[m.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?m.jsx("p",{className:"text-sm text-text-primary",children:m.jsx(za,{data:o,depth:n+1})}):m.jsx(za,{data:o,depth:n+1})]},a)})})}return m.jsx("span",{children:String(r)})}function z0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return m.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&m.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?m.jsx(Jw,{className:y}):m.jsx(Fw,{className:y})}),m.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?m.jsx($w,{className:y}):m.jsx(Yw,{className:y})}),m.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?m.jsx(Vw,{className:`${y} text-status-success`}):m.jsx(Gw,{className:y})}),h&&m.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:m.jsx(ag,{className:y})}),d&&m.jsx("button",{onClick:d,className:E,title:"Close (Esc)",children:m.jsx(lg,{className:y})})]})}function Zw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,d]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[j,q]=T.useState(a?0:1),[M,z]=T.useState(1),G=j%2===0,ne=M%2===0,ee=T.useCallback(()=>q(Z=>Z+1),[]),pe=T.useCallback(()=>z(Z=>Z+1),[]);let ae=r;if(typeof r=="string")try{ae=JSON.parse(r)}catch{}const k=async()=>{const Z=typeof r=="string"?r:JSON.stringify(ae,null,2);await navigator.clipboard.writeText(Z),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{z(1),w(!0)},[]),se=s==="panel",W=se?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",F=se?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return m.jsxs("div",{className:W,children:[n&&m.jsx(Hw,{children:n}),m.jsxs("div",{ref:f,className:"relative",children:[m.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:m.jsx(z0,{mode:h,setMode:d,isCollapsed:G,onToggleCollapse:ee,onCopy:k,copied:g,onFullscreen:X})}),m.jsx("div",{className:F,children:h==="json"?m.jsx(Bo,{data:ae,generation:j}):m.jsx(za,{data:ae})})]}),m.jsxs(Jg,{open:E,onClose:()=>w(!1),sourceRef:f,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx(z0,{mode:h,setMode:d,isCollapsed:ne,onToggleCollapse:pe,onCopy:k,copied:g,onClose:()=>w(!1),large:!0})}),m.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?m.jsx(Bo,{data:ae,generation:M}):m.jsx(za,{data:ae})})]})]})}const Ww=100,q0=500;let eS=0;const Qg={"escalation.created":"text-status-warning","escalation.claimed":"text-blue-400","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function U0({event:r,forceExpanded:n=!1}){var j,q;const[s,a]=T.useState(n),o=Qg[r.type]||"text-text-tertiary";T.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",d=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return m.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[m.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[m.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),m.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),m.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(j=r.data)!=null&&j.workflowId?String(r.data.workflowId):"",(q=r.data)!=null&&q.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),m.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),m.jsx(ch,{open:s,children:m.jsx("div",{className:w,children:m.jsx(Zw,{data:r.data})})})]})}function tS({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,d]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:j}=T.useContext(Ya),{patterns:q,pagePattern:M,userPatterns:z,addPattern:G,removePattern:ne}=Lw(),ee=T.useCallback(ae=>{const k=String(ae.type||"unknown");if(k.startsWith("mesh."))return;const X=`${k}:${ae.timestamp||""}:${ae.escalationId||ae.workflowId||ae.taskId||""}`,se=Date.now(),W=w.current.get(X);if(!(W&&se-W<q0)){if(w.current.set(X,se),w.current.size>200)for(const[F,Z]of w.current)se-Z>q0*2&&w.current.delete(F);f(F=>[{id:++eS,type:k,timestamp:ae.timestamp||new Date().toISOString(),data:ae},...F].slice(0,Ww))}},[]),pe=T.useRef(ee);return pe.current=ee,T.useEffect(()=>{const ae=q.map(k=>j(k,X=>pe.current(X)));return()=>ae.forEach(k=>k())},[j,q.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),m.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[m.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?m.jsx(Fx,{className:"w-3 h-3 text-text-tertiary"}):m.jsx(Jx,{className:"w-3 h-3 text-text-tertiary"}),m.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&m.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&m.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Qg[o[0].type]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),m.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[m.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:ae=>{ae.stopPropagation(),a()},children:m.jsx(Qx,{className:"w-3 h-3"})}),o.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:ae=>{ae.stopPropagation(),d(!0)},children:m.jsx(ag,{className:"w-3 h-3"})}),m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:ae=>{ae.stopPropagation(),f([])},children:m.jsx(Ix,{className:"w-3 h-3"})})]})]})]}),s&&m.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[m.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),m.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),z.map(ae=>m.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[ae.replace("lt.events.",""),m.jsx("button",{onClick:()=>ne(ae),className:"text-text-quaternary hover:text-status-error",children:m.jsx(Po,{className:"w-2 h-2"})})]},ae))]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",value:g,onChange:ae=>y(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&g.trim()&&(G(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),m.jsxs("button",{onClick:()=>{g.trim()&&(G(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[m.jsx(Xx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),m.jsx(ch,{open:r,children:m.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?m.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(ae=>m.jsx(U0,{event:ae},ae.id))})}),m.jsxs(Jg,{open:h,onClose:()=>d(!1),sourceRef:E,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx("button",{onClick:()=>d(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:m.jsx(lg,{className:"w-5 h-5"})})}),o.length===0?m.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(ae=>m.jsx(U0,{event:ae,forceExpanded:!0},ae.id))]})]})}function nS(){return Hn({queryKey:["docs"],queryFn:()=>Xe("/docs"),staleTime:5*6e4})}function sS(r){return Hn({queryKey:["docs",r],queryFn:()=>Xe(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function iS(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),d=T.useRef(r),g=T.useRef(s);h.current=o,d.current=r,g.current=s;const y=T.useCallback((M,z)=>{var ne;const G=h.current;if(G){const ee=((ne=z==null?void 0:z.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...G,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const z=d.current;if(z.length===0)return;const G=z[z.length-1],ne=h.current;if(ne){const pe=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...ne,scrollTop:pe}])}n(z.slice(0,-1)),f(G),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=G.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const z=g.current;if(z.length===0)return;const G=z[z.length-1],ne=h.current;if(ne){const pe=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...d.current,{...ne,scrollTop:pe}])}a(z.slice(0,-1)),f(G),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=G.scrollTop)})},[]),j=T.useCallback(M=>{var ne,ee;const z=h.current;if(!z)return;const G=((ne=M==null?void 0:M.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...z,scrollTop:G}]),a([]),f({...z,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),q=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:j,reset:q}}function rS(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);o=d.join("/")}return{path:o,anchor:a}}function aS(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function lS(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function oS({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const E=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=rS(g.dataset.docLink,n);s(E,w);return}};return m.jsx(uh,{content:r,className:"docs-content",onClick:o})}function cS(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const d=o[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function uS({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=cS(r),f=d=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===d?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(d,g){return m.jsxs("details",{open:!0,children:[m.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[m.jsx(Kx,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),m.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>m.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return m.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>m.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...o.values()].map(d=>h(d))]})}function fS({open:r,onClose:n}){var se,W,F;const[s,a]=T.useState(!1),{data:o}=nS(),f=iS(),{data:h,isLoading:d}=sS(((se=f.current)==null?void 0:se.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var le;const Z=(le=g.current)==null?void 0:le.querySelector(`#${CSS.escape(y)}`);Z==null||Z.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var re;const Z=aS(window.location.hash),le=(Z==null?void 0:Z.path)??"README.md";((re=f.current)==null?void 0:re.path)!==le&&f.navigate(le,g),Z!=null&&Z.anchor&&E(Z.anchor)},[f]),j=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const Z=lS(f.current.path);window.location.hash!==Z&&window.history.replaceState(null,"",window.location.pathname+window.location.search+Z)},[r,(W=f.current)==null?void 0:W.path]),T.useEffect(()=>{if(!r)return;const Z=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",Z),()=>window.removeEventListener("hashchange",Z)},[r,w]);const q=T.useCallback((Z,le)=>{le&&E(le),f.navigate(Z,g)},[f]),M=T.useCallback(Z=>{f.navigate(Z,g)},[f]),z=T.useCallback(()=>{f.goBack(g)},[f]),G=T.useCallback(()=>{f.goForward(g)},[f]),ne=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){j.current=!0,w();const Z=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(Z)}},[r]),!(r||s))return null;const pe=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},ae=((F=f.current)==null?void 0:F.path)??null,k=f.backStack.length>0,X=f.forwardStack.length>0;return m.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[m.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:pe}),m.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{onClick:z,disabled:!k,className:`p-0.5 transition-colors ${k?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:m.jsx(Zx,{className:"w-4 h-4"})}),m.jsx("button",{onClick:G,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:m.jsx(Kp,{className:"w-4 h-4"})}),m.jsx(rg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),m.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),m.jsx("button",{onClick:pe,className:"p-1 text-text-tertiary hover:text-text-primary",children:m.jsx(Po,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?m.jsx(uS,{docs:o.docs,selected:ae,onSelect:M}):m.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),m.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:ae?d?m.jsxs("div",{className:"animate-pulse space-y-2",children:[m.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?m.jsx(oS,{content:h.content,currentPath:ae,onNavigate:q,onAnchorClick:ne}):m.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[m.jsx(Kp,{className:"w-5 h-5 mb-2"}),m.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function hS(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const B0=2e3;function dS(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
56
+ ${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${_o(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${_o(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${_o(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${_o(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",d=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let w=y,j;for(;(j=d.exec(w))!==null;){const q=j.index+j[0].length;E.push(w.slice(0,q)),w=w.slice(q).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&E.push(w),E.map(q=>{const M=q.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Xw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Kw(r){return Xw.test(r)}function fh({content:r,className:n,onClick:s}){const a=T.useMemo(()=>Iw(r),[r]);return m.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Lo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[d,g]=T.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return m.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>m.jsxs("div",{children:[m.jsx(Lo,{data:y,depth:n+1,generation:s}),E<r.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?m.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],j)=>m.jsxs("div",{children:[m.jsx("span",{className:"text-text-secondary",children:E}),m.jsx("span",{className:"text-text-tertiary",children:": "}),m.jsx(Lo,{data:w,depth:n+1,generation:s}),j<y.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return m.jsx("span",{children:String(r)})}function za({data:r,depth:n=0}){if(r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Kw(r)?m.jsx(fh,{content:r}):m.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):m.jsx("div",{className:"space-y-2",children:r.map((s,a)=>m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),m.jsx("div",{className:"flex-1",children:m.jsx(za,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):m.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return m.jsxs("div",{children:[m.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?m.jsx("p",{className:"text-sm text-text-primary",children:m.jsx(za,{data:o,depth:n+1})}):m.jsx(za,{data:o,depth:n+1})]},a)})})}return m.jsx("span",{children:String(r)})}function U0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return m.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&m.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?m.jsx(Jw,{className:y}):m.jsx(Fw,{className:y})}),m.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?m.jsx($w,{className:y}):m.jsx(Yw,{className:y})}),m.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?m.jsx(Vw,{className:`${y} text-status-success`}):m.jsx(Gw,{className:y})}),h&&m.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:m.jsx(og,{className:y})}),d&&m.jsx("button",{onClick:d,className:E,title:"Close (Esc)",children:m.jsx(cg,{className:y})})]})}function Zw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,d]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[j,q]=T.useState(a?0:1),[M,D]=T.useState(1),W=j%2===0,se=M%2===0,ee=T.useCallback(()=>q(K=>K+1),[]),me=T.useCallback(()=>D(K=>K+1),[]);let re=r;if(typeof r=="string")try{re=JSON.parse(r)}catch{}const C=async()=>{const K=typeof r=="string"?r:JSON.stringify(re,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{D(1),w(!0)},[]),ce=s==="panel",V=ce?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",G=ce?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return m.jsxs("div",{className:V,children:[n&&m.jsx(Hw,{children:n}),m.jsxs("div",{ref:f,className:"relative",children:[m.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:m.jsx(U0,{mode:h,setMode:d,isCollapsed:W,onToggleCollapse:ee,onCopy:C,copied:g,onFullscreen:X})}),m.jsx("div",{className:G,children:h==="json"?m.jsx(Lo,{data:re,generation:j}):m.jsx(za,{data:re})})]}),m.jsxs(Ig,{open:E,onClose:()=>w(!1),sourceRef:f,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx(U0,{mode:h,setMode:d,isCollapsed:se,onToggleCollapse:me,onCopy:C,copied:g,onClose:()=>w(!1),large:!0})}),m.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?m.jsx(Lo,{data:re,generation:M}):m.jsx(za,{data:re})})]})]})}const Ww=100,B0=500;let eS=0;const Xg={"escalation.created":"text-blue-400","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function Kg(r){const n=r.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:r}function L0({event:r,forceExpanded:n=!1}){var j,q;const[s,a]=T.useState(n),o=Xg[Kg(r.type)]||"text-text-tertiary";T.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",d=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return m.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[m.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[m.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),m.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),m.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(j=r.data)!=null&&j.workflowId?String(r.data.workflowId):"",(q=r.data)!=null&&q.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),m.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),m.jsx(uh,{open:s,children:m.jsx("div",{className:w,children:m.jsx(Zw,{data:r.data})})})]})}function tS({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,d]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:j}=T.useContext(Ya),{patterns:q,pagePattern:M,userPatterns:D,addPattern:W,removePattern:se}=Lw(),ee=T.useCallback(re=>{const C=String(re.type||"unknown");if(C.startsWith("mesh."))return;const X=`${C}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ce=Date.now(),V=w.current.get(X);if(!(V&&ce-V<B0)){if(w.current.set(X,ce),w.current.size>200)for(const[G,K]of w.current)ce-K>B0*2&&w.current.delete(G);f(G=>[{id:++eS,type:C,timestamp:re.timestamp||new Date().toISOString(),data:re},...G].slice(0,Ww))}},[]),me=T.useRef(ee);return me.current=ee,T.useEffect(()=>{const re=q.map(C=>j(C,X=>me.current(X)));return()=>re.forEach(C=>C())},[j,q.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),m.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[m.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?m.jsx(Jx,{className:"w-3 h-3 text-text-tertiary"}):m.jsx(Qx,{className:"w-3 h-3 text-text-tertiary"}),m.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&m.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&m.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Xg[Kg(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),m.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[m.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:re=>{re.stopPropagation(),a()},children:m.jsx(Ix,{className:"w-3 h-3"})}),o.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),d(!0)},children:m.jsx(og,{className:"w-3 h-3"})}),m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),f([])},children:m.jsx(Xx,{className:"w-3 h-3"})})]})]})]}),s&&m.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[m.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),m.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),D.map(re=>m.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[re.replace("lt.events.",""),m.jsx("button",{onClick:()=>se(re),className:"text-text-quaternary hover:text-status-error",children:m.jsx($o,{className:"w-2 h-2"})})]},re))]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",value:g,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&g.trim()&&(W(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),m.jsxs("button",{onClick:()=>{g.trim()&&(W(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[m.jsx(Kx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),m.jsx(uh,{open:r,children:m.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?m.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>m.jsx(L0,{event:re},re.id))})}),m.jsxs(Ig,{open:h,onClose:()=>d(!1),sourceRef:E,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx("button",{onClick:()=>d(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:m.jsx(cg,{className:"w-5 h-5"})})}),o.length===0?m.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>m.jsx(L0,{event:re,forceExpanded:!0},re.id))]})]})}function nS(){return Hn({queryKey:["docs"],queryFn:()=>Xe("/docs"),staleTime:5*6e4})}function sS(r){return Hn({queryKey:["docs",r],queryFn:()=>Xe(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function iS(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),d=T.useRef(r),g=T.useRef(s);h.current=o,d.current=r,g.current=s;const y=T.useCallback((M,D)=>{var se;const W=h.current;if(W){const ee=((se=D==null?void 0:D.current)==null?void 0:se.scrollTop)??0;n([...d.current,{...W,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const D=d.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...se,scrollTop:me}])}n(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const D=g.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...d.current,{...se,scrollTop:me}])}a(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),j=T.useCallback(M=>{var se,ee;const D=h.current;if(!D)return;const W=((se=M==null?void 0:M.current)==null?void 0:se.scrollTop)??0;n([...d.current,{...D,scrollTop:W}]),a([]),f({...D,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),q=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:j,reset:q}}function rS(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);o=d.join("/")}return{path:o,anchor:a}}function aS(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function lS(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function oS({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const E=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=rS(g.dataset.docLink,n);s(E,w);return}};return m.jsx(fh,{content:r,className:"docs-content",onClick:o})}function cS(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const d=o[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function uS({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=cS(r),f=d=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===d?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(d,g){return m.jsxs("details",{open:!0,children:[m.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[m.jsx(Zx,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),m.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>m.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return m.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>m.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...o.values()].map(d=>h(d))]})}function fS({open:r,onClose:n}){var ce,V,G;const[s,a]=T.useState(!1),{data:o}=nS(),f=iS(),{data:h,isLoading:d}=sS(((ce=f.current)==null?void 0:ce.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var ae;const K=(ae=g.current)==null?void 0:ae.querySelector(`#${CSS.escape(y)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var ne;const K=aS(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((ne=f.current)==null?void 0:ne.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&E(K.anchor)},[f]),j=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const K=lS(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(V=f.current)==null?void 0:V.path]),T.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const q=T.useCallback((K,ae)=>{ae&&E(ae),f.navigate(K,g)},[f]),M=T.useCallback(K=>{f.navigate(K,g)},[f]),D=T.useCallback(()=>{f.goBack(g)},[f]),W=T.useCallback(()=>{f.goForward(g)},[f]),se=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){j.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},re=((G=f.current)==null?void 0:G.path)??null,C=f.backStack.length>0,X=f.forwardStack.length>0;return m.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[m.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),m.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{onClick:D,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:m.jsx(Wx,{className:"w-4 h-4"})}),m.jsx("button",{onClick:W,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:m.jsx(Wp,{className:"w-4 h-4"})}),m.jsx(lg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),m.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),m.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:m.jsx($o,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?m.jsx(uS,{docs:o.docs,selected:re,onSelect:M}):m.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),m.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:re?d?m.jsxs("div",{className:"animate-pulse space-y-2",children:[m.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?m.jsx(oS,{content:h.content,currentPath:re,onNavigate:q,onAnchorClick:se}):m.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[m.jsx(Wp,{className:"w-5 h-5 mb-2"}),m.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function hS(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const H0=2e3;function dS(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
57
57
  ${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
58
58
  `)}
59
59
  [End prior conversation]
60
60
 
61
- `}function mS(r){const n=r.summary,s=r.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof r=="string"?r:"Query completed.")}const Ig=T.createContext(null);function pS({children:r}){const n=Ws(),[s,a]=T.useState(!1),[o,f]=T.useState([]),[h,d]=T.useState(null),[g,y]=T.useState({}),E=T.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??hS(n.pathname)};T.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const j=T.useCallback(()=>a(ne=>!ne),[]),q=T.useCallback(ne=>{y(ne)},[]),M=T.useCallback(()=>{f([]),d(null)},[]),z=T.useCallback(async ne=>{var W;const ee=new Date().toISOString(),pe={id:`user-${Date.now()}`,role:"user",content:ne,timestamp:ee},ae={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:ee,pending:!0};f(F=>[...F,pe,ae]);const k={...w};(W=k.entities)!=null&&W.yamlContent&&k.entities.yamlContent.length>B0&&(k.entities={...k.entities,yamlContent:k.entities.yamlContent.slice(0,B0)+`
62
- ... (truncated)`});const se=`${dS(o.concat(pe))}${ne}`;try{const Z=(await Xe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:se,tags:k.suggestedTags,context:k,wait:!1,direct:!0})})).workflow_id;d(Z),f(le=>le.map(re=>re.id===ae.id?{...re,workflowId:Z}:re)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var le;try{const re=await Xe(`/workflows/${Z}/result`),qe=(le=re==null?void 0:re.result)==null?void 0:le.data;if(qe){E.current&&clearInterval(E.current),E.current=null,d(null);const Ge=mS(qe);let Le;try{Le=(await Xe(`/workflow-states/${Z}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===ae.id?{...te,content:Ge,timestamp:new Date().toISOString(),pending:!1,durationMs:Le}:te))}}catch{}},3e3)}catch{f(F=>F.map(Z=>Z.id===ae.id?{...Z,content:"Failed to submit query. Please try again.",pending:!1}:Z))}},[o,w]),G=T.useCallback(async ne=>{const ee=o.find(k=>k.id===ne);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const pe=o.indexOf(ee),ae=o.slice(0,pe).reverse().find(k=>k.role==="user");if(ae){f(k=>k.map(X=>X.id===ne?{...X,compilationStatus:"compiling"}:X));try{const k=await Xe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ae.content,summary:ee.content})}),X=await Xe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:k.tool_name,description:k.description,tags:k.tags,app_id:"longtail"})});await Xe(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(se=>se.map(W=>W.id===ne?{...W,compilationStatus:"done"}:W))}catch(k){const X=k instanceof Error?k.message:"Compilation failed";f(se=>se.map(W=>W.id===ne?{...W,compilationStatus:"error",compilationError:X}:W))}}},[o]);return m.jsx(Ig.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:o,sendMessage:z,pageContext:w,setPageContext:q,activeWorkflowId:h,clearMessages:M,compileMessage:G},children:r})}function Xg(){const r=T.useContext(Ig);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function gS(){const{helpOpen:r,toggleHelp:n}=Xg();return m.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?m.jsx(Po,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):m.jsx("img",{src:`${Bn}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const Kg=6048e5,yS=864e5,L0=6e4,H0=525600,P0=43200,$0=1440,Y0=Symbol.for("constructDateFrom");function hs(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&Y0 in r?r[Y0](n):r instanceof Date?new r.constructor(n):new Date(n)}function nn(r,n){return hs(n||r,r)}let bS={};function Va(){return bS}function Ha(r,n){var d,g,y,E;const s=Va(),a=(n==null?void 0:n.weekStartsOn)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=nn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Lo(r,n){return Ha(r,{...n,weekStartsOn:1})}function Zg(r,n){const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),o=hs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Lo(o),h=hs(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=Lo(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Ho(r){const n=nn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function Wg(r,...n){const s=hs.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function G0(r,n){const s=nn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function xS(r,n,s){const[a,o]=Wg(s==null?void 0:s.in,r,n),f=G0(a),h=G0(o),d=+f-Ho(f),g=+h-Ho(h);return Math.round((d-g)/yS)}function vS(r,n){const s=Zg(r,n),a=hs(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Lo(a)}function _S(r,n){const s=+nn(r)-+nn(n);return s<0?-1:s>0?1:s}function wS(r){return hs(r,Date.now())}function SS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function ES(r){return!(!SS(r)&&typeof r!="number"||isNaN(+nn(r)))}function AS(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function OS(r,n){const s=nn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const jS={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},TS=(r,n,s)=>{let a;const o=jS[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function _f(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const NS={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},CS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},kS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},MS={date:_f({formats:NS,defaultWidth:"full"}),time:_f({formats:CS,defaultWidth:"full"}),dateTime:_f({formats:kS,defaultWidth:"full"})},RS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},DS=(r,n,s,a)=>RS[r];function Oa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;o=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const zS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},qS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},US={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},BS={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},HS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},PS=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},$S={ordinalNumber:PS,era:Oa({values:zS,defaultWidth:"wide"}),quarter:Oa({values:qS,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Oa({values:US,defaultWidth:"wide"}),day:Oa({values:BS,defaultWidth:"wide"}),dayPeriod:Oa({values:LS,defaultWidth:"wide",formattingValues:HS,defaultFormattingWidth:"wide"})};function ja(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?GS(d,w=>w.test(h)):YS(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function YS(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function GS(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function VS(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const d=n.slice(o.length);return{value:h,rest:d}}}const FS=/^(\d+)(th|st|nd|rd)?/i,JS=/\d+/i,QS={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},IS={any:[/^b/i,/^(a|c)/i]},XS={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},KS={any:[/1/i,/2/i,/3/i,/4/i]},ZS={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},WS={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},e2={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},t2={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},n2={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},s2={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},i2={ordinalNumber:VS({matchPattern:FS,parsePattern:JS,valueCallback:r=>parseInt(r,10)}),era:ja({matchPatterns:QS,defaultMatchWidth:"wide",parsePatterns:IS,defaultParseWidth:"any"}),quarter:ja({matchPatterns:XS,defaultMatchWidth:"wide",parsePatterns:KS,defaultParseWidth:"any",valueCallback:r=>r+1}),month:ja({matchPatterns:ZS,defaultMatchWidth:"wide",parsePatterns:WS,defaultParseWidth:"any"}),day:ja({matchPatterns:e2,defaultMatchWidth:"wide",parsePatterns:t2,defaultParseWidth:"any"}),dayPeriod:ja({matchPatterns:n2,defaultMatchWidth:"any",parsePatterns:s2,defaultParseWidth:"any"})},ey={code:"en-US",formatDistance:TS,formatLong:MS,formatRelative:DS,localize:$S,match:i2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function r2(r,n){const s=nn(r,n==null?void 0:n.in);return xS(s,OS(s))+1}function a2(r,n){const s=nn(r,n==null?void 0:n.in),a=+Lo(s)-+vS(s);return Math.round(a/Kg)+1}function ty(r,n){var E,w,j,q;const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Va(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(j=o.locale)==null?void 0:j.options)==null?void 0:q.firstWeekContainsDate)??1,h=hs((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=Ha(h,n),g=hs((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Ha(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function l2(r,n){var d,g,y,E;const s=Va(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=ty(r,n),f=hs((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Ha(f,n)}function o2(r,n){const s=nn(r,n==null?void 0:n.in),a=+Ha(s,n)-+l2(s,n);return Math.round(a/Kg)+1}function Ye(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Gs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ye(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ye(s+1,2)},d(r,n){return Ye(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ye(r.getHours()%12||12,n.length)},H(r,n){return Ye(r.getHours(),n.length)},m(r,n){return Ye(r.getMinutes(),n.length)},s(r,n){return Ye(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ye(o,n.length)}},pr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},V0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Gs.y(r,n)},Y:function(r,n,s,a){const o=ty(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ye(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ye(f,n.length)},R:function(r,n){const s=Zg(r);return Ye(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ye(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ye(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ye(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Gs.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ye(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const o=o2(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ye(o,n.length)},I:function(r,n,s){const a=a2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ye(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Gs.d(r,n)},D:function(r,n,s){const a=r2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ye(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ye(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ye(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ye(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=pr.noon:a===0?o=pr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=pr.evening:a>=12?o=pr.afternoon:a>=4?o=pr.morning:o=pr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Gs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Gs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ye(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ye(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Gs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Gs.s(r,n)},S:function(r,n){return Gs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return J0(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return J0(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+F0(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+F0(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ye(a,n.length)},T:function(r,n,s){return Ye(+r,n.length)}};function F0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ye(f,2)}function J0(r,n){return r%60===0?(r>0?"-":"+")+Ye(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ye(Math.trunc(a/60),2),f=Ye(a%60,2);return s+o+n+f}const Q0=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},ny=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},c2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return Q0(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",Q0(a,n)).replace("{{time}}",ny(o,n))},u2={p:ny,P:c2},f2=/^D+$/,h2=/^Y+$/,d2=["D","DD","YY","YYYY"];function m2(r){return f2.test(r)}function p2(r){return h2.test(r)}function g2(r,n,s){const a=y2(r,n,s);if(console.warn(a),d2.includes(r))throw new RangeError(a)}function y2(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const b2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,v2=/^'([^]*?)'?$/,_2=/''/g,w2=/[a-zA-Z]/;function sy(r,n,s){var E,w,j,q;const a=Va(),o=a.locale??ey,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((q=(j=a.locale)==null?void 0:j.options)==null?void 0:q.weekStartsOn)??0,d=nn(r,s==null?void 0:s.in);if(!ES(d))throw new RangeError("Invalid time value");let g=n.match(x2).map(M=>{const z=M[0];if(z==="p"||z==="P"){const G=u2[z];return G(M,o.formatLong)}return M}).join("").match(b2).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const z=M[0];if(z==="'")return{isToken:!1,value:S2(M)};if(V0[z])return{isToken:!0,value:M};if(z.match(w2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const z=M.value;(p2(z)||m2(z))&&g2(z,n,String(r));const G=V0[z[0]];return G(d,z,o.localize,y)}).join("")}function S2(r){const n=r.match(v2);return n?n[1].replace(_2,"'"):r}function E2(r,n,s){const a=Va(),o=(s==null?void 0:s.locale)??a.locale??ey,f=_S(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[d,g]=Wg(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=AS((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-d.getTime(),w=E/L0,j=Ho(g)-Ho(d),q=(E-j)/L0,M=s==null?void 0:s.unit;let z;if(M?z=M:w<1?z="second":w<60?z="minute":w<$0?z="hour":q<P0?z="day":q<H0?z="month":z="year",z==="second"){const G=y(E/1e3);return o.formatDistance("xSeconds",G,h)}else if(z==="minute"){const G=y(w);return o.formatDistance("xMinutes",G,h)}else if(z==="hour"){const G=y(w/60);return o.formatDistance("xHours",G,h)}else if(z==="day"){const G=y(q/$0);return o.formatDistance("xDays",G,h)}else if(z==="month"){const G=y(q/P0);return G===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",G,h)}else{const G=y(q/H0);return o.formatDistance("xYears",G,h)}}function A2(r,n){return E2(r,wS(r),n)}function O2(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":A2(n,{addSuffix:!0})}function FE(r){return r<=0?"Expired":fh(r)}function j2(r){return r==null?"--":fh(r)}function fh(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function JE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return fh(a-s)}function iy({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[d,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),j=220,q=T.useCallback(()=>{if(!y.current)return;const ne=y.current.getBoundingClientRect(),ee=window.innerWidth-j-8,pe=Math.max(8,Math.min(ne.left,ee));g({top:ne.bottom+4,left:pe})},[]),M=T.useCallback(async(ne,ee)=>{try{await navigator.clipboard.writeText(ne),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),z=T.useCallback(()=>{clearTimeout(w.current),q(),o(!0)},[q]),G=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),m.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:z,onMouseLeave:G,children:[n,a&&d&&ng.createPortal(m.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:d.top,left:d.left},onMouseEnter:z,onMouseLeave:G,children:r.map(ne=>m.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(ne.value,ne.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ne.label}),m.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===ne.label?"✓":ne.value})]},ne.label))}),document.body)]})}function T2(r,n){const s=new Date(r);switch(n){case"relative":return O2(r);case"datetime":return sy(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function N2(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:sy(n,"MMM d, yyyy h:mm:ss a")}]}function C2({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>N2(r),[r]);return m.jsx(iy,{options:o,children:m.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:T2(r,n)})})}function k2({ms:r,className:n=""}){const s=j2(r),a=T.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):m.jsx(iy,{options:a,children:m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const M2=["sm","md","lg","full"],I0={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},X0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function R2({which:r}){const n="stroke-current";switch(r){case"sm":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function D2({msg:r}){const[n,s]=T.useState(0);T.useEffect(()=>{const h=new Date(r.timestamp).getTime(),d=()=>s(Math.floor((Date.now()-h)/1e3));d();const g=setInterval(d,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return m.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),m.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&m.jsxs(gr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[m.jsx(og,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function z2({msg:r,compileMessage:n}){const s=r.role==="assistant";return m.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[m.jsx(C2,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),m.jsx(k2,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&m.jsx(gr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:m.jsx(og,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&m.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:m.jsx(Wx,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function q2(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Xg(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[j,q]=T.useState(!0),M=T.useRef(null),z=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&z.current&&z.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const k=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r,E,n]),!r)return null;const G=()=>{const k=g.trim();!k||f||(a(k),y(""),z.current&&(z.current.style.height="auto"))},ne=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),G())},ee=E==="full",pe=o.page.replace(/-/g," "),ae=ee?{}:{bottom:"108px"};return m.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?I0.full:`right-6 ${I0[E]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ae,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[m.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),m.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:pe})]}),m.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[m.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:M2.map(k=>m.jsx("button",{onClick:()=>w(k),className:`p-1 rounded transition-colors ${k===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":k===E,"aria-label":X0[k],title:X0[k],children:m.jsx(R2,{which:k})},k))}),s.length>0&&m.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:m.jsx(ev,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),m.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:m.jsx(Po,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),m.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&m.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(k=>m.jsxs("div",{className:`text-xs leading-relaxed ${k.role==="user"?"text-right":"text-left"}`,children:[m.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${k.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:k.pending?m.jsx(D2,{msg:k}):k.role==="assistant"?m.jsx(uh,{content:k.content}):k.content}),!k.pending&&m.jsx("div",{className:"mt-0.5",children:m.jsx(z2,{msg:k,compileMessage:d})})]},k.id))]}),m.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsx("textarea",{ref:z,value:g,onChange:k=>{y(k.target.value);const X=k.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:ne,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),m.jsx("button",{onClick:G,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:m.jsx(tv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function U2(){var z;const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),{data:a}=bw(),o=!!((z=a==null?void 0:a.ai)!=null&&z.enabled),{collapsed:f,toggle:h}=Vg(),[d,g]=T.useState(!1),[y,E]=T.useState(!1),[w,j]=T.useState(()=>window.location.hash.startsWith("#docs")),q=Ws(),M=T.useRef(null);return T.useEffect(()=>{const G=M.current;G&&(G.classList.remove("animate-page-in"),G.offsetWidth,G.classList.add("animate-page-in"))},[q.pathname]),T.useEffect(()=>{const G=()=>{window.location.hash.startsWith("#docs")&&j(!0)};return window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)},[]),m.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[m.jsx(Ew,{onToggleEventFeed:()=>g(G=>!G),onToggleDocs:()=>j(G=>!G)}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsxs("aside",{className:`${f?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[m.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[m.jsx(Nw,{aiEnabled:o}),(r||n("admin")||s("engineer"))&&m.jsx(Cw,{}),o&&(r||n("admin")||s("engineer"))&&m.jsx(Mw,{}),(r||n("admin")||s("engineer"))&&m.jsx(Dw,{}),(r||n("admin"))&&m.jsx(qw,{})]}),m.jsx("button",{onClick:h,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${f?"flex justify-center":"flex items-center px-7"}`,"aria-label":f?"Expand sidebar":"Collapse sidebar",children:f?m.jsx(nv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):m.jsx(sv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{ref:M,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:m.jsx(wo,{})})})]}),m.jsx(tS,{open:d,onToggle:()=>g(G=>!G),configOpen:y,onToggleConfig:()=>E(G=>!G)}),m.jsx(fS,{open:w,onClose:()=>{j(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),o&&m.jsx(gS,{}),o&&m.jsx(q2,{})]})}function B2(){const{isAuthenticated:r}=Oi(),n=Ws();return r?m.jsx(vw,{children:m.jsx(pS,{children:m.jsx(U2,{})})}):m.jsx(Fs,{to:"/login",state:{from:n.pathname},replace:!0})}function ry({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),m.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),m.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),m.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),m.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),m.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),m.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("path",{d:"M12 8v4l3 3"})]})}}async function L2(){return Xe("/auth/oauth/providers")}async function H2(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Xe(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function QE(){return Hn({queryKey:["oauth-connections"],queryFn:()=>Xe("/auth/oauth/connections")})}function IE(){const r=Nn();return Pn({mutationFn:({provider:n,label:s})=>H2(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function P2(){var X;const{login:r,isAuthenticated:n}=Oi(),s=sg(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),d=((X=a.state)==null?void 0:X.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,j]=T.useState(""),[q,M]=T.useState(h||""),[z,G]=T.useState(!1),[ne,ee]=T.useState(!!f),[pe,ae]=T.useState([]);if(T.useEffect(()=>{f||L2().then(ae).catch(()=>{})},[]),T.useEffect(()=>{if(!ne)return;const se=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(se)},[ne]),n&&!ne)return m.jsx(Fs,{to:d,replace:!0});const k=async se=>{var W,F;if(se.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}G(!0);try{const Z=await fetch(`${Bn}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),le=await Z.json();if(!Z.ok){M(le.error||"Login failed");return}ee(!0),r(le.token,{username:y.trim(),password:w},{displayName:(W=le.user)==null?void 0:W.display_name,username:(F=le.user)==null?void 0:F.external_id})}catch{M("Unable to connect to server")}finally{G(!1)}};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ne?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:m.jsx(oh,{size:"lg",hideLabel:ne})}),m.jsxs("form",{onSubmit:k,className:`space-y-5 transition-opacity duration-300 ${ne?"opacity-0":""}`,children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),m.jsx("input",{id:"username",type:"text",value:y,onChange:se=>E(se.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ne,autoComplete:"username"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),m.jsx("input",{id:"password",type:"password",value:w,onChange:se=>j(se.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&m.jsx("p",{className:"text-sm text-status-error",children:q}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:z||ne,children:z?"Signing in...":"Sign In"}),pe.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[m.jsx("div",{className:"flex-1 h-px bg-border"}),m.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),m.jsx("div",{className:"flex-1 h-px bg-border"})]}),m.jsx("div",{className:"space-y-2",children:pe.filter(se=>se.provider!=="anthropic").map(se=>m.jsxs("a",{href:`${Bn}/api/auth/oauth/${se.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[m.jsx(ry,{provider:se.provider}),"Sign in with ",se.name]},se.provider))})]})]})]})})}function K0(){const{isAuthenticated:r}=Oi(),n=sg(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[d,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,j]=T.useState(!1),q=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),z=G=>{G.preventDefault();const ne=f.trim();if(!ne){E("A token or API key is required");return}if(!ne.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),E("");const ee=`${Bn}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ne)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:"mb-10",children:m.jsx(oh,{size:"lg"})}),m.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[m.jsx(ry,{provider:"anthropic",className:"w-6 h-6"}),m.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),m.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),m.jsxs("form",{onSubmit:z,className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),m.jsx("input",{id:"token",type:"password",value:f,onChange:G=>h(G.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&m.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&m.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),m.jsx("input",{id:"label",type:"text",value:d,onChange:G=>g(G.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),m.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&m.jsx("p",{className:"text-sm text-status-error",children:y}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),m.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),m.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",m.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",m.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function wf({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?m.jsx(wo,{}):r&&r.some(h=>f(h))?m.jsx(wo,{}):n&&n.some(h=>o(h))?m.jsx(wo,{}):m.jsx(Fs,{to:s,replace:!0})}const $2=T.lazy(()=>Ae(()=>import("./ProcessesListPage-CT_3b5Wt.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),Y2=T.lazy(()=>Ae(()=>import("./ProcessDetailPage-DyzNjwu8.js"),__vite__mapDeps([16,1,2,4,17,13,18,15,9,6,19,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),G2=T.lazy(()=>Ae(()=>import("./McpOverview-CZFW5qMb.js"),__vite__mapDeps([22,1,23,24,25,26,12,13,27,6]),import.meta.url).then(r=>({default:r.McpOverview}))),V2=T.lazy(()=>Ae(()=>import("./McpRunsPage-aZg057y3.js"),__vite__mapDeps([28,1,24,25,26,5,6,7,8,15,13,9,29,12,11,10,14,30]),import.meta.url).then(r=>({default:r.McpRunsPage}))),F2=T.lazy(()=>Ae(()=>import("./McpRunDetailPage-X0sfRFTk.js"),__vite__mapDeps([31,1,24,18,12,13,32,6,33,34,14,35,36,11]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),J2=T.lazy(()=>Ae(()=>import("./McpQueryPage-D14466yi.js"),__vite__mapDeps([37,1,12,13,7,8,11,10,14,9,29,15,30,5,6,4,38]),import.meta.url).then(r=>({default:r.McpQueryPage}))),Q2=T.lazy(()=>Ae(()=>import("./McpQueryDetailPage-q9xH-QRo.js"),__vite__mapDeps([39,1,12,13,18,38,40,6,25,4,41,33,24,3,2,42,43,44,45,32,46,35]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),I2=T.lazy(()=>Ae(()=>import("./EscalationsOverview-kYGHfnLf.js"),__vite__mapDeps([47,1,4,12,13,27,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),X2=T.lazy(()=>Ae(()=>import("./AvailableEscalationsPage-CA9x9o5s.js"),__vite__mapDeps([48,1,4,49,5,6,7,8,10,12,13,50,51,52,21,53,11,54,19,15,9,55,30,14]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),K2=T.lazy(()=>Ae(()=>import("./OperatorDashboard-iZEHnndU.js"),__vite__mapDeps([56,1,4,49,5,6,7,8,12,13,10,30,53,11,54,19,15,9,55,14]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),Z2=T.lazy(()=>Ae(()=>import("./index-BAXzN-QB.js"),__vite__mapDeps([57,1,34,49,12,13,55,3,4,20,21,51,50,18,19,32,6,33]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),W2=T.lazy(()=>Ae(()=>import("./WorkflowsOverview-DaJRDkNy.js"),__vite__mapDeps([58,1,3,4,12,13,27,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),eE=T.lazy(()=>Ae(()=>import("./index-BCQ65lNu.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),tE=T.lazy(()=>Ae(()=>import("./index-BCQ65lNu.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),nE=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-eCH4gpAk.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),sE=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-eCH4gpAk.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),iE=T.lazy(()=>Ae(()=>import("./YamlWorkflowsPage-CkpQaUmz.js"),__vite__mapDeps([62,1,25,40,5,6,63,12,13,11,8,43,44,45,42,60,46,18,64]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),rE=T.lazy(()=>Ae(()=>import("./TasksListPage-BDmaUIKu.js"),__vite__mapDeps([65,1,2,3,5,6,7,8,18,54,46,10,11,12,13,15]),import.meta.url).then(r=>({default:r.TasksListPage}))),aE=T.lazy(()=>Ae(()=>import("./TaskDetailPage-22cJsFmM.js"),__vite__mapDeps([66,1,2,18,54,12,13,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),Z0=T.lazy(()=>Ae(()=>import("./WorkflowExecutionPage-BjC0j9_L.js"),__vite__mapDeps([67,1,3,4,34,2,12,13,33,14,18,32,6,35,36,11]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),lE=T.lazy(()=>Ae(()=>import("./AdminDashboard-Cfo0mwL2.js"),__vite__mapDeps([68,1,2,4,23,17,13,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),oE=T.lazy(()=>Ae(()=>import("./index-D4KGadbW.js"),__vite__mapDeps([69,1,3,7,8,11,30,5,6,12,13,70,15]),import.meta.url).then(r=>({default:r.WorkersPage}))),cE=T.lazy(()=>Ae(()=>import("./index-UtAfnStw.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),W0=T.lazy(()=>Ae(()=>import("./index-UtAfnStw.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),uE=T.lazy(()=>Ae(()=>import("./index-DdKbIZNE.js"),__vite__mapDeps([74,1,23,8,72,52,6,12,13,11,10,5,63,75,43,44,45,42,64,30,18]),import.meta.url).then(r=>({default:r.McpServersPage}))),eg=T.lazy(()=>Ae(()=>import("./index-aJRDh4zW.js"),__vite__mapDeps([76,1,23,73,12,13,41,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),fE=T.lazy(()=>Ae(()=>import("./index-C5dHozmW.js"),__vite__mapDeps([77,1,21,5,6,7,8,10,11,9,72,52,30,12,13,19,45,49,46]),import.meta.url).then(r=>({default:r.UsersPage}))),hE=T.lazy(()=>Ae(()=>import("./RolesPage-CpRJq-sg.js"),__vite__mapDeps([78,1,49,7,8,72,52,6,12,13,19,30]),import.meta.url).then(r=>({default:r.RolesPage}))),dE=T.lazy(()=>Ae(()=>import("./index-BYXiz05a.js"),__vite__mapDeps([79,1,12,13,52,6,50]),import.meta.url).then(r=>({default:r.MaintenancePage}))),mE=T.lazy(()=>Ae(()=>import("./index-Bh-PnP17.js"),__vite__mapDeps([80,1,17,13,11,5,6,81,52,33,70,7,8,30]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),pE=T.lazy(()=>Ae(()=>import("./index-D1MywQ2z.js"),__vite__mapDeps([82,1,6,81,5,7,8,10,11,9,12,13,14]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),gE=T.lazy(()=>Ae(()=>import("./CredentialsPage-DJGLssm0.js"),__vite__mapDeps([83,1,12,13,46,72,52,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),yE=T.lazy(()=>Ae(()=>import("./index-3n5VREXN.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,46]),import.meta.url).then(r=>({default:r.FilesPage}))),bE=T.lazy(()=>Ae(()=>import("./index-_DfbFHXk.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,46,87,41,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),xE=T.lazy(()=>Ae(()=>import("./HomePage-CwRebzmO.js"),__vite__mapDeps([88,1,3,24,81,2,4,19,13,15,14,89,6]),import.meta.url).then(r=>({default:r.HomePage}))),vE=T.lazy(()=>Ae(()=>import("./AgentsPage-CTVocfBb.js"),__vite__mapDeps([90,1,91,4,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.AgentsPage}))),_E=T.lazy(()=>Ae(()=>import("./AgentDetailPage-3mZA7SOb.js"),__vite__mapDeps([92,1,91,93,13,4,89,15,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),tg=T.lazy(()=>Ae(()=>import("./AgentConfigPage-DBtvb2x5.js"),__vite__mapDeps([94,1,91,93,13,12,87,43,44,45,3,25,95,96,89,15,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),wE=T.lazy(()=>Ae(()=>import("./CapabilitiesPage-wpVtkGeU.js"),__vite__mapDeps([97,1,95,75,23,43,44,45,13,42,64,6,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),SE=T.lazy(()=>Ae(()=>import("./TopicsPage-tVPdz-k0.js"),__vite__mapDeps([98,1,96,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.TopicsPage}))),EE=T.lazy(()=>Ae(()=>import("./TopicDetailPage-DW97-YHQ.js"),__vite__mapDeps([99,1,96,14,13,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function AE(){return m.jsxs("div",{className:"animate-pulse space-y-4",children:[m.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return m.jsx(T.Suspense,{fallback:m.jsx(AE,{}),children:m.jsx("div",{className:"animate-page-enter",children:r})})}const ay=new yx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{ay.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=`${window.__LT_BASE__||""}/login`;window.location.pathname!==n&&(window.location.href=`${n}?returnTo=${encodeURIComponent(window.location.pathname)}`)});const OE=vx([{path:"/login",element:m.jsx(P2,{})},{path:"/connect/anthropic",element:m.jsx(K0,{})},{path:"/connect/:provider",element:m.jsx(K0,{})},{path:"/",element:m.jsx(B2,{}),children:[{index:!0,element:m.jsx(xe,{children:m.jsx(xE,{})})},{path:"processes/all",element:m.jsx(xe,{children:m.jsx($2,{})})},{path:"processes/detail/:originId",element:m.jsx(xe,{children:m.jsx(Y2,{})})},{path:"credentials",element:m.jsx(xe,{children:m.jsx(gE,{})})},{path:"connections",element:m.jsx(Fs,{to:"/credentials",replace:!0})},{path:"escalations",element:m.jsx(xe,{children:m.jsx(I2,{})})},{path:"escalations/available",element:m.jsx(xe,{children:m.jsx(X2,{})})},{path:"escalations/queue",element:m.jsx(xe,{children:m.jsx(K2,{})})},{path:"escalations/detail/:id",element:m.jsx(xe,{children:m.jsx(Z2,{})})},{path:"capabilities",element:m.jsx(xe,{children:m.jsx(wE,{})})},{path:"agents",element:m.jsx(xe,{children:m.jsx(vE,{})})},{path:"agents/new",element:m.jsx(xe,{children:m.jsx(tg,{})})},{path:"agents/:id",element:m.jsx(xe,{children:m.jsx(_E,{})})},{path:"agents/:id/edit",element:m.jsx(xe,{children:m.jsx(tg,{})})},{path:"topics",element:m.jsx(xe,{children:m.jsx(SE,{})})},{path:"topics/:topic",element:m.jsx(xe,{children:m.jsx(EE,{})})},{element:m.jsx(wf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:m.jsx(xe,{children:m.jsx(W2,{})})},{path:"workflows/executions",element:m.jsx(xe,{children:m.jsx(sE,{})})},{path:"workflows/durable/executions",element:m.jsx(xe,{children:m.jsx(nE,{})})},{path:"workflows/durable/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(Z0,{})})},{path:"workflows/tasks",element:m.jsx(xe,{children:m.jsx(rE,{})})},{path:"workflows/tasks/detail/:id",element:m.jsx(xe,{children:m.jsx(aE,{})})},{path:"workflows/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(Z0,{})})},{path:"workflows/start",element:m.jsx(xe,{children:m.jsx(eE,{})})},{path:"workflows/durable/invoke",element:m.jsx(xe,{children:m.jsx(tE,{})})},{path:"workflows/cron",element:m.jsx(Fs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:m.jsx(xe,{children:m.jsx(oE,{})})},{path:"workflows/registry",element:m.jsx(xe,{children:m.jsx(cE,{})})},{path:"workflows/registry/new",element:m.jsx(xe,{children:m.jsx(W0,{})})},{path:"workflows/registry/:workflowType",element:m.jsx(xe,{children:m.jsx(W0,{})})}]},{element:m.jsx(wf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:m.jsx(xe,{children:m.jsx(G2,{})})},{path:"mcp/queries",element:m.jsx(xe,{children:m.jsx(J2,{})})},{path:"mcp/queries/:workflowId",element:m.jsx(xe,{children:m.jsx(Q2,{})})},{path:"mcp/tools",element:m.jsx(Fs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:m.jsx(xe,{children:m.jsx(uE,{})})},{path:"mcp/servers/new",element:m.jsx(xe,{children:m.jsx(eg,{})})},{path:"mcp/servers/:serverId",element:m.jsx(xe,{children:m.jsx(eg,{})})},{path:"mcp/workflows",element:m.jsx(xe,{children:m.jsx(iE,{})})},{path:"mcp/executions",element:m.jsx(xe,{children:m.jsx(V2,{})})},{path:"mcp/executions/:jobId",element:m.jsx(xe,{children:m.jsx(F2,{})})},{path:"files",element:m.jsx(xe,{children:m.jsx(yE,{})})},{path:"knowledge",element:m.jsx(xe,{children:m.jsx(bE,{})})}]},{element:m.jsx(wf,{roleTypes:["admin","superadmin"]}),children:[{path:"admin",element:m.jsx(xe,{children:m.jsx(lE,{})})},{path:"admin/users",element:m.jsx(xe,{children:m.jsx(fE,{})})},{path:"admin/bots",element:m.jsx(Fs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:m.jsx(Fs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:m.jsx(xe,{children:m.jsx(hE,{})})},{path:"admin/maintenance",element:m.jsx(xe,{children:m.jsx(dE,{})})},{path:"admin/controlplane",element:m.jsx(xe,{children:m.jsx(mE,{})})},{path:"admin/streams",element:m.jsx(xe,{children:m.jsx(pE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function jE(){return m.jsx(bx,{client:ay,children:m.jsx(hv,{children:m.jsx(gw,{children:m.jsx(_x,{router:OE})})})})}ov.createRoot(document.getElementById("root")).render(m.jsx(T.StrictMode,{children:m.jsx(jE,{})}));export{QE as A,IE as B,ch as C,k2 as D,fg as E,Jg as F,Zw as J,Bn as L,p_ as N,ry as O,Hw as S,JE as a,Xe as b,y_ as c,C2 as d,zE as e,j2 as f,UE as g,LE as h,RE as i,Oi as j,PE as k,$E as l,YE as m,GE as n,VE as o,DE as p,ww as q,_w as r,BE as s,qE as t,bw as u,HE as v,sy as w,iy as x,FE as y,fh as z};
63
- //# sourceMappingURL=index-BpN31nuC.js.map
61
+ `}function mS(r){const n=r.summary,s=r.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof r=="string"?r:"Query completed.")}const Zg=T.createContext(null);function pS({children:r}){const n=Ws(),[s,a]=T.useState(!1),[o,f]=T.useState([]),[h,d]=T.useState(null),[g,y]=T.useState({}),E=T.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??hS(n.pathname)};T.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const j=T.useCallback(()=>a(se=>!se),[]),q=T.useCallback(se=>{y(se)},[]),M=T.useCallback(()=>{f([]),d(null)},[]),D=T.useCallback(async se=>{var V;const ee=new Date().toISOString(),me={id:`user-${Date.now()}`,role:"user",content:se,timestamp:ee},re={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:ee,pending:!0};f(G=>[...G,me,re]);const C={...w};(V=C.entities)!=null&&V.yamlContent&&C.entities.yamlContent.length>H0&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,H0)+`
62
+ ... (truncated)`});const ce=`${dS(o.concat(me))}${se}`;try{const K=(await Xe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ce,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;d(K),f(ae=>ae.map(ne=>ne.id===re.id?{...ne,workflowId:K}:ne)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var ae;try{const ne=await Xe(`/workflows/${K}/result`),ke=(ae=ne==null?void 0:ne.result)==null?void 0:ae.data;if(ke){E.current&&clearInterval(E.current),E.current=null,d(null);const He=mS(ke);let Me;try{Me=(await Xe(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===re.id?{...te,content:He,timestamp:new Date().toISOString(),pending:!1,durationMs:Me}:te))}}catch{}},3e3)}catch{f(G=>G.map(K=>K.id===re.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,w]),W=T.useCallback(async se=>{const ee=o.find(C=>C.id===se);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const me=o.indexOf(ee),re=o.slice(0,me).reverse().find(C=>C.role==="user");if(re){f(C=>C.map(X=>X.id===se?{...X,compilationStatus:"compiling"}:X));try{const C=await Xe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:ee.content})}),X=await Xe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:"longtail"})});await Xe(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"done"}:V))}catch(C){const X=C instanceof Error?C.message:"Compilation failed";f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"error",compilationError:X}:V))}}},[o]);return m.jsx(Zg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:o,sendMessage:D,pageContext:w,setPageContext:q,activeWorkflowId:h,clearMessages:M,compileMessage:W},children:r})}function Wg(){const r=T.useContext(Zg);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function gS(){const{helpOpen:r,toggleHelp:n}=Wg();return m.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?m.jsx($o,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):m.jsx("img",{src:`${Wt}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const ey=6048e5,yS=864e5,P0=6e4,$0=525600,Y0=43200,G0=1440,V0=Symbol.for("constructDateFrom");function hs(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&V0 in r?r[V0](n):r instanceof Date?new r.constructor(n):new Date(n)}function sn(r,n){return hs(n||r,r)}let bS={};function Va(){return bS}function Ha(r,n){var d,g,y,E;const s=Va(),a=(n==null?void 0:n.weekStartsOn)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=sn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Ho(r,n){return Ha(r,{...n,weekStartsOn:1})}function ty(r,n){const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=hs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Ho(o),h=hs(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=Ho(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Po(r){const n=sn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function ny(r,...n){const s=hs.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function F0(r,n){const s=sn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function xS(r,n,s){const[a,o]=ny(s==null?void 0:s.in,r,n),f=F0(a),h=F0(o),d=+f-Po(f),g=+h-Po(h);return Math.round((d-g)/yS)}function vS(r,n){const s=ty(r,n),a=hs(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Ho(a)}function _S(r,n){const s=+sn(r)-+sn(n);return s<0?-1:s>0?1:s}function wS(r){return hs(r,Date.now())}function SS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function ES(r){return!(!SS(r)&&typeof r!="number"||isNaN(+sn(r)))}function AS(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function OS(r,n){const s=sn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const jS={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},TS=(r,n,s)=>{let a;const o=jS[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function wf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const NS={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},CS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},kS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},MS={date:wf({formats:NS,defaultWidth:"full"}),time:wf({formats:CS,defaultWidth:"full"}),dateTime:wf({formats:kS,defaultWidth:"full"})},RS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},DS=(r,n,s,a)=>RS[r];function Oa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;o=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const zS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},qS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},US={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},BS={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},HS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},PS=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},$S={ordinalNumber:PS,era:Oa({values:zS,defaultWidth:"wide"}),quarter:Oa({values:qS,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Oa({values:US,defaultWidth:"wide"}),day:Oa({values:BS,defaultWidth:"wide"}),dayPeriod:Oa({values:LS,defaultWidth:"wide",formattingValues:HS,defaultFormattingWidth:"wide"})};function ja(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?GS(d,w=>w.test(h)):YS(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function YS(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function GS(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function VS(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const d=n.slice(o.length);return{value:h,rest:d}}}const FS=/^(\d+)(th|st|nd|rd)?/i,JS=/\d+/i,QS={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},IS={any:[/^b/i,/^(a|c)/i]},XS={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},KS={any:[/1/i,/2/i,/3/i,/4/i]},ZS={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},WS={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},e2={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},t2={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},n2={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},s2={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},i2={ordinalNumber:VS({matchPattern:FS,parsePattern:JS,valueCallback:r=>parseInt(r,10)}),era:ja({matchPatterns:QS,defaultMatchWidth:"wide",parsePatterns:IS,defaultParseWidth:"any"}),quarter:ja({matchPatterns:XS,defaultMatchWidth:"wide",parsePatterns:KS,defaultParseWidth:"any",valueCallback:r=>r+1}),month:ja({matchPatterns:ZS,defaultMatchWidth:"wide",parsePatterns:WS,defaultParseWidth:"any"}),day:ja({matchPatterns:e2,defaultMatchWidth:"wide",parsePatterns:t2,defaultParseWidth:"any"}),dayPeriod:ja({matchPatterns:n2,defaultMatchWidth:"any",parsePatterns:s2,defaultParseWidth:"any"})},sy={code:"en-US",formatDistance:TS,formatLong:MS,formatRelative:DS,localize:$S,match:i2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function r2(r,n){const s=sn(r,n==null?void 0:n.in);return xS(s,OS(s))+1}function a2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ho(s)-+vS(s);return Math.round(a/ey)+1}function iy(r,n){var E,w,j,q;const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Va(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(j=o.locale)==null?void 0:j.options)==null?void 0:q.firstWeekContainsDate)??1,h=hs((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=Ha(h,n),g=hs((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Ha(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function l2(r,n){var d,g,y,E;const s=Va(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=iy(r,n),f=hs((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Ha(f,n)}function o2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ha(s,n)-+l2(s,n);return Math.round(a/ey)+1}function Ge(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Gs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ge(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ge(s+1,2)},d(r,n){return Ge(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ge(r.getHours()%12||12,n.length)},H(r,n){return Ge(r.getHours(),n.length)},m(r,n){return Ge(r.getMinutes(),n.length)},s(r,n){return Ge(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ge(o,n.length)}},pr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},J0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Gs.y(r,n)},Y:function(r,n,s,a){const o=iy(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ge(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ge(f,n.length)},R:function(r,n){const s=ty(r);return Ge(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ge(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ge(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ge(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Gs.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ge(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const o=o2(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ge(o,n.length)},I:function(r,n,s){const a=a2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ge(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Gs.d(r,n)},D:function(r,n,s){const a=r2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ge(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ge(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ge(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ge(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=pr.noon:a===0?o=pr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=pr.evening:a>=12?o=pr.afternoon:a>=4?o=pr.morning:o=pr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Gs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Gs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Gs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Gs.s(r,n)},S:function(r,n){return Gs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return I0(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return I0(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+Q0(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+Q0(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ge(a,n.length)},T:function(r,n,s){return Ge(+r,n.length)}};function Q0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ge(f,2)}function I0(r,n){return r%60===0?(r>0?"-":"+")+Ge(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ge(Math.trunc(a/60),2),f=Ge(a%60,2);return s+o+n+f}const X0=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},ry=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},c2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return X0(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",X0(a,n)).replace("{{time}}",ry(o,n))},u2={p:ry,P:c2},f2=/^D+$/,h2=/^Y+$/,d2=["D","DD","YY","YYYY"];function m2(r){return f2.test(r)}function p2(r){return h2.test(r)}function g2(r,n,s){const a=y2(r,n,s);if(console.warn(a),d2.includes(r))throw new RangeError(a)}function y2(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const b2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,v2=/^'([^]*?)'?$/,_2=/''/g,w2=/[a-zA-Z]/;function ay(r,n,s){var E,w,j,q;const a=Va(),o=a.locale??sy,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((q=(j=a.locale)==null?void 0:j.options)==null?void 0:q.weekStartsOn)??0,d=sn(r,s==null?void 0:s.in);if(!ES(d))throw new RangeError("Invalid time value");let g=n.match(x2).map(M=>{const D=M[0];if(D==="p"||D==="P"){const W=u2[D];return W(M,o.formatLong)}return M}).join("").match(b2).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const D=M[0];if(D==="'")return{isToken:!1,value:S2(M)};if(J0[D])return{isToken:!0,value:M};if(D.match(w2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const D=M.value;(p2(D)||m2(D))&&g2(D,n,String(r));const W=J0[D[0]];return W(d,D,o.localize,y)}).join("")}function S2(r){const n=r.match(v2);return n?n[1].replace(_2,"'"):r}function E2(r,n,s){const a=Va(),o=(s==null?void 0:s.locale)??a.locale??sy,f=_S(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[d,g]=ny(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=AS((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-d.getTime(),w=E/P0,j=Po(g)-Po(d),q=(E-j)/P0,M=s==null?void 0:s.unit;let D;if(M?D=M:w<1?D="second":w<60?D="minute":w<G0?D="hour":q<Y0?D="day":q<$0?D="month":D="year",D==="second"){const W=y(E/1e3);return o.formatDistance("xSeconds",W,h)}else if(D==="minute"){const W=y(w);return o.formatDistance("xMinutes",W,h)}else if(D==="hour"){const W=y(w/60);return o.formatDistance("xHours",W,h)}else if(D==="day"){const W=y(q/G0);return o.formatDistance("xDays",W,h)}else if(D==="month"){const W=y(q/Y0);return W===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",W,h)}else{const W=y(q/$0);return o.formatDistance("xYears",W,h)}}function A2(r,n){return E2(r,wS(r),n)}function O2(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":A2(n,{addSuffix:!0})}function FE(r){return r<=0?"Expired":hh(r)}function j2(r){return r==null?"--":hh(r)}function hh(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function JE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return hh(a-s)}function ly({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[d,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),j=220,q=T.useCallback(()=>{if(!y.current)return;const se=y.current.getBoundingClientRect(),ee=window.innerWidth-j-8,me=Math.max(8,Math.min(se.left,ee));g({top:se.bottom+4,left:me})},[]),M=T.useCallback(async(se,ee)=>{try{await navigator.clipboard.writeText(se),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),D=T.useCallback(()=>{clearTimeout(w.current),q(),o(!0)},[q]),W=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),m.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:D,onMouseLeave:W,children:[n,a&&d&&ig.createPortal(m.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:d.top,left:d.left},onMouseEnter:D,onMouseLeave:W,children:r.map(se=>m.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(se.value,se.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:se.label}),m.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===se.label?"✓":se.value})]},se.label))}),document.body)]})}function T2(r,n){const s=new Date(r);switch(n){case"relative":return O2(r);case"datetime":return ay(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function N2(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:ay(n,"MMM d, yyyy h:mm:ss a")}]}function C2({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>N2(r),[r]);return m.jsx(ly,{options:o,children:m.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:T2(r,n)})})}function k2({ms:r,className:n=""}){const s=j2(r),a=T.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):m.jsx(ly,{options:a,children:m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const M2=["sm","md","lg","full"],K0={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},Z0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function R2({which:r}){const n="stroke-current";switch(r){case"sm":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function D2({msg:r}){const[n,s]=T.useState(0);T.useEffect(()=>{const h=new Date(r.timestamp).getTime(),d=()=>s(Math.floor((Date.now()-h)/1e3));d();const g=setInterval(d,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return m.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),m.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&m.jsxs(gr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[m.jsx(ug,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function z2({msg:r,compileMessage:n}){const s=r.role==="assistant";return m.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[m.jsx(C2,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),m.jsx(k2,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&m.jsx(gr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:m.jsx(ug,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&m.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:m.jsx(ev,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function q2(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Wg(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[j,q]=T.useState(!0),M=T.useRef(null),D=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&D.current&&D.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const C=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,E,n]),!r)return null;const W=()=>{const C=g.trim();!C||f||(a(C),y(""),D.current&&(D.current.style.height="auto"))},se=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),W())},ee=E==="full",me=o.page.replace(/-/g," "),re=ee?{}:{bottom:"108px"};return m.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?K0.full:`right-6 ${K0[E]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[m.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),m.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),m.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[m.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:M2.map(C=>m.jsx("button",{onClick:()=>w(C),className:`p-1 rounded transition-colors ${C===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===E,"aria-label":Z0[C],title:Z0[C],children:m.jsx(R2,{which:C})},C))}),s.length>0&&m.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:m.jsx(tv,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),m.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:m.jsx($o,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),m.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&m.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>m.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[m.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?m.jsx(D2,{msg:C}):C.role==="assistant"?m.jsx(fh,{content:C.content}):C.content}),!C.pending&&m.jsx("div",{className:"mt-0.5",children:m.jsx(z2,{msg:C,compileMessage:d})})]},C.id))]}),m.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsx("textarea",{ref:D,value:g,onChange:C=>{y(C.target.value);const X=C.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:se,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),m.jsx("button",{onClick:W,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:m.jsx(nv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function U2(){var M;const{isBuilder:r,isOps:n}=Vg(),{data:s}=xw(),a=!!((M=s==null?void 0:s.ai)!=null&&M.enabled),{collapsed:o,toggle:f}=Jg(),[h,d]=T.useState(!1),[g,y]=T.useState(!1),[E,w]=T.useState(()=>window.location.hash.startsWith("#docs")),j=Ws(),q=T.useRef(null);return T.useEffect(()=>{const D=q.current;D&&(D.classList.remove("animate-page-in"),D.offsetWidth,D.classList.add("animate-page-in"))},[j.pathname]),T.useEffect(()=>{const D=()=>{window.location.hash.startsWith("#docs")&&w(!0)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]),m.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[m.jsx(Aw,{onToggleEventFeed:()=>d(D=>!D),onToggleDocs:()=>w(D=>!D)}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsxs("aside",{className:`${o?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[m.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[m.jsx(Cw,{aiEnabled:a,isBuilder:r}),r&&m.jsx(kw,{}),r&&a&&m.jsx(Rw,{}),r&&m.jsx(zw,{}),(r||n)&&m.jsx(qw,{isBuilder:r})]}),m.jsx("button",{onClick:f,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${o?"flex justify-center":"flex items-center px-7"}`,"aria-label":o?"Expand sidebar":"Collapse sidebar",children:o?m.jsx(sv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):m.jsx(iv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{ref:q,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:m.jsx(So,{})})})]}),m.jsx(tS,{open:h,onToggle:()=>d(D=>!D),configOpen:g,onToggleConfig:()=>y(D=>!D)}),m.jsx(fS,{open:E,onClose:()=>{w(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),a&&m.jsx(gS,{}),a&&m.jsx(q2,{})]})}function B2(){const{isAuthenticated:r}=Oi(),n=Ws();return r?m.jsx(_w,{children:m.jsx(pS,{children:m.jsx(U2,{})})}):m.jsx(Fs,{to:"/login",state:{from:n.pathname},replace:!0})}function oy({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),m.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),m.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),m.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),m.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),m.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),m.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("path",{d:"M12 8v4l3 3"})]})}}async function L2(){return Xe("/auth/oauth/providers")}async function H2(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Xe(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function QE(){return Hn({queryKey:["oauth-connections"],queryFn:()=>Xe("/auth/oauth/connections")})}function IE(){const r=Cn();return Pn({mutationFn:({provider:n,label:s})=>H2(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function P2(){var ce;const{login:r,isAuthenticated:n}=Oi(),s=rg(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),d=((ce=a.state)==null?void 0:ce.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,j]=T.useState(""),[q,M]=T.useState(h||""),[D,W]=T.useState(!1),[se,ee]=T.useState(!!f),[me,re]=T.useState([]),C=T.useRef(!1);if(T.useEffect(()=>{f||C.current||(C.current=!0,(async()=>{var V,G,K,ae;try{const ne=await fetch(`${Wt}/api/settings`);if(!ne.ok)return;const ke=await ne.json();if(!((V=ke.auth)!=null&&V.sso))return;const He=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!He.ok){M("Host authentication required — please log in to your organization first");return}const Me=await He.json();Me.token&&((G=ke.auth)!=null&&G.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",ke.auth.ssoLogoutUrl),ee(!0),r(Me.token,void 0,{displayName:(K=Me.user)==null?void 0:K.display_name,username:(ae=Me.user)==null?void 0:ae.external_id}))}catch{}})())},[]),T.useEffect(()=>{f||L2().then(re).catch(()=>{})},[]),T.useEffect(()=>{if(!se)return;const V=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(V)},[se]),n&&!se)return m.jsx(Fs,{to:d,replace:!0});const X=async V=>{var G,K;if(V.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}W(!0);try{const ae=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ne=await ae.json();if(!ae.ok){M(ne.error||"Login failed");return}ee(!0),r(ne.token,{username:y.trim(),password:w},{displayName:(G=ne.user)==null?void 0:G.display_name,username:(K=ne.user)==null?void 0:K.external_id})}catch{M("Unable to connect to server")}finally{W(!1)}};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${se?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:m.jsx(ch,{size:"lg",hideLabel:se})}),m.jsxs("form",{onSubmit:X,className:`space-y-5 transition-opacity duration-300 ${se?"opacity-0":""}`,children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),m.jsx("input",{id:"username",type:"text",value:y,onChange:V=>E(V.target.value),className:"input",placeholder:"Enter your username",autoFocus:!se,autoComplete:"username"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),m.jsx("input",{id:"password",type:"password",value:w,onChange:V=>j(V.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&m.jsx("p",{className:"text-sm text-status-error",children:q}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:D||se,children:D?"Signing in...":"Sign In"}),me.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[m.jsx("div",{className:"flex-1 h-px bg-border"}),m.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),m.jsx("div",{className:"flex-1 h-px bg-border"})]}),m.jsx("div",{className:"space-y-2",children:me.filter(V=>V.provider!=="anthropic").map(V=>m.jsxs("a",{href:`${Wt}/api/auth/oauth/${V.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[m.jsx(oy,{provider:V.provider}),"Sign in with ",V.name]},V.provider))})]})]})]})})}function W0(){const{isAuthenticated:r}=Oi(),n=rg(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[d,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,j]=T.useState(!1),q=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),D=W=>{W.preventDefault();const se=f.trim();if(!se){E("A token or API key is required");return}if(!se.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),E("");const ee=`${Wt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(se)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:"mb-10",children:m.jsx(ch,{size:"lg"})}),m.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[m.jsx(oy,{provider:"anthropic",className:"w-6 h-6"}),m.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),m.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),m.jsxs("form",{onSubmit:D,className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),m.jsx("input",{id:"token",type:"password",value:f,onChange:W=>h(W.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&m.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&m.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),m.jsx("input",{id:"label",type:"text",value:d,onChange:W=>g(W.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),m.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&m.jsx("p",{className:"text-sm text-status-error",children:y}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),m.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),m.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",m.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",m.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function wo({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?m.jsx(So,{}):r&&r.some(h=>f(h))?m.jsx(So,{}):n&&n.some(h=>o(h))?m.jsx(So,{}):m.jsx(Fs,{to:s,replace:!0})}const $2=T.lazy(()=>Ae(()=>import("./ProcessesListPage-DR1RGaMl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),Y2=T.lazy(()=>Ae(()=>import("./ProcessDetailPage-DYIfvWyc.js"),__vite__mapDeps([16,1,2,4,17,13,18,15,9,6,19,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),G2=T.lazy(()=>Ae(()=>import("./McpOverview-BzyxJyc9.js"),__vite__mapDeps([22,1,23,24,25,26,12,13,27,6]),import.meta.url).then(r=>({default:r.McpOverview}))),V2=T.lazy(()=>Ae(()=>import("./McpRunsPage-SXyiwc0d.js"),__vite__mapDeps([28,1,24,25,26,5,6,7,8,15,13,9,29,12,11,10,14,30]),import.meta.url).then(r=>({default:r.McpRunsPage}))),F2=T.lazy(()=>Ae(()=>import("./McpRunDetailPage-DKZp-p7S.js"),__vite__mapDeps([31,1,24,18,12,13,32,6,33,34,14,35,36,11]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),J2=T.lazy(()=>Ae(()=>import("./McpQueryPage-WZfTY43_.js"),__vite__mapDeps([37,1,12,13,7,8,11,10,14,9,29,15,30,5,6,4,38]),import.meta.url).then(r=>({default:r.McpQueryPage}))),Q2=T.lazy(()=>Ae(()=>import("./McpQueryDetailPage-DXNseeKl.js"),__vite__mapDeps([39,1,12,13,18,38,40,6,25,4,41,33,24,3,2,42,43,44,45,32,46,35]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),I2=T.lazy(()=>Ae(()=>import("./EscalationsOverview-1KO5dXzk.js"),__vite__mapDeps([47,1,4,12,13,27,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),X2=T.lazy(()=>Ae(()=>import("./AvailableEscalationsPage-DR1e0TQZ.js"),__vite__mapDeps([48,1,4,49,5,6,7,8,10,12,13,50,51,52,21,53,11,54,19,15,9,55,30,14]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),K2=T.lazy(()=>Ae(()=>import("./OperatorDashboard-Cy7ySMXj.js"),__vite__mapDeps([56,1,4,49,5,6,7,8,12,13,10,30,53,11,54,19,15,9,55,14]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),Z2=T.lazy(()=>Ae(()=>import("./index-l_8R6U4r.js"),__vite__mapDeps([57,1,34,49,12,13,55,3,4,20,21,51,50,18,19,32,6,33]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),W2=T.lazy(()=>Ae(()=>import("./WorkflowsOverview-B4DUcVxs.js"),__vite__mapDeps([58,1,3,4,12,13,27,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),eE=T.lazy(()=>Ae(()=>import("./index-BFaDxPxA.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),tE=T.lazy(()=>Ae(()=>import("./index-BFaDxPxA.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),nE=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-D-G8Xudz.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),sE=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-D-G8Xudz.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),iE=T.lazy(()=>Ae(()=>import("./YamlWorkflowsPage-CnTNOku0.js"),__vite__mapDeps([62,1,25,40,5,6,63,12,13,11,8,43,44,45,42,60,46,18,64]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),rE=T.lazy(()=>Ae(()=>import("./TasksListPage-BRg-uFtF.js"),__vite__mapDeps([65,1,2,3,5,6,7,8,18,54,46,10,11,12,13,15]),import.meta.url).then(r=>({default:r.TasksListPage}))),aE=T.lazy(()=>Ae(()=>import("./TaskDetailPage-BO5p7AEe.js"),__vite__mapDeps([66,1,2,18,54,12,13,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),eg=T.lazy(()=>Ae(()=>import("./WorkflowExecutionPage-BQ7AYlQA.js"),__vite__mapDeps([67,1,3,4,34,2,12,13,33,14,18,32,6,35,36,11]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),lE=T.lazy(()=>Ae(()=>import("./AdminDashboard-BwUGcCxQ.js"),__vite__mapDeps([68,1,2,4,23,17,13,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),oE=T.lazy(()=>Ae(()=>import("./index-v0OQpgXS.js"),__vite__mapDeps([69,1,3,7,8,11,30,5,6,12,13,70,15]),import.meta.url).then(r=>({default:r.WorkersPage}))),cE=T.lazy(()=>Ae(()=>import("./index-BduDiGcw.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),tg=T.lazy(()=>Ae(()=>import("./index-BduDiGcw.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),uE=T.lazy(()=>Ae(()=>import("./index-CbrMW-gM.js"),__vite__mapDeps([74,1,23,8,72,52,6,12,13,11,10,5,63,75,43,44,45,42,64,30,18]),import.meta.url).then(r=>({default:r.McpServersPage}))),ng=T.lazy(()=>Ae(()=>import("./index-CvOGgvzP.js"),__vite__mapDeps([76,1,23,73,12,13,41,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),fE=T.lazy(()=>Ae(()=>import("./index-a98qWLB-.js"),__vite__mapDeps([77,1,21,5,6,7,8,10,11,9,72,52,30,12,13,19,45,49,46]),import.meta.url).then(r=>({default:r.UsersPage}))),hE=T.lazy(()=>Ae(()=>import("./RolesPage-pMERxj15.js"),__vite__mapDeps([78,1,49,7,8,72,52,6,12,13,19,30]),import.meta.url).then(r=>({default:r.RolesPage}))),dE=T.lazy(()=>Ae(()=>import("./index-DQHmfTPo.js"),__vite__mapDeps([79,1,12,13,52,6,50]),import.meta.url).then(r=>({default:r.MaintenancePage}))),mE=T.lazy(()=>Ae(()=>import("./index-BeLphL59.js"),__vite__mapDeps([80,1,17,13,11,5,6,81,52,33,70,7,8,30]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),pE=T.lazy(()=>Ae(()=>import("./index-DDlrQeTj.js"),__vite__mapDeps([82,1,6,81,5,7,8,10,11,9,12,13,14]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),gE=T.lazy(()=>Ae(()=>import("./CredentialsPage-Dt4nJs_B.js"),__vite__mapDeps([83,1,12,13,46,72,52,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),yE=T.lazy(()=>Ae(()=>import("./index-B9_1AZaG.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,46]),import.meta.url).then(r=>({default:r.FilesPage}))),bE=T.lazy(()=>Ae(()=>import("./index-CRiBkHPb.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,46,87,41,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),xE=T.lazy(()=>Ae(()=>import("./HomePage-B2Jgo1J1.js"),__vite__mapDeps([88,1,3,24,81,2,4,19,13,15,14,6]),import.meta.url).then(r=>({default:r.HomePage}))),vE=T.lazy(()=>Ae(()=>import("./AgentsPage-CGpVG6r8.js"),__vite__mapDeps([89,1,90,4,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.AgentsPage}))),_E=T.lazy(()=>Ae(()=>import("./AgentDetailPage-XJpl7wfJ.js"),__vite__mapDeps([91,1,90,92,13,4,15,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),sg=T.lazy(()=>Ae(()=>import("./AgentConfigPage-DgrYzLwq.js"),__vite__mapDeps([93,1,90,92,13,12,87,43,44,45,3,25,94,95,15,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),wE=T.lazy(()=>Ae(()=>import("./CapabilitiesPage-kCB8fyOj.js"),__vite__mapDeps([96,1,94,75,23,43,44,45,13,42,64,6,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),SE=T.lazy(()=>Ae(()=>import("./TopicsPage-B3Aa8Haz.js"),__vite__mapDeps([97,1,95,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.TopicsPage}))),EE=T.lazy(()=>Ae(()=>import("./TopicDetailPage-D7gCsPKB.js"),__vite__mapDeps([98,1,95,14,13,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function AE(){return m.jsxs("div",{className:"animate-pulse space-y-4",children:[m.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return m.jsx(T.Suspense,{fallback:m.jsx(AE,{}),children:m.jsx("div",{className:"animate-page-enter",children:r})})}const cy=new vx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{cy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=`${window.__LT_BASE__||""}/login`;window.location.pathname!==n&&(window.location.href=`${n}?returnTo=${encodeURIComponent(window.location.pathname)}`)});const OE=Sx([{path:"/login",element:m.jsx(P2,{})},{path:"/connect/anthropic",element:m.jsx(W0,{})},{path:"/connect/:provider",element:m.jsx(W0,{})},{path:"/",element:m.jsx(B2,{}),children:[{index:!0,element:m.jsx(xe,{children:m.jsx(xE,{})})},{path:"processes/all",element:m.jsx(xe,{children:m.jsx($2,{})})},{path:"processes/detail/:originId",element:m.jsx(xe,{children:m.jsx(Y2,{})})},{path:"credentials",element:m.jsx(xe,{children:m.jsx(gE,{})})},{path:"connections",element:m.jsx(Fs,{to:"/credentials",replace:!0})},{path:"escalations",element:m.jsx(xe,{children:m.jsx(I2,{})})},{path:"escalations/available",element:m.jsx(xe,{children:m.jsx(X2,{})})},{path:"escalations/queue",element:m.jsx(xe,{children:m.jsx(K2,{})})},{path:"escalations/detail/:id",element:m.jsx(xe,{children:m.jsx(Z2,{})})},{path:"capabilities",element:m.jsx(xe,{children:m.jsx(wE,{})})},{path:"agents",element:m.jsx(xe,{children:m.jsx(vE,{})})},{path:"agents/new",element:m.jsx(xe,{children:m.jsx(sg,{})})},{path:"agents/:id",element:m.jsx(xe,{children:m.jsx(_E,{})})},{path:"agents/:id/edit",element:m.jsx(xe,{children:m.jsx(sg,{})})},{path:"topics",element:m.jsx(xe,{children:m.jsx(SE,{})})},{path:"topics/:topic",element:m.jsx(xe,{children:m.jsx(EE,{})})},{element:m.jsx(wo,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:m.jsx(xe,{children:m.jsx(W2,{})})},{path:"workflows/executions",element:m.jsx(xe,{children:m.jsx(sE,{})})},{path:"workflows/durable/executions",element:m.jsx(xe,{children:m.jsx(nE,{})})},{path:"workflows/durable/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(eg,{})})},{path:"workflows/tasks",element:m.jsx(xe,{children:m.jsx(rE,{})})},{path:"workflows/tasks/detail/:id",element:m.jsx(xe,{children:m.jsx(aE,{})})},{path:"workflows/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(eg,{})})},{path:"workflows/start",element:m.jsx(xe,{children:m.jsx(eE,{})})},{path:"workflows/durable/invoke",element:m.jsx(xe,{children:m.jsx(tE,{})})},{path:"workflows/cron",element:m.jsx(Fs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:m.jsx(xe,{children:m.jsx(oE,{})})},{path:"workflows/registry",element:m.jsx(xe,{children:m.jsx(cE,{})})},{path:"workflows/registry/new",element:m.jsx(xe,{children:m.jsx(tg,{})})},{path:"workflows/registry/:workflowType",element:m.jsx(xe,{children:m.jsx(tg,{})})}]},{element:m.jsx(wo,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:m.jsx(xe,{children:m.jsx(G2,{})})},{path:"mcp/queries",element:m.jsx(xe,{children:m.jsx(J2,{})})},{path:"mcp/queries/:workflowId",element:m.jsx(xe,{children:m.jsx(Q2,{})})},{path:"mcp/tools",element:m.jsx(Fs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:m.jsx(xe,{children:m.jsx(uE,{})})},{path:"mcp/servers/new",element:m.jsx(xe,{children:m.jsx(ng,{})})},{path:"mcp/servers/:serverId",element:m.jsx(xe,{children:m.jsx(ng,{})})},{path:"mcp/workflows",element:m.jsx(xe,{children:m.jsx(iE,{})})},{path:"mcp/executions",element:m.jsx(xe,{children:m.jsx(V2,{})})},{path:"mcp/executions/:jobId",element:m.jsx(xe,{children:m.jsx(F2,{})})},{path:"files",element:m.jsx(xe,{children:m.jsx(yE,{})})},{path:"knowledge",element:m.jsx(xe,{children:m.jsx(bE,{})})}]},{element:m.jsx(wo,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:m.jsx(xe,{children:m.jsx(lE,{})})},{path:"admin/users",element:m.jsx(xe,{children:m.jsx(fE,{})})}]},{element:m.jsx(wo,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:m.jsx(Fs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:m.jsx(Fs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:m.jsx(xe,{children:m.jsx(hE,{})})},{path:"admin/maintenance",element:m.jsx(xe,{children:m.jsx(dE,{})})},{path:"admin/controlplane",element:m.jsx(xe,{children:m.jsx(mE,{})})},{path:"admin/streams",element:m.jsx(xe,{children:m.jsx(pE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function jE(){return m.jsx(_x,{client:cy,children:m.jsx(dv,{children:m.jsx(yw,{children:m.jsx(Ex,{router:OE})})})})}cv.createRoot(document.getElementById("root")).render(m.jsx(T.StrictMode,{children:m.jsx(jE,{})}));export{hh as A,QE as B,uh as C,k2 as D,IE as E,Ig as F,hg as G,Zw as J,Wt as L,g_ as N,oy as O,Hw as S,JE as a,Xe as b,b_ as c,C2 as d,zE as e,j2 as f,UE as g,LE as h,RE as i,Oi as j,PE as k,$E as l,YE as m,GE as n,VE as o,DE as p,Sw as q,ww as r,Vg as s,BE as t,xw as u,qE as v,HE as w,ay as x,ly as y,FE as z};
63
+ //# sourceMappingURL=index-_BRA9uFL.js.map