@hotmeshio/long-tail 0.10.2 → 0.10.4

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 (397) hide show
  1. package/README.md +1 -0
  2. package/build/api/bot-accounts.d.ts +4 -0
  3. package/build/api/bot-accounts.js +3 -1
  4. package/build/api/escalations/metadata.js +21 -1
  5. package/build/api/escalations/resolve.d.ts +8 -0
  6. package/build/api/escalations/resolve.js +82 -3
  7. package/build/api/roles.d.ts +2 -0
  8. package/build/api/roles.js +4 -0
  9. package/build/bin/ltc.js +10 -1
  10. package/build/index.js +7 -1
  11. package/build/lib/cli/client.d.ts +4 -1
  12. package/build/lib/cli/client.js +4 -2
  13. package/build/lib/db/schemas/023_role_enforce_schema.sql +18 -0
  14. package/build/lib/typed-resolution.d.ts +35 -0
  15. package/build/lib/typed-resolution.js +37 -0
  16. package/build/modules/branding.d.ts +21 -2
  17. package/build/modules/branding.js +22 -1
  18. package/build/modules/config.d.ts +1 -0
  19. package/build/modules/config.js +5 -0
  20. package/build/routes/bot-accounts.js +3 -1
  21. package/build/routes/settings.js +21 -0
  22. package/build/sdk/index.d.ts +4 -0
  23. package/build/sdk/index.js +14 -0
  24. package/build/services/escalation/crud.d.ts +18 -6
  25. package/build/services/escalation/crud.js +18 -2
  26. package/build/services/escalation/index.d.ts +1 -0
  27. package/build/services/escalation/index.js +1 -0
  28. package/build/services/escalation/resolver-validation.d.ts +28 -0
  29. package/build/services/escalation/resolver-validation.js +95 -0
  30. package/build/services/escalation/sql.d.ts +12 -2
  31. package/build/services/escalation/sql.js +22 -2
  32. package/build/services/iam/bots.d.ts +4 -1
  33. package/build/services/iam/bots.js +5 -3
  34. package/build/services/iam/sql.d.ts +2 -2
  35. package/build/services/iam/sql.js +15 -1
  36. package/build/services/role/enforcement-cache.d.ts +21 -0
  37. package/build/services/role/enforcement-cache.js +0 -0
  38. package/build/services/role/index.js +5 -0
  39. package/build/services/role/sql.d.ts +12 -2
  40. package/build/services/role/sql.js +15 -2
  41. package/build/services/role/types.d.ts +9 -0
  42. package/build/shared/form-validation/derive-field-label.d.ts +14 -0
  43. package/build/shared/form-validation/derive-field-label.js +31 -0
  44. package/build/shared/form-validation/field-validator.d.ts +45 -0
  45. package/build/shared/form-validation/field-validator.js +214 -0
  46. package/build/shared/form-validation/index.d.ts +12 -0
  47. package/build/shared/form-validation/index.js +28 -0
  48. package/build/shared/form-validation/validate-resolver-payload.d.ts +41 -0
  49. package/build/shared/form-validation/validate-resolver-payload.js +62 -0
  50. package/build/shared/form-validation/x-lt-bind.d.ts +41 -0
  51. package/build/shared/form-validation/x-lt-bind.js +110 -0
  52. package/build/shared/form-validation/x-lt-help.d.ts +21 -0
  53. package/build/shared/form-validation/x-lt-help.js +91 -0
  54. package/build/shared/form-validation/x-lt-show-if.d.ts +7 -0
  55. package/build/shared/form-validation/x-lt-show-if.js +84 -0
  56. package/build/system/mcp-servers/admin/schemas.d.ts +3 -0
  57. package/build/system/mcp-servers/admin/schemas.js +1 -0
  58. package/build/system/mcp-servers/admin/users.js +3 -1
  59. package/build/system/mcp-servers/human-queue-schemas.d.ts +4 -4
  60. package/build/system/mcp-servers/human-queue-schemas.js +4 -1
  61. package/build/system/mcp-servers/human-queue.js +41 -2
  62. package/build/tsconfig.tsbuildinfo +1 -1
  63. package/build/types/sdk.d.ts +6 -1
  64. package/build/types/startup.d.ts +26 -0
  65. package/build/types/validation.d.ts +43 -0
  66. package/build/types/validation.js +28 -0
  67. package/dashboard/dist/assets/{AdminDashboard-Dy031e9g.js → AdminDashboard-Cma2NGsF.js} +2 -2
  68. package/dashboard/dist/assets/{AdminDashboard-Dy031e9g.js.map → AdminDashboard-Cma2NGsF.js.map} +1 -1
  69. package/dashboard/dist/assets/AgentConfigPage-CbIhM-fa.js +16 -0
  70. package/dashboard/dist/assets/AgentConfigPage-CbIhM-fa.js.map +1 -0
  71. package/dashboard/dist/assets/AgentDetailPage-DuLEKzRT.js +4 -0
  72. package/dashboard/dist/assets/AgentDetailPage-DuLEKzRT.js.map +1 -0
  73. package/dashboard/dist/assets/AgentsPage-DZO9i7Nl.js +2 -0
  74. package/dashboard/dist/assets/AgentsPage-DZO9i7Nl.js.map +1 -0
  75. package/dashboard/dist/assets/AvailableEscalationsPage-DlVoNd8B.js +2 -0
  76. package/dashboard/dist/assets/AvailableEscalationsPage-DlVoNd8B.js.map +1 -0
  77. package/dashboard/dist/assets/{BotPicker-2QEIpc-K.js → BotPicker-CidlGr6f.js} +2 -2
  78. package/dashboard/dist/assets/{BotPicker-2QEIpc-K.js.map → BotPicker-CidlGr6f.js.map} +1 -1
  79. package/dashboard/dist/assets/CapabilitiesPage-BMNNTa0D.js +2 -0
  80. package/dashboard/dist/assets/{CapabilitiesPage-lQJGZ_-t.js.map → CapabilitiesPage-BMNNTa0D.js.map} +1 -1
  81. package/dashboard/dist/assets/{CollapsibleSection-CHWP0WI6.js → CollapsibleSection-W9F9lziT.js} +2 -2
  82. package/dashboard/dist/assets/{CollapsibleSection-CHWP0WI6.js.map → CollapsibleSection-W9F9lziT.js.map} +1 -1
  83. package/dashboard/dist/assets/ConfirmDeleteModal-BUh-Dzba.js +2 -0
  84. package/dashboard/dist/assets/{ConfirmDeleteModal-C0x0HcHX.js.map → ConfirmDeleteModal-BUh-Dzba.js.map} +1 -1
  85. package/dashboard/dist/assets/{CopyableId-uot2mE_g.js → CopyableId-B1mxKfVb.js} +2 -2
  86. package/dashboard/dist/assets/{CopyableId-uot2mE_g.js.map → CopyableId-B1mxKfVb.js.map} +1 -1
  87. package/dashboard/dist/assets/CountdownTimer-lkv_7msa.js +2 -0
  88. package/dashboard/dist/assets/{CountdownTimer-TXsRlTU4.js.map → CountdownTimer-lkv_7msa.js.map} +1 -1
  89. package/dashboard/dist/assets/{CredentialsPage-BKxS-1sA.js → CredentialsPage-DyOgfnPB.js} +2 -2
  90. package/dashboard/dist/assets/CredentialsPage-DyOgfnPB.js.map +1 -0
  91. package/dashboard/dist/assets/{CronLabel-Bd2G0Rap.js → CronLabel-geum95dj.js} +2 -2
  92. package/dashboard/dist/assets/{CronLabel-Bd2G0Rap.js.map → CronLabel-geum95dj.js.map} +1 -1
  93. package/dashboard/dist/assets/CustomDurationPicker-ClufO2ew.js +2 -0
  94. package/dashboard/dist/assets/CustomDurationPicker-ClufO2ew.js.map +1 -0
  95. package/dashboard/dist/assets/DataTable-BTu2AaEl.js +2 -0
  96. package/dashboard/dist/assets/DataTable-BTu2AaEl.js.map +1 -0
  97. package/dashboard/dist/assets/{DropZone-DNDEgMpJ.js → DropZone-C3hOjJtC.js} +2 -2
  98. package/dashboard/dist/assets/{DropZone-DNDEgMpJ.js.map → DropZone-C3hOjJtC.js.map} +1 -1
  99. package/dashboard/dist/assets/{ElapsedCell-g7GO7f8L.js → ElapsedCell-DFOW9T4b.js} +2 -2
  100. package/dashboard/dist/assets/{ElapsedCell-g7GO7f8L.js.map → ElapsedCell-DFOW9T4b.js.map} +1 -1
  101. package/dashboard/dist/assets/EscalationListSchemaPage-_IhqXIQu.js +20 -0
  102. package/dashboard/dist/assets/EscalationListSchemaPage-_IhqXIQu.js.map +1 -0
  103. package/dashboard/dist/assets/EscalationSchemaPage-BCC7iscN.js +9 -0
  104. package/dashboard/dist/assets/EscalationSchemaPage-BCC7iscN.js.map +1 -0
  105. package/dashboard/dist/assets/EscalationsOverview-CvIdOtoP.js +2 -0
  106. package/dashboard/dist/assets/EscalationsOverview-CvIdOtoP.js.map +1 -0
  107. package/dashboard/dist/assets/EventTable-DJWJ7J0m.js +2 -0
  108. package/dashboard/dist/assets/EventTable-DJWJ7J0m.js.map +1 -0
  109. package/dashboard/dist/assets/FilterBar-BR3ztZ8y.js +2 -0
  110. package/dashboard/dist/assets/FilterBar-BR3ztZ8y.js.map +1 -0
  111. package/dashboard/dist/assets/GraphInvokePage-Cwn-8Glr.js +2 -0
  112. package/dashboard/dist/assets/GraphInvokePage-Cwn-8Glr.js.map +1 -0
  113. package/dashboard/dist/assets/HomePage-D8RVntg0.js +2 -0
  114. package/dashboard/dist/assets/HomePage-D8RVntg0.js.map +1 -0
  115. package/dashboard/dist/assets/ListToolbar-DuoEdVtK.js +2 -0
  116. package/dashboard/dist/assets/ListToolbar-DuoEdVtK.js.map +1 -0
  117. package/dashboard/dist/assets/McpOverview-NXKsGiWU.js +2 -0
  118. package/dashboard/dist/assets/McpOverview-NXKsGiWU.js.map +1 -0
  119. package/dashboard/dist/assets/McpQueryDetailPage-BC-iXfIx.js +5 -0
  120. package/dashboard/dist/assets/McpQueryDetailPage-BC-iXfIx.js.map +1 -0
  121. package/dashboard/dist/assets/{McpQueryPage-CsKNXUhb.js → McpQueryPage-BPJmFYOY.js} +2 -2
  122. package/dashboard/dist/assets/{McpQueryPage-CsKNXUhb.js.map → McpQueryPage-BPJmFYOY.js.map} +1 -1
  123. package/dashboard/dist/assets/McpRunDetailPage-B49nUXEl.js +2 -0
  124. package/dashboard/dist/assets/McpRunDetailPage-B49nUXEl.js.map +1 -0
  125. package/dashboard/dist/assets/McpRunsPage-Ce_XIYpP.js +2 -0
  126. package/dashboard/dist/assets/McpRunsPage-Ce_XIYpP.js.map +1 -0
  127. package/dashboard/dist/assets/NamespacePill-LWvZXt_g.js +2 -0
  128. package/dashboard/dist/assets/NamespacePill-LWvZXt_g.js.map +1 -0
  129. package/dashboard/dist/assets/OperationsPage-DI7AQO9f.js +2 -0
  130. package/dashboard/dist/assets/OperationsPage-DI7AQO9f.js.map +1 -0
  131. package/dashboard/dist/assets/OperatorDashboard-DpXjhs-3.js +2 -0
  132. package/dashboard/dist/assets/{OperatorDashboard-_axS17fp.js.map → OperatorDashboard-DpXjhs-3.js.map} +1 -1
  133. package/dashboard/dist/assets/PageHeader-DvEmMMP6.js +2 -0
  134. package/dashboard/dist/assets/PageHeader-DvEmMMP6.js.map +1 -0
  135. package/dashboard/dist/assets/PageHeaderWithStats-X0eAmu-x.js +2 -0
  136. package/dashboard/dist/assets/PageHeaderWithStats-X0eAmu-x.js.map +1 -0
  137. package/dashboard/dist/assets/{PriorityBadge-B4ykBH7f.js → PriorityBadge-CCERr9vQ.js} +2 -2
  138. package/dashboard/dist/assets/PriorityBadge-CCERr9vQ.js.map +1 -0
  139. package/dashboard/dist/assets/ProcessDetailPage-DpYSMRj1.js +2 -0
  140. package/dashboard/dist/assets/ProcessDetailPage-DpYSMRj1.js.map +1 -0
  141. package/dashboard/dist/assets/{ProcessesListPage-CoQEi_Su.js → ProcessesListPage-CQ9tSw7U.js} +2 -2
  142. package/dashboard/dist/assets/{ProcessesListPage-CoQEi_Su.js.map → ProcessesListPage-CQ9tSw7U.js.map} +1 -1
  143. package/dashboard/dist/assets/RoleDetailPage-DKeQKDkW.js +8 -0
  144. package/dashboard/dist/assets/RoleDetailPage-DKeQKDkW.js.map +1 -0
  145. package/dashboard/dist/assets/RolePill-CWhoLwef.js +2 -0
  146. package/dashboard/dist/assets/RolePill-CWhoLwef.js.map +1 -0
  147. package/dashboard/dist/assets/RolesPage-D-6kIact.js +2 -0
  148. package/dashboard/dist/assets/RolesPage-D-6kIact.js.map +1 -0
  149. package/dashboard/dist/assets/RunAsSelector-DzYcpQTm.js +2 -0
  150. package/dashboard/dist/assets/RunAsSelector-DzYcpQTm.js.map +1 -0
  151. package/dashboard/dist/assets/StatCard-DBANWIss.js +2 -0
  152. package/dashboard/dist/assets/StatCard-DBANWIss.js.map +1 -0
  153. package/dashboard/dist/assets/StatusBadge-BbqghFMi.js +2 -0
  154. package/dashboard/dist/assets/StatusBadge-BbqghFMi.js.map +1 -0
  155. package/dashboard/dist/assets/{StickyPagination-Cd83AHd_.js → StickyPagination-BTGfmGV3.js} +2 -2
  156. package/dashboard/dist/assets/{StickyPagination-Cd83AHd_.js.map → StickyPagination-BTGfmGV3.js.map} +1 -1
  157. package/dashboard/dist/assets/StreamMessageDetail-DqRpzA_6.js +2 -0
  158. package/dashboard/dist/assets/StreamMessageDetail-DqRpzA_6.js.map +1 -0
  159. package/dashboard/dist/assets/SwimlaneTimeline-CA106TYo.js +2 -0
  160. package/dashboard/dist/assets/SwimlaneTimeline-CA106TYo.js.map +1 -0
  161. package/dashboard/dist/assets/TagInput-CoR4MzsW.js +2 -0
  162. package/dashboard/dist/assets/TagInput-CoR4MzsW.js.map +1 -0
  163. package/dashboard/dist/assets/{TaskDetailPage-DnjhW7qv.js → TaskDetailPage-BRg-w2Ev.js} +2 -2
  164. package/dashboard/dist/assets/{TaskDetailPage-DnjhW7qv.js.map → TaskDetailPage-BRg-w2Ev.js.map} +1 -1
  165. package/dashboard/dist/assets/TaskQueuePill-Dw3YN8M-.js +2 -0
  166. package/dashboard/dist/assets/TaskQueuePill-Dw3YN8M-.js.map +1 -0
  167. package/dashboard/dist/assets/{TasksListPage-DySfZFgs.js → TasksListPage-kB_j9G8o.js} +2 -2
  168. package/dashboard/dist/assets/{TasksListPage-DySfZFgs.js.map → TasksListPage-kB_j9G8o.js.map} +1 -1
  169. package/dashboard/dist/assets/{TimeAgo-BKOl-7Tt.js → TimeAgo-D7dSIY7-.js} +2 -2
  170. package/dashboard/dist/assets/{TimeAgo-BKOl-7Tt.js.map → TimeAgo-D7dSIY7-.js.map} +1 -1
  171. package/dashboard/dist/assets/TimestampCell-BZe6bx18.js +2 -0
  172. package/dashboard/dist/assets/TimestampCell-BZe6bx18.js.map +1 -0
  173. package/dashboard/dist/assets/ToolPill-xX-buQtY.js +2 -0
  174. package/dashboard/dist/assets/ToolPill-xX-buQtY.js.map +1 -0
  175. package/dashboard/dist/assets/ToolTestPanel-U3NaF_T_.js +2 -0
  176. package/dashboard/dist/assets/ToolTestPanel-U3NaF_T_.js.map +1 -0
  177. package/dashboard/dist/assets/TopicDetailPage-BpALvXP1.js +9 -0
  178. package/dashboard/dist/assets/TopicDetailPage-BpALvXP1.js.map +1 -0
  179. package/dashboard/dist/assets/TopicsPage-Cy3chaca.js +2 -0
  180. package/dashboard/dist/assets/{TopicsPage-5yW63ELl.js.map → TopicsPage-Cy3chaca.js.map} +1 -1
  181. package/dashboard/dist/assets/{UserName-DcXhOSVm.js → UserName-VXM1oHMC.js} +2 -2
  182. package/dashboard/dist/assets/{UserName-DcXhOSVm.js.map → UserName-VXM1oHMC.js.map} +1 -1
  183. package/dashboard/dist/assets/WorkflowExecutionPage-BCq2cR1V.js +2 -0
  184. package/dashboard/dist/assets/WorkflowExecutionPage-BCq2cR1V.js.map +1 -0
  185. package/dashboard/dist/assets/WorkflowPill-CQ1AmhlC.js +2 -0
  186. package/dashboard/dist/assets/WorkflowPill-CQ1AmhlC.js.map +1 -0
  187. package/dashboard/dist/assets/{WorkflowsDashboard-C0Bbrd5M.js → WorkflowsDashboard-BbM69MnB.js} +2 -2
  188. package/dashboard/dist/assets/{WorkflowsDashboard-C0Bbrd5M.js.map → WorkflowsDashboard-BbM69MnB.js.map} +1 -1
  189. package/dashboard/dist/assets/WorkflowsOverview-D5HthpAW.js +2 -0
  190. package/dashboard/dist/assets/WorkflowsOverview-D5HthpAW.js.map +1 -0
  191. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BcbrYhDI.js → YamlWorkflowDetailPage-CDDVMYWi.js} +10 -10
  192. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BcbrYhDI.js.map → YamlWorkflowDetailPage-CDDVMYWi.js.map} +1 -1
  193. package/dashboard/dist/assets/YamlWorkflowsPage-FFjWwydj.js +2 -0
  194. package/dashboard/dist/assets/YamlWorkflowsPage-FFjWwydj.js.map +1 -0
  195. package/dashboard/dist/assets/{agents-CopQ3t5o.js → agents-BwiSNu73.js} +2 -2
  196. package/dashboard/dist/assets/{agents-CopQ3t5o.js.map → agents-BwiSNu73.js.map} +1 -1
  197. package/dashboard/dist/assets/bots-ClgSrxel.js +2 -0
  198. package/dashboard/dist/assets/bots-ClgSrxel.js.map +1 -0
  199. package/dashboard/dist/assets/{capabilities-5JRieYUy.js → capabilities-JUaKsby4.js} +2 -2
  200. package/dashboard/dist/assets/{capabilities-5JRieYUy.js.map → capabilities-JUaKsby4.js.map} +1 -1
  201. package/dashboard/dist/assets/{controlplane-B4rT6tIw.js → controlplane-CuTQ7eUE.js} +2 -2
  202. package/dashboard/dist/assets/{controlplane-B4rT6tIw.js.map → controlplane-CuTQ7eUE.js.map} +1 -1
  203. package/dashboard/dist/assets/escalation-columns-CS0c7cAr.js +2 -0
  204. package/dashboard/dist/assets/escalation-columns-CS0c7cAr.js.map +1 -0
  205. package/dashboard/dist/assets/index-BBA4AxmL.js +2 -0
  206. package/dashboard/dist/assets/index-BBA4AxmL.js.map +1 -0
  207. package/dashboard/dist/assets/index-C-8xXyvr.js +63 -0
  208. package/dashboard/dist/assets/index-C-8xXyvr.js.map +1 -0
  209. package/dashboard/dist/assets/index-C1t0YIXC.js +5 -0
  210. package/dashboard/dist/assets/index-C1t0YIXC.js.map +1 -0
  211. package/dashboard/dist/assets/index-C9o2UNhC.js +2 -0
  212. package/dashboard/dist/assets/index-C9o2UNhC.js.map +1 -0
  213. package/dashboard/dist/assets/index-CBj-vstO.js +2 -0
  214. package/dashboard/dist/assets/{index-Dd1RxGNw.js.map → index-CBj-vstO.js.map} +1 -1
  215. package/dashboard/dist/assets/index-CUguKMXZ.js +2 -0
  216. package/dashboard/dist/assets/index-CUguKMXZ.js.map +1 -0
  217. package/dashboard/dist/assets/index-Cavwd8UU.js +6 -0
  218. package/dashboard/dist/assets/index-Cavwd8UU.js.map +1 -0
  219. package/dashboard/dist/assets/index-CnsPBTXL.js +2 -0
  220. package/dashboard/dist/assets/index-CnsPBTXL.js.map +1 -0
  221. package/dashboard/dist/assets/index-CoPWHo_H.js +2 -0
  222. package/dashboard/dist/assets/index-CoPWHo_H.js.map +1 -0
  223. package/dashboard/dist/assets/index-CwQVaa7x.js +2 -0
  224. package/dashboard/dist/assets/index-CwQVaa7x.js.map +1 -0
  225. package/dashboard/dist/assets/index-DSa-6Ux8.js +2 -0
  226. package/dashboard/dist/assets/index-DSa-6Ux8.js.map +1 -0
  227. package/dashboard/dist/assets/index-DeMs_aBT.css +1 -0
  228. package/dashboard/dist/assets/index-Ikj_NTuy.js +5 -0
  229. package/dashboard/dist/assets/index-Ikj_NTuy.js.map +1 -0
  230. package/dashboard/dist/assets/index-Xd1jcHe7.js +2 -0
  231. package/dashboard/dist/assets/index-Xd1jcHe7.js.map +1 -0
  232. package/dashboard/dist/assets/{knowledge-B9bmoXOe.js → knowledge-BHBt-6kW.js} +2 -2
  233. package/dashboard/dist/assets/{knowledge-B9bmoXOe.js.map → knowledge-BHBt-6kW.js.map} +1 -1
  234. package/dashboard/dist/assets/{mcp-DYMFBOFz.js → mcp-CBcz4BCS.js} +2 -2
  235. package/dashboard/dist/assets/{mcp-DYMFBOFz.js.map → mcp-CBcz4BCS.js.map} +1 -1
  236. package/dashboard/dist/assets/{mcp-query-wloSpyPM.js → mcp-query-C4fKTOYo.js} +2 -2
  237. package/dashboard/dist/assets/{mcp-query-wloSpyPM.js.map → mcp-query-C4fKTOYo.js.map} +1 -1
  238. package/dashboard/dist/assets/{pipelines-DBXX6TEi.js → pipelines-CmAAH3B6.js} +2 -2
  239. package/dashboard/dist/assets/{pipelines-DBXX6TEi.js.map → pipelines-CmAAH3B6.js.map} +1 -1
  240. package/dashboard/dist/assets/role-display-Dvo2lDpU.js +2 -0
  241. package/dashboard/dist/assets/role-display-Dvo2lDpU.js.map +1 -0
  242. package/dashboard/dist/assets/task-queues-7-sHKPsN.js +2 -0
  243. package/dashboard/dist/assets/task-queues-7-sHKPsN.js.map +1 -0
  244. package/dashboard/dist/assets/{tasks-CD3-C7tP.js → tasks-BAEsqcz2.js} +2 -2
  245. package/dashboard/dist/assets/{tasks-CD3-C7tP.js.map → tasks-BAEsqcz2.js.map} +1 -1
  246. package/dashboard/dist/assets/{topics-D8pKi6zA.js → topics-CY0pJ6_o.js} +2 -2
  247. package/dashboard/dist/assets/{topics-D8pKi6zA.js.map → topics-CY0pJ6_o.js.map} +1 -1
  248. package/dashboard/dist/assets/{useEventHooks-DV9pLDOW.js → useEventHooks-BlpwRvHO.js} +2 -2
  249. package/dashboard/dist/assets/{useEventHooks-DV9pLDOW.js.map → useEventHooks-BlpwRvHO.js.map} +1 -1
  250. package/dashboard/dist/assets/{useNamespace-DykYhZY9.js → useNamespace-CoNUlZ6Z.js} +2 -2
  251. package/dashboard/dist/assets/{useNamespace-DykYhZY9.js.map → useNamespace-CoNUlZ6Z.js.map} +1 -1
  252. package/dashboard/dist/assets/{useYamlActivityEvents-By044UAv.js → useYamlActivityEvents-8GUn5Wie.js} +2 -2
  253. package/dashboard/dist/assets/{useYamlActivityEvents-By044UAv.js.map → useYamlActivityEvents-8GUn5Wie.js.map} +1 -1
  254. package/dashboard/dist/assets/{users-mI9goDjj.js → users-uGtDRGxR.js} +2 -2
  255. package/dashboard/dist/assets/{users-mI9goDjj.js.map → users-uGtDRGxR.js.map} +1 -1
  256. package/dashboard/dist/assets/{vendor-icons-ihWGa7_d.js → vendor-icons-DKCAtTJ9.js} +135 -130
  257. package/dashboard/dist/assets/vendor-icons-DKCAtTJ9.js.map +1 -0
  258. package/dashboard/dist/assets/{workflows-DCUilz68.js → workflows-DoX-AtHN.js} +2 -2
  259. package/dashboard/dist/assets/{workflows-DCUilz68.js.map → workflows-DoX-AtHN.js.map} +1 -1
  260. package/dashboard/dist/assets/{yaml-workflows-DWNMP1PT.js → yaml-workflows-DM3jVem2.js} +2 -2
  261. package/dashboard/dist/assets/{yaml-workflows-DWNMP1PT.js.map → yaml-workflows-DM3jVem2.js.map} +1 -1
  262. package/dashboard/dist/index.html +3 -3
  263. package/docs/api/http/escalations.md +15 -1
  264. package/docs/api/http/roles.md +2 -0
  265. package/docs/design-principles.md +234 -0
  266. package/docs/hitl/design.md +228 -0
  267. package/docs/hitl/form.md +21 -1
  268. package/docs/hitl/iframe.md +1 -1
  269. package/docs/hitl/x-lt-display.md +56 -0
  270. package/docs/hitl/x-lt-layout.md +20 -1
  271. package/docs/hitl/x-lt-list-schema.md +8 -1
  272. package/docs/hitl/x-lt-widget.md +23 -0
  273. package/docs/hitl-guide.md +4 -2
  274. package/docs/schema-enforcement.md +149 -0
  275. package/package.json +1 -1
  276. package/dashboard/dist/assets/AgentConfigPage-CqmtYBbC.js +0 -16
  277. package/dashboard/dist/assets/AgentConfigPage-CqmtYBbC.js.map +0 -1
  278. package/dashboard/dist/assets/AgentDetailPage-oYLBrN74.js +0 -4
  279. package/dashboard/dist/assets/AgentDetailPage-oYLBrN74.js.map +0 -1
  280. package/dashboard/dist/assets/AgentsPage-CHczRx5N.js +0 -2
  281. package/dashboard/dist/assets/AgentsPage-CHczRx5N.js.map +0 -1
  282. package/dashboard/dist/assets/AvailableEscalationsPage-DDVuivEE.js +0 -2
  283. package/dashboard/dist/assets/AvailableEscalationsPage-DDVuivEE.js.map +0 -1
  284. package/dashboard/dist/assets/CapabilitiesPage-lQJGZ_-t.js +0 -2
  285. package/dashboard/dist/assets/ConfirmDeleteModal-C0x0HcHX.js +0 -2
  286. package/dashboard/dist/assets/CountdownTimer-TXsRlTU4.js +0 -2
  287. package/dashboard/dist/assets/CredentialsPage-BKxS-1sA.js.map +0 -1
  288. package/dashboard/dist/assets/CustomDurationPicker-j4bBrDJ6.js +0 -2
  289. package/dashboard/dist/assets/CustomDurationPicker-j4bBrDJ6.js.map +0 -1
  290. package/dashboard/dist/assets/DataTable-Byn3oyT9.js +0 -2
  291. package/dashboard/dist/assets/DataTable-Byn3oyT9.js.map +0 -1
  292. package/dashboard/dist/assets/EscalationListSchemaPage-CIJ-OgVC.js +0 -20
  293. package/dashboard/dist/assets/EscalationListSchemaPage-CIJ-OgVC.js.map +0 -1
  294. package/dashboard/dist/assets/EscalationSchemaPage-C7dHgG8e.js +0 -9
  295. package/dashboard/dist/assets/EscalationSchemaPage-C7dHgG8e.js.map +0 -1
  296. package/dashboard/dist/assets/EscalationsOverview-D8NrATg2.js +0 -2
  297. package/dashboard/dist/assets/EscalationsOverview-D8NrATg2.js.map +0 -1
  298. package/dashboard/dist/assets/EventTable-DBV1P2ME.js +0 -2
  299. package/dashboard/dist/assets/EventTable-DBV1P2ME.js.map +0 -1
  300. package/dashboard/dist/assets/FilterBar-B5Vk5tBF.js +0 -2
  301. package/dashboard/dist/assets/FilterBar-B5Vk5tBF.js.map +0 -1
  302. package/dashboard/dist/assets/GraphInvokePage-DbHvggQ_.js +0 -2
  303. package/dashboard/dist/assets/GraphInvokePage-DbHvggQ_.js.map +0 -1
  304. package/dashboard/dist/assets/HomePage-BpexnDO_.js +0 -2
  305. package/dashboard/dist/assets/HomePage-BpexnDO_.js.map +0 -1
  306. package/dashboard/dist/assets/ListToolbar-KC6LGtKP.js +0 -2
  307. package/dashboard/dist/assets/ListToolbar-KC6LGtKP.js.map +0 -1
  308. package/dashboard/dist/assets/McpOverview-BDZC9Hvl.js +0 -2
  309. package/dashboard/dist/assets/McpOverview-BDZC9Hvl.js.map +0 -1
  310. package/dashboard/dist/assets/McpQueryDetailPage-CXhgX1pS.js +0 -5
  311. package/dashboard/dist/assets/McpQueryDetailPage-CXhgX1pS.js.map +0 -1
  312. package/dashboard/dist/assets/McpRunDetailPage-BM3mUSlH.js +0 -2
  313. package/dashboard/dist/assets/McpRunDetailPage-BM3mUSlH.js.map +0 -1
  314. package/dashboard/dist/assets/McpRunsPage-f5hDbpLo.js +0 -2
  315. package/dashboard/dist/assets/McpRunsPage-f5hDbpLo.js.map +0 -1
  316. package/dashboard/dist/assets/NamespacePill-C4u6Go1W.js +0 -2
  317. package/dashboard/dist/assets/NamespacePill-C4u6Go1W.js.map +0 -1
  318. package/dashboard/dist/assets/OperationsPage-D37cZ8Qh.js +0 -2
  319. package/dashboard/dist/assets/OperationsPage-D37cZ8Qh.js.map +0 -1
  320. package/dashboard/dist/assets/OperatorDashboard-_axS17fp.js +0 -2
  321. package/dashboard/dist/assets/PageHeader-Bxa1XFz0.js +0 -2
  322. package/dashboard/dist/assets/PageHeader-Bxa1XFz0.js.map +0 -1
  323. package/dashboard/dist/assets/PageHeaderWithStats-D_sO0MqJ.js +0 -2
  324. package/dashboard/dist/assets/PageHeaderWithStats-D_sO0MqJ.js.map +0 -1
  325. package/dashboard/dist/assets/PriorityBadge-B4ykBH7f.js.map +0 -1
  326. package/dashboard/dist/assets/ProcessDetailPage-D8pAWUXx.js +0 -2
  327. package/dashboard/dist/assets/ProcessDetailPage-D8pAWUXx.js.map +0 -1
  328. package/dashboard/dist/assets/RoleDetailPage-ufbypNNR.js +0 -8
  329. package/dashboard/dist/assets/RoleDetailPage-ufbypNNR.js.map +0 -1
  330. package/dashboard/dist/assets/RolePill-DLwmVMam.js +0 -2
  331. package/dashboard/dist/assets/RolePill-DLwmVMam.js.map +0 -1
  332. package/dashboard/dist/assets/RolesPage-CxpXm4Sw.js +0 -2
  333. package/dashboard/dist/assets/RolesPage-CxpXm4Sw.js.map +0 -1
  334. package/dashboard/dist/assets/RunAsSelector-BebF8Lib.js +0 -2
  335. package/dashboard/dist/assets/RunAsSelector-BebF8Lib.js.map +0 -1
  336. package/dashboard/dist/assets/SlidePanel-BDVDuwIf.js +0 -2
  337. package/dashboard/dist/assets/SlidePanel-BDVDuwIf.js.map +0 -1
  338. package/dashboard/dist/assets/StatCard-DrdlUeQz.js +0 -2
  339. package/dashboard/dist/assets/StatCard-DrdlUeQz.js.map +0 -1
  340. package/dashboard/dist/assets/StatusBadge-CEQMRmSQ.js +0 -2
  341. package/dashboard/dist/assets/StatusBadge-CEQMRmSQ.js.map +0 -1
  342. package/dashboard/dist/assets/StreamMessageDetail-BIXbrZM0.js +0 -2
  343. package/dashboard/dist/assets/StreamMessageDetail-BIXbrZM0.js.map +0 -1
  344. package/dashboard/dist/assets/SwimlaneTimeline-CC5qZjYo.js +0 -2
  345. package/dashboard/dist/assets/SwimlaneTimeline-CC5qZjYo.js.map +0 -1
  346. package/dashboard/dist/assets/TagInput-C2gi47M8.js +0 -2
  347. package/dashboard/dist/assets/TagInput-C2gi47M8.js.map +0 -1
  348. package/dashboard/dist/assets/TaskQueuePill-BPP0Almh.js +0 -2
  349. package/dashboard/dist/assets/TaskQueuePill-BPP0Almh.js.map +0 -1
  350. package/dashboard/dist/assets/TimestampCell-DGOsba-A.js +0 -2
  351. package/dashboard/dist/assets/TimestampCell-DGOsba-A.js.map +0 -1
  352. package/dashboard/dist/assets/ToolPill-D74TkYB-.js +0 -2
  353. package/dashboard/dist/assets/ToolPill-D74TkYB-.js.map +0 -1
  354. package/dashboard/dist/assets/ToolTestPanel-Bez6OyRL.js +0 -2
  355. package/dashboard/dist/assets/ToolTestPanel-Bez6OyRL.js.map +0 -1
  356. package/dashboard/dist/assets/TopicDetailPage-BHccgkU_.js +0 -9
  357. package/dashboard/dist/assets/TopicDetailPage-BHccgkU_.js.map +0 -1
  358. package/dashboard/dist/assets/TopicsPage-5yW63ELl.js +0 -2
  359. package/dashboard/dist/assets/WorkflowExecutionPage-CDDLled5.js +0 -2
  360. package/dashboard/dist/assets/WorkflowExecutionPage-CDDLled5.js.map +0 -1
  361. package/dashboard/dist/assets/WorkflowPill-Fjc2q9U9.js +0 -2
  362. package/dashboard/dist/assets/WorkflowPill-Fjc2q9U9.js.map +0 -1
  363. package/dashboard/dist/assets/WorkflowsOverview-D8MkSMex.js +0 -2
  364. package/dashboard/dist/assets/WorkflowsOverview-D8MkSMex.js.map +0 -1
  365. package/dashboard/dist/assets/YamlWorkflowsPage-9Ki54d-9.js +0 -2
  366. package/dashboard/dist/assets/YamlWorkflowsPage-9Ki54d-9.js.map +0 -1
  367. package/dashboard/dist/assets/bots-CAYJYL9E.js +0 -2
  368. package/dashboard/dist/assets/bots-CAYJYL9E.js.map +0 -1
  369. package/dashboard/dist/assets/escalation-columns-BbS5X61l.js +0 -2
  370. package/dashboard/dist/assets/escalation-columns-BbS5X61l.js.map +0 -1
  371. package/dashboard/dist/assets/index-B68A3v-S.js +0 -2
  372. package/dashboard/dist/assets/index-B68A3v-S.js.map +0 -1
  373. package/dashboard/dist/assets/index-BAi89Xpm.js +0 -2
  374. package/dashboard/dist/assets/index-BAi89Xpm.js.map +0 -1
  375. package/dashboard/dist/assets/index-BJ0jjFsI.js +0 -5
  376. package/dashboard/dist/assets/index-BJ0jjFsI.js.map +0 -1
  377. package/dashboard/dist/assets/index-BOJMUk4F.js +0 -2
  378. package/dashboard/dist/assets/index-BOJMUk4F.js.map +0 -1
  379. package/dashboard/dist/assets/index-BrgYykPV.js +0 -2
  380. package/dashboard/dist/assets/index-BrgYykPV.js.map +0 -1
  381. package/dashboard/dist/assets/index-BxgtIqvl.js +0 -2
  382. package/dashboard/dist/assets/index-BxgtIqvl.js.map +0 -1
  383. package/dashboard/dist/assets/index-C0cHXaX-.css +0 -1
  384. package/dashboard/dist/assets/index-CDHDoHYz.js +0 -6
  385. package/dashboard/dist/assets/index-CDHDoHYz.js.map +0 -1
  386. package/dashboard/dist/assets/index-CUZJHXew.js +0 -2
  387. package/dashboard/dist/assets/index-CUZJHXew.js.map +0 -1
  388. package/dashboard/dist/assets/index-D5n_e59T.js +0 -2
  389. package/dashboard/dist/assets/index-D5n_e59T.js.map +0 -1
  390. package/dashboard/dist/assets/index-DIgiIoou.js +0 -63
  391. package/dashboard/dist/assets/index-DIgiIoou.js.map +0 -1
  392. package/dashboard/dist/assets/index-Dd1RxGNw.js +0 -2
  393. package/dashboard/dist/assets/index-iOb3sGsC.js +0 -5
  394. package/dashboard/dist/assets/index-iOb3sGsC.js.map +0 -1
  395. package/dashboard/dist/assets/index-mcAkQblr.js +0 -2
  396. package/dashboard/dist/assets/index-mcAkQblr.js.map +0 -1
  397. package/dashboard/dist/assets/vendor-icons-ihWGa7_d.js.map +0 -1
@@ -1,63 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CoQEi_Su.js","./vendor-query-B2UbickB.js","./tasks-CD3-C7tP.js","./workflows-DCUilz68.js","./useEventHooks-DV9pLDOW.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./useDebouncedValue-BA5S7V54.js","./api-path-u2Jf9QXS.js","./DataTable-Byn3oyT9.js","./EmptyState-BcsfPq9T.js","./TimestampCell-DGOsba-A.js","./StickyPagination-Cd83AHd_.js","./FilterBar-B5Vk5tBF.js","./PageHeader-Bxa1XFz0.js","./vendor-icons-ihWGa7_d.js","./ListToolbar-KC6LGtKP.js","./WorkflowPill-Fjc2q9U9.js","./ProcessDetailPage-D8pAWUXx.js","./PageHeaderWithStats-D_sO0MqJ.js","./StatusBadge-CEQMRmSQ.js","./RolePill-DLwmVMam.js","./UserName-DcXhOSVm.js","./users-mI9goDjj.js","./McpOverview-BDZC9Hvl.js","./mcp-DYMFBOFz.js","./pipelines-DBXX6TEi.js","./yaml-workflows-DWNMP1PT.js","./controlplane-B4rT6tIw.js","./StatCard-DrdlUeQz.js","./McpRunsPage-f5hDbpLo.js","./useNamespace-DykYhZY9.js","./ElapsedCell-g7GO7f8L.js","./RowActions-BA9L9djf.js","./McpRunDetailPage-BM3mUSlH.js","./CopyableId-uot2mE_g.js","./CollapsibleSection-CHWP0WI6.js","./EventTable-DBV1P2ME.js","./SwimlaneTimeline-CC5qZjYo.js","./StreamMessageDetail-BIXbrZM0.js","./McpQueryPage-CsKNXUhb.js","./mcp-query-wloSpyPM.js","./McpQueryDetailPage-CXhgX1pS.js","./TagInput-C2gi47M8.js","./useYamlActivityEvents-By044UAv.js","./helpers-DzO-OGPe.js","./RunAsSelector-BebF8Lib.js","./BotPicker-2QEIpc-K.js","./bots-CAYJYL9E.js","./ToolPill-D74TkYB-.js","./TimeAgo-BKOl-7Tt.js","./EscalationsOverview-D8NrATg2.js","./AvailableEscalationsPage-DDVuivEE.js","./CustomDurationPicker-j4bBrDJ6.js","./Modal-D4afnAjc.js","./constants-BHkpVaqx.js","./CountdownTimer-TXsRlTU4.js","./escalation-columns-BbS5X61l.js","./PriorityBadge-B4ykBH7f.js","./OperatorDashboard-_axS17fp.js","./index-BJ0jjFsI.js","./SlidePanel-BDVDuwIf.js","./WorkflowsOverview-D8MkSMex.js","./index-CDHDoHYz.js","./NamespacePill-C4u6Go1W.js","./WorkflowsDashboard-C0Bbrd5M.js","./YamlWorkflowsPage-9Ki54d-9.js","./GraphInvokePage-DbHvggQ_.js","./YamlWorkflowDetailPage-BcbrYhDI.js","./TasksListPage-DySfZFgs.js","./TaskDetailPage-DnjhW7qv.js","./WorkflowExecutionPage-CDDLled5.js","./AdminDashboard-Dy031e9g.js","./index-B68A3v-S.js","./TaskQueuePill-BPP0Almh.js","./index-iOb3sGsC.js","./ConfirmDeleteModal-C0x0HcHX.js","./index-BOJMUk4F.js","./ToolTestPanel-Bez6OyRL.js","./index-BAi89Xpm.js","./index-D5n_e59T.js","./RolesPage-CxpXm4Sw.js","./RoleDetailPage-ufbypNNR.js","./EscalationSchemaPage-C7dHgG8e.js","./EscalationListSchemaPage-CIJ-OgVC.js","./index-BrgYykPV.js","./OperationsPage-D37cZ8Qh.js","./index-BxgtIqvl.js","./index-Dd1RxGNw.js","./CredentialsPage-BKxS-1sA.js","./index-CUZJHXew.js","./DropZone-DNDEgMpJ.js","./index-mcAkQblr.js","./knowledge-B9bmoXOe.js","./HomePage-BpexnDO_.js","./AgentsPage-CHczRx5N.js","./agents-CopQ3t5o.js","./AgentDetailPage-oYLBrN74.js","./CronLabel-Bd2G0Rap.js","./AgentConfigPage-CqmtYBbC.js","./capabilities-5JRieYUy.js","./topics-D8pKi6zA.js","./CapabilitiesPage-lQJGZ_-t.js","./TopicsPage-5yW63ELl.js","./TopicDetailPage-BHccgkU_.js"])))=>i.map(i=>d[i]);
2
- var hv=Object.defineProperty;var dv=(i,t,s)=>t in i?hv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var v=(i,t,s)=>dv(i,typeof t!="symbol"?t+"":t,s);import{r as mv,a as A,j as h,u as mt,b as vt,c as Nt,Q as pv,d as yv}from"./vendor-query-B2UbickB.js";import{r as gv,u as Qn,L as Mi,N as qr,a as zy,b as Yn,O as Nr,c as Uy,d as bv,R as xv}from"./vendor-react-CXumBFUA.js";import{E as vv,S as _v,D as lh,X as si,I as v0,R as By,B as Ly,U as wv,a as Sv,L as Ev,b as jv,Z as Av,P as _0,c as Py,d as Ov,e as w0,f as S0,g as E0,C as Tv,W as oh,h as Nv,i as kv,F as Cv,j as Mv,k as Rv,T as Dv,N as qv,l as zv,M as Hy,m as $y,n as Uv,o as Bv,p as Lv,q as Pv,r as Hv,s as $v,t as j0,G as Yv,u as Vv,v as Fv,w as Gv,x as Iv}from"./vendor-icons-ihWGa7_d.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function a(o){if(o.ep)return;o.ep=!0;const u=s(o);fetch(o.href,u)}})();var vf={exports:{}},za={},_f={exports:{}},wf={};/**
3
- * @license React
4
- * scheduler.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var A0;function Qv(){return A0||(A0=1,(function(i){function t(Y,ae){var de=Y.length;Y.push(ae);e:for(;0<de;){var Oe=de-1>>>1,$=Y[Oe];if(0<o($,ae))Y[Oe]=ae,Y[de]=$,de=Oe;else break e}}function s(Y){return Y.length===0?null:Y[0]}function a(Y){if(Y.length===0)return null;var ae=Y[0],de=Y.pop();if(de!==ae){Y[0]=de;e:for(var Oe=0,$=Y.length,be=$>>>1;Oe<be;){var xe=2*(Oe+1)-1,je=Y[xe],Pe=xe+1,_t=Y[Pe];if(0>o(je,de))Pe<$&&0>o(_t,je)?(Y[Oe]=_t,Y[Pe]=de,Oe=Pe):(Y[Oe]=je,Y[xe]=de,Oe=xe);else if(Pe<$&&0>o(_t,de))Y[Oe]=_t,Y[Pe]=de,Oe=Pe;else break e}}return ae}function o(Y,ae){var de=Y.sortIndex-ae.sortIndex;return de!==0?de:Y.id-ae.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;i.unstable_now=function(){return u.now()}}else{var d=Date,m=d.now();i.unstable_now=function(){return d.now()-m}}var y=[],g=[],E=1,_=null,T=3,q=!1,C=!1,R=!1,Q=!1,se=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,le=typeof setImmediate<"u"?setImmediate:null;function re(Y){for(var ae=s(g);ae!==null;){if(ae.callback===null)a(g);else if(ae.startTime<=Y)a(g),ae.sortIndex=ae.expirationTime,t(y,ae);else break;ae=s(g)}}function N(Y){if(R=!1,re(Y),!C)if(s(y)!==null)C=!0,Z||(Z=!0,ie());else{var ae=s(g);ae!==null&&Ne(N,ae.startTime-Y)}}var Z=!1,ce=-1,G=5,F=-1;function K(){return Q?!0:!(i.unstable_now()-F<G)}function J(){if(Q=!1,Z){var Y=i.unstable_now();F=Y;var ae=!0;try{e:{C=!1,R&&(R=!1,U(ce),ce=-1),q=!0;var de=T;try{t:{for(re(Y),_=s(y);_!==null&&!(_.expirationTime>Y&&K());){var Oe=_.callback;if(typeof Oe=="function"){_.callback=null,T=_.priorityLevel;var $=Oe(_.expirationTime<=Y);if(Y=i.unstable_now(),typeof $=="function"){_.callback=$,re(Y),ae=!0;break t}_===s(y)&&a(y),re(Y)}else a(y);_=s(y)}if(_!==null)ae=!0;else{var be=s(g);be!==null&&Ne(N,be.startTime-Y),ae=!1}}break e}finally{_=null,T=de,q=!1}ae=void 0}}finally{ae?ie():Z=!1}}}var ie;if(typeof le=="function")ie=function(){le(J)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,Se=he.port2;he.port1.onmessage=J,ie=function(){Se.postMessage(null)}}else ie=function(){se(J,0)};function Ne(Y,ae){ce=se(function(){Y(i.unstable_now())},ae)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(Y){Y.callback=null},i.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<Y?Math.floor(1e3/Y):5},i.unstable_getCurrentPriorityLevel=function(){return T},i.unstable_next=function(Y){switch(T){case 1:case 2:case 3:var ae=3;break;default:ae=T}var de=T;T=ae;try{return Y()}finally{T=de}},i.unstable_requestPaint=function(){Q=!0},i.unstable_runWithPriority=function(Y,ae){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var de=T;T=Y;try{return ae()}finally{T=de}},i.unstable_scheduleCallback=function(Y,ae,de){var Oe=i.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Oe+de:Oe):de=Oe,Y){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=de+$,Y={id:E++,callback:ae,priorityLevel:Y,startTime:de,expirationTime:$,sortIndex:-1},de>Oe?(Y.sortIndex=de,t(g,Y),s(y)===null&&Y===s(g)&&(R?(U(ce),ce=-1):R=!0,Ne(N,de-Oe))):(Y.sortIndex=$,t(y,Y),C||q||(C=!0,Z||(Z=!0,ie()))),Y},i.unstable_shouldYield=K,i.unstable_wrapCallback=function(Y){var ae=T;return function(){var de=T;T=ae;try{return Y.apply(this,arguments)}finally{T=de}}}})(wf)),wf}var O0;function Jv(){return O0||(O0=1,_f.exports=Qv()),_f.exports}/**
11
- * @license React
12
- * react-dom-client.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var T0;function Kv(){if(T0)return za;T0=1;var i=Jv(),t=mv(),s=gv();function a(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+n+" 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 u(e){var n=e,r=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(r=n.return),e=n.return;while(e)}return n.tag===3?r:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function y(e){if(u(e)!==e)throw Error(a(188))}function g(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(a(188));return n!==e?null:e}for(var r=e,l=n;;){var c=r.return;if(c===null)break;var f=c.alternate;if(f===null){if(l=c.return,l!==null){r=l;continue}break}if(c.child===f.child){for(f=c.child;f;){if(f===r)return y(c),e;if(f===l)return y(c),n;f=f.sibling}throw Error(a(188))}if(r.return!==l.return)r=c,l=f;else{for(var p=!1,b=c.child;b;){if(b===r){p=!0,r=c,l=f;break}if(b===l){p=!0,l=c,r=f;break}b=b.sibling}if(!p){for(b=f.child;b;){if(b===r){p=!0,r=f,l=c;break}if(b===l){p=!0,l=f,r=c;break}b=b.sibling}if(!p)throw Error(a(189))}}if(r.alternate!==l)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?e:n}function E(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=E(e),n!==null)return n;e=e.sibling}return null}var _=Object.assign,T=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),se=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),le=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=J&&e[J]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function Se(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case se:return"Profiler";case Q:return"StrictMode";case N:return"Suspense";case Z:return"SuspenseList";case F:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case le:return e.displayName||"Context";case U:return(e._context.displayName||"Context")+".Consumer";case re:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return n=e.displayName||null,n!==null?n:Se(e.type)||"Memo";case G:n=e._payload,e=e._init;try{return Se(e(n))}catch{}}return null}var Ne=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Oe=[],$=-1;function be(e){return{current:e}}function xe(e){0>$||(e.current=Oe[$],Oe[$]=null,$--)}function je(e,n){$++,Oe[$]=e.current,e.current=n}var Pe=be(null),_t=be(null),jt=be(null),rt=be(null);function ct(e,n){switch(je(jt,n),je(_t,e),je(Pe,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Yp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Yp(n),e=Vp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}xe(Pe),je(Pe,e)}function Te(){xe(Pe),xe(_t),xe(jt)}function wt(e){e.memoizedState!==null&&je(rt,e);var n=Pe.current,r=Vp(n,e.type);n!==r&&(je(_t,e),je(Pe,r))}function Un(e){_t.current===e&&(xe(Pe),xe(_t)),rt.current===e&&(xe(rt),Ma._currentValue=de)}var un,li;function fn(e){if(un===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);un=n&&n[1]||"",li=-1<r.stack.indexOf(`
19
- at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+un+e+li}var zi=!1;function vs(e,n){if(!e||zi)return"";zi=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(V){var P=V}Reflect.construct(e,[],te)}else{try{te.call()}catch(V){P=V}e.call(te.prototype)}}else{try{throw Error()}catch(V){P=V}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(V){if(V&&P&&typeof V.stack=="string")return[V.stack,P.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 f=l.DetermineComponentFrameRoot(),p=f[0],b=f[1];if(p&&b){var O=p.split(`
21
- `),L=b.split(`
22
- `);for(c=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;c<L.length&&!L[c].includes("DetermineComponentFrameRoot");)c++;if(l===O.length||c===L.length)for(l=O.length-1,c=L.length-1;1<=l&&0<=c&&O[l]!==L[c];)c--;for(;1<=l&&0<=c;l--,c--)if(O[l]!==L[c]){if(l!==1||c!==1)do if(l--,c--,0>c||O[l]!==L[c]){var I=`
23
- `+O[l].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),I}while(1<=l&&0<=c);break}}}finally{zi=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?fn(r):""}function ll(e,n){switch(e.tag){case 26:case 27:case 5:return fn(e.type);case 16:return fn("Lazy");case 13:return e.child!==n&&n!==null?fn("Suspense Fallback"):fn("Suspense");case 19:return fn("SuspenseList");case 0:case 15:return vs(e.type,!1);case 11:return vs(e.type.render,!1);case 1:return vs(e.type,!0);case 31:return fn("Activity");default:return""}}function ol(e){try{var n="",r=null;do n+=ll(e,r),r=e,e=e.return;while(e);return n}catch(l){return`
24
- Error generating stack: `+l.message+`
25
- `+l.stack}}var $r=Object.prototype.hasOwnProperty,Yr=i.unstable_scheduleCallback,Jn=i.unstable_cancelCallback,cl=i.unstable_shouldYield,Ui=i.unstable_requestPaint,tt=i.unstable_now,cc=i.unstable_getCurrentPriorityLevel,ul=i.unstable_ImmediatePriority,fl=i.unstable_UserBlockingPriority,Bi=i.unstable_NormalPriority,uc=i.unstable_LowPriority,hl=i.unstable_IdlePriority,fc=i.log,dl=i.unstable_setDisableYieldValue,oi=null,ut=null;function It(e){if(typeof fc=="function"&&dl(e),ut&&typeof ut.setStrictMode=="function")try{ut.setStrictMode(oi,e)}catch{}}var Dt=Math.clz32?Math.clz32:Li,Vr=Math.log,Fr=Math.LN2;function Li(e){return e>>>=0,e===0?32:31-(Vr(e)/Fr|0)|0}var _s=256,Kn=262144,ws=4194304;function jn(e){var n=e&42;if(n!==0)return n;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 ci(e,n,r){var l=e.pendingLanes;if(l===0)return 0;var c=0,f=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~f,l!==0?c=jn(l):(p&=b,p!==0?c=jn(p):r||(r=b&~e,r!==0&&(c=jn(r))))):(b=l&~f,b!==0?c=jn(b):p!==0?c=jn(p):r||(r=l&~e,r!==0&&(c=jn(r)))),c===0?0:n!==0&&n!==c&&(n&f)===0&&(f=c&-c,r=n&-n,f>=r||f===32&&(r&4194048)!==0)?n:c}function ui(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Gr(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Pi(){var e=ws;return ws<<=1,(ws&62914560)===0&&(ws=4194304),e}function Ss(e){for(var n=[],r=0;31>r;r++)n.push(e);return n}function An(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Es(e,n,r,l,c,f){var p=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,L=e.hiddenUpdates;for(r=p&~r;0<r;){var I=31-Dt(r),te=1<<I;b[I]=0,O[I]=-1;var P=L[I];if(P!==null)for(L[I]=null,I=0;I<P.length;I++){var V=P[I];V!==null&&(V.lane&=-536870913)}r&=~te}l!==0&&js(e,l,0),f!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=f&~(p&~n))}function js(e,n,r){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Dt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|r&261930}function fi(e,n){var r=e.entangledLanes|=n;for(e=e.entanglements;r;){var l=31-Dt(r),c=1<<l;c&n|e[l]&n&&(e[l]|=n),r&=~c}}function As(e,n){var r=n&-n;return r=(r&42)!==0?1:Xn(r),(r&(e.suspendedLanes|n))!==0?0:r}function Xn(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 hi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ir(){var e=ae.p;return e!==0?e:(e=window.event,e===void 0?32:d0(e.type))}function ml(e,n){var r=ae.p;try{return ae.p=e,n()}finally{ae.p=r}}var Bn=Math.random().toString(36).slice(2),Ke="__reactFiber$"+Bn,at="__reactProps$"+Bn,Qt="__reactContainer$"+Bn,di="__reactEvents$"+Bn,Qr="__reactListeners$"+Bn,pl="__reactHandles$"+Bn,yl="__reactResources$"+Bn,St="__reactMarker$"+Bn;function Hi(e){delete e[Ke],delete e[at],delete e[di],delete e[Qr],delete e[pl]}function x(e){var n=e[Ke];if(n)return n;for(var r=e.parentNode;r;){if(n=r[Qt]||r[Ke]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(e=Xp(e);e!==null;){if(r=e[Ke])return r;e=Xp(e)}return n}e=r,r=e.parentNode}return null}function S(e){if(e=e[Ke]||e[Qt]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function w(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(a(33))}function j(e){var n=e[yl];return n||(n=e[yl]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function k(e){e[St]=!0}var z=new Set,ee={};function ne(e,n){H(e,n),H(e+"Capture",n)}function H(e,n){for(ee[e]=n,e=0;e<n.length;e++)z.add(n[e])}var W=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]*$"),pe={},Me={};function Ze(e){return $r.call(Me,e)?!0:$r.call(pe,e)?!1:W.test(e)?Me[e]=!0:(pe[e]=!0,!1)}function qt(e,n,r){if(Ze(n))if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+r)}}function On(e,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+r)}}function Zn(e,n,r,l){if(l===null)e.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(n,r,""+l)}}function hn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qh(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function rb(e,n,r){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,f=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return c.call(this)},set:function(p){r=""+p,f.call(this,p)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(p){r=""+p},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function hc(e){if(!e._valueTracker){var n=qh(e)?"checked":"value";e._valueTracker=rb(e,n,""+e[n])}}function zh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var r=n.getValue(),l="";return e&&(l=qh(e)?e.checked?"true":"false":e.value),e=l,e!==r?(n.setValue(e),!0):!1}function gl(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 ab=/[\n"\\]/g;function dn(e){return e.replace(ab,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function dc(e,n,r,l,c,f,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),n!=null?p==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+hn(n)):e.value!==""+hn(n)&&(e.value=""+hn(n)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),n!=null?mc(e,p,hn(n)):r!=null?mc(e,p,hn(r)):l!=null&&e.removeAttribute("value"),c==null&&f!=null&&(e.defaultChecked=!!f),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+hn(b):e.removeAttribute("name")}function Uh(e,n,r,l,c,f,p,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),n!=null||r!=null){if(!(f!=="submit"&&f!=="reset"||n!=null)){hc(e);return}r=r!=null?""+hn(r):"",n=n!=null?""+hn(n):r,b||n===e.value||(e.value=n),e.defaultValue=n}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),hc(e)}function mc(e,n,r){n==="number"&&gl(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function $i(e,n,r,l){if(e=e.options,n){n={};for(var c=0;c<r.length;c++)n["$"+r[c]]=!0;for(r=0;r<e.length;r++)c=n.hasOwnProperty("$"+e[r].value),e[r].selected!==c&&(e[r].selected=c),c&&l&&(e[r].defaultSelected=!0)}else{for(r=""+hn(r),n=null,c=0;c<e.length;c++){if(e[c].value===r){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}n!==null||e[c].disabled||(n=e[c])}n!==null&&(n.selected=!0)}}function Bh(e,n,r){if(n!=null&&(n=""+hn(n),n!==e.value&&(e.value=n),r==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=r!=null?""+hn(r):""}function Lh(e,n,r,l){if(n==null){if(l!=null){if(r!=null)throw Error(a(92));if(Ne(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),n=r}r=hn(n),e.defaultValue=r,l=e.textContent,l===r&&l!==""&&l!==null&&(e.value=l),hc(e)}function Yi(e,n){if(n){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=n;return}}e.textContent=n}var lb=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 Ph(e,n,r){var l=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,r):typeof r!="number"||r===0||lb.has(n)?n==="float"?e.cssFloat=r:e[n]=(""+r).trim():e[n]=r+"px"}function Hh(e,n,r){if(n!=null&&typeof n!="object")throw Error(a(62));if(e=e.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in n)l=n[c],n.hasOwnProperty(c)&&r[c]!==l&&Ph(e,c,l)}else for(var f in n)n.hasOwnProperty(f)&&Ph(e,f,n[f])}function pc(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 ob=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"]]),cb=/^[\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 bl(e){return cb.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Wn(){}var yc=null;function gc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Vi=null,Fi=null;function $h(e){var n=S(e);if(n&&(e=n.stateNode)){var r=e[at]||null;e:switch(e=n.stateNode,n.type){case"input":if(dc(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+dn(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var l=r[n];if(l!==e&&l.form===e.form){var c=l[at]||null;if(!c)throw Error(a(90));dc(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(n=0;n<r.length;n++)l=r[n],l.form===e.form&&zh(l)}break e;case"textarea":Bh(e,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&$i(e,!!r.multiple,n,!1)}}}var bc=!1;function Yh(e,n,r){if(bc)return e(n,r);bc=!0;try{var l=e(n);return l}finally{if(bc=!1,(Vi!==null||Fi!==null)&&(ro(),Vi&&(n=Vi,e=Fi,Fi=Vi=null,$h(n),e)))for(n=0;n<e.length;n++)$h(e[n])}}function Jr(e,n){var r=e.stateNode;if(r===null)return null;var l=r[at]||null;if(l===null)return null;r=l[n];e:switch(n){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(r&&typeof r!="function")throw Error(a(231,n,typeof r));return r}var es=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xc=!1;if(es)try{var Kr={};Object.defineProperty(Kr,"passive",{get:function(){xc=!0}}),window.addEventListener("test",Kr,Kr),window.removeEventListener("test",Kr,Kr)}catch{xc=!1}var Os=null,vc=null,xl=null;function Vh(){if(xl)return xl;var e,n=vc,r=n.length,l,c="value"in Os?Os.value:Os.textContent,f=c.length;for(e=0;e<r&&n[e]===c[e];e++);var p=r-e;for(l=1;l<=p&&n[r-l]===c[f-l];l++);return xl=c.slice(e,1<l?1-l:void 0)}function vl(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function _l(){return!0}function Fh(){return!1}function Pt(e){function n(r,l,c,f,p){this._reactName=r,this._targetInst=c,this.type=l,this.nativeEvent=f,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(r=e[b],this[b]=r?r(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?_l:Fh,this.isPropagationStopped=Fh,this}return _(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=_l)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=_l)},persist:function(){},isPersistent:_l}),n}var mi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wl=Pt(mi),Xr=_({},mi,{view:0,detail:0}),ub=Pt(Xr),_c,wc,Zr,Sl=_({},Xr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ec,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!==Zr&&(Zr&&e.type==="mousemove"?(_c=e.screenX-Zr.screenX,wc=e.screenY-Zr.screenY):wc=_c=0,Zr=e),_c)},movementY:function(e){return"movementY"in e?e.movementY:wc}}),Gh=Pt(Sl),fb=_({},Sl,{dataTransfer:0}),hb=Pt(fb),db=_({},Xr,{relatedTarget:0}),Sc=Pt(db),mb=_({},mi,{animationName:0,elapsedTime:0,pseudoElement:0}),pb=Pt(mb),yb=_({},mi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),gb=Pt(yb),bb=_({},mi,{data:0}),Ih=Pt(bb),xb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vb={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"},_b={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=_b[e])?!!n[e]:!1}function Ec(){return wb}var Sb=_({},Xr,{key:function(e){if(e.key){var n=xb[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=vl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?vb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ec,charCode:function(e){return e.type==="keypress"?vl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?vl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Eb=Pt(Sb),jb=_({},Sl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qh=Pt(jb),Ab=_({},Xr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ec}),Ob=Pt(Ab),Tb=_({},mi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Nb=Pt(Tb),kb=_({},Sl,{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}),Cb=Pt(kb),Mb=_({},mi,{newState:0,oldState:0}),Rb=Pt(Mb),Db=[9,13,27,32],jc=es&&"CompositionEvent"in window,Wr=null;es&&"documentMode"in document&&(Wr=document.documentMode);var qb=es&&"TextEvent"in window&&!Wr,Jh=es&&(!jc||Wr&&8<Wr&&11>=Wr),Kh=" ",Xh=!1;function Zh(e,n){switch(e){case"keyup":return Db.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gi=!1;function zb(e,n){switch(e){case"compositionend":return Wh(n);case"keypress":return n.which!==32?null:(Xh=!0,Kh);case"textInput":return e=n.data,e===Kh&&Xh?null:e;default:return null}}function Ub(e,n){if(Gi)return e==="compositionend"||!jc&&Zh(e,n)?(e=Vh(),xl=vc=Os=null,Gi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Jh&&n.locale!=="ko"?null:n.data;default:return null}}var Bb={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 ed(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Bb[e.type]:n==="textarea"}function td(e,n,r,l){Vi?Fi?Fi.push(l):Fi=[l]:Vi=l,n=ho(n,"onChange"),0<n.length&&(r=new wl("onChange","change",null,r,l),e.push({event:r,listeners:n}))}var ea=null,ta=null;function Lb(e){Up(e,0)}function El(e){var n=w(e);if(zh(n))return e}function nd(e,n){if(e==="change")return n}var sd=!1;if(es){var Ac;if(es){var Oc="oninput"in document;if(!Oc){var id=document.createElement("div");id.setAttribute("oninput","return;"),Oc=typeof id.oninput=="function"}Ac=Oc}else Ac=!1;sd=Ac&&(!document.documentMode||9<document.documentMode)}function rd(){ea&&(ea.detachEvent("onpropertychange",ad),ta=ea=null)}function ad(e){if(e.propertyName==="value"&&El(ta)){var n=[];td(n,ta,e,gc(e)),Yh(Lb,n)}}function Pb(e,n,r){e==="focusin"?(rd(),ea=n,ta=r,ea.attachEvent("onpropertychange",ad)):e==="focusout"&&rd()}function Hb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return El(ta)}function $b(e,n){if(e==="click")return El(n)}function Yb(e,n){if(e==="input"||e==="change")return El(n)}function Vb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Jt=typeof Object.is=="function"?Object.is:Vb;function na(e,n){if(Jt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var r=Object.keys(e),l=Object.keys(n);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var c=r[l];if(!$r.call(n,c)||!Jt(e[c],n[c]))return!1}return!0}function ld(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function od(e,n){var r=ld(e);e=0;for(var l;r;){if(r.nodeType===3){if(l=e+r.textContent.length,e<=n&&l>=n)return{node:r,offset:n-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ld(r)}}function cd(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?cd(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function ud(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=gl(e.document);n instanceof e.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)e=n.contentWindow;else break;n=gl(e.document)}return n}function Tc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Fb=es&&"documentMode"in document&&11>=document.documentMode,Ii=null,Nc=null,sa=null,kc=!1;function fd(e,n,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;kc||Ii==null||Ii!==gl(l)||(l=Ii,"selectionStart"in l&&Tc(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}),sa&&na(sa,l)||(sa=l,l=ho(Nc,"onSelect"),0<l.length&&(n=new wl("onSelect","select",null,n,r),e.push({event:n,listeners:l}),n.target=Ii)))}function pi(e,n){var r={};return r[e.toLowerCase()]=n.toLowerCase(),r["Webkit"+e]="webkit"+n,r["Moz"+e]="moz"+n,r}var Qi={animationend:pi("Animation","AnimationEnd"),animationiteration:pi("Animation","AnimationIteration"),animationstart:pi("Animation","AnimationStart"),transitionrun:pi("Transition","TransitionRun"),transitionstart:pi("Transition","TransitionStart"),transitioncancel:pi("Transition","TransitionCancel"),transitionend:pi("Transition","TransitionEnd")},Cc={},hd={};es&&(hd=document.createElement("div").style,"AnimationEvent"in window||(delete Qi.animationend.animation,delete Qi.animationiteration.animation,delete Qi.animationstart.animation),"TransitionEvent"in window||delete Qi.transitionend.transition);function yi(e){if(Cc[e])return Cc[e];if(!Qi[e])return e;var n=Qi[e],r;for(r in n)if(n.hasOwnProperty(r)&&r in hd)return Cc[e]=n[r];return e}var dd=yi("animationend"),md=yi("animationiteration"),pd=yi("animationstart"),Gb=yi("transitionrun"),Ib=yi("transitionstart"),Qb=yi("transitioncancel"),yd=yi("transitionend"),gd=new Map,Mc="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(" ");Mc.push("scrollEnd");function Tn(e,n){gd.set(e,n),ne(n,[e])}var jl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},mn=[],Ji=0,Rc=0;function Al(){for(var e=Ji,n=Rc=Ji=0;n<e;){var r=mn[n];mn[n++]=null;var l=mn[n];mn[n++]=null;var c=mn[n];mn[n++]=null;var f=mn[n];if(mn[n++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}f!==0&&bd(r,c,f)}}function Ol(e,n,r,l){mn[Ji++]=e,mn[Ji++]=n,mn[Ji++]=r,mn[Ji++]=l,Rc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Dc(e,n,r,l){return Ol(e,n,r,l),Tl(e)}function gi(e,n){return Ol(e,null,null,n),Tl(e)}function bd(e,n,r){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r);for(var c=!1,f=e.return;f!==null;)f.childLanes|=r,l=f.alternate,l!==null&&(l.childLanes|=r),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(c=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,c&&n!==null&&(c=31-Dt(r),e=f.hiddenUpdates,l=e[c],l===null?e[c]=[n]:l.push(n),n.lane=r|536870912),f):null}function Tl(e){if(50<ja)throw ja=0,Yu=null,Error(a(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ki={};function Jb(e,n,r,l){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,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 Kt(e,n,r,l){return new Jb(e,n,r,l)}function qc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ts(e,n){var r=e.alternate;return r===null?(r=Kt(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function xd(e,n){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,n=r.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Nl(e,n,r,l,c,f){var p=0;if(l=e,typeof e=="function")qc(e)&&(p=1);else if(typeof e=="string")p=ev(e,r,Pe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case F:return e=Kt(31,r,n,c),e.elementType=F,e.lanes=f,e;case R:return bi(r.children,c,f,n);case Q:p=8,c|=24;break;case se:return e=Kt(12,r,n,c|2),e.elementType=se,e.lanes=f,e;case N:return e=Kt(13,r,n,c),e.elementType=N,e.lanes=f,e;case Z:return e=Kt(19,r,n,c),e.elementType=Z,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case le:p=10;break e;case U:p=9;break e;case re:p=11;break e;case ce:p=14;break e;case G:p=16,l=null;break e}p=29,r=Error(a(130,e===null?"null":typeof e,"")),l=null}return n=Kt(p,r,n,c),n.elementType=e,n.type=l,n.lanes=f,n}function bi(e,n,r,l){return e=Kt(7,e,l,n),e.lanes=r,e}function zc(e,n,r){return e=Kt(6,e,null,n),e.lanes=r,e}function vd(e){var n=Kt(18,null,null,0);return n.stateNode=e,n}function Uc(e,n,r){return n=Kt(4,e.children!==null?e.children:[],e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var _d=new WeakMap;function pn(e,n){if(typeof e=="object"&&e!==null){var r=_d.get(e);return r!==void 0?r:(n={value:e,source:n,stack:ol(n)},_d.set(e,n),n)}return{value:e,source:n,stack:ol(n)}}var Xi=[],Zi=0,kl=null,ia=0,yn=[],gn=0,Ts=null,Ln=1,Pn="";function ns(e,n){Xi[Zi++]=ia,Xi[Zi++]=kl,kl=e,ia=n}function wd(e,n,r){yn[gn++]=Ln,yn[gn++]=Pn,yn[gn++]=Ts,Ts=e;var l=Ln;e=Pn;var c=32-Dt(l)-1;l&=~(1<<c),r+=1;var f=32-Dt(n)+c;if(30<f){var p=c-c%5;f=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Ln=1<<32-Dt(n)+c|r<<c|l,Pn=f+e}else Ln=1<<f|r<<c|l,Pn=e}function Bc(e){e.return!==null&&(ns(e,1),wd(e,1,0))}function Lc(e){for(;e===kl;)kl=Xi[--Zi],Xi[Zi]=null,ia=Xi[--Zi],Xi[Zi]=null;for(;e===Ts;)Ts=yn[--gn],yn[gn]=null,Pn=yn[--gn],yn[gn]=null,Ln=yn[--gn],yn[gn]=null}function Sd(e,n){yn[gn++]=Ln,yn[gn++]=Pn,yn[gn++]=Ts,Ln=n.id,Pn=n.overflow,Ts=e}var kt=null,We=null,Ue=!1,Ns=null,bn=!1,Pc=Error(a(519));function ks(e){var n=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ra(pn(n,e)),Pc}function Ed(e){var n=e.stateNode,r=e.type,l=e.memoizedProps;switch(n[Ke]=e,n[at]=l,r){case"dialog":De("cancel",n),De("close",n);break;case"iframe":case"object":case"embed":De("load",n);break;case"video":case"audio":for(r=0;r<Oa.length;r++)De(Oa[r],n);break;case"source":De("error",n);break;case"img":case"image":case"link":De("error",n),De("load",n);break;case"details":De("toggle",n);break;case"input":De("invalid",n),Uh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":De("invalid",n);break;case"textarea":De("invalid",n),Lh(n,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||l.suppressHydrationWarning===!0||Hp(n.textContent,r)?(l.popover!=null&&(De("beforetoggle",n),De("toggle",n)),l.onScroll!=null&&De("scroll",n),l.onScrollEnd!=null&&De("scrollend",n),l.onClick!=null&&(n.onclick=Wn),n=!0):n=!1,n||ks(e,!0)}function jd(e){for(kt=e.return;kt;)switch(kt.tag){case 5:case 31:case 13:bn=!1;return;case 27:case 3:bn=!0;return;default:kt=kt.return}}function Wi(e){if(e!==kt)return!1;if(!Ue)return jd(e),Ue=!0,!1;var n=e.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||rf(e.type,e.memoizedProps)),r=!r),r&&We&&ks(e),jd(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));We=Kp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));We=Kp(e)}else n===27?(n=We,Vs(e.type)?(e=uf,uf=null,We=e):We=n):We=kt?vn(e.stateNode.nextSibling):null;return!0}function xi(){We=kt=null,Ue=!1}function Hc(){var e=Ns;return e!==null&&(Vt===null?Vt=e:Vt.push.apply(Vt,e),Ns=null),e}function ra(e){Ns===null?Ns=[e]:Ns.push(e)}var $c=be(null),vi=null,ss=null;function Cs(e,n,r){je($c,n._currentValue),n._currentValue=r}function is(e){e._currentValue=$c.current,xe($c)}function Yc(e,n,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===r)break;e=e.return}}function Vc(e,n,r,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var f=c.dependencies;if(f!==null){var p=c.child;f=f.firstContext;e:for(;f!==null;){var b=f;f=c;for(var O=0;O<n.length;O++)if(b.context===n[O]){f.lanes|=r,b=f.alternate,b!==null&&(b.lanes|=r),Yc(f.return,r,e),l||(p=null);break e}f=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=r,f=p.alternate,f!==null&&(f.lanes|=r),Yc(p,r,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 er(e,n,r,l){e=null;for(var c=n,f=!1;c!==null;){if(!f){if((c.flags&524288)!==0)f=!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;Jt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===rt.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Ma):e=[Ma])}c=c.return}e!==null&&Vc(n,e,r,l),n.flags|=262144}function Cl(e){for(e=e.firstContext;e!==null;){if(!Jt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function _i(e){vi=e,ss=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ct(e){return Ad(vi,e)}function Ml(e,n){return vi===null&&_i(e),Ad(e,n)}function Ad(e,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},ss===null){if(e===null)throw Error(a(308));ss=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else ss=ss.next=n;return r}var Kb=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(r,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(r){return r()})}},Xb=i.unstable_scheduleCallback,Zb=i.unstable_NormalPriority,pt={$$typeof:le,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fc(){return{controller:new Kb,data:new Map,refCount:0}}function aa(e){e.refCount--,e.refCount===0&&Xb(Zb,function(){e.controller.abort()})}var la=null,Gc=0,tr=0,nr=null;function Wb(e,n){if(la===null){var r=la=[];Gc=0,tr=Ju(),nr={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Gc++,n.then(Od,Od),n}function Od(){if(--Gc===0&&la!==null){nr!==null&&(nr.status="fulfilled");var e=la;la=null,tr=0,nr=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function ex(e,n){var r=[],l={status:"pending",value:null,reason:null,then:function(c){r.push(c)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var c=0;c<r.length;c++)(0,r[c])(n)},function(c){for(l.status="rejected",l.reason=c,c=0;c<r.length;c++)(0,r[c])(void 0)}),l}var Td=Y.S;Y.S=function(e,n){fp=tt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Wb(e,n),Td!==null&&Td(e,n)};var wi=be(null);function Ic(){var e=wi.current;return e!==null?e:Xe.pooledCache}function Rl(e,n){n===null?je(wi,wi.current):je(wi,n.pool)}function Nd(){var e=Ic();return e===null?null:{parent:pt._currentValue,pool:e}}var sr=Error(a(460)),Qc=Error(a(474)),Dl=Error(a(542)),ql={then:function(){}};function kd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Cd(e,n,r){switch(r=e[r],r===void 0?e.push(n):r!==n&&(n.then(Wn,Wn),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Rd(e),e;default:if(typeof n.status=="string")n.then(Wn,Wn);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var c=n;c.status="fulfilled",c.value=l}},function(l){if(n.status==="pending"){var c=n;c.status="rejected",c.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Rd(e),e}throw Ei=n,sr}}function Si(e){try{var n=e._init;return n(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Ei=r,sr):r}}var Ei=null;function Md(){if(Ei===null)throw Error(a(459));var e=Ei;return Ei=null,e}function Rd(e){if(e===sr||e===Dl)throw Error(a(483))}var ir=null,oa=0;function zl(e){var n=oa;return oa+=1,ir===null&&(ir=[]),Cd(ir,e,n)}function ca(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ul(e,n){throw n.$$typeof===T?Error(a(525)):(e=Object.prototype.toString.call(n),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Dd(e){function n(D,M){if(e){var B=D.deletions;B===null?(D.deletions=[M],D.flags|=16):B.push(M)}}function r(D,M){if(!e)return null;for(;M!==null;)n(D,M),M=M.sibling;return null}function l(D){for(var M=new Map;D!==null;)D.key!==null?M.set(D.key,D):M.set(D.index,D),D=D.sibling;return M}function c(D,M){return D=ts(D,M),D.index=0,D.sibling=null,D}function f(D,M,B){return D.index=B,e?(B=D.alternate,B!==null?(B=B.index,B<M?(D.flags|=67108866,M):B):(D.flags|=67108866,M)):(D.flags|=1048576,M)}function p(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function b(D,M,B,X){return M===null||M.tag!==6?(M=zc(B,D.mode,X),M.return=D,M):(M=c(M,B),M.return=D,M)}function O(D,M,B,X){var ve=B.type;return ve===R?I(D,M,B.props.children,X,B.key):M!==null&&(M.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===G&&Si(ve)===M.type)?(M=c(M,B.props),ca(M,B),M.return=D,M):(M=Nl(B.type,B.key,B.props,null,D.mode,X),ca(M,B),M.return=D,M)}function L(D,M,B,X){return M===null||M.tag!==4||M.stateNode.containerInfo!==B.containerInfo||M.stateNode.implementation!==B.implementation?(M=Uc(B,D.mode,X),M.return=D,M):(M=c(M,B.children||[]),M.return=D,M)}function I(D,M,B,X,ve){return M===null||M.tag!==7?(M=bi(B,D.mode,X,ve),M.return=D,M):(M=c(M,B),M.return=D,M)}function te(D,M,B){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=zc(""+M,D.mode,B),M.return=D,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case q:return B=Nl(M.type,M.key,M.props,null,D.mode,B),ca(B,M),B.return=D,B;case C:return M=Uc(M,D.mode,B),M.return=D,M;case G:return M=Si(M),te(D,M,B)}if(Ne(M)||ie(M))return M=bi(M,D.mode,B,null),M.return=D,M;if(typeof M.then=="function")return te(D,zl(M),B);if(M.$$typeof===le)return te(D,Ml(D,M),B);Ul(D,M)}return null}function P(D,M,B,X){var ve=M!==null?M.key:null;if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return ve!==null?null:b(D,M,""+B,X);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case q:return B.key===ve?O(D,M,B,X):null;case C:return B.key===ve?L(D,M,B,X):null;case G:return B=Si(B),P(D,M,B,X)}if(Ne(B)||ie(B))return ve!==null?null:I(D,M,B,X,null);if(typeof B.then=="function")return P(D,M,zl(B),X);if(B.$$typeof===le)return P(D,M,Ml(D,B),X);Ul(D,B)}return null}function V(D,M,B,X,ve){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return D=D.get(B)||null,b(M,D,""+X,ve);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case q:return D=D.get(X.key===null?B:X.key)||null,O(M,D,X,ve);case C:return D=D.get(X.key===null?B:X.key)||null,L(M,D,X,ve);case G:return X=Si(X),V(D,M,B,X,ve)}if(Ne(X)||ie(X))return D=D.get(B)||null,I(M,D,X,ve,null);if(typeof X.then=="function")return V(D,M,B,zl(X),ve);if(X.$$typeof===le)return V(D,M,B,Ml(M,X),ve);Ul(M,X)}return null}function ye(D,M,B,X){for(var ve=null,He=null,ge=M,Ce=M=0,ze=null;ge!==null&&Ce<B.length;Ce++){ge.index>Ce?(ze=ge,ge=null):ze=ge.sibling;var $e=P(D,ge,B[Ce],X);if($e===null){ge===null&&(ge=ze);break}e&&ge&&$e.alternate===null&&n(D,ge),M=f($e,M,Ce),He===null?ve=$e:He.sibling=$e,He=$e,ge=ze}if(Ce===B.length)return r(D,ge),Ue&&ns(D,Ce),ve;if(ge===null){for(;Ce<B.length;Ce++)ge=te(D,B[Ce],X),ge!==null&&(M=f(ge,M,Ce),He===null?ve=ge:He.sibling=ge,He=ge);return Ue&&ns(D,Ce),ve}for(ge=l(ge);Ce<B.length;Ce++)ze=V(ge,D,Ce,B[Ce],X),ze!==null&&(e&&ze.alternate!==null&&ge.delete(ze.key===null?Ce:ze.key),M=f(ze,M,Ce),He===null?ve=ze:He.sibling=ze,He=ze);return e&&ge.forEach(function(Js){return n(D,Js)}),Ue&&ns(D,Ce),ve}function _e(D,M,B,X){if(B==null)throw Error(a(151));for(var ve=null,He=null,ge=M,Ce=M=0,ze=null,$e=B.next();ge!==null&&!$e.done;Ce++,$e=B.next()){ge.index>Ce?(ze=ge,ge=null):ze=ge.sibling;var Js=P(D,ge,$e.value,X);if(Js===null){ge===null&&(ge=ze);break}e&&ge&&Js.alternate===null&&n(D,ge),M=f(Js,M,Ce),He===null?ve=Js:He.sibling=Js,He=Js,ge=ze}if($e.done)return r(D,ge),Ue&&ns(D,Ce),ve;if(ge===null){for(;!$e.done;Ce++,$e=B.next())$e=te(D,$e.value,X),$e!==null&&(M=f($e,M,Ce),He===null?ve=$e:He.sibling=$e,He=$e);return Ue&&ns(D,Ce),ve}for(ge=l(ge);!$e.done;Ce++,$e=B.next())$e=V(ge,D,Ce,$e.value,X),$e!==null&&(e&&$e.alternate!==null&&ge.delete($e.key===null?Ce:$e.key),M=f($e,M,Ce),He===null?ve=$e:He.sibling=$e,He=$e);return e&&ge.forEach(function(fv){return n(D,fv)}),Ue&&ns(D,Ce),ve}function Je(D,M,B,X){if(typeof B=="object"&&B!==null&&B.type===R&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case q:e:{for(var ve=B.key;M!==null;){if(M.key===ve){if(ve=B.type,ve===R){if(M.tag===7){r(D,M.sibling),X=c(M,B.props.children),X.return=D,D=X;break e}}else if(M.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===G&&Si(ve)===M.type){r(D,M.sibling),X=c(M,B.props),ca(X,B),X.return=D,D=X;break e}r(D,M);break}else n(D,M);M=M.sibling}B.type===R?(X=bi(B.props.children,D.mode,X,B.key),X.return=D,D=X):(X=Nl(B.type,B.key,B.props,null,D.mode,X),ca(X,B),X.return=D,D=X)}return p(D);case C:e:{for(ve=B.key;M!==null;){if(M.key===ve)if(M.tag===4&&M.stateNode.containerInfo===B.containerInfo&&M.stateNode.implementation===B.implementation){r(D,M.sibling),X=c(M,B.children||[]),X.return=D,D=X;break e}else{r(D,M);break}else n(D,M);M=M.sibling}X=Uc(B,D.mode,X),X.return=D,D=X}return p(D);case G:return B=Si(B),Je(D,M,B,X)}if(Ne(B))return ye(D,M,B,X);if(ie(B)){if(ve=ie(B),typeof ve!="function")throw Error(a(150));return B=ve.call(B),_e(D,M,B,X)}if(typeof B.then=="function")return Je(D,M,zl(B),X);if(B.$$typeof===le)return Je(D,M,Ml(D,B),X);Ul(D,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,M!==null&&M.tag===6?(r(D,M.sibling),X=c(M,B),X.return=D,D=X):(r(D,M),X=zc(B,D.mode,X),X.return=D,D=X),p(D)):r(D,M)}return function(D,M,B,X){try{oa=0;var ve=Je(D,M,B,X);return ir=null,ve}catch(ge){if(ge===sr||ge===Dl)throw ge;var He=Kt(29,ge,null,D.mode);return He.lanes=X,He.return=D,He}finally{}}}var ji=Dd(!0),qd=Dd(!1),Ms=!1;function Jc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kc(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Rs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ds(e,n,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ye&2)!==0){var c=l.pending;return c===null?n.next=n:(n.next=c.next,c.next=n),l.pending=n,n=Tl(e),bd(e,null,r),n}return Ol(e,l,n,r),Tl(e)}function ua(e,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,r|=l,n.lanes=r,fi(e,r)}}function Xc(e,n){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var c=null,f=null;if(r=r.firstBaseUpdate,r!==null){do{var p={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};f===null?c=f=p:f=f.next=p,r=r.next}while(r!==null);f===null?c=f=n:f=f.next=n}else c=f=n;r={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:f,shared:l.shared,callbacks:l.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=n:e.next=n,r.lastBaseUpdate=n}var Zc=!1;function fa(){if(Zc){var e=nr;if(e!==null)throw e}}function ha(e,n,r,l){Zc=!1;var c=e.updateQueue;Ms=!1;var f=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var O=b,L=O.next;O.next=null,p===null?f=L:p.next=L,p=O;var I=e.alternate;I!==null&&(I=I.updateQueue,b=I.lastBaseUpdate,b!==p&&(b===null?I.firstBaseUpdate=L:b.next=L,I.lastBaseUpdate=O))}if(f!==null){var te=c.baseState;p=0,I=L=O=null,b=f;do{var P=b.lane&-536870913,V=P!==b.lane;if(V?(qe&P)===P:(l&P)===P){P!==0&&P===tr&&(Zc=!0),I!==null&&(I=I.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ye=e,_e=b;P=n;var Je=r;switch(_e.tag){case 1:if(ye=_e.payload,typeof ye=="function"){te=ye.call(Je,te,P);break e}te=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=_e.payload,P=typeof ye=="function"?ye.call(Je,te,P):ye,P==null)break e;te=_({},te,P);break e;case 2:Ms=!0}}P=b.callback,P!==null&&(e.flags|=64,V&&(e.flags|=8192),V=c.callbacks,V===null?c.callbacks=[P]:V.push(P))}else V={lane:P,tag:b.tag,payload:b.payload,callback:b.callback,next:null},I===null?(L=I=V,O=te):I=I.next=V,p|=P;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;V=b,b=V.next,V.next=null,c.lastBaseUpdate=V,c.shared.pending=null}}while(!0);I===null&&(O=te),c.baseState=O,c.firstBaseUpdate=L,c.lastBaseUpdate=I,f===null&&(c.shared.lanes=0),Ls|=p,e.lanes=p,e.memoizedState=te}}function zd(e,n){if(typeof e!="function")throw Error(a(191,e));e.call(n)}function Ud(e,n){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)zd(r[e],n)}var rr=be(null),Bl=be(0);function Bd(e,n){e=ds,je(Bl,e),je(rr,n),ds=e|n.baseLanes}function Wc(){je(Bl,ds),je(rr,rr.current)}function eu(){ds=Bl.current,xe(rr),xe(Bl)}var Xt=be(null),xn=null;function qs(e){var n=e.alternate;je(ft,ft.current&1),je(Xt,e),xn===null&&(n===null||rr.current!==null||n.memoizedState!==null)&&(xn=e)}function tu(e){je(ft,ft.current),je(Xt,e),xn===null&&(xn=e)}function Ld(e){e.tag===22?(je(ft,ft.current),je(Xt,e),xn===null&&(xn=e)):zs()}function zs(){je(ft,ft.current),je(Xt,Xt.current)}function Zt(e){xe(Xt),xn===e&&(xn=null),xe(ft)}var ft=be(0);function Ll(e){for(var n=e;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||of(r)||cf(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var rs=0,ke=null,Ie=null,yt=null,Pl=!1,ar=!1,Ai=!1,Hl=0,da=0,lr=null,tx=0;function lt(){throw Error(a(321))}function nu(e,n){if(n===null)return!1;for(var r=0;r<n.length&&r<e.length;r++)if(!Jt(e[r],n[r]))return!1;return!0}function su(e,n,r,l,c,f){return rs=f,ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?wm:bu,Ai=!1,f=r(l,c),Ai=!1,ar&&(f=Hd(n,r,l,c)),Pd(e),f}function Pd(e){Y.H=ya;var n=Ie!==null&&Ie.next!==null;if(rs=0,yt=Ie=ke=null,Pl=!1,da=0,lr=null,n)throw Error(a(300));e===null||gt||(e=e.dependencies,e!==null&&Cl(e)&&(gt=!0))}function Hd(e,n,r,l){ke=e;var c=0;do{if(ar&&(lr=null),da=0,ar=!1,25<=c)throw Error(a(301));if(c+=1,yt=Ie=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}Y.H=Sm,f=n(r,l)}while(ar);return f}function nx(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?ma(n):n,e=e.useState()[0],(Ie!==null?Ie.memoizedState:null)!==e&&(ke.flags|=1024),n}function iu(){var e=Hl!==0;return Hl=0,e}function ru(e,n,r){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~r}function au(e){if(Pl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Pl=!1}rs=0,yt=Ie=ke=null,ar=!1,da=Hl=0,lr=null}function zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?ke.memoizedState=yt=e:yt=yt.next=e,yt}function ht(){if(Ie===null){var e=ke.alternate;e=e!==null?e.memoizedState:null}else e=Ie.next;var n=yt===null?ke.memoizedState:yt.next;if(n!==null)yt=n,Ie=e;else{if(e===null)throw ke.alternate===null?Error(a(467)):Error(a(310));Ie=e,e={memoizedState:Ie.memoizedState,baseState:Ie.baseState,baseQueue:Ie.baseQueue,queue:Ie.queue,next:null},yt===null?ke.memoizedState=yt=e:yt=yt.next=e}return yt}function $l(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ma(e){var n=da;return da+=1,lr===null&&(lr=[]),e=Cd(lr,e,n),n=ke,(yt===null?n.memoizedState:yt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?wm:bu),e}function Yl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ma(e);if(e.$$typeof===le)return Ct(e)}throw Error(a(438,String(e)))}function lu(e){var n=null,r=ke.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var l=ke.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(c){return c.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=$l(),ke.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(e),l=0;l<e;l++)r[l]=K;return n.index++,r}function as(e,n){return typeof n=="function"?n(e):n}function Vl(e){var n=ht();return ou(n,Ie,e)}function ou(e,n,r){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var c=e.baseQueue,f=l.pending;if(f!==null){if(c!==null){var p=c.next;c.next=f.next,f.next=p}n.baseQueue=c=f,l.pending=null}if(f=e.baseState,c===null)e.memoizedState=f;else{n=c.next;var b=p=null,O=null,L=n,I=!1;do{var te=L.lane&-536870913;if(te!==L.lane?(qe&te)===te:(rs&te)===te){var P=L.revertLane;if(P===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),te===tr&&(I=!0);else if((rs&P)===P){L=L.next,P===tr&&(I=!0);continue}else te={lane:0,revertLane:L.revertLane,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},O===null?(b=O=te,p=f):O=O.next=te,ke.lanes|=P,Ls|=P;te=L.action,Ai&&r(f,te),f=L.hasEagerState?L.eagerState:r(f,te)}else P={lane:te,revertLane:L.revertLane,gesture:L.gesture,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},O===null?(b=O=P,p=f):O=O.next=P,ke.lanes|=te,Ls|=te;L=L.next}while(L!==null&&L!==n);if(O===null?p=f:O.next=b,!Jt(f,e.memoizedState)&&(gt=!0,I&&(r=nr,r!==null)))throw r;e.memoizedState=f,e.baseState=p,e.baseQueue=O,l.lastRenderedState=f}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function cu(e){var n=ht(),r=n.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=e;var l=r.dispatch,c=r.pending,f=n.memoizedState;if(c!==null){r.pending=null;var p=c=c.next;do f=e(f,p.action),p=p.next;while(p!==c);Jt(f,n.memoizedState)||(gt=!0),n.memoizedState=f,n.baseQueue===null&&(n.baseState=f),r.lastRenderedState=f}return[f,l]}function $d(e,n,r){var l=ke,c=ht(),f=Ue;if(f){if(r===void 0)throw Error(a(407));r=r()}else r=n();var p=!Jt((Ie||c).memoizedState,r);if(p&&(c.memoizedState=r,gt=!0),c=c.queue,hu(Fd.bind(null,l,c,e),[e]),c.getSnapshot!==n||p||yt!==null&&yt.memoizedState.tag&1){if(l.flags|=2048,or(9,{destroy:void 0},Vd.bind(null,l,c,r,n),null),Xe===null)throw Error(a(349));f||(rs&127)!==0||Yd(l,n,r)}return r}function Yd(e,n,r){e.flags|=16384,e={getSnapshot:n,value:r},n=ke.updateQueue,n===null?(n=$l(),ke.updateQueue=n,n.stores=[e]):(r=n.stores,r===null?n.stores=[e]:r.push(e))}function Vd(e,n,r,l){n.value=r,n.getSnapshot=l,Gd(n)&&Id(e)}function Fd(e,n,r){return r(function(){Gd(n)&&Id(e)})}function Gd(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!Jt(e,r)}catch{return!0}}function Id(e){var n=gi(e,2);n!==null&&Ft(n,e,2)}function uu(e){var n=zt();if(typeof e=="function"){var r=e;if(e=r(),Ai){It(!0);try{r()}finally{It(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:e},n}function Qd(e,n,r,l){return e.baseState=r,ou(e,Ie,typeof l=="function"?l:as)}function sx(e,n,r,l,c){if(Il(e))throw Error(a(485));if(e=n.action,e!==null){var f={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){f.listeners.push(p)}};Y.T!==null?r(!0):f.isTransition=!1,l(f),r=n.pending,r===null?(f.next=n.pending=f,Jd(n,f)):(f.next=r.next,n.pending=r.next=f)}}function Jd(e,n){var r=n.action,l=n.payload,c=e.state;if(n.isTransition){var f=Y.T,p={};Y.T=p;try{var b=r(c,l),O=Y.S;O!==null&&O(p,b),Kd(e,n,b)}catch(L){fu(e,n,L)}finally{f!==null&&p.types!==null&&(f.types=p.types),Y.T=f}}else try{f=r(c,l),Kd(e,n,f)}catch(L){fu(e,n,L)}}function Kd(e,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){Xd(e,n,l)},function(l){return fu(e,n,l)}):Xd(e,n,r)}function Xd(e,n,r){n.status="fulfilled",n.value=r,Zd(n),e.state=r,n=e.pending,n!==null&&(r=n.next,r===n?e.pending=null:(r=r.next,n.next=r,Jd(e,r)))}function fu(e,n,r){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=r,Zd(n),n=n.next;while(n!==l)}e.action=null}function Zd(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Wd(e,n){return n}function em(e,n){if(Ue){var r=Xe.formState;if(r!==null){e:{var l=ke;if(Ue){if(We){t:{for(var c=We,f=bn;c.nodeType!==8;){if(!f){c=null;break t}if(c=vn(c.nextSibling),c===null){c=null;break t}}f=c.data,c=f==="F!"||f==="F"?c:null}if(c){We=vn(c.nextSibling),l=c.data==="F!";break e}}ks(l)}l=!1}l&&(n=r[0])}}return r=zt(),r.memoizedState=r.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wd,lastRenderedState:n},r.queue=l,r=xm.bind(null,ke,l),l.dispatch=r,l=uu(!1),f=gu.bind(null,ke,!1,l.queue),l=zt(),c={state:n,dispatch:null,action:e,pending:null},l.queue=c,r=sx.bind(null,ke,c,f,r),c.dispatch=r,l.memoizedState=e,[n,r,!1]}function tm(e){var n=ht();return nm(n,Ie,e)}function nm(e,n,r){if(n=ou(e,n,Wd)[0],e=Vl(as)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=ma(n)}catch(p){throw p===sr?Dl:p}else l=n;n=ht();var c=n.queue,f=c.dispatch;return r!==n.memoizedState&&(ke.flags|=2048,or(9,{destroy:void 0},ix.bind(null,c,r),null)),[l,f,e]}function ix(e,n){e.action=n}function sm(e){var n=ht(),r=Ie;if(r!==null)return nm(n,r,e);ht(),n=n.memoizedState,r=ht();var l=r.queue.dispatch;return r.memoizedState=e,[n,l,!1]}function or(e,n,r,l){return e={tag:e,create:r,deps:l,inst:n,next:null},n=ke.updateQueue,n===null&&(n=$l(),ke.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=e.next=e:(l=r.next,r.next=e,e.next=l,n.lastEffect=e),e}function im(){return ht().memoizedState}function Fl(e,n,r,l){var c=zt();ke.flags|=e,c.memoizedState=or(1|n,{destroy:void 0},r,l===void 0?null:l)}function Gl(e,n,r,l){var c=ht();l=l===void 0?null:l;var f=c.memoizedState.inst;Ie!==null&&l!==null&&nu(l,Ie.memoizedState.deps)?c.memoizedState=or(n,f,r,l):(ke.flags|=e,c.memoizedState=or(1|n,f,r,l))}function rm(e,n){Fl(8390656,8,e,n)}function hu(e,n){Gl(2048,8,e,n)}function rx(e){ke.flags|=4;var n=ke.updateQueue;if(n===null)n=$l(),ke.updateQueue=n,n.events=[e];else{var r=n.events;r===null?n.events=[e]:r.push(e)}}function am(e){var n=ht().memoizedState;return rx({ref:n,nextImpl:e}),function(){if((Ye&2)!==0)throw Error(a(440));return n.impl.apply(void 0,arguments)}}function lm(e,n){return Gl(4,2,e,n)}function om(e,n){return Gl(4,4,e,n)}function cm(e,n){if(typeof n=="function"){e=e();var r=n(e);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function um(e,n,r){r=r!=null?r.concat([e]):null,Gl(4,4,cm.bind(null,n,e),r)}function du(){}function fm(e,n){var r=ht();n=n===void 0?null:n;var l=r.memoizedState;return n!==null&&nu(n,l[1])?l[0]:(r.memoizedState=[e,n],e)}function hm(e,n){var r=ht();n=n===void 0?null:n;var l=r.memoizedState;if(n!==null&&nu(n,l[1]))return l[0];if(l=e(),Ai){It(!0);try{e()}finally{It(!1)}}return r.memoizedState=[l,n],l}function mu(e,n,r){return r===void 0||(rs&1073741824)!==0&&(qe&261930)===0?e.memoizedState=n:(e.memoizedState=r,e=dp(),ke.lanes|=e,Ls|=e,r)}function dm(e,n,r,l){return Jt(r,n)?r:rr.current!==null?(e=mu(e,r,l),Jt(e,n)||(gt=!0),e):(rs&42)===0||(rs&1073741824)!==0&&(qe&261930)===0?(gt=!0,e.memoizedState=r):(e=dp(),ke.lanes|=e,Ls|=e,n)}function mm(e,n,r,l,c){var f=ae.p;ae.p=f!==0&&8>f?f:8;var p=Y.T,b={};Y.T=b,gu(e,!1,n,r);try{var O=c(),L=Y.S;if(L!==null&&L(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var I=ex(O,l);pa(e,n,I,tn(e))}else pa(e,n,l,tn(e))}catch(te){pa(e,n,{then:function(){},status:"rejected",reason:te},tn())}finally{ae.p=f,p!==null&&b.types!==null&&(p.types=b.types),Y.T=p}}function ax(){}function pu(e,n,r,l){if(e.tag!==5)throw Error(a(476));var c=pm(e).queue;mm(e,c,n,de,r===null?ax:function(){return ym(e),r(l)})}function pm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:de},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:r},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function ym(e){var n=pm(e);n.next===null&&(n=e.alternate.memoizedState),pa(e,n.next.queue,{},tn())}function yu(){return Ct(Ma)}function gm(){return ht().memoizedState}function bm(){return ht().memoizedState}function lx(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var r=tn();e=Rs(r);var l=Ds(n,e,r);l!==null&&(Ft(l,n,r),ua(l,n,r)),n={cache:Fc()},e.payload=n;return}n=n.return}}function ox(e,n,r){var l=tn();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Il(e)?vm(n,r):(r=Dc(e,n,r,l),r!==null&&(Ft(r,e,l),_m(r,n,l)))}function xm(e,n,r){var l=tn();pa(e,n,r,l)}function pa(e,n,r,l){var c={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Il(e))vm(n,c);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=n.lastRenderedReducer,f!==null))try{var p=n.lastRenderedState,b=f(p,r);if(c.hasEagerState=!0,c.eagerState=b,Jt(b,p))return Ol(e,n,c,0),Xe===null&&Al(),!1}catch{}finally{}if(r=Dc(e,n,c,l),r!==null)return Ft(r,e,l),_m(r,n,l),!0}return!1}function gu(e,n,r,l){if(l={lane:2,revertLane:Ju(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Il(e)){if(n)throw Error(a(479))}else n=Dc(e,r,l,2),n!==null&&Ft(n,e,2)}function Il(e){var n=e.alternate;return e===ke||n!==null&&n===ke}function vm(e,n){ar=Pl=!0;var r=e.pending;r===null?n.next=n:(n.next=r.next,r.next=n),e.pending=n}function _m(e,n,r){if((r&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,r|=l,n.lanes=r,fi(e,r)}}var ya={readContext:Ct,use:Yl,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};ya.useEffectEvent=lt;var wm={readContext:Ct,use:Yl,useCallback:function(e,n){return zt().memoizedState=[e,n===void 0?null:n],e},useContext:Ct,useEffect:rm,useImperativeHandle:function(e,n,r){r=r!=null?r.concat([e]):null,Fl(4194308,4,cm.bind(null,n,e),r)},useLayoutEffect:function(e,n){return Fl(4194308,4,e,n)},useInsertionEffect:function(e,n){Fl(4,2,e,n)},useMemo:function(e,n){var r=zt();n=n===void 0?null:n;var l=e();if(Ai){It(!0);try{e()}finally{It(!1)}}return r.memoizedState=[l,n],l},useReducer:function(e,n,r){var l=zt();if(r!==void 0){var c=r(n);if(Ai){It(!0);try{r(n)}finally{It(!1)}}}else c=n;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=ox.bind(null,ke,e),[l.memoizedState,e]},useRef:function(e){var n=zt();return e={current:e},n.memoizedState=e},useState:function(e){e=uu(e);var n=e.queue,r=xm.bind(null,ke,n);return n.dispatch=r,[e.memoizedState,r]},useDebugValue:du,useDeferredValue:function(e,n){var r=zt();return mu(r,e,n)},useTransition:function(){var e=uu(!1);return e=mm.bind(null,ke,e.queue,!0,!1),zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,r){var l=ke,c=zt();if(Ue){if(r===void 0)throw Error(a(407));r=r()}else{if(r=n(),Xe===null)throw Error(a(349));(qe&127)!==0||Yd(l,n,r)}c.memoizedState=r;var f={value:r,getSnapshot:n};return c.queue=f,rm(Fd.bind(null,l,f,e),[e]),l.flags|=2048,or(9,{destroy:void 0},Vd.bind(null,l,f,r,n),null),r},useId:function(){var e=zt(),n=Xe.identifierPrefix;if(Ue){var r=Pn,l=Ln;r=(l&~(1<<32-Dt(l)-1)).toString(32)+r,n="_"+n+"R_"+r,r=Hl++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=tx++,n="_"+n+"r_"+r.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:yu,useFormState:em,useActionState:em,useOptimistic:function(e){var n=zt();n.memoizedState=n.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=gu.bind(null,ke,!0,r),r.dispatch=n,[e,n]},useMemoCache:lu,useCacheRefresh:function(){return zt().memoizedState=lx.bind(null,ke)},useEffectEvent:function(e){var n=zt(),r={impl:e};return n.memoizedState=r,function(){if((Ye&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},bu={readContext:Ct,use:Yl,useCallback:fm,useContext:Ct,useEffect:hu,useImperativeHandle:um,useInsertionEffect:lm,useLayoutEffect:om,useMemo:hm,useReducer:Vl,useRef:im,useState:function(){return Vl(as)},useDebugValue:du,useDeferredValue:function(e,n){var r=ht();return dm(r,Ie.memoizedState,e,n)},useTransition:function(){var e=Vl(as)[0],n=ht().memoizedState;return[typeof e=="boolean"?e:ma(e),n]},useSyncExternalStore:$d,useId:gm,useHostTransitionStatus:yu,useFormState:tm,useActionState:tm,useOptimistic:function(e,n){var r=ht();return Qd(r,Ie,e,n)},useMemoCache:lu,useCacheRefresh:bm};bu.useEffectEvent=am;var Sm={readContext:Ct,use:Yl,useCallback:fm,useContext:Ct,useEffect:hu,useImperativeHandle:um,useInsertionEffect:lm,useLayoutEffect:om,useMemo:hm,useReducer:cu,useRef:im,useState:function(){return cu(as)},useDebugValue:du,useDeferredValue:function(e,n){var r=ht();return Ie===null?mu(r,e,n):dm(r,Ie.memoizedState,e,n)},useTransition:function(){var e=cu(as)[0],n=ht().memoizedState;return[typeof e=="boolean"?e:ma(e),n]},useSyncExternalStore:$d,useId:gm,useHostTransitionStatus:yu,useFormState:sm,useActionState:sm,useOptimistic:function(e,n){var r=ht();return Ie!==null?Qd(r,Ie,e,n):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:lu,useCacheRefresh:bm};Sm.useEffectEvent=am;function xu(e,n,r,l){n=e.memoizedState,r=r(l,n),r=r==null?n:_({},n,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var vu={enqueueSetState:function(e,n,r){e=e._reactInternals;var l=tn(),c=Rs(l);c.payload=n,r!=null&&(c.callback=r),n=Ds(e,c,l),n!==null&&(Ft(n,e,l),ua(n,e,l))},enqueueReplaceState:function(e,n,r){e=e._reactInternals;var l=tn(),c=Rs(l);c.tag=1,c.payload=n,r!=null&&(c.callback=r),n=Ds(e,c,l),n!==null&&(Ft(n,e,l),ua(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var r=tn(),l=Rs(r);l.tag=2,n!=null&&(l.callback=n),n=Ds(e,l,r),n!==null&&(Ft(n,e,r),ua(n,e,r))}};function Em(e,n,r,l,c,f,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,f,p):n.prototype&&n.prototype.isPureReactComponent?!na(r,l)||!na(c,f):!0}function jm(e,n,r,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,l),n.state!==e&&vu.enqueueReplaceState(n,n.state,null)}function Oi(e,n){var r=n;if("ref"in n){r={};for(var l in n)l!=="ref"&&(r[l]=n[l])}if(e=e.defaultProps){r===n&&(r=_({},r));for(var c in e)r[c]===void 0&&(r[c]=e[c])}return r}function Am(e){jl(e)}function Om(e){console.error(e)}function Tm(e){jl(e)}function Ql(e,n){try{var r=e.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Nm(e,n,r){try{var l=e.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function _u(e,n,r){return r=Rs(r),r.tag=3,r.payload={element:null},r.callback=function(){Ql(e,n)},r}function km(e){return e=Rs(e),e.tag=3,e}function Cm(e,n,r,l){var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var f=l.value;e.payload=function(){return c(f)},e.callback=function(){Nm(n,r,l)}}var p=r.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Nm(n,r,l),typeof c!="function"&&(Ps===null?Ps=new Set([this]):Ps.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function cx(e,n,r,l,c){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=r.alternate,n!==null&&er(n,r,c,!0),r=Xt.current,r!==null){switch(r.tag){case 31:case 13:return xn===null?ao():r.alternate===null&&ot===0&&(ot=3),r.flags&=-257,r.flags|=65536,r.lanes=c,l===ql?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([l]):n.add(l),Gu(e,l,c)),!1;case 22:return r.flags|=65536,l===ql?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([l]):r.add(l)),Gu(e,l,c)),!1}throw Error(a(435,r.tag))}return Gu(e,l,c),ao(),!1}if(Ue)return n=Xt.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=c,l!==Pc&&(e=Error(a(422),{cause:l}),ra(pn(e,r)))):(l!==Pc&&(n=Error(a(423),{cause:l}),ra(pn(n,r))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=pn(l,r),c=_u(e.stateNode,l,c),Xc(e,c),ot!==4&&(ot=2)),!1;var f=Error(a(520),{cause:l});if(f=pn(f,r),Ea===null?Ea=[f]:Ea.push(f),ot!==4&&(ot=2),n===null)return!0;l=pn(l,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,e=c&-c,r.lanes|=e,e=_u(r.stateNode,l,e),Xc(r,e),!1;case 1:if(n=r.type,f=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Ps===null||!Ps.has(f))))return r.flags|=65536,c&=-c,r.lanes|=c,c=km(c),Cm(c,e,r,l),Xc(r,c),!1}r=r.return}while(r!==null);return!1}var wu=Error(a(461)),gt=!1;function Mt(e,n,r,l){n.child=e===null?qd(n,null,r,l):ji(n,e.child,r,l)}function Mm(e,n,r,l,c){r=r.render;var f=n.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return _i(n),l=su(e,n,r,p,f,c),b=iu(),e!==null&&!gt?(ru(e,n,c),ls(e,n,c)):(Ue&&b&&Bc(n),n.flags|=1,Mt(e,n,l,c),n.child)}function Rm(e,n,r,l,c){if(e===null){var f=r.type;return typeof f=="function"&&!qc(f)&&f.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=f,Dm(e,n,f,l,c)):(e=Nl(r.type,null,l,n,n.mode,c),e.ref=n.ref,e.return=n,n.child=e)}if(f=e.child,!ku(e,c)){var p=f.memoizedProps;if(r=r.compare,r=r!==null?r:na,r(p,l)&&e.ref===n.ref)return ls(e,n,c)}return n.flags|=1,e=ts(f,l),e.ref=n.ref,e.return=n,n.child=e}function Dm(e,n,r,l,c){if(e!==null){var f=e.memoizedProps;if(na(f,l)&&e.ref===n.ref)if(gt=!1,n.pendingProps=l=f,ku(e,c))(e.flags&131072)!==0&&(gt=!0);else return n.lanes=e.lanes,ls(e,n,c)}return Su(e,n,r,l,c)}function qm(e,n,r,l){var c=l.children,f=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(f=f!==null?f.baseLanes|r:r,e!==null){for(l=n.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~f}else l=0,n.child=null;return zm(e,n,f,r,l)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Rl(n,f!==null?f.cachePool:null),f!==null?Bd(n,f):Wc(),Ld(n);else return l=n.lanes=536870912,zm(e,n,f!==null?f.baseLanes|r:r,r,l)}else f!==null?(Rl(n,f.cachePool),Bd(n,f),zs(),n.memoizedState=null):(e!==null&&Rl(n,null),Wc(),zs());return Mt(e,n,c,r),n.child}function ga(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function zm(e,n,r,l,c){var f=Ic();return f=f===null?null:{parent:pt._currentValue,pool:f},n.memoizedState={baseLanes:r,cachePool:f},e!==null&&Rl(n,null),Wc(),Ld(n),e!==null&&er(e,n,l,!0),n.childLanes=c,null}function Jl(e,n){return n=Xl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Um(e,n,r){return ji(n,e.child,null,r),e=Jl(n,n.pendingProps),e.flags|=2,Zt(n),n.memoizedState=null,e}function ux(e,n,r){var l=n.pendingProps,c=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ue){if(l.mode==="hidden")return e=Jl(n,l),n.lanes=536870912,ga(null,e);if(tu(n),(e=We)?(e=Jp(e,bn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ts!==null?{id:Ln,overflow:Pn}:null,retryLane:536870912,hydrationErrors:null},r=vd(e),r.return=n,n.child=r,kt=n,We=null)):e=null,e===null)throw ks(n);return n.lanes=536870912,null}return Jl(n,l)}var f=e.memoizedState;if(f!==null){var p=f.dehydrated;if(tu(n),c)if(n.flags&256)n.flags&=-257,n=Um(e,n,r);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(a(558));else if(gt||er(e,n,r,!1),c=(r&e.childLanes)!==0,gt||c){if(l=Xe,l!==null&&(p=As(l,r),p!==0&&p!==f.retryLane))throw f.retryLane=p,gi(e,p),Ft(l,e,p),wu;ao(),n=Um(e,n,r)}else e=f.treeContext,We=vn(p.nextSibling),kt=n,Ue=!0,Ns=null,bn=!1,e!==null&&Sd(n,e),n=Jl(n,l),n.flags|=4096;return n}return e=ts(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Kl(e,n){var r=n.ref;if(r===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(e===null||e.ref!==r)&&(n.flags|=4194816)}}function Su(e,n,r,l,c){return _i(n),r=su(e,n,r,l,void 0,c),l=iu(),e!==null&&!gt?(ru(e,n,c),ls(e,n,c)):(Ue&&l&&Bc(n),n.flags|=1,Mt(e,n,r,c),n.child)}function Bm(e,n,r,l,c,f){return _i(n),n.updateQueue=null,r=Hd(n,l,r,c),Pd(e),l=iu(),e!==null&&!gt?(ru(e,n,f),ls(e,n,f)):(Ue&&l&&Bc(n),n.flags|=1,Mt(e,n,r,f),n.child)}function Lm(e,n,r,l,c){if(_i(n),n.stateNode===null){var f=Ki,p=r.contextType;typeof p=="object"&&p!==null&&(f=Ct(p)),f=new r(l,f),n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=vu,n.stateNode=f,f._reactInternals=n,f=n.stateNode,f.props=l,f.state=n.memoizedState,f.refs={},Jc(n),p=r.contextType,f.context=typeof p=="object"&&p!==null?Ct(p):Ki,f.state=n.memoizedState,p=r.getDerivedStateFromProps,typeof p=="function"&&(xu(n,r,p,l),f.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(p=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),p!==f.state&&vu.enqueueReplaceState(f,f.state,null),ha(n,l,f,c),fa(),f.state=n.memoizedState),typeof f.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){f=n.stateNode;var b=n.memoizedProps,O=Oi(r,b);f.props=O;var L=f.context,I=r.contextType;p=Ki,typeof I=="object"&&I!==null&&(p=Ct(I));var te=r.getDerivedStateFromProps;I=typeof te=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=n.pendingProps!==b,I||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||L!==p)&&jm(n,f,l,p),Ms=!1;var P=n.memoizedState;f.state=P,ha(n,l,f,c),fa(),L=n.memoizedState,b||P!==L||Ms?(typeof te=="function"&&(xu(n,r,te,l),L=n.memoizedState),(O=Ms||Em(n,r,O,l,P,L,p))?(I||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(n.flags|=4194308)):(typeof f.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=L),f.props=l,f.state=L,f.context=p,l=O):(typeof f.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{f=n.stateNode,Kc(e,n),p=n.memoizedProps,I=Oi(r,p),f.props=I,te=n.pendingProps,P=f.context,L=r.contextType,O=Ki,typeof L=="object"&&L!==null&&(O=Ct(L)),b=r.getDerivedStateFromProps,(L=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(p!==te||P!==O)&&jm(n,f,l,O),Ms=!1,P=n.memoizedState,f.state=P,ha(n,l,f,c),fa();var V=n.memoizedState;p!==te||P!==V||Ms||e!==null&&e.dependencies!==null&&Cl(e.dependencies)?(typeof b=="function"&&(xu(n,r,b,l),V=n.memoizedState),(I=Ms||Em(n,r,I,l,P,V,O)||e!==null&&e.dependencies!==null&&Cl(e.dependencies))?(L||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(l,V,O),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(l,V,O)),typeof f.componentDidUpdate=="function"&&(n.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof f.componentDidUpdate!="function"||p===e.memoizedProps&&P===e.memoizedState||(n.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&P===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=V),f.props=l,f.state=V,f.context=O,l=I):(typeof f.componentDidUpdate!="function"||p===e.memoizedProps&&P===e.memoizedState||(n.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&P===e.memoizedState||(n.flags|=1024),l=!1)}return f=l,Kl(e,n),l=(n.flags&128)!==0,f||l?(f=n.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:f.render(),n.flags|=1,e!==null&&l?(n.child=ji(n,e.child,null,c),n.child=ji(n,null,r,c)):Mt(e,n,r,c),n.memoizedState=f.state,e=n.child):e=ls(e,n,c),e}function Pm(e,n,r,l){return xi(),n.flags|=256,Mt(e,n,r,l),n.child}var Eu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ju(e){return{baseLanes:e,cachePool:Nd()}}function Au(e,n,r){return e=e!==null?e.childLanes&~r:0,n&&(e|=en),e}function Hm(e,n,r){var l=n.pendingProps,c=!1,f=(n.flags&128)!==0,p;if((p=f)||(p=e!==null&&e.memoizedState===null?!1:(ft.current&2)!==0),p&&(c=!0,n.flags&=-129),p=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ue){if(c?qs(n):zs(),(e=We)?(e=Jp(e,bn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ts!==null?{id:Ln,overflow:Pn}:null,retryLane:536870912,hydrationErrors:null},r=vd(e),r.return=n,n.child=r,kt=n,We=null)):e=null,e===null)throw ks(n);return cf(e)?n.lanes=32:n.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(zs(),c=n.mode,b=Xl({mode:"hidden",children:b},c),l=bi(l,c,r,null),b.return=n,l.return=n,b.sibling=l,n.child=b,l=n.child,l.memoizedState=ju(r),l.childLanes=Au(e,p,r),n.memoizedState=Eu,ga(null,l)):(qs(n),Ou(n,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(f)n.flags&256?(qs(n),n.flags&=-257,n=Tu(e,n,r)):n.memoizedState!==null?(zs(),n.child=e.child,n.flags|=128,n=null):(zs(),b=l.fallback,c=n.mode,l=Xl({mode:"visible",children:l.children},c),b=bi(b,c,r,null),b.flags|=2,l.return=n,b.return=n,l.sibling=b,n.child=l,ji(n,e.child,null,r),l=n.child,l.memoizedState=ju(r),l.childLanes=Au(e,p,r),n.memoizedState=Eu,n=ga(null,l));else if(qs(n),cf(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var L=p.dgst;p=L,l=Error(a(419)),l.stack="",l.digest=p,ra({value:l,source:null,stack:null}),n=Tu(e,n,r)}else if(gt||er(e,n,r,!1),p=(r&e.childLanes)!==0,gt||p){if(p=Xe,p!==null&&(l=As(p,r),l!==0&&l!==O.retryLane))throw O.retryLane=l,gi(e,l),Ft(p,e,l),wu;of(b)||ao(),n=Tu(e,n,r)}else of(b)?(n.flags|=192,n.child=e.child,n=null):(e=O.treeContext,We=vn(b.nextSibling),kt=n,Ue=!0,Ns=null,bn=!1,e!==null&&Sd(n,e),n=Ou(n,l.children),n.flags|=4096);return n}return c?(zs(),b=l.fallback,c=n.mode,O=e.child,L=O.sibling,l=ts(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,L!==null?b=ts(L,b):(b=bi(b,c,r,null),b.flags|=2),b.return=n,l.return=n,l.sibling=b,n.child=l,ga(null,l),l=n.child,b=e.child.memoizedState,b===null?b=ju(r):(c=b.cachePool,c!==null?(O=pt._currentValue,c=c.parent!==O?{parent:O,pool:O}:c):c=Nd(),b={baseLanes:b.baseLanes|r,cachePool:c}),l.memoizedState=b,l.childLanes=Au(e,p,r),n.memoizedState=Eu,ga(e.child,l)):(qs(n),r=e.child,e=r.sibling,r=ts(r,{mode:"visible",children:l.children}),r.return=n,r.sibling=null,e!==null&&(p=n.deletions,p===null?(n.deletions=[e],n.flags|=16):p.push(e)),n.child=r,n.memoizedState=null,r)}function Ou(e,n){return n=Xl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Xl(e,n){return e=Kt(22,e,null,n),e.lanes=0,e}function Tu(e,n,r){return ji(n,e.child,null,r),e=Ou(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function $m(e,n,r){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),Yc(e.return,n,r)}function Nu(e,n,r,l,c,f){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:c,treeForkCount:f}:(p.isBackwards=n,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=r,p.tailMode=c,p.treeForkCount=f)}function Ym(e,n,r){var l=n.pendingProps,c=l.revealOrder,f=l.tail;l=l.children;var p=ft.current,b=(p&2)!==0;if(b?(p=p&1|2,n.flags|=128):p&=1,je(ft,p),Mt(e,n,l,r),l=Ue?ia:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&$m(e,r,n);else if(e.tag===19)$m(e,r,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(r=n.child,c=null;r!==null;)e=r.alternate,e!==null&&Ll(e)===null&&(c=r),r=r.sibling;r=c,r===null?(c=n.child,n.child=null):(c=r.sibling,r.sibling=null),Nu(n,!1,c,r,f,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,c=n.child,n.child=null;c!==null;){if(e=c.alternate,e!==null&&Ll(e)===null){n.child=c;break}e=c.sibling,c.sibling=r,r=c,c=e}Nu(n,!0,r,null,f,l);break;case"together":Nu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function ls(e,n,r){if(e!==null&&(n.dependencies=e.dependencies),Ls|=n.lanes,(r&n.childLanes)===0)if(e!==null){if(er(e,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(a(153));if(n.child!==null){for(e=n.child,r=ts(e,e.pendingProps),n.child=r,r.return=n;e.sibling!==null;)e=e.sibling,r=r.sibling=ts(e,e.pendingProps),r.return=n;r.sibling=null}return n.child}function ku(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Cl(e)))}function fx(e,n,r){switch(n.tag){case 3:ct(n,n.stateNode.containerInfo),Cs(n,pt,e.memoizedState.cache),xi();break;case 27:case 5:wt(n);break;case 4:ct(n,n.stateNode.containerInfo);break;case 10:Cs(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,tu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(qs(n),n.flags|=128,null):(r&n.child.childLanes)!==0?Hm(e,n,r):(qs(n),e=ls(e,n,r),e!==null?e.sibling:null);qs(n);break;case 19:var c=(e.flags&128)!==0;if(l=(r&n.childLanes)!==0,l||(er(e,n,r,!1),l=(r&n.childLanes)!==0),c){if(l)return Ym(e,n,r);n.flags|=128}if(c=n.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),je(ft,ft.current),l)break;return null;case 22:return n.lanes=0,qm(e,n,r,n.pendingProps);case 24:Cs(n,pt,e.memoizedState.cache)}return ls(e,n,r)}function Vm(e,n,r){if(e!==null)if(e.memoizedProps!==n.pendingProps)gt=!0;else{if(!ku(e,r)&&(n.flags&128)===0)return gt=!1,fx(e,n,r);gt=(e.flags&131072)!==0}else gt=!1,Ue&&(n.flags&1048576)!==0&&wd(n,ia,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=Si(n.elementType),n.type=e,typeof e=="function")qc(e)?(l=Oi(e,l),n.tag=1,n=Lm(null,n,e,l,r)):(n.tag=0,n=Su(null,n,e,l,r));else{if(e!=null){var c=e.$$typeof;if(c===re){n.tag=11,n=Mm(null,n,e,l,r);break e}else if(c===ce){n.tag=14,n=Rm(null,n,e,l,r);break e}}throw n=Se(e)||e,Error(a(306,n,""))}}return n;case 0:return Su(e,n,n.type,n.pendingProps,r);case 1:return l=n.type,c=Oi(l,n.pendingProps),Lm(e,n,l,c,r);case 3:e:{if(ct(n,n.stateNode.containerInfo),e===null)throw Error(a(387));l=n.pendingProps;var f=n.memoizedState;c=f.element,Kc(e,n),ha(n,l,null,r);var p=n.memoizedState;if(l=p.cache,Cs(n,pt,l),l!==f.cache&&Vc(n,[pt],r,!0),fa(),l=p.element,f.isDehydrated)if(f={element:l,isDehydrated:!1,cache:p.cache},n.updateQueue.baseState=f,n.memoizedState=f,n.flags&256){n=Pm(e,n,l,r);break e}else if(l!==c){c=pn(Error(a(424)),n),ra(c),n=Pm(e,n,l,r);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(We=vn(e.firstChild),kt=n,Ue=!0,Ns=null,bn=!0,r=qd(n,null,l,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(xi(),l===c){n=ls(e,n,r);break e}Mt(e,n,l,r)}n=n.child}return n;case 26:return Kl(e,n),e===null?(r=t0(n.type,null,n.pendingProps,null))?n.memoizedState=r:Ue||(r=n.type,e=n.pendingProps,l=mo(jt.current).createElement(r),l[Ke]=n,l[at]=e,Rt(l,r,e),k(l),n.stateNode=l):n.memoizedState=t0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return wt(n),e===null&&Ue&&(l=n.stateNode=Zp(n.type,n.pendingProps,jt.current),kt=n,bn=!0,c=We,Vs(n.type)?(uf=c,We=vn(l.firstChild)):We=c),Mt(e,n,n.pendingProps.children,r),Kl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ue&&((c=l=We)&&(l=Hx(l,n.type,n.pendingProps,bn),l!==null?(n.stateNode=l,kt=n,We=vn(l.firstChild),bn=!1,c=!0):c=!1),c||ks(n)),wt(n),c=n.type,f=n.pendingProps,p=e!==null?e.memoizedProps:null,l=f.children,rf(c,f)?l=null:p!==null&&rf(c,p)&&(n.flags|=32),n.memoizedState!==null&&(c=su(e,n,nx,null,null,r),Ma._currentValue=c),Kl(e,n),Mt(e,n,l,r),n.child;case 6:return e===null&&Ue&&((e=r=We)&&(r=$x(r,n.pendingProps,bn),r!==null?(n.stateNode=r,kt=n,We=null,e=!0):e=!1),e||ks(n)),null;case 13:return Hm(e,n,r);case 4:return ct(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=ji(n,null,l,r):Mt(e,n,l,r),n.child;case 11:return Mm(e,n,n.type,n.pendingProps,r);case 7:return Mt(e,n,n.pendingProps,r),n.child;case 8:return Mt(e,n,n.pendingProps.children,r),n.child;case 12:return Mt(e,n,n.pendingProps.children,r),n.child;case 10:return l=n.pendingProps,Cs(n,n.type,l.value),Mt(e,n,l.children,r),n.child;case 9:return c=n.type._context,l=n.pendingProps.children,_i(n),c=Ct(c),l=l(c),n.flags|=1,Mt(e,n,l,r),n.child;case 14:return Rm(e,n,n.type,n.pendingProps,r);case 15:return Dm(e,n,n.type,n.pendingProps,r);case 19:return Ym(e,n,r);case 31:return ux(e,n,r);case 22:return qm(e,n,r,n.pendingProps);case 24:return _i(n),l=Ct(pt),e===null?(c=Ic(),c===null&&(c=Xe,f=Fc(),c.pooledCache=f,f.refCount++,f!==null&&(c.pooledCacheLanes|=r),c=f),n.memoizedState={parent:l,cache:c},Jc(n),Cs(n,pt,c)):((e.lanes&r)!==0&&(Kc(e,n),ha(n,null,null,r),fa()),c=e.memoizedState,f=n.memoizedState,c.parent!==l?(c={parent:l,cache:l},n.memoizedState=c,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=c),Cs(n,pt,l)):(l=f.cache,Cs(n,pt,l),l!==c.cache&&Vc(n,[pt],r,!0))),Mt(e,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(a(156,n.tag))}function os(e){e.flags|=4}function Cu(e,n,r,l,c){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(gp())e.flags|=8192;else throw Ei=ql,Qc}else e.flags&=-16777217}function Fm(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!a0(n))if(gp())e.flags|=8192;else throw Ei=ql,Qc}function Zl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Pi():536870912,e.lanes|=n,hr|=n)}function ba(e,n){if(!Ue)switch(e.tailMode){case"hidden":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function et(e){var n=e.alternate!==null&&e.alternate.child===e.child,r=0,l=0;if(n)for(var c=e.child;c!==null;)r|=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;)r|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=r,n}function hx(e,n,r){var l=n.pendingProps;switch(Lc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(n),null;case 1:return et(n),null;case 3:return r=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),is(pt),Te(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Wi(n)?os(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Hc())),et(n),null;case 26:var c=n.type,f=n.memoizedState;return e===null?(os(n),f!==null?(et(n),Fm(n,f)):(et(n),Cu(n,c,null,l,r))):f?f!==e.memoizedState?(os(n),et(n),Fm(n,f)):(et(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&os(n),et(n),Cu(n,c,e,l,r)),null;case 27:if(Un(n),r=jt.current,c=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&os(n);else{if(!l){if(n.stateNode===null)throw Error(a(166));return et(n),null}e=Pe.current,Wi(n)?Ed(n):(e=Zp(c,l,r),n.stateNode=e,os(n))}return et(n),null;case 5:if(Un(n),c=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&os(n);else{if(!l){if(n.stateNode===null)throw Error(a(166));return et(n),null}if(f=Pe.current,Wi(n))Ed(n);else{var p=mo(jt.current);switch(f){case 1:f=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:f=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":f=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":f=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":f=p.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?f.multiple=!0:l.size&&(f.size=l.size);break;default:f=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}f[Ke]=n,f[at]=l;e:for(p=n.child;p!==null;){if(p.tag===5||p.tag===6)f.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===n)break e;for(;p.sibling===null;){if(p.return===null||p.return===n)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}n.stateNode=f;e:switch(Rt(f,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&&os(n)}}return et(n),Cu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,r),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&os(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(a(166));if(e=jt.current,Wi(n)){if(e=n.stateNode,r=n.memoizedProps,l=null,c=kt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Ke]=n,e=!!(e.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||Hp(e.nodeValue,r)),e||ks(n,!0)}else e=mo(e).createTextNode(l),e[Ke]=n,n.stateNode=e}return et(n),null;case 31:if(r=n.memoizedState,e===null||e.memoizedState!==null){if(l=Wi(n),r!==null){if(e===null){if(!l)throw Error(a(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Ke]=n}else xi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;et(n),e=!1}else r=Hc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return n.flags&256?(Zt(n),n):(Zt(n),null);if((n.flags&128)!==0)throw Error(a(558))}return et(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Wi(n),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=n.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Ke]=n}else xi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;et(n),c=!1}else c=Hc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return n.flags&256?(Zt(n),n):(Zt(n),null)}return Zt(n),(n.flags&128)!==0?(n.lanes=r,n):(r=l!==null,e=e!==null&&e.memoizedState!==null,r&&(l=n.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),f=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(f=l.memoizedState.cachePool.pool),f!==c&&(l.flags|=2048)),r!==e&&r&&(n.child.flags|=8192),Zl(n,n.updateQueue),et(n),null);case 4:return Te(),e===null&&Wu(n.stateNode.containerInfo),et(n),null;case 10:return is(n.type),et(n),null;case 19:if(xe(ft),l=n.memoizedState,l===null)return et(n),null;if(c=(n.flags&128)!==0,f=l.rendering,f===null)if(c)ba(l,!1);else{if(ot!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(f=Ll(e),f!==null){for(n.flags|=128,ba(l,!1),e=f.updateQueue,n.updateQueue=e,Zl(n,e),n.subtreeFlags=0,e=r,r=n.child;r!==null;)xd(r,e),r=r.sibling;return je(ft,ft.current&1|2),Ue&&ns(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&tt()>so&&(n.flags|=128,c=!0,ba(l,!1),n.lanes=4194304)}else{if(!c)if(e=Ll(f),e!==null){if(n.flags|=128,c=!0,e=e.updateQueue,n.updateQueue=e,Zl(n,e),ba(l,!0),l.tail===null&&l.tailMode==="hidden"&&!f.alternate&&!Ue)return et(n),null}else 2*tt()-l.renderingStartTime>so&&r!==536870912&&(n.flags|=128,c=!0,ba(l,!1),n.lanes=4194304);l.isBackwards?(f.sibling=n.child,n.child=f):(e=l.last,e!==null?e.sibling=f:n.child=f,l.last=f)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=tt(),e.sibling=null,r=ft.current,je(ft,c?r&1|2:r&1),Ue&&ns(n,l.treeForkCount),e):(et(n),null);case 22:case 23:return Zt(n),eu(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(r&536870912)!==0&&(n.flags&128)===0&&(et(n),n.subtreeFlags&6&&(n.flags|=8192)):et(n),r=n.updateQueue,r!==null&&Zl(n,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==r&&(n.flags|=2048),e!==null&&xe(wi),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),is(pt),et(n),null;case 25:return null;case 30:return null}throw Error(a(156,n.tag))}function dx(e,n){switch(Lc(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return is(pt),Te(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Un(n),null;case 31:if(n.memoizedState!==null){if(Zt(n),n.alternate===null)throw Error(a(340));xi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Zt(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(a(340));xi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return xe(ft),null;case 4:return Te(),null;case 10:return is(n.type),null;case 22:case 23:return Zt(n),eu(),e!==null&&xe(wi),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return is(pt),null;case 25:return null;default:return null}}function Gm(e,n){switch(Lc(n),n.tag){case 3:is(pt),Te();break;case 26:case 27:case 5:Un(n);break;case 4:Te();break;case 31:n.memoizedState!==null&&Zt(n);break;case 13:Zt(n);break;case 19:xe(ft);break;case 10:is(n.type);break;case 22:case 23:Zt(n),eu(),e!==null&&xe(wi);break;case 24:is(pt)}}function xa(e,n){try{var r=n.updateQueue,l=r!==null?r.lastEffect:null;if(l!==null){var c=l.next;r=c;do{if((r.tag&e)===e){l=void 0;var f=r.create,p=r.inst;l=f(),p.destroy=l}r=r.next}while(r!==c)}}catch(b){Fe(n,n.return,b)}}function Us(e,n,r){try{var l=n.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var f=c.next;l=f;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=n;var O=r,L=b;try{L()}catch(I){Fe(c,O,I)}}}l=l.next}while(l!==f)}}catch(I){Fe(n,n.return,I)}}function Im(e){var n=e.updateQueue;if(n!==null){var r=e.stateNode;try{Ud(n,r)}catch(l){Fe(e,e.return,l)}}}function Qm(e,n,r){r.props=Oi(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(l){Fe(e,n,l)}}function va(e,n){try{var r=e.ref;if(r!==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 r=="function"?e.refCleanup=r(l):r.current=l}}catch(c){Fe(e,n,c)}}function Hn(e,n){var r=e.ref,l=e.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(c){Fe(e,n,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(c){Fe(e,n,c)}else r.current=null}function Jm(e){var n=e.type,r=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&l.focus();break e;case"img":r.src?l.src=r.src:r.srcSet&&(l.srcset=r.srcSet)}}catch(c){Fe(e,e.return,c)}}function Mu(e,n,r){try{var l=e.stateNode;qx(l,e.type,r,n),l[at]=n}catch(c){Fe(e,e.return,c)}}function Km(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Vs(e.type)||e.tag===4}function Ru(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Km(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&&Vs(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 Du(e,n,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(e),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=Wn));else if(l!==4&&(l===27&&Vs(e.type)&&(r=e.stateNode,n=null),e=e.child,e!==null))for(Du(e,n,r),e=e.sibling;e!==null;)Du(e,n,r),e=e.sibling}function Wl(e,n,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?r.insertBefore(e,n):r.appendChild(e);else if(l!==4&&(l===27&&Vs(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Wl(e,n,r),e=e.sibling;e!==null;)Wl(e,n,r),e=e.sibling}function Xm(e){var n=e.stateNode,r=e.memoizedProps;try{for(var l=e.type,c=n.attributes;c.length;)n.removeAttributeNode(c[0]);Rt(n,l,r),n[Ke]=e,n[at]=r}catch(f){Fe(e,e.return,f)}}var cs=!1,bt=!1,qu=!1,Zm=typeof WeakSet=="function"?WeakSet:Set,At=null;function mx(e,n){if(e=e.containerInfo,nf=_o,e=ud(e),Tc(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var c=l.anchorOffset,f=l.focusNode;l=l.focusOffset;try{r.nodeType,f.nodeType}catch{r=null;break e}var p=0,b=-1,O=-1,L=0,I=0,te=e,P=null;t:for(;;){for(var V;te!==r||c!==0&&te.nodeType!==3||(b=p+c),te!==f||l!==0&&te.nodeType!==3||(O=p+l),te.nodeType===3&&(p+=te.nodeValue.length),(V=te.firstChild)!==null;)P=te,te=V;for(;;){if(te===e)break t;if(P===r&&++L===c&&(b=p),P===f&&++I===l&&(O=p),(V=te.nextSibling)!==null)break;te=P,P=te.parentNode}te=V}r=b===-1||O===-1?null:{start:b,end:O}}else r=null}r=r||{start:0,end:0}}else r=null;for(sf={focusedElem:e,selectionRange:r},_o=!1,At=n;At!==null;)if(n=At,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,At=e;else for(;At!==null;){switch(n=At,f=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)c=e[r],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,r=n,c=f.memoizedProps,f=f.memoizedState,l=r.stateNode;try{var ye=Oi(r.type,c);e=l.getSnapshotBeforeUpdate(ye,f),l.__reactInternalSnapshotBeforeUpdate=e}catch(_e){Fe(r,r.return,_e)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,r=e.nodeType,r===9)lf(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":lf(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=n.sibling,e!==null){e.return=n.return,At=e;break}At=n.return}}function Wm(e,n,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:fs(e,r),l&4&&xa(5,r);break;case 1:if(fs(e,r),l&4)if(e=r.stateNode,n===null)try{e.componentDidMount()}catch(p){Fe(r,r.return,p)}else{var c=Oi(r.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(c,n,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Fe(r,r.return,p)}}l&64&&Im(r),l&512&&va(r,r.return);break;case 3:if(fs(e,r),l&64&&(e=r.updateQueue,e!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{Ud(e,n)}catch(p){Fe(r,r.return,p)}}break;case 27:n===null&&l&4&&Xm(r);case 26:case 5:fs(e,r),n===null&&l&4&&Jm(r),l&512&&va(r,r.return);break;case 12:fs(e,r);break;case 31:fs(e,r),l&4&&np(e,r);break;case 13:fs(e,r),l&4&&sp(e,r),l&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=Sx.bind(null,r),Yx(e,r))));break;case 22:if(l=r.memoizedState!==null||cs,!l){n=n!==null&&n.memoizedState!==null||bt,c=cs;var f=bt;cs=l,(bt=n)&&!f?hs(e,r,(r.subtreeFlags&8772)!==0):fs(e,r),cs=c,bt=f}break;case 30:break;default:fs(e,r)}}function ep(e){var n=e.alternate;n!==null&&(e.alternate=null,ep(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Hi(n)),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 nt=null,Ht=!1;function us(e,n,r){for(r=r.child;r!==null;)tp(e,n,r),r=r.sibling}function tp(e,n,r){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(oi,r)}catch{}switch(r.tag){case 26:bt||Hn(r,n),us(e,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:bt||Hn(r,n);var l=nt,c=Ht;Vs(r.type)&&(nt=r.stateNode,Ht=!1),us(e,n,r),Na(r.stateNode),nt=l,Ht=c;break;case 5:bt||Hn(r,n);case 6:if(l=nt,c=Ht,nt=null,us(e,n,r),nt=l,Ht=c,nt!==null)if(Ht)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(r.stateNode)}catch(f){Fe(r,n,f)}else try{nt.removeChild(r.stateNode)}catch(f){Fe(r,n,f)}break;case 18:nt!==null&&(Ht?(e=nt,Ip(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),vr(e)):Ip(nt,r.stateNode));break;case 4:l=nt,c=Ht,nt=r.stateNode.containerInfo,Ht=!0,us(e,n,r),nt=l,Ht=c;break;case 0:case 11:case 14:case 15:Us(2,r,n),bt||Us(4,r,n),us(e,n,r);break;case 1:bt||(Hn(r,n),l=r.stateNode,typeof l.componentWillUnmount=="function"&&Qm(r,n,l)),us(e,n,r);break;case 21:us(e,n,r);break;case 22:bt=(l=bt)||r.memoizedState!==null,us(e,n,r),bt=l;break;default:us(e,n,r)}}function np(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{vr(e)}catch(r){Fe(n,n.return,r)}}}function sp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{vr(e)}catch(r){Fe(n,n.return,r)}}function px(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Zm),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Zm),n;default:throw Error(a(435,e.tag))}}function eo(e,n){var r=px(e);n.forEach(function(l){if(!r.has(l)){r.add(l);var c=Ex.bind(null,e,l);l.then(c,c)}})}function $t(e,n){var r=n.deletions;if(r!==null)for(var l=0;l<r.length;l++){var c=r[l],f=e,p=n,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Vs(b.type)){nt=b.stateNode,Ht=!1;break e}break;case 5:nt=b.stateNode,Ht=!1;break e;case 3:case 4:nt=b.stateNode.containerInfo,Ht=!0;break e}b=b.return}if(nt===null)throw Error(a(160));tp(f,p,c),nt=null,Ht=!1,f=c.alternate,f!==null&&(f.return=null),c.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)ip(n,e),n=n.sibling}var Nn=null;function ip(e,n){var r=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:$t(n,e),Yt(e),l&4&&(Us(3,e,e.return),xa(3,e),Us(5,e,e.return));break;case 1:$t(n,e),Yt(e),l&512&&(bt||r===null||Hn(r,r.return)),l&64&&cs&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?l:r.concat(l))));break;case 26:var c=Nn;if($t(n,e),Yt(e),l&512&&(bt||r===null||Hn(r,r.return)),l&4){var f=r!==null?r.memoizedState:null;if(l=e.memoizedState,r===null)if(l===null)if(e.stateNode===null){e:{l=e.type,r=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":f=c.getElementsByTagName("title")[0],(!f||f[St]||f[Ke]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=c.createElement(l),c.head.insertBefore(f,c.querySelector("head > title"))),Rt(f,l,r),f[Ke]=e,k(f),l=f;break e;case"link":var p=i0("link","href",c).get(l+(r.href||""));if(p){for(var b=0;b<p.length;b++)if(f=p[b],f.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&f.getAttribute("rel")===(r.rel==null?null:r.rel)&&f.getAttribute("title")===(r.title==null?null:r.title)&&f.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){p.splice(b,1);break t}}f=c.createElement(l),Rt(f,l,r),c.head.appendChild(f);break;case"meta":if(p=i0("meta","content",c).get(l+(r.content||""))){for(b=0;b<p.length;b++)if(f=p[b],f.getAttribute("content")===(r.content==null?null:""+r.content)&&f.getAttribute("name")===(r.name==null?null:r.name)&&f.getAttribute("property")===(r.property==null?null:r.property)&&f.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&f.getAttribute("charset")===(r.charSet==null?null:r.charSet)){p.splice(b,1);break t}}f=c.createElement(l),Rt(f,l,r),c.head.appendChild(f);break;default:throw Error(a(468,l))}f[Ke]=e,k(f),l=f}e.stateNode=l}else r0(c,e.type,e.stateNode);else e.stateNode=s0(c,l,e.memoizedProps);else f!==l?(f===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):f.count--,l===null?r0(c,e.type,e.stateNode):s0(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Mu(e,e.memoizedProps,r.memoizedProps)}break;case 27:$t(n,e),Yt(e),l&512&&(bt||r===null||Hn(r,r.return)),r!==null&&l&4&&Mu(e,e.memoizedProps,r.memoizedProps);break;case 5:if($t(n,e),Yt(e),l&512&&(bt||r===null||Hn(r,r.return)),e.flags&32){c=e.stateNode;try{Yi(c,"")}catch(ye){Fe(e,e.return,ye)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,Mu(e,c,r!==null?r.memoizedProps:c)),l&1024&&(qu=!0);break;case 6:if($t(n,e),Yt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,r=e.stateNode;try{r.nodeValue=l}catch(ye){Fe(e,e.return,ye)}}break;case 3:if(go=null,c=Nn,Nn=po(n.containerInfo),$t(n,e),Nn=c,Yt(e),l&4&&r!==null&&r.memoizedState.isDehydrated)try{vr(n.containerInfo)}catch(ye){Fe(e,e.return,ye)}qu&&(qu=!1,rp(e));break;case 4:l=Nn,Nn=po(e.stateNode.containerInfo),$t(n,e),Yt(e),Nn=l;break;case 12:$t(n,e),Yt(e);break;case 31:$t(n,e),Yt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,eo(e,l)));break;case 13:$t(n,e),Yt(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(no=tt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,eo(e,l)));break;case 22:c=e.memoizedState!==null;var O=r!==null&&r.memoizedState!==null,L=cs,I=bt;if(cs=L||c,bt=I||O,$t(n,e),bt=I,cs=L,Yt(e),l&8192)e:for(n=e.stateNode,n._visibility=c?n._visibility&-2:n._visibility|1,c&&(r===null||O||cs||bt||Ti(e)),r=null,n=e;;){if(n.tag===5||n.tag===26){if(r===null){O=r=n;try{if(f=O.stateNode,c)p=f.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=O.stateNode;var te=O.memoizedProps.style,P=te!=null&&te.hasOwnProperty("display")?te.display:null;b.style.display=P==null||typeof P=="boolean"?"":(""+P).trim()}}catch(ye){Fe(O,O.return,ye)}}}else if(n.tag===6){if(r===null){O=n;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(ye){Fe(O,O.return,ye)}}}else if(n.tag===18){if(r===null){O=n;try{var V=O.stateNode;c?Qp(V,!0):Qp(O.stateNode,!1)}catch(ye){Fe(O,O.return,ye)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,eo(e,r))));break;case 19:$t(n,e),Yt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,eo(e,l)));break;case 30:break;case 21:break;default:$t(n,e),Yt(e)}}function Yt(e){var n=e.flags;if(n&2){try{for(var r,l=e.return;l!==null;){if(Km(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var c=r.stateNode,f=Ru(e);Wl(e,f,c);break;case 5:var p=r.stateNode;r.flags&32&&(Yi(p,""),r.flags&=-33);var b=Ru(e);Wl(e,b,p);break;case 3:case 4:var O=r.stateNode.containerInfo,L=Ru(e);Du(e,L,O);break;default:throw Error(a(161))}}catch(I){Fe(e,e.return,I)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function rp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;rp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function fs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Wm(e,n.alternate,n),n=n.sibling}function Ti(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Us(4,n,n.return),Ti(n);break;case 1:Hn(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&Qm(n,n.return,r),Ti(n);break;case 27:Na(n.stateNode);case 26:case 5:Hn(n,n.return),Ti(n);break;case 22:n.memoizedState===null&&Ti(n);break;case 30:Ti(n);break;default:Ti(n)}e=e.sibling}}function hs(e,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,c=e,f=n,p=f.flags;switch(f.tag){case 0:case 11:case 15:hs(c,f,r),xa(4,f);break;case 1:if(hs(c,f,r),l=f,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(L){Fe(l,l.return,L)}if(l=f,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++)zd(O[c],b)}catch(L){Fe(l,l.return,L)}}r&&p&64&&Im(f),va(f,f.return);break;case 27:Xm(f);case 26:case 5:hs(c,f,r),r&&l===null&&p&4&&Jm(f),va(f,f.return);break;case 12:hs(c,f,r);break;case 31:hs(c,f,r),r&&p&4&&np(c,f);break;case 13:hs(c,f,r),r&&p&4&&sp(c,f);break;case 22:f.memoizedState===null&&hs(c,f,r),va(f,f.return);break;case 30:break;default:hs(c,f,r)}n=n.sibling}}function zu(e,n){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&aa(r))}function Uu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&aa(e))}function kn(e,n,r,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)ap(e,n,r,l),n=n.sibling}function ap(e,n,r,l){var c=n.flags;switch(n.tag){case 0:case 11:case 15:kn(e,n,r,l),c&2048&&xa(9,n);break;case 1:kn(e,n,r,l);break;case 3:kn(e,n,r,l),c&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&aa(e)));break;case 12:if(c&2048){kn(e,n,r,l),e=n.stateNode;try{var f=n.memoizedProps,p=f.id,b=f.onPostCommit;typeof b=="function"&&b(p,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Fe(n,n.return,O)}}else kn(e,n,r,l);break;case 31:kn(e,n,r,l);break;case 13:kn(e,n,r,l);break;case 23:break;case 22:f=n.stateNode,p=n.alternate,n.memoizedState!==null?f._visibility&2?kn(e,n,r,l):_a(e,n):f._visibility&2?kn(e,n,r,l):(f._visibility|=2,cr(e,n,r,l,(n.subtreeFlags&10256)!==0||!1)),c&2048&&zu(p,n);break;case 24:kn(e,n,r,l),c&2048&&Uu(n.alternate,n);break;default:kn(e,n,r,l)}}function cr(e,n,r,l,c){for(c=c&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var f=e,p=n,b=r,O=l,L=p.flags;switch(p.tag){case 0:case 11:case 15:cr(f,p,b,O,c),xa(8,p);break;case 23:break;case 22:var I=p.stateNode;p.memoizedState!==null?I._visibility&2?cr(f,p,b,O,c):_a(f,p):(I._visibility|=2,cr(f,p,b,O,c)),c&&L&2048&&zu(p.alternate,p);break;case 24:cr(f,p,b,O,c),c&&L&2048&&Uu(p.alternate,p);break;default:cr(f,p,b,O,c)}n=n.sibling}}function _a(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=e,l=n,c=l.flags;switch(l.tag){case 22:_a(r,l),c&2048&&zu(l.alternate,l);break;case 24:_a(r,l),c&2048&&Uu(l.alternate,l);break;default:_a(r,l)}n=n.sibling}}var wa=8192;function ur(e,n,r){if(e.subtreeFlags&wa)for(e=e.child;e!==null;)lp(e,n,r),e=e.sibling}function lp(e,n,r){switch(e.tag){case 26:ur(e,n,r),e.flags&wa&&e.memoizedState!==null&&tv(r,Nn,e.memoizedState,e.memoizedProps);break;case 5:ur(e,n,r);break;case 3:case 4:var l=Nn;Nn=po(e.stateNode.containerInfo),ur(e,n,r),Nn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=wa,wa=16777216,ur(e,n,r),wa=l):ur(e,n,r));break;default:ur(e,n,r)}}function op(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Sa(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];At=l,up(l,e)}op(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)cp(e),e=e.sibling}function cp(e){switch(e.tag){case 0:case 11:case 15:Sa(e),e.flags&2048&&Us(9,e,e.return);break;case 3:Sa(e);break;case 12:Sa(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,to(e)):Sa(e);break;default:Sa(e)}}function to(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];At=l,up(l,e)}op(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Us(8,n,n.return),to(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,to(n));break;default:to(n)}e=e.sibling}}function up(e,n){for(;At!==null;){var r=At;switch(r.tag){case 0:case 11:case 15:Us(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var l=r.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:aa(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,At=l;else e:for(r=e;At!==null;){l=At;var c=l.sibling,f=l.return;if(ep(l),l===r){At=null;break e}if(c!==null){c.return=f,At=c;break e}At=f}}}var yx={getCacheForType:function(e){var n=Ct(pt),r=n.data.get(e);return r===void 0&&(r=e(),n.data.set(e,r)),r},cacheSignal:function(){return Ct(pt).controller.signal}},gx=typeof WeakMap=="function"?WeakMap:Map,Ye=0,Xe=null,Re=null,qe=0,Ve=0,Wt=null,Bs=!1,fr=!1,Bu=!1,ds=0,ot=0,Ls=0,Ni=0,Lu=0,en=0,hr=0,Ea=null,Vt=null,Pu=!1,no=0,fp=0,so=1/0,io=null,Ps=null,Et=0,Hs=null,dr=null,ms=0,Hu=0,$u=null,hp=null,ja=0,Yu=null;function tn(){return(Ye&2)!==0&&qe!==0?qe&-qe:Y.T!==null?Ju():Ir()}function dp(){if(en===0)if((qe&536870912)===0||Ue){var e=Kn;Kn<<=1,(Kn&3932160)===0&&(Kn=262144),en=e}else en=536870912;return e=Xt.current,e!==null&&(e.flags|=32),en}function Ft(e,n,r){(e===Xe&&(Ve===2||Ve===9)||e.cancelPendingCommit!==null)&&(mr(e,0),$s(e,qe,en,!1)),An(e,r),((Ye&2)===0||e!==Xe)&&(e===Xe&&((Ye&2)===0&&(Ni|=r),ot===4&&$s(e,qe,en,!1)),$n(e))}function mp(e,n,r){if((Ye&6)!==0)throw Error(a(327));var l=!r&&(n&127)===0&&(n&e.expiredLanes)===0||ui(e,n),c=l?vx(e,n):Fu(e,n,!0),f=l;do{if(c===0){fr&&!l&&$s(e,n,0,!1);break}else{if(r=e.current.alternate,f&&!bx(r)){c=Fu(e,n,!1),f=!1;continue}if(c===2){if(f=n,e.errorRecoveryDisabledLanes&f)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){n=p;e:{var b=e;c=Ea;var O=b.current.memoizedState.isDehydrated;if(O&&(mr(b,p).flags|=256),p=Fu(b,p,!1),p!==2){if(Bu&&!O){b.errorRecoveryDisabledLanes|=f,Ni|=f,c=4;break e}f=Vt,Vt=c,f!==null&&(Vt===null?Vt=f:Vt.push.apply(Vt,f))}c=p}if(f=!1,c!==2)continue}}if(c===1){mr(e,0),$s(e,n,0,!0);break}e:{switch(l=e,f=c,f){case 0:case 1:throw Error(a(345));case 4:if((n&4194048)!==n)break;case 6:$s(l,n,en,!Bs);break e;case 2:Vt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((n&62914560)===n&&(c=no+300-tt(),10<c)){if($s(l,n,en,!Bs),ci(l,0,!0)!==0)break e;ms=n,l.timeoutHandle=Fp(pp.bind(null,l,r,Vt,io,Pu,n,en,Ni,hr,Bs,f,"Throttled",-0,0),c);break e}pp(l,r,Vt,io,Pu,n,en,Ni,hr,Bs,f,null,-0,0)}}break}while(!0);$n(e)}function pp(e,n,r,l,c,f,p,b,O,L,I,te,P,V){if(e.timeoutHandle=-1,te=n.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wn},lp(n,f,te);var ye=(f&62914560)===f?no-tt():(f&4194048)===f?fp-tt():0;if(ye=nv(te,ye),ye!==null){ms=f,e.cancelPendingCommit=ye(Sp.bind(null,e,n,f,r,l,c,p,b,O,I,te,null,P,V)),$s(e,f,p,!L);return}}Sp(e,n,f,r,l,c,p,b,O)}function bx(e){for(var n=e;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var c=r[l],f=c.getSnapshot;c=c.value;try{if(!Jt(f(),c))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function $s(e,n,r,l){n&=~Lu,n&=~Ni,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var c=n;0<c;){var f=31-Dt(c),p=1<<f;l[f]=-1,c&=~p}r!==0&&js(e,r,n)}function ro(){return(Ye&6)===0?(Aa(0),!1):!0}function Vu(){if(Re!==null){if(Ve===0)var e=Re.return;else e=Re,ss=vi=null,au(e),ir=null,oa=0,e=Re;for(;e!==null;)Gm(e.alternate,e),e=e.return;Re=null}}function mr(e,n){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,Bx(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),ms=0,Vu(),Xe=e,Re=r=ts(e.current,null),qe=n,Ve=0,Wt=null,Bs=!1,fr=ui(e,n),Bu=!1,hr=en=Lu=Ni=Ls=ot=0,Vt=Ea=null,Pu=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var c=31-Dt(l),f=1<<c;n|=e[c],l&=~f}return ds=n,Al(),r}function yp(e,n){ke=null,Y.H=ya,n===sr||n===Dl?(n=Md(),Ve=3):n===Qc?(n=Md(),Ve=4):Ve=n===wu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Wt=n,Re===null&&(ot=1,Ql(e,pn(n,e.current)))}function gp(){var e=Xt.current;return e===null?!0:(qe&4194048)===qe?xn===null:(qe&62914560)===qe||(qe&536870912)!==0?e===xn:!1}function bp(){var e=Y.H;return Y.H=ya,e===null?ya:e}function xp(){var e=Y.A;return Y.A=yx,e}function ao(){ot=4,Bs||(qe&4194048)!==qe&&Xt.current!==null||(fr=!0),(Ls&134217727)===0&&(Ni&134217727)===0||Xe===null||$s(Xe,qe,en,!1)}function Fu(e,n,r){var l=Ye;Ye|=2;var c=bp(),f=xp();(Xe!==e||qe!==n)&&(io=null,mr(e,n)),n=!1;var p=ot;e:do try{if(Ve!==0&&Re!==null){var b=Re,O=Wt;switch(Ve){case 8:Vu(),p=6;break e;case 3:case 2:case 9:case 6:Xt.current===null&&(n=!0);var L=Ve;if(Ve=0,Wt=null,pr(e,b,O,L),r&&fr){p=0;break e}break;default:L=Ve,Ve=0,Wt=null,pr(e,b,O,L)}}xx(),p=ot;break}catch(I){yp(e,I)}while(!0);return n&&e.shellSuspendCounter++,ss=vi=null,Ye=l,Y.H=c,Y.A=f,Re===null&&(Xe=null,qe=0,Al()),p}function xx(){for(;Re!==null;)vp(Re)}function vx(e,n){var r=Ye;Ye|=2;var l=bp(),c=xp();Xe!==e||qe!==n?(io=null,so=tt()+500,mr(e,n)):fr=ui(e,n);e:do try{if(Ve!==0&&Re!==null){n=Re;var f=Wt;t:switch(Ve){case 1:Ve=0,Wt=null,pr(e,n,f,1);break;case 2:case 9:if(kd(f)){Ve=0,Wt=null,_p(n);break}n=function(){Ve!==2&&Ve!==9||Xe!==e||(Ve=7),$n(e)},f.then(n,n);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:kd(f)?(Ve=0,Wt=null,_p(n)):(Ve=0,Wt=null,pr(e,n,f,7));break;case 5:var p=null;switch(Re.tag){case 26:p=Re.memoizedState;case 5:case 27:var b=Re;if(p?a0(p):b.stateNode.complete){Ve=0,Wt=null;var O=b.sibling;if(O!==null)Re=O;else{var L=b.return;L!==null?(Re=L,lo(L)):Re=null}break t}}Ve=0,Wt=null,pr(e,n,f,5);break;case 6:Ve=0,Wt=null,pr(e,n,f,6);break;case 8:Vu(),ot=6;break e;default:throw Error(a(462))}}_x();break}catch(I){yp(e,I)}while(!0);return ss=vi=null,Y.H=l,Y.A=c,Ye=r,Re!==null?0:(Xe=null,qe=0,Al(),ot)}function _x(){for(;Re!==null&&!cl();)vp(Re)}function vp(e){var n=Vm(e.alternate,e,ds);e.memoizedProps=e.pendingProps,n===null?lo(e):Re=n}function _p(e){var n=e,r=n.alternate;switch(n.tag){case 15:case 0:n=Bm(r,n,n.pendingProps,n.type,void 0,qe);break;case 11:n=Bm(r,n,n.pendingProps,n.type.render,n.ref,qe);break;case 5:au(n);default:Gm(r,n),n=Re=xd(n,ds),n=Vm(r,n,ds)}e.memoizedProps=e.pendingProps,n===null?lo(e):Re=n}function pr(e,n,r,l){ss=vi=null,au(n),ir=null,oa=0;var c=n.return;try{if(cx(e,c,n,r,qe)){ot=1,Ql(e,pn(r,e.current)),Re=null;return}}catch(f){if(c!==null)throw Re=c,f;ot=1,Ql(e,pn(r,e.current)),Re=null;return}n.flags&32768?(Ue||l===1?e=!0:fr||(qe&536870912)!==0?e=!1:(Bs=e=!0,(l===2||l===9||l===3||l===6)&&(l=Xt.current,l!==null&&l.tag===13&&(l.flags|=16384))),wp(n,e)):lo(n)}function lo(e){var n=e;do{if((n.flags&32768)!==0){wp(n,Bs);return}e=n.return;var r=hx(n.alternate,n,ds);if(r!==null){Re=r;return}if(n=n.sibling,n!==null){Re=n;return}Re=n=e}while(n!==null);ot===0&&(ot=5)}function wp(e,n){do{var r=dx(e.alternate,e);if(r!==null){r.flags&=32767,Re=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(e=e.sibling,e!==null)){Re=e;return}Re=e=r}while(e!==null);ot=6,Re=null}function Sp(e,n,r,l,c,f,p,b,O){e.cancelPendingCommit=null;do oo();while(Et!==0);if((Ye&6)!==0)throw Error(a(327));if(n!==null){if(n===e.current)throw Error(a(177));if(f=n.lanes|n.childLanes,f|=Rc,Es(e,r,f,p,b,O),e===Xe&&(Re=Xe=null,qe=0),dr=n,Hs=e,ms=r,Hu=f,$u=c,hp=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,jx(Bi,function(){return Tp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=Y.T,Y.T=null,c=ae.p,ae.p=2,p=Ye,Ye|=4;try{mx(e,n,r)}finally{Ye=p,ae.p=c,Y.T=l}}Et=1,Ep(),jp(),Ap()}}function Ep(){if(Et===1){Et=0;var e=Hs,n=dr,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=Y.T,Y.T=null;var l=ae.p;ae.p=2;var c=Ye;Ye|=4;try{ip(n,e);var f=sf,p=ud(e.containerInfo),b=f.focusedElem,O=f.selectionRange;if(p!==b&&b&&b.ownerDocument&&cd(b.ownerDocument.documentElement,b)){if(O!==null&&Tc(b)){var L=O.start,I=O.end;if(I===void 0&&(I=L),"selectionStart"in b)b.selectionStart=L,b.selectionEnd=Math.min(I,b.value.length);else{var te=b.ownerDocument||document,P=te&&te.defaultView||window;if(P.getSelection){var V=P.getSelection(),ye=b.textContent.length,_e=Math.min(O.start,ye),Je=O.end===void 0?_e:Math.min(O.end,ye);!V.extend&&_e>Je&&(p=Je,Je=_e,_e=p);var D=od(b,_e),M=od(b,Je);if(D&&M&&(V.rangeCount!==1||V.anchorNode!==D.node||V.anchorOffset!==D.offset||V.focusNode!==M.node||V.focusOffset!==M.offset)){var B=te.createRange();B.setStart(D.node,D.offset),V.removeAllRanges(),_e>Je?(V.addRange(B),V.extend(M.node,M.offset)):(B.setEnd(M.node,M.offset),V.addRange(B))}}}}for(te=[],V=b;V=V.parentNode;)V.nodeType===1&&te.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<te.length;b++){var X=te[b];X.element.scrollLeft=X.left,X.element.scrollTop=X.top}}_o=!!nf,sf=nf=null}finally{Ye=c,ae.p=l,Y.T=r}}e.current=n,Et=2}}function jp(){if(Et===2){Et=0;var e=Hs,n=dr,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=Y.T,Y.T=null;var l=ae.p;ae.p=2;var c=Ye;Ye|=4;try{Wm(e,n.alternate,n)}finally{Ye=c,ae.p=l,Y.T=r}}Et=3}}function Ap(){if(Et===4||Et===3){Et=0,Ui();var e=Hs,n=dr,r=ms,l=hp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Et=5:(Et=0,dr=Hs=null,Op(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ps=null),hi(r),n=n.stateNode,ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(oi,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=Y.T,c=ae.p,ae.p=2,Y.T=null;try{for(var f=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];f(b.value,{componentStack:b.stack})}}finally{Y.T=n,ae.p=c}}(ms&3)!==0&&oo(),$n(e),c=e.pendingLanes,(r&261930)!==0&&(c&42)!==0?e===Yu?ja++:(ja=0,Yu=e):ja=0,Aa(0)}}function Op(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,aa(n)))}function oo(){return Ep(),jp(),Ap(),Tp()}function Tp(){if(Et!==5)return!1;var e=Hs,n=Hu;Hu=0;var r=hi(ms),l=Y.T,c=ae.p;try{ae.p=32>r?32:r,Y.T=null,r=$u,$u=null;var f=Hs,p=ms;if(Et=0,dr=Hs=null,ms=0,(Ye&6)!==0)throw Error(a(331));var b=Ye;if(Ye|=4,cp(f.current),ap(f,f.current,p,r),Ye=b,Aa(0,!1),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(oi,f)}catch{}return!0}finally{ae.p=c,Y.T=l,Op(e,n)}}function Np(e,n,r){n=pn(r,n),n=_u(e.stateNode,n,2),e=Ds(e,n,2),e!==null&&(An(e,2),$n(e))}function Fe(e,n,r){if(e.tag===3)Np(e,e,r);else for(;n!==null;){if(n.tag===3){Np(n,e,r);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ps===null||!Ps.has(l))){e=pn(r,e),r=km(2),l=Ds(n,r,2),l!==null&&(Cm(r,l,n,e),An(l,2),$n(l));break}}n=n.return}}function Gu(e,n,r){var l=e.pingCache;if(l===null){l=e.pingCache=new gx;var c=new Set;l.set(n,c)}else c=l.get(n),c===void 0&&(c=new Set,l.set(n,c));c.has(r)||(Bu=!0,c.add(r),e=wx.bind(null,e,n,r),n.then(e,e))}function wx(e,n,r){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Xe===e&&(qe&r)===r&&(ot===4||ot===3&&(qe&62914560)===qe&&300>tt()-no?(Ye&2)===0&&mr(e,0):Lu|=r,hr===qe&&(hr=0)),$n(e)}function kp(e,n){n===0&&(n=Pi()),e=gi(e,n),e!==null&&(An(e,n),$n(e))}function Sx(e){var n=e.memoizedState,r=0;n!==null&&(r=n.retryLane),kp(e,r)}function Ex(e,n){var r=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(r=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(n),kp(e,r)}function jx(e,n){return Yr(e,n)}var co=null,yr=null,Iu=!1,uo=!1,Qu=!1,Ys=0;function $n(e){e!==yr&&e.next===null&&(yr===null?co=yr=e:yr=yr.next=e),uo=!0,Iu||(Iu=!0,Ox())}function Aa(e,n){if(!Qu&&uo){Qu=!0;do for(var r=!1,l=co;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var f=0;else{var p=l.suspendedLanes,b=l.pingedLanes;f=(1<<31-Dt(42|e)+1)-1,f&=c&~(p&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(r=!0,Dp(l,f))}else f=qe,f=ci(l,l===Xe?f:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(f&3)===0||ui(l,f)||(r=!0,Dp(l,f));l=l.next}while(r);Qu=!1}}function Ax(){Cp()}function Cp(){uo=Iu=!1;var e=0;Ys!==0&&Ux()&&(e=Ys);for(var n=tt(),r=null,l=co;l!==null;){var c=l.next,f=Mp(l,n);f===0?(l.next=null,r===null?co=c:r.next=c,c===null&&(yr=r)):(r=l,(e!==0||(f&3)!==0)&&(uo=!0)),l=c}Et!==0&&Et!==5||Aa(e),Ys!==0&&(Ys=0)}function Mp(e,n){for(var r=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var p=31-Dt(f),b=1<<p,O=c[p];O===-1?((b&r)===0||(b&l)!==0)&&(c[p]=Gr(b,n)):O<=n&&(e.expiredLanes|=b),f&=~b}if(n=Xe,r=qe,r=ci(e,e===n?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,r===0||e===n&&(Ve===2||Ve===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Jn(l),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||ui(e,r)){if(n=r&-r,n===e.callbackPriority)return n;switch(l!==null&&Jn(l),hi(r)){case 2:case 8:r=fl;break;case 32:r=Bi;break;case 268435456:r=hl;break;default:r=Bi}return l=Rp.bind(null,e),r=Yr(r,l),e.callbackPriority=n,e.callbackNode=r,n}return l!==null&&l!==null&&Jn(l),e.callbackPriority=2,e.callbackNode=null,2}function Rp(e,n){if(Et!==0&&Et!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(oo()&&e.callbackNode!==r)return null;var l=qe;return l=ci(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(mp(e,l,n),Mp(e,tt()),e.callbackNode!=null&&e.callbackNode===r?Rp.bind(null,e):null)}function Dp(e,n){if(oo())return null;mp(e,n,!0)}function Ox(){Lx(function(){(Ye&6)!==0?Yr(ul,Ax):Cp()})}function Ju(){if(Ys===0){var e=tr;e===0&&(e=_s,_s<<=1,(_s&261888)===0&&(_s=256)),Ys=e}return Ys}function qp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bl(""+e)}function zp(e,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,e.id&&r.setAttribute("form",e.id),n.parentNode.insertBefore(r,n),e=new FormData(e),r.parentNode.removeChild(r),e}function Tx(e,n,r,l,c){if(n==="submit"&&r&&r.stateNode===c){var f=qp((c[at]||null).action),p=l.submitter;p&&(n=(n=p[at]||null)?qp(n.formAction):p.getAttribute("formAction"),n!==null&&(f=n,p=null));var b=new wl("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ys!==0){var O=p?zp(c,p):new FormData(c);pu(r,{pending:!0,data:O,method:c.method,action:f},null,O)}}else typeof f=="function"&&(b.preventDefault(),O=p?zp(c,p):new FormData(c),pu(r,{pending:!0,data:O,method:c.method,action:f},f,O))},currentTarget:c}]})}}for(var Ku=0;Ku<Mc.length;Ku++){var Xu=Mc[Ku],Nx=Xu.toLowerCase(),kx=Xu[0].toUpperCase()+Xu.slice(1);Tn(Nx,"on"+kx)}Tn(dd,"onAnimationEnd"),Tn(md,"onAnimationIteration"),Tn(pd,"onAnimationStart"),Tn("dblclick","onDoubleClick"),Tn("focusin","onFocus"),Tn("focusout","onBlur"),Tn(Gb,"onTransitionRun"),Tn(Ib,"onTransitionStart"),Tn(Qb,"onTransitionCancel"),Tn(yd,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),ne("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ne("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ne("onBeforeInput",["compositionend","keypress","textInput","paste"]),ne("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ne("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ne("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oa="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(" "),Cx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Oa));function Up(e,n){n=(n&4)!==0;for(var r=0;r<e.length;r++){var l=e[r],c=l.event;l=l.listeners;e:{var f=void 0;if(n)for(var p=l.length-1;0<=p;p--){var b=l[p],O=b.instance,L=b.currentTarget;if(b=b.listener,O!==f&&c.isPropagationStopped())break e;f=b,c.currentTarget=L;try{f(c)}catch(I){jl(I)}c.currentTarget=null,f=O}else for(p=0;p<l.length;p++){if(b=l[p],O=b.instance,L=b.currentTarget,b=b.listener,O!==f&&c.isPropagationStopped())break e;f=b,c.currentTarget=L;try{f(c)}catch(I){jl(I)}c.currentTarget=null,f=O}}}}function De(e,n){var r=n[di];r===void 0&&(r=n[di]=new Set);var l=e+"__bubble";r.has(l)||(Bp(n,e,2,!1),r.add(l))}function Zu(e,n,r){var l=0;n&&(l|=4),Bp(r,e,l,n)}var fo="_reactListening"+Math.random().toString(36).slice(2);function Wu(e){if(!e[fo]){e[fo]=!0,z.forEach(function(r){r!=="selectionchange"&&(Cx.has(r)||Zu(r,!1,e),Zu(r,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[fo]||(n[fo]=!0,Zu("selectionchange",!1,n))}}function Bp(e,n,r,l){switch(d0(n)){case 2:var c=rv;break;case 8:c=av;break;default:c=pf}r=c.bind(null,n,r,e),c=void 0,!xc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(n,r,{capture:!0,passive:c}):e.addEventListener(n,r,!0):c!==void 0?e.addEventListener(n,r,{passive:c}):e.addEventListener(n,r,!1)}function ef(e,n,r,l,c){var f=l;if((n&1)===0&&(n&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=f=p;continue e}b=b.parentNode}}l=l.return}Yh(function(){var L=f,I=gc(r),te=[];e:{var P=gd.get(e);if(P!==void 0){var V=wl,ye=e;switch(e){case"keypress":if(vl(r)===0)break e;case"keydown":case"keyup":V=Eb;break;case"focusin":ye="focus",V=Sc;break;case"focusout":ye="blur",V=Sc;break;case"beforeblur":case"afterblur":V=Sc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":V=Gh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=hb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=Ob;break;case dd:case md:case pd:V=pb;break;case yd:V=Nb;break;case"scroll":case"scrollend":V=ub;break;case"wheel":V=Cb;break;case"copy":case"cut":case"paste":V=gb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=Qh;break;case"toggle":case"beforetoggle":V=Rb}var _e=(n&4)!==0,Je=!_e&&(e==="scroll"||e==="scrollend"),D=_e?P!==null?P+"Capture":null:P;_e=[];for(var M=L,B;M!==null;){var X=M;if(B=X.stateNode,X=X.tag,X!==5&&X!==26&&X!==27||B===null||D===null||(X=Jr(M,D),X!=null&&_e.push(Ta(M,X,B))),Je)break;M=M.return}0<_e.length&&(P=new V(P,ye,null,r,I),te.push({event:P,listeners:_e}))}}if((n&7)===0){e:{if(P=e==="mouseover"||e==="pointerover",V=e==="mouseout"||e==="pointerout",P&&r!==yc&&(ye=r.relatedTarget||r.fromElement)&&(x(ye)||ye[Qt]))break e;if((V||P)&&(P=I.window===I?I:(P=I.ownerDocument)?P.defaultView||P.parentWindow:window,V?(ye=r.relatedTarget||r.toElement,V=L,ye=ye?x(ye):null,ye!==null&&(Je=u(ye),_e=ye.tag,ye!==Je||_e!==5&&_e!==27&&_e!==6)&&(ye=null)):(V=null,ye=L),V!==ye)){if(_e=Gh,X="onMouseLeave",D="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(_e=Qh,X="onPointerLeave",D="onPointerEnter",M="pointer"),Je=V==null?P:w(V),B=ye==null?P:w(ye),P=new _e(X,M+"leave",V,r,I),P.target=Je,P.relatedTarget=B,X=null,x(I)===L&&(_e=new _e(D,M+"enter",ye,r,I),_e.target=B,_e.relatedTarget=Je,X=_e),Je=X,V&&ye)t:{for(_e=Mx,D=V,M=ye,B=0,X=D;X;X=_e(X))B++;X=0;for(var ve=M;ve;ve=_e(ve))X++;for(;0<B-X;)D=_e(D),B--;for(;0<X-B;)M=_e(M),X--;for(;B--;){if(D===M||M!==null&&D===M.alternate){_e=D;break t}D=_e(D),M=_e(M)}_e=null}else _e=null;V!==null&&Lp(te,P,V,_e,!1),ye!==null&&Je!==null&&Lp(te,Je,ye,_e,!0)}}e:{if(P=L?w(L):window,V=P.nodeName&&P.nodeName.toLowerCase(),V==="select"||V==="input"&&P.type==="file")var He=nd;else if(ed(P))if(sd)He=Yb;else{He=Hb;var ge=Pb}else V=P.nodeName,!V||V.toLowerCase()!=="input"||P.type!=="checkbox"&&P.type!=="radio"?L&&pc(L.elementType)&&(He=nd):He=$b;if(He&&(He=He(e,L))){td(te,He,r,I);break e}ge&&ge(e,P,L),e==="focusout"&&L&&P.type==="number"&&L.memoizedProps.value!=null&&mc(P,"number",P.value)}switch(ge=L?w(L):window,e){case"focusin":(ed(ge)||ge.contentEditable==="true")&&(Ii=ge,Nc=L,sa=null);break;case"focusout":sa=Nc=Ii=null;break;case"mousedown":kc=!0;break;case"contextmenu":case"mouseup":case"dragend":kc=!1,fd(te,r,I);break;case"selectionchange":if(Fb)break;case"keydown":case"keyup":fd(te,r,I)}var Ce;if(jc)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Gi?Zh(e,r)&&(ze="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(ze="onCompositionStart");ze&&(Jh&&r.locale!=="ko"&&(Gi||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Gi&&(Ce=Vh()):(Os=I,vc="value"in Os?Os.value:Os.textContent,Gi=!0)),ge=ho(L,ze),0<ge.length&&(ze=new Ih(ze,e,null,r,I),te.push({event:ze,listeners:ge}),Ce?ze.data=Ce:(Ce=Wh(r),Ce!==null&&(ze.data=Ce)))),(Ce=qb?zb(e,r):Ub(e,r))&&(ze=ho(L,"onBeforeInput"),0<ze.length&&(ge=new Ih("onBeforeInput","beforeinput",null,r,I),te.push({event:ge,listeners:ze}),ge.data=Ce)),Tx(te,e,L,r,I)}Up(te,n)})}function Ta(e,n,r){return{instance:e,listener:n,currentTarget:r}}function ho(e,n){for(var r=n+"Capture",l=[];e!==null;){var c=e,f=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||f===null||(c=Jr(e,r),c!=null&&l.unshift(Ta(e,c,f)),c=Jr(e,n),c!=null&&l.push(Ta(e,c,f))),e.tag===3)return l;e=e.return}return[]}function Mx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Lp(e,n,r,l,c){for(var f=n._reactName,p=[];r!==null&&r!==l;){var b=r,O=b.alternate,L=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||L===null||(O=L,c?(L=Jr(r,f),L!=null&&p.unshift(Ta(r,L,O))):c||(L=Jr(r,f),L!=null&&p.push(Ta(r,L,O)))),r=r.return}p.length!==0&&e.push({event:n,listeners:p})}var Rx=/\r\n?/g,Dx=/\u0000|\uFFFD/g;function Pp(e){return(typeof e=="string"?e:""+e).replace(Rx,`
26
- `).replace(Dx,"")}function Hp(e,n){return n=Pp(n),Pp(e)===n}function Qe(e,n,r,l,c,f){switch(r){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Yi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Yi(e,""+l);break;case"className":On(e,"class",l);break;case"tabIndex":On(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":On(e,r,l);break;case"style":Hh(e,l,f);break;case"data":if(n!=="object"){On(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=bl(""+l),e.setAttribute(r,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(r,"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 f=="function"&&(r==="formAction"?(n!=="input"&&Qe(e,n,"name",c.name,c,null),Qe(e,n,"formEncType",c.formEncType,c,null),Qe(e,n,"formMethod",c.formMethod,c,null),Qe(e,n,"formTarget",c.formTarget,c,null)):(Qe(e,n,"encType",c.encType,c,null),Qe(e,n,"method",c.method,c,null),Qe(e,n,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=bl(""+l),e.setAttribute(r,l);break;case"onClick":l!=null&&(e.onclick=Wn);break;case"onScroll":l!=null&&De("scroll",e);break;case"onScrollEnd":l!=null&&De("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=r}}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}r=bl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);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(r,""+l):e.removeAttribute(r);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(r,""):e.removeAttribute(r);break;case"capture":case"download":l===!0?e.setAttribute(r,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(r,l):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(r,l):e.removeAttribute(r);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(r):e.setAttribute(r,l);break;case"popover":De("beforetoggle",e),De("toggle",e),qt(e,"popover",l);break;case"xlinkActuate":Zn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Zn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Zn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Zn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Zn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Zn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":qt(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=ob.get(r)||r,qt(e,r,l))}}function tf(e,n,r,l,c,f){switch(r){case"style":Hh(e,l,f);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"children":typeof l=="string"?Yi(e,l):(typeof l=="number"||typeof l=="bigint")&&Yi(e,""+l);break;case"onScroll":l!=null&&De("scroll",e);break;case"onScrollEnd":l!=null&&De("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Wn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ee.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(c=r.endsWith("Capture"),n=r.slice(2,c?r.length-7:void 0),f=e[at]||null,f=f!=null?f[r]:null,typeof f=="function"&&e.removeEventListener(n,f,c),typeof l=="function")){typeof f!="function"&&f!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,l,c);break e}r in e?e[r]=l:l===!0?e.setAttribute(r,""):qt(e,r,l)}}}function Rt(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var l=!1,c=!1,f;for(f in r)if(r.hasOwnProperty(f)){var p=r[f];if(p!=null)switch(f){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,n));default:Qe(e,n,f,p,r,null)}}c&&Qe(e,n,"srcSet",r.srcSet,r,null),l&&Qe(e,n,"src",r.src,r,null);return;case"input":De("invalid",e);var b=f=p=c=null,O=null,L=null;for(l in r)if(r.hasOwnProperty(l)){var I=r[l];if(I!=null)switch(l){case"name":c=I;break;case"type":p=I;break;case"checked":O=I;break;case"defaultChecked":L=I;break;case"value":f=I;break;case"defaultValue":b=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(a(137,n));break;default:Qe(e,n,l,I,r,null)}}Uh(e,f,b,O,L,p,c,!1);return;case"select":De("invalid",e),l=p=f=null;for(c in r)if(r.hasOwnProperty(c)&&(b=r[c],b!=null))switch(c){case"value":f=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Qe(e,n,c,b,r,null)}n=f,r=p,e.multiple=!!l,n!=null?$i(e,!!l,n,!1):r!=null&&$i(e,!!l,r,!0);return;case"textarea":De("invalid",e),f=c=l=null;for(p in r)if(r.hasOwnProperty(p)&&(b=r[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":f=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Qe(e,n,p,b,r,null)}Lh(e,l,c,f);return;case"option":for(O in r)if(r.hasOwnProperty(O)&&(l=r[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Qe(e,n,O,l,r,null)}return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(l=0;l<Oa.length;l++)De(Oa[l],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("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(L in r)if(r.hasOwnProperty(L)&&(l=r[L],l!=null))switch(L){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,n));default:Qe(e,n,L,l,r,null)}return;default:if(pc(n)){for(I in r)r.hasOwnProperty(I)&&(l=r[I],l!==void 0&&tf(e,n,I,l,r,void 0));return}}for(b in r)r.hasOwnProperty(b)&&(l=r[b],l!=null&&Qe(e,n,b,l,r,null))}function qx(e,n,r,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,f=null,p=null,b=null,O=null,L=null,I=null;for(V in r){var te=r[V];if(r.hasOwnProperty(V)&&te!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":O=te;default:l.hasOwnProperty(V)||Qe(e,n,V,null,l,te)}}for(var P in l){var V=l[P];if(te=r[P],l.hasOwnProperty(P)&&(V!=null||te!=null))switch(P){case"type":f=V;break;case"name":c=V;break;case"checked":L=V;break;case"defaultChecked":I=V;break;case"value":p=V;break;case"defaultValue":b=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(a(137,n));break;default:V!==te&&Qe(e,n,P,V,l,te)}}dc(e,p,b,O,L,I,f,c);return;case"select":V=p=b=P=null;for(f in r)if(O=r[f],r.hasOwnProperty(f)&&O!=null)switch(f){case"value":break;case"multiple":V=O;default:l.hasOwnProperty(f)||Qe(e,n,f,null,l,O)}for(c in l)if(f=l[c],O=r[c],l.hasOwnProperty(c)&&(f!=null||O!=null))switch(c){case"value":P=f;break;case"defaultValue":b=f;break;case"multiple":p=f;default:f!==O&&Qe(e,n,c,f,l,O)}n=b,r=p,l=V,P!=null?$i(e,!!r,P,!1):!!l!=!!r&&(n!=null?$i(e,!!r,n,!0):$i(e,!!r,r?[]:"",!1));return;case"textarea":V=P=null;for(b in r)if(c=r[b],r.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Qe(e,n,b,null,l,c)}for(p in l)if(c=l[p],f=r[p],l.hasOwnProperty(p)&&(c!=null||f!=null))switch(p){case"value":P=c;break;case"defaultValue":V=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==f&&Qe(e,n,p,c,l,f)}Bh(e,P,V);return;case"option":for(var ye in r)if(P=r[ye],r.hasOwnProperty(ye)&&P!=null&&!l.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:Qe(e,n,ye,null,l,P)}for(O in l)if(P=l[O],V=r[O],l.hasOwnProperty(O)&&P!==V&&(P!=null||V!=null))switch(O){case"selected":e.selected=P&&typeof P!="function"&&typeof P!="symbol";break;default:Qe(e,n,O,P,l,V)}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 _e in r)P=r[_e],r.hasOwnProperty(_e)&&P!=null&&!l.hasOwnProperty(_e)&&Qe(e,n,_e,null,l,P);for(L in l)if(P=l[L],V=r[L],l.hasOwnProperty(L)&&P!==V&&(P!=null||V!=null))switch(L){case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,n));break;default:Qe(e,n,L,P,l,V)}return;default:if(pc(n)){for(var Je in r)P=r[Je],r.hasOwnProperty(Je)&&P!==void 0&&!l.hasOwnProperty(Je)&&tf(e,n,Je,void 0,l,P);for(I in l)P=l[I],V=r[I],!l.hasOwnProperty(I)||P===V||P===void 0&&V===void 0||tf(e,n,I,P,l,V);return}}for(var D in r)P=r[D],r.hasOwnProperty(D)&&P!=null&&!l.hasOwnProperty(D)&&Qe(e,n,D,null,l,P);for(te in l)P=l[te],V=r[te],!l.hasOwnProperty(te)||P===V||P==null&&V==null||Qe(e,n,te,P,l,V)}function $p(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var c=r[l],f=c.transferSize,p=c.initiatorType,b=c.duration;if(f&&b&&$p(p)){for(p=0,b=c.responseEnd,l+=1;l<r.length;l++){var O=r[l],L=O.startTime;if(L>b)break;var I=O.transferSize,te=O.initiatorType;I&&$p(te)&&(O=O.responseEnd,p+=I*(O<b?1:(b-L)/(O-L)))}if(--l,n+=8*(f+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var nf=null,sf=null;function mo(e){return e.nodeType===9?e:e.ownerDocument}function Yp(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 Vp(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function rf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var af=null;function Ux(){var e=window.event;return e&&e.type==="popstate"?e===af?!1:(af=e,!0):(af=null,!1)}var Fp=typeof setTimeout=="function"?setTimeout:void 0,Bx=typeof clearTimeout=="function"?clearTimeout:void 0,Gp=typeof Promise=="function"?Promise:void 0,Lx=typeof queueMicrotask=="function"?queueMicrotask:typeof Gp<"u"?function(e){return Gp.resolve(null).then(e).catch(Px)}:Fp;function Px(e){setTimeout(function(){throw e})}function Vs(e){return e==="head"}function Ip(e,n){var r=n,l=0;do{var c=r.nextSibling;if(e.removeChild(r),c&&c.nodeType===8)if(r=c.data,r==="/$"||r==="/&"){if(l===0){e.removeChild(c),vr(n);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Na(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Na(r);for(var f=r.firstChild;f;){var p=f.nextSibling,b=f.nodeName;f[St]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||r.removeChild(f),f=p}}else r==="body"&&Na(e.ownerDocument.body);r=c}while(r);vr(n)}function Qp(e,n){var r=e;e=0;do{var l=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),l&&l.nodeType===8)if(r=l.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=l}while(r)}function lf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":lf(r),Hi(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function Hx(e,n,r,l){for(;e.nodeType===1;){var c=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[St])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==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(f=e.getAttribute("src"),(f!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var f=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=vn(e.nextSibling),e===null)break}return null}function $x(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=vn(e.nextSibling),e===null))return null;return e}function Jp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=vn(e.nextSibling),e===null))return null;return e}function of(e){return e.data==="$?"||e.data==="$~"}function cf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Yx(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var l=function(){n(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function vn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var uf=null;function Kp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return vn(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function Xp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function Zp(e,n,r){switch(n=mo(r),e){case"html":if(e=n.documentElement,!e)throw Error(a(452));return e;case"head":if(e=n.head,!e)throw Error(a(453));return e;case"body":if(e=n.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function Na(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Hi(e)}var _n=new Map,Wp=new Set;function po(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ps=ae.d;ae.d={f:Vx,r:Fx,D:Gx,C:Ix,L:Qx,m:Jx,X:Xx,S:Kx,M:Zx};function Vx(){var e=ps.f(),n=ro();return e||n}function Fx(e){var n=S(e);n!==null&&n.tag===5&&n.type==="form"?ym(n):ps.r(e)}var gr=typeof document>"u"?null:document;function e0(e,n,r){var l=gr;if(l&&typeof n=="string"&&n){var c=dn(n);c='link[rel="'+e+'"][href="'+c+'"]',typeof r=="string"&&(c+='[crossorigin="'+r+'"]'),Wp.has(c)||(Wp.add(c),e={rel:e,crossOrigin:r,href:n},l.querySelector(c)===null&&(n=l.createElement("link"),Rt(n,"link",e),k(n),l.head.appendChild(n)))}}function Gx(e){ps.D(e),e0("dns-prefetch",e,null)}function Ix(e,n){ps.C(e,n),e0("preconnect",e,n)}function Qx(e,n,r){ps.L(e,n,r);var l=gr;if(l&&e&&n){var c='link[rel="preload"][as="'+dn(n)+'"]';n==="image"&&r&&r.imageSrcSet?(c+='[imagesrcset="'+dn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(c+='[imagesizes="'+dn(r.imageSizes)+'"]')):c+='[href="'+dn(e)+'"]';var f=c;switch(n){case"style":f=br(e);break;case"script":f=xr(e)}_n.has(f)||(e=_({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),_n.set(f,e),l.querySelector(c)!==null||n==="style"&&l.querySelector(ka(f))||n==="script"&&l.querySelector(Ca(f))||(n=l.createElement("link"),Rt(n,"link",e),k(n),l.head.appendChild(n)))}}function Jx(e,n){ps.m(e,n);var r=gr;if(r&&e){var l=n&&typeof n.as=="string"?n.as:"script",c='link[rel="modulepreload"][as="'+dn(l)+'"][href="'+dn(e)+'"]',f=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=xr(e)}if(!_n.has(f)&&(e=_({rel:"modulepreload",href:e},n),_n.set(f,e),r.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ca(f)))return}l=r.createElement("link"),Rt(l,"link",e),k(l),r.head.appendChild(l)}}}function Kx(e,n,r){ps.S(e,n,r);var l=gr;if(l&&e){var c=j(l).hoistableStyles,f=br(e);n=n||"default";var p=c.get(f);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ka(f)))b.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":n},r),(r=_n.get(f))&&ff(e,r);var O=p=l.createElement("link");k(O),Rt(O,"link",e),O._p=new Promise(function(L,I){O.onload=L,O.onerror=I}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,yo(p,n,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(f,p)}}}function Xx(e,n){ps.X(e,n);var r=gr;if(r&&e){var l=j(r).hoistableScripts,c=xr(e),f=l.get(c);f||(f=r.querySelector(Ca(c)),f||(e=_({src:e,async:!0},n),(n=_n.get(c))&&hf(e,n),f=r.createElement("script"),k(f),Rt(f,"link",e),r.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},l.set(c,f))}}function Zx(e,n){ps.M(e,n);var r=gr;if(r&&e){var l=j(r).hoistableScripts,c=xr(e),f=l.get(c);f||(f=r.querySelector(Ca(c)),f||(e=_({src:e,async:!0,type:"module"},n),(n=_n.get(c))&&hf(e,n),f=r.createElement("script"),k(f),Rt(f,"link",e),r.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},l.set(c,f))}}function t0(e,n,r,l){var c=(c=jt.current)?po(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=br(r.href),r=j(c).hoistableStyles,l=r.get(n),l||(l={type:"style",instance:null,count:0,state:null},r.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=br(r.href);var f=j(c).hoistableStyles,p=f.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,p),(f=c.querySelector(ka(e)))&&!f._p&&(p.instance=f,p.state.loading=5),_n.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},_n.set(e,r),f||Wx(c,e,r,p.state))),n&&l===null)throw Error(a(528,""));return p}if(n&&l!==null)throw Error(a(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=xr(r),r=j(c).hoistableScripts,l=r.get(n),l||(l={type:"script",instance:null,count:0,state:null},r.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function br(e){return'href="'+dn(e)+'"'}function ka(e){return'link[rel="stylesheet"]['+e+"]"}function n0(e){return _({},e,{"data-precedence":e.precedence,precedence:null})}function Wx(e,n,r,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),Rt(n,"link",r),k(n),e.head.appendChild(n))}function xr(e){return'[src="'+dn(e)+'"]'}function Ca(e){return"script[async]"+e}function s0(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+dn(r.href)+'"]');if(l)return n.instance=l,k(l),l;var c=_({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),k(l),Rt(l,"style",c),yo(l,r.precedence,e),n.instance=l;case"stylesheet":c=br(r.href);var f=e.querySelector(ka(c));if(f)return n.state.loading|=4,n.instance=f,k(f),f;l=n0(r),(c=_n.get(c))&&ff(l,c),f=(e.ownerDocument||e).createElement("link"),k(f);var p=f;return p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),Rt(f,"link",l),n.state.loading|=4,yo(f,r.precedence,e),n.instance=f;case"script":return f=xr(r.src),(c=e.querySelector(Ca(f)))?(n.instance=c,k(c),c):(l=r,(c=_n.get(f))&&(l=_({},r),hf(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),k(c),Rt(c,"link",l),e.head.appendChild(c),n.instance=c);case"void":return null;default:throw Error(a(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,yo(l,r.precedence,e));return n.instance}function yo(e,n,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,f=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===n)f=b;else if(f!==c)break}f?f.parentNode.insertBefore(e,f.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function ff(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function hf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var go=null;function i0(e,n,r){if(go===null){var l=new Map,c=go=new Map;c.set(r,l)}else c=go,l=c.get(r),l||(l=new Map,c.set(r,l));if(l.has(e))return l;for(l.set(e,null),r=r.getElementsByTagName(e),c=0;c<r.length;c++){var f=r[c];if(!(f[St]||f[Ke]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var p=f.getAttribute(n)||"";p=e+p;var b=l.get(p);b?b.push(f):l.set(p,[f])}}return l}function r0(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function ev(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function a0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function tv(e,n,r,l){if(r.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var c=br(l.href),f=n.querySelector(ka(c));if(f){n=f._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=bo.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=f,k(f);return}f=n.ownerDocument||n,l=n0(l),(c=_n.get(c))&&ff(l,c),f=f.createElement("link"),k(f);var p=f;p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),Rt(f,"link",l),r.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=bo.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var df=0;function nv(e,n){return e.stylesheets&&e.count===0&&vo(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var l=setTimeout(function(){if(e.stylesheets&&vo(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+n);0<e.imgBytes&&df===0&&(df=62500*zx());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&vo(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>df?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function bo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var xo=null;function vo(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,xo=new Map,n.forEach(sv,e),xo=null,bo.call(e))}function sv(e,n){if(!(n.state.loading&4)){var r=xo.get(e);if(r)var l=r.get(null);else{r=new Map,xo.set(e,r);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<c.length;f++){var p=c[f];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(r.set(p.dataset.precedence,p),l=p)}l&&r.set(null,l)}c=n.instance,p=c.getAttribute("data-precedence"),f=r.get(p)||l,f===l&&r.set(null,c),r.set(p,c),this.count++,l=bo.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),f?f.parentNode.insertBefore(c,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),n.state.loading|=4}}var Ma={$$typeof:le,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function iv(e,n,r,l,c,f,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=Ss(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ss(0),this.hiddenUpdates=Ss(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=f,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function l0(e,n,r,l,c,f,p,b,O,L,I,te){return e=new iv(e,n,r,p,O,L,I,te,b),n=1,f===!0&&(n|=24),f=Kt(3,null,null,n),e.current=f,f.stateNode=e,n=Fc(),n.refCount++,e.pooledCache=n,n.refCount++,f.memoizedState={element:l,isDehydrated:r,cache:n},Jc(f),e}function o0(e){return e?(e=Ki,e):Ki}function c0(e,n,r,l,c,f){c=o0(c),l.context===null?l.context=c:l.pendingContext=c,l=Rs(n),l.payload={element:r},f=f===void 0?null:f,f!==null&&(l.callback=f),r=Ds(e,l,n),r!==null&&(Ft(r,e,n),ua(r,e,n))}function u0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function mf(e,n){u0(e,n),(e=e.alternate)&&u0(e,n)}function f0(e){if(e.tag===13||e.tag===31){var n=gi(e,67108864);n!==null&&Ft(n,e,67108864),mf(e,67108864)}}function h0(e){if(e.tag===13||e.tag===31){var n=tn();n=Xn(n);var r=gi(e,n);r!==null&&Ft(r,e,n),mf(e,n)}}var _o=!0;function rv(e,n,r,l){var c=Y.T;Y.T=null;var f=ae.p;try{ae.p=2,pf(e,n,r,l)}finally{ae.p=f,Y.T=c}}function av(e,n,r,l){var c=Y.T;Y.T=null;var f=ae.p;try{ae.p=8,pf(e,n,r,l)}finally{ae.p=f,Y.T=c}}function pf(e,n,r,l){if(_o){var c=yf(l);if(c===null)ef(e,n,l,wo,r),m0(e,l);else if(ov(c,e,n,r,l))l.stopPropagation();else if(m0(e,l),n&4&&-1<lv.indexOf(e)){for(;c!==null;){var f=S(c);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var p=jn(f.pendingLanes);if(p!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var O=1<<31-Dt(p);b.entanglements[1]|=O,p&=~O}$n(f),(Ye&6)===0&&(so=tt()+500,Aa(0))}}break;case 31:case 13:b=gi(f,2),b!==null&&Ft(b,f,2),ro(),mf(f,2)}if(f=yf(l),f===null&&ef(e,n,l,wo,r),f===c)break;c=f}c!==null&&l.stopPropagation()}else ef(e,n,l,null,r)}}function yf(e){return e=gc(e),gf(e)}var wo=null;function gf(e){if(wo=null,e=x(e),e!==null){var n=u(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=d(n),e!==null)return e;e=null}else if(r===31){if(e=m(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return wo=e,null}function d0(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(cc()){case ul:return 2;case fl:return 8;case Bi:case uc:return 32;case hl:return 268435456;default:return 32}default:return 32}}var bf=!1,Fs=null,Gs=null,Is=null,Ra=new Map,Da=new Map,Qs=[],lv="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 m0(e,n){switch(e){case"focusin":case"focusout":Fs=null;break;case"dragenter":case"dragleave":Gs=null;break;case"mouseover":case"mouseout":Is=null;break;case"pointerover":case"pointerout":Ra.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Da.delete(n.pointerId)}}function qa(e,n,r,l,c,f){return e===null||e.nativeEvent!==f?(e={blockedOn:n,domEventName:r,eventSystemFlags:l,nativeEvent:f,targetContainers:[c]},n!==null&&(n=S(n),n!==null&&f0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,c!==null&&n.indexOf(c)===-1&&n.push(c),e)}function ov(e,n,r,l,c){switch(n){case"focusin":return Fs=qa(Fs,e,n,r,l,c),!0;case"dragenter":return Gs=qa(Gs,e,n,r,l,c),!0;case"mouseover":return Is=qa(Is,e,n,r,l,c),!0;case"pointerover":var f=c.pointerId;return Ra.set(f,qa(Ra.get(f)||null,e,n,r,l,c)),!0;case"gotpointercapture":return f=c.pointerId,Da.set(f,qa(Da.get(f)||null,e,n,r,l,c)),!0}return!1}function p0(e){var n=x(e.target);if(n!==null){var r=u(n);if(r!==null){if(n=r.tag,n===13){if(n=d(r),n!==null){e.blockedOn=n,ml(e.priority,function(){h0(r)});return}}else if(n===31){if(n=m(r),n!==null){e.blockedOn=n,ml(e.priority,function(){h0(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function So(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=yf(e.nativeEvent);if(r===null){r=e.nativeEvent;var l=new r.constructor(r.type,r);yc=l,r.target.dispatchEvent(l),yc=null}else return n=S(r),n!==null&&f0(n),e.blockedOn=r,!1;n.shift()}return!0}function y0(e,n,r){So(e)&&r.delete(n)}function cv(){bf=!1,Fs!==null&&So(Fs)&&(Fs=null),Gs!==null&&So(Gs)&&(Gs=null),Is!==null&&So(Is)&&(Is=null),Ra.forEach(y0),Da.forEach(y0)}function Eo(e,n){e.blockedOn===n&&(e.blockedOn=null,bf||(bf=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,cv)))}var jo=null;function g0(e){jo!==e&&(jo=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){jo===e&&(jo=null);for(var n=0;n<e.length;n+=3){var r=e[n],l=e[n+1],c=e[n+2];if(typeof l!="function"){if(gf(l||r)===null)continue;break}var f=S(r);f!==null&&(e.splice(n,3),n-=3,pu(f,{pending:!0,data:c,method:r.method,action:l},l,c))}}))}function vr(e){function n(O){return Eo(O,e)}Fs!==null&&Eo(Fs,e),Gs!==null&&Eo(Gs,e),Is!==null&&Eo(Is,e),Ra.forEach(n),Da.forEach(n);for(var r=0;r<Qs.length;r++){var l=Qs[r];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Qs.length&&(r=Qs[0],r.blockedOn===null);)p0(r),r.blockedOn===null&&Qs.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var c=r[l],f=r[l+1],p=c[at]||null;if(typeof f=="function")p||g0(r);else if(p){var b=null;if(f&&f.hasAttribute("formAction")){if(c=f,p=f[at]||null)b=p.formAction;else if(gf(c)!==null)continue}else b=p.action;typeof b=="function"?r[l+1]=b:(r.splice(l,3),l-=3),g0(r)}}}function b0(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function n(){c!==null&&(c(),c=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),c!==null&&(c(),c=null)}}}function xf(e){this._internalRoot=e}Ao.prototype.render=xf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(a(409));var r=n.current,l=tn();c0(r,l,e,n,null,null)},Ao.prototype.unmount=xf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;c0(e.current,2,null,e,null,null),ro(),n[Qt]=null}};function Ao(e){this._internalRoot=e}Ao.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ir();e={blockedOn:null,target:e,priority:n};for(var r=0;r<Qs.length&&n!==0&&n<Qs[r].priority;r++);Qs.splice(r,0,e),r===0&&p0(e)}};var x0=t.version;if(x0!=="19.2.4")throw Error(a(527,x0,"19.2.4"));ae.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=g(n),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var uv={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oo.isDisabled&&Oo.supportsFiber)try{oi=Oo.inject(uv),ut=Oo}catch{}}return za.createRoot=function(e,n){if(!o(e))throw Error(a(299));var r=!1,l="",c=Am,f=Om,p=Tm;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(c=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(p=n.onRecoverableError)),n=l0(e,1,!1,null,null,r,l,null,c,f,p,b0),e[Qt]=n.current,Wu(e),new xf(n)},za.hydrateRoot=function(e,n,r){if(!o(e))throw Error(a(299));var l=!1,c="",f=Am,p=Om,b=Tm,O=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(p=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError),r.formState!==void 0&&(O=r.formState)),n=l0(e,1,!0,n,r??null,l,c,O,f,p,b,b0),n.context=o0(null),r=n.current,l=tn(),l=Xn(l),c=Rs(l),c.callback=null,Ds(r,c,l),r=l,n.current.lanes=r,An(n,r),$n(n),e[Qt]=n.current,Wu(e),new Ao(n)},za.version="19.2.4",za}var N0;function Xv(){if(N0)return vf.exports;N0=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),vf.exports=Kv(),vf.exports}var Zv=Xv();const Wv="modulepreload",e1=function(i,t){return new URL(i,t).href},k0={},Ee=function(t,s,a){let o=Promise.resolve();if(s&&s.length>0){let d=function(E){return Promise.all(E.map(_=>Promise.resolve(_).then(T=>({status:"fulfilled",value:T}),T=>({status:"rejected",reason:T}))))};const m=document.getElementsByTagName("link"),y=document.querySelector("meta[property=csp-nonce]"),g=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));o=d(s.map(E=>{if(E=e1(E,a),E in k0)return;k0[E]=!0;const _=E.endsWith(".css"),T=_?'[rel="stylesheet"]':"";if(!!a)for(let R=m.length-1;R>=0;R--){const Q=m[R];if(Q.href===E&&(!_||Q.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${T}`))return;const C=document.createElement("link");if(C.rel=_?"stylesheet":Wv,_||(C.as="script"),C.crossOrigin="",C.href=E,g&&C.setAttribute("nonce",g),document.head.appendChild(C),_)return new Promise((R,Q)=>{C.addEventListener("load",R),C.addEventListener("error",()=>Q(new Error(`Unable to preload CSS for ${E}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return o.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return t().catch(u)})};function ch(i){try{const t=i.split(".");if(t.length!==3)return null;const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function Yy(i){const t=ch(i);return!t||typeof t.exp!="number"?null:t.exp}function uh(i,t=0){const s=Yy(i);return s===null?!0:Date.now()/1e3>=s-t}const Gt=window.__LT_BASE__??"",Uf=`${Gt}/api`;let Zs=null;function To(i){Zs=i}function Vy(){return Zs}async function C0(){const i=sessionStorage.getItem("lt_credentials");if(!i)return null;try{const{username:t,password:s}=JSON.parse(i),a=await fetch(`${Uf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,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 Ks=null;async function Ae(i,t={}){const s={"Content-Type":"application/json",...t.headers};if(Zs){if(uh(Zs)){Ks||(Ks=C0().finally(()=>{Ks=null}));const o=await Ks;if(o)Zs=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 ${Zs}`}let a=await fetch(`${Uf}${i}`,{...t,headers:s});if(a.status===401&&Zs){Ks||(Ks=C0().finally(()=>{Ks=null}));const o=await Ks;if(o&&(Zs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${Uf}${i}`,{...t,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 Fy=A.createContext(null),t1=300;function Sf(i,t){if(uh(i))return null;const s=ch(i);if(!s)return null;const a=t??(()=>{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 n1({children:i}){const[t,s]=A.useState(()=>{const _=sessionStorage.getItem("lt_token");return _?uh(_)?(sessionStorage.removeItem("lt_token"),null):(To(_),Sf(_)):null}),a=A.useRef(void 0),o=A.useCallback(_=>{clearTimeout(a.current);const T=Yy(_);if(!T)return;const q=(T-t1)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{try{const C=ch(_);if(C!=null&&C.sso){const re=await fetch(`${Gt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const N=await re.json();N.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:N.token}}));return}const R=sessionStorage.getItem("lt_credentials");if(!R)return;const{username:Q,password:se}=JSON.parse(R),U=await fetch(`${Gt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:Q,password:se})});if(!U.ok)return;const le=await U.json();le.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:le.token}}))}catch{}},q))},[]),u=A.useCallback((_,T,q)=>{const C={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(T==null?void 0:T.username)??null},R=Sf(_,C);R&&(To(_),sessionStorage.setItem("lt_token",_),sessionStorage.setItem("lt_user_info",JSON.stringify(C)),T&&sessionStorage.setItem("lt_credentials",JSON.stringify(T)),s(R),o(_))},[o]),d=A.useCallback(()=>{clearTimeout(a.current);const _=sessionStorage.getItem("lt_sso_logout_url");To(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),_&&(window.location.href=_)},[]);A.useEffect(()=>{const _=()=>d(),T=q=>{var Q;const C=(Q=q.detail)==null?void 0:Q.token;if(!C)return;const R=Sf(C);R&&(To(C),sessionStorage.setItem("lt_token",C),s(R),o(C))};return window.addEventListener("auth:unauthorized",_),window.addEventListener("auth:refreshed",T),()=>{window.removeEventListener("auth:unauthorized",_),window.removeEventListener("auth:refreshed",T)}},[d,o]),A.useEffect(()=>{const _=sessionStorage.getItem("lt_token");return _&&t&&o(_),()=>clearTimeout(a.current)},[]);const m=(t==null?void 0:t.roles.some(_=>_.type==="superadmin"))??!1,y=A.useCallback(_=>(t==null?void 0:t.roles.some(T=>T.role===_))??!1,[t]),g=A.useCallback(_=>(t==null?void 0:t.roles.some(T=>T.type===_))??!1,[t]),E=(t==null?void 0:t.roles.map(_=>_.role))??[];return h.jsx(Fy.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:m,login:u,logout:d,hasRole:y,hasRoleType:g,userRoleNames:E},children:i})}function zn(){const i=A.useContext(Fy);if(!i)throw new Error("useAuth must be used within AuthProvider");return i}const on=new Uint8Array(0),qi=new TextEncoder,an=new TextDecoder;function s1(...i){let t=0;for(let o=0;o<i.length;o++)t+=i[o].length;const s=new Uint8Array(t);let a=0;for(let o=0;o<i.length;o++)s.set(i[o],a),a+=i[o].length;return s}function Ia(...i){const t=[];for(let s=0;s<i.length;s++)t.push(qi.encode(i[s]));return t.length===0?on:t.length===1?t[0]:s1(...t)}function M0(i){return!i||i.length===0?"":an.decode(i)}const R0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",D0=36,i1=0xcfd41b9100000,q0=33,r1=333,z0=22;function a1(i){for(let t=0;t<i.length;t++)i[t]=Math.floor(Math.random()*255)}function l1(i){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(i):a1(i)}class o1{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(z0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*i1),this.inc=Math.floor(Math.random()*(r1-q0)+q0)}setPre(){const t=new Uint8Array(12);l1(t);for(let s=0;s<12;s++){const a=t[s]%36;this.buf[s]=R0.charCodeAt(a)}}fillSeq(){let t=this.seq;for(let s=z0-1;s>=12;s--)this.buf[s]=R0.charCodeAt(t%D0),t=Math.floor(t/D0)}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 ii=new o1;var ys;(function(i){i.Disconnect="disconnect",i.Reconnect="reconnect",i.Update="update",i.LDM="ldm",i.Error="error"})(ys||(ys={}));var kr;(function(i){i.Reconnecting="reconnecting",i.PingTimer="pingTimer",i.StaleConnection="staleConnection",i.ClientInitiatedReconnect="client initiated reconnect"})(kr||(kr={}));var oe;(function(i){i.ApiError="BAD API",i.BadAuthentication="BAD_AUTHENTICATION",i.BadCreds="BAD_CREDS",i.BadHeader="BAD_HEADER",i.BadJson="BAD_JSON",i.BadPayload="BAD_PAYLOAD",i.BadSubject="BAD_SUBJECT",i.Cancelled="CANCELLED",i.ConnectionClosed="CONNECTION_CLOSED",i.ConnectionDraining="CONNECTION_DRAINING",i.ConnectionRefused="CONNECTION_REFUSED",i.ConnectionTimeout="CONNECTION_TIMEOUT",i.Disconnect="DISCONNECT",i.InvalidOption="INVALID_OPTION",i.InvalidPayload="INVALID_PAYLOAD",i.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",i.NoResponders="503",i.NotFunction="NOT_FUNC",i.RequestError="REQUEST_ERROR",i.ServerOptionNotAvailable="SERVER_OPT_NA",i.SubClosed="SUB_CLOSED",i.SubDraining="SUB_DRAINING",i.Timeout="TIMEOUT",i.Tls="TLS",i.Unknown="UNKNOWN_ERROR",i.WssRequired="WSS_REQUIRED",i.JetStreamInvalidAck="JESTREAM_INVALID_ACK",i.JetStream404NoMessages="404",i.JetStream408RequestTimeout="408",i.JetStream409MaxAckPendingExceeded="409",i.JetStream409="409",i.JetStreamNotEnabled="503",i.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",i.AuthorizationViolation="AUTHORIZATION_VIOLATION",i.AuthenticationExpired="AUTHENTICATION_EXPIRED",i.ProtocolError="NATS_PROTOCOL_ERR",i.PermissionsViolation="PERMISSIONS_VIOLATION",i.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",i.AccountExpired="ACCOUNT_EXPIRED"})(oe||(oe={}));function c1(i){return typeof i.code=="string"}class Gy{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(oe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(oe.BadJson,"Bad JSON"),this.messages.set(oe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return u1.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const u1=new Gy;class me 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=Gy.getMessage(s);return new me(o,s,a)}isAuthError(){return this.code===oe.AuthenticationExpired||this.code===oe.AuthorizationViolation||this.code===oe.AccountExpired}isAuthTimeout(){return this.code===oe.AuthenticationTimeout}isPermissionError(){return this.code===oe.PermissionsViolation}isProtocolError(){return this.code===oe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var sn;(function(i){i[i.Exact=0]="Exact",i[i.CanonicalMIME=1]="CanonicalMIME",i[i.IgnoreCase=2]="IgnoreCase"})(sn||(sn={}));var Dn;(function(i){i.Timer="timer",i.Count="count",i.JitterTimer="jitterTimer",i.SentinelMsg="sentinelMsg"})(Dn||(Dn={}));var Qa;(function(i){i.STATS="io.nats.micro.v1.stats_response",i.INFO="io.nats.micro.v1.info_response",i.PING="io.nats.micro.v1.ping_response"})(Qa||(Qa={}));const Go="Nats-Service-Error",Io="Nats-Service-Error-Code";class Qo extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Qo.toServiceError(s)!==null}static toServiceError(s){var o,u;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Io))||"";if(a!==""){const d=parseInt(a)||400,m=((u=s==null?void 0:s.headers)==null?void 0:u.get(Go))||"";return new Qo(d,m.length?m:a)}return null}}function gs(i=""){if(i=i||"_INBOX",typeof i!="string")throw new Error("prefix must be a string");return i.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${i}'`)}),`${i}.${ii.next()}`}const Bf="127.0.0.1";var Ws;(function(i){i.PING="PING",i.STATS="STATS",i.INFO="INFO"})(Ws||(Ws={}));function sc(i,...t){for(let s=0;s<t.length;s++){const a=t[s];Object.keys(a).forEach(function(o){i[o]=a[o]})}return i}function No(i){return an.decode(i).replace(/\n/g,"␊").replace(/\r/g,"␍")}function zr(i,t=!0){const s=t?me.errorForCode(oe.Timeout):null;let a,o;const u=new Promise((d,m)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{m(s===null?me.errorForCode(oe.Timeout):s)},i)});return Object.assign(u,a)}function Lr(i=0){let t;const s=new Promise(a=>{const o=setTimeout(()=>{a()},i);t={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,t)}function it(){let i={};const t=new Promise((s,a)=>{i={resolve:s,reject:a}});return Object.assign(t,i)}function Iy(i){for(let t=i.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[i[t],i[s]]=[i[s],i[t]]}return i}function f1(i){return i===0?0:Math.floor(i/2+Math.random()*i)}function fh(i=[0,250,250,500,500,3e3,5e3]){Array.isArray(i)||(i=[0,250,250,500,500,3e3,5e3]);const t=i.length-1;return{backoff(s){return f1(s>t?i[t]:i[s])}}}function st(i){return i*1e6}function hh(i){return Math.floor(i/1e6)}function U0(i){let a=!0;const o=new Array(i.length);for(let u=0;u<i.length;u++){let d=i.charCodeAt(u);if(d===58||d<33||d>126)throw new me(`'${i[u]}' is not a valid character for a header key`,oe.BadHeader);a&&97<=d&&d<=122?d-=32:!a&&65<=d&&d<=90&&(d+=32),o[u]=d,a=d==45}return String.fromCharCode(...o)}function bs(i=0,t=""){if(i===0&&t!==""||i>0&&t==="")throw new Error("setting status requires both code and description");return new ei(i,t)}const Ef="NATS/1.0";class ei{constructor(t=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=t,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[s,a]of this.headers){const o=t.values(s);if(a.length!==o.length)return!1;const u=[...a].sort(),d=[...o].sort();for(let m=0;m<u.length;m++)if(u[m]!==d[m])return!1}return!0}return!1}static decode(t){const s=new ei,o=an.decode(t).split(`\r
27
- `),u=o[0];if(u!==Ef){let d=u.replace(Ef,"").trim();if(d.length>0){s._code=parseInt(d,10),isNaN(s._code)&&(s._code=0);const m=s._code.toString();d=d.replace(m,""),s._description=d.trim()}}return o.length>=1&&o.slice(1).map(d=>{if(d){const m=d.indexOf(":");if(m>-1){const y=d.slice(0,m),g=d.slice(m+1).trim();s.append(y,g)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Ef;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)t=`${t}\r
28
- ${s}: ${a[o]}`;return`${t}\r
29
- \r
30
- `}encode(){return qi.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new me("invalid header value - \\r and \\n are not allowed.",oe.BadHeader);return t.trim()}keys(){const t=[];for(const s of this.headers.keys())t.push(s);return t}findKeys(t,s=sn.Exact){const a=this.keys();switch(s){case sn.Exact:return a.filter(o=>o===t);case sn.CanonicalMIME:return t=U0(t),a.filter(o=>o===t);default:{const o=t.toLowerCase();return a.filter(u=>o===u.toLowerCase())}}}get(t,s=sn.Exact){const a=this.findKeys(t,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(t,s=sn.Exact){const a=this.findKeys(t,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(t,s=sn.Exact){return this.findKeys(t,s).length>0}set(t,s,a=sn.Exact){this.delete(t,a),this.append(t,s,a)}append(t,s,a=sn.Exact){const o=U0(t);a===sn.CanonicalMIME&&(t=o);const u=this.findKeys(t,a);t=u.length>0?u[0]:t;const d=ei.validHeaderValue(s);let m=this.headers.get(t);m||(m=[],this.headers.set(t,m)),m.push(d)}values(t,s=sn.Exact){const a=[];return this.findKeys(t,s).forEach(u=>{const d=this.headers.get(u);d&&a.push(...d)}),a}delete(t,s=sn.Exact){this.findKeys(t,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(s=>{t[s]=this.values(s)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const s=new ei;for(const a in t)s.headers.set(a,t[a]);return s}}function Lf(){return{encode(i){return qi.encode(i)},decode(i){return an.decode(i)}}}function qn(i){return{encode(t){try{return t===void 0&&(t=null),qi.encode(JSON.stringify(t))}catch(s){throw me.errorForCode(oe.BadJson,s)}},decode(t){try{return JSON.parse(an.decode(t),i)}catch(s){throw me.errorForCode(oe.BadJson,s)}}}}function Qy(i){var t;return i&&i.data.length===0&&((t=i.headers)==null?void 0:t.code)===503?me.errorForCode(oe.NoResponders):null}class dh{constructor(t,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=t,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=an.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=an.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=ei.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=on,s){return this.reply?(this.publisher.publish(this.reply,t,s),!0):!1}size(){var o;const t=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 t+s+a}json(t){return qn(t).decode(this.data)}string(){return an.decode(this.data)}requestInfo(){var s;const t=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return t?JSON.parse(t,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(dh,"jc");function Cr(i){return ic("durable",i)}function Ut(i){return ic("stream",i)}function ic(i,t=""){if(t==="")throw Error(`${i} name required`);return[".","*",">","/","\\"," "," ",`
31
- `,"\r"].forEach(a=>{if(t.indexOf(a)!==-1){switch(a){case`
32
- `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${i} name - ${i} name cannot contain '${a}'`)}}),""}function Ya(i,t=""){if(t==="")throw Error(`${i} name required`);const s=h1(t);if(s.length)throw new Error(`invalid ${i} name - ${i} name ${s}`)}function h1(i=""){if(i==="")throw Error("name required");const t=/^[-\w]+$/g;if(i.match(t)===null){for(const a of i.split(""))if(a.match(t)===null)return`cannot contain '${a}'`}return""}function Pf(i){if(i.data.length>0)return!1;const t=i.headers;return t?t.code>=100&&t.code<200:!1}function Hf(i){var t;return Pf(i)&&((t=i.headers)==null?void 0:t.description)==="Idle Heartbeat"}function d1(i,t,s){const a=bs(i,t),o={hdr:1,sid:0,size:0},u=new dh(o,on,{});return u._headers=a,u._subject=s,u}function Mr(i){if(i.data.length!==0)return null;const t=i.headers;return t?Jy(t.code,t.description):null}var Sn;(function(i){i.MaxBatchExceeded="exceeded maxrequestbatch of",i.MaxExpiresExceeded="exceeded maxrequestexpires of",i.MaxBytesExceeded="exceeded maxrequestmaxbytes of",i.MaxMessageSizeExceeded="message size exceeds maxbytes",i.PushConsumer="consumer is push based",i.MaxWaitingExceeded="exceeded maxwaiting",i.IdleHeartbeatMissed="idle heartbeats missed",i.ConsumerDeleted="consumer deleted"})(Sn||(Sn={}));function m1(i){return i.code!==oe.JetStream409?!1:[Sn.MaxBatchExceeded,Sn.MaxExpiresExceeded,Sn.MaxBytesExceeded,Sn.MaxMessageSizeExceeded,Sn.PushConsumer,Sn.IdleHeartbeatMissed,Sn.ConsumerDeleted].find(s=>i.message.indexOf(s)!==-1)!==void 0}function Jy(i,t=""){if(i<300)return null;switch(t=t.toLowerCase(),i){case 404:return new me(t,oe.JetStream404NoMessages);case 408:return new me(t,oe.JetStream408RequestTimeout);case 409:{const s=t.startsWith(Sn.IdleHeartbeatMissed)?oe.JetStreamIdleHeartBeat:oe.JetStream409;return new me(t,s)}case 503:return me.errorForCode(oe.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=oe.Unknown),new me(t,`${i}`)}}class Tt{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=it(),this.yields=[],this.iterClosed=it(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new me("unsupported iterator",oe.ApiError);if(this.yielding)throw new me("already yielding",oe.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let s=0;s<t.length;s++){if(typeof t[s]=="function"){const o=t[s];try{o()}catch(u){throw u}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[s]):!0){this.processed++;const o=Date.now();yield t[s],this.time=Date.now()-o,this.dispatchedFn&&t[s]&&this.dispatchedFn(t[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=it())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class mh{constructor(t,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=t,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(t,s=0,a=2){this.interval=t,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(t){console.log(t)}},this.interval)}}var $f;(function(i){i.Limits="limits",i.Interest="interest",i.Workqueue="workqueue"})($f||($f={}));var Za;(function(i){i.Old="old",i.New="new"})(Za||(Za={}));var Yf;(function(i){i.File="file",i.Memory="memory"})(Yf||(Yf={}));var dt;(function(i){i.All="all",i.Last="last",i.New="new",i.StartSequence="by_start_sequence",i.StartTime="by_start_time",i.LastPerSubject="last_per_subject"})(dt||(dt={}));var Ot;(function(i){i.None="none",i.All="all",i.Explicit="explicit",i.NotSet=""})(Ot||(Ot={}));var Ur;(function(i){i.Instant="instant",i.Original="original"})(Ur||(Ur={}));var ri;(function(i){i.None="none",i.S2="s2"})(ri||(ri={}));var Jo;(function(i){i.CreateOrUpdate="",i.Update="update",i.Create="create"})(Jo||(Jo={}));function p1(i,t={}){return Object.assign({name:i,deliver_policy:dt.All,ack_policy:Ot.Explicit,ack_wait:st(30*1e3),replay_policy:Ur.Instant},t)}var B0;(function(i){i.API="api_audit",i.StreamAction="stream_action",i.ConsumerAction="consumer_action",i.SnapshotCreate="snapshot_create",i.SnapshotComplete="snapshot_complete",i.RestoreCreate="restore_create",i.RestoreComplete="restore_complete",i.MaxDeliver="max_deliver",i.Terminated="terminated",i.Ack="consumer_ack",i.StreamLeaderElected="stream_leader_elected",i.StreamQuorumLost="stream_quorum_lost",i.ConsumerLeaderElected="consumer_leader_elected",i.ConsumerQuorumLost="consumer_quorum_lost"})(B0||(B0={}));var Lt;(function(i){i.StreamSourceHdr="Nats-Stream-Source",i.LastConsumerSeqHdr="Nats-Last-Consumer",i.LastStreamSeqHdr="Nats-Last-Stream",i.ConsumerStalledHdr="Nats-Consumer-Stalled",i.MessageSizeHdr="Nats-Msg-Size",i.RollupHdr="Nats-Rollup",i.RollupValueSubject="sub",i.RollupValueAll="all",i.PendingMessagesHdr="Nats-Pending-Messages",i.PendingBytesHdr="Nats-Pending-Bytes"})(Lt||(Lt={}));var Mn;(function(i){i.LastValue="",i.AllHistory="history",i.UpdatesOnly="updates"})(Mn||(Mn={}));var Ar;(function(i){i.Stream="Nats-Stream",i.Sequence="Nats-Sequence",i.TimeStamp="Nats-Time-Stamp",i.Subject="Nats-Subject"})(Ar||(Ar={}));var L0;(function(i){i.Stream="Nats-Stream",i.Subject="Nats-Subject",i.Sequence="Nats-Sequence",i.LastSequence="Nats-Last-Sequence",i.Size="Nats-Msg-Size"})(L0||(L0={}));const rn="KV_";class y1{constructor(t){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=p1("",t||{})}getOpts(){var s;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((s=t.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?Ot.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Cr(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=dt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=dt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=dt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=dt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=dt.Last,this}deliverNew(){return this.config.deliver_policy=dt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Ot.None,this}ackAll(){return this.config.ack_policy=Ot.All,this}ackExplicit(){return this.config.ack_policy=Ot.Explicit,this}ackWait(t){return this.config.ack_wait=st(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=Ur.Instant,this}replayOriginal(){return this.config.replay_policy=Ur.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=st(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,s){return this.stream=t,this.config.durable_name=s,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=st(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=st(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function ti(i){return new y1(i)}function P0(i){return typeof i.getOpts=="function"}class g1{static encode(t){if(typeof t=="string")return btoa(t);const s=Array.from(t);return btoa(String.fromCharCode(...s))}static decode(t,s=!1){const a=atob(t);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class Rr{static encode(t){return Rr.toB64URLEncoding(g1.encode(t))}static decode(t,s=!1){return Rr.decode(Rr.fromB64URLEncoding(t),s)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Br{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let s=0;for(let u=0;u<t.length;u++)s+=t[u].length;const a=new Uint8Array(s);let o=0;for(let u=0;u<t.length;u++)a.set(t[u],o),o+=t[u].length;return a}static fromAscii(t){return t||(t=""),qi.encode(t)}static toAscii(t){return an.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)t.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(t===void 0||t>a)&&(t=a);const o=s.subarray(0,t);return a>t&&this.buffers.push(s.subarray(t)),this.byteLength=a-t,o}}return new Uint8Array(0)}fill(t,...s){t&&(this.buffers.push(t),this.byteLength+=t.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 b1(i,t){return t.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in i)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(i,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(i)}var x1=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Ua=x1.performance||{};Ua.now||Ua.mozNow||Ua.msNow||Ua.oNow||Ua.webkitNow;var H0={versions:{}},v1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _1(i){if(i.__esModule)return i;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(s){var a=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:function(){return i[s]}})}),t}var jf,rc={exports:{}},$0={},Y0=_1(b1({__proto__:null,default:$0},[$0]));jf=rc,(function(){var i="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var a=!t&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&H0.versions&&H0.versions.node;o?s=v1:a&&(s=self);var u=!s.JS_SHA256_NO_COMMON_JS&&jf.exports,d=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",m="0123456789abcdef".split(""),y=[-2147483648,8388608,32768,128],g=[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],_=["hex","array","digest","arrayBuffer"],T=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(N){return Object.prototype.toString.call(N)==="[object Array]"}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(N){return typeof N=="object"&&N.buffer&&N.buffer.constructor===ArrayBuffer});var q=function(N,Z){return function(ce){return new U(Z,!0).update(ce)[N]()}},C=function(N){var Z=q("hex",N);o&&(Z=R(Z,N)),Z.create=function(){return new U(N)},Z.update=function(F){return Z.create().update(F)};for(var ce=0;ce<_.length;++ce){var G=_[ce];Z[G]=q(G,N)}return Z},R=function(N,Z){var ce,G=Y0,F=Y0.Buffer,K=Z?"sha224":"sha256";return ce=F.from&&!s.JS_SHA256_NO_BUFFER_FROM?F.from:function(J){return new F(J)},function(J){if(typeof J=="string")return G.createHash(K).update(J,"utf8").digest("hex");if(J==null)throw new Error(i);return J.constructor===ArrayBuffer&&(J=new Uint8Array(J)),Array.isArray(J)||ArrayBuffer.isView(J)||J.constructor===F?G.createHash(K).update(ce(J)).digest("hex"):N(J)}},Q=function(N,Z){return function(ce,G){return new le(ce,Z,!0).update(G)[N]()}},se=function(N){var Z=Q("hex",N);Z.create=function(F){return new le(F,N)},Z.update=function(F,K){return Z.create(F).update(K)};for(var ce=0;ce<_.length;++ce){var G=_[ce];Z[G]=Q(G,N)}return Z};function U(N,Z){Z?(T[0]=T[16]=T[1]=T[2]=T[3]=T[4]=T[5]=T[6]=T[7]=T[8]=T[9]=T[10]=T[11]=T[12]=T[13]=T[14]=T[15]=0,this.blocks=T):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],N?(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=N}function le(N,Z,ce){var G,F=typeof N;if(F==="string"){var K,J=[],ie=N.length,he=0;for(G=0;G<ie;++G)(K=N.charCodeAt(G))<128?J[he++]=K:K<2048?(J[he++]=192|K>>>6,J[he++]=128|63&K):K<55296||K>=57344?(J[he++]=224|K>>>12,J[he++]=128|K>>>6&63,J[he++]=128|63&K):(K=65536+((1023&K)<<10|1023&N.charCodeAt(++G)),J[he++]=240|K>>>18,J[he++]=128|K>>>12&63,J[he++]=128|K>>>6&63,J[he++]=128|63&K);N=J}else{if(F!=="object")throw new Error(i);if(N===null)throw new Error(i);if(d&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!(Array.isArray(N)||d&&ArrayBuffer.isView(N)))throw new Error(i)}N.length>64&&(N=new U(Z,!0).update(N).array());var Se=[],Ne=[];for(G=0;G<64;++G){var Y=N[G]||0;Se[G]=92^Y,Ne[G]=54^Y}U.call(this,Z,ce),this.update(Ne),this.oKeyPad=Se,this.inner=!0,this.sharedMemory=ce}U.prototype.update=function(N){if(!this.finalized){var Z,ce=typeof N;if(ce!=="string"){if(ce!=="object")throw new Error(i);if(N===null)throw new Error(i);if(d&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!(Array.isArray(N)||d&&ArrayBuffer.isView(N)))throw new Error(i);Z=!0}for(var G,F,K=0,J=N.length,ie=this.blocks;K<J;){if(this.hashed&&(this.hashed=!1,ie[0]=this.block,this.block=ie[16]=ie[1]=ie[2]=ie[3]=ie[4]=ie[5]=ie[6]=ie[7]=ie[8]=ie[9]=ie[10]=ie[11]=ie[12]=ie[13]=ie[14]=ie[15]=0),Z)for(F=this.start;K<J&&F<64;++K)ie[F>>>2]|=N[K]<<g[3&F++];else for(F=this.start;K<J&&F<64;++K)(G=N.charCodeAt(K))<128?ie[F>>>2]|=G<<g[3&F++]:G<2048?(ie[F>>>2]|=(192|G>>>6)<<g[3&F++],ie[F>>>2]|=(128|63&G)<<g[3&F++]):G<55296||G>=57344?(ie[F>>>2]|=(224|G>>>12)<<g[3&F++],ie[F>>>2]|=(128|G>>>6&63)<<g[3&F++],ie[F>>>2]|=(128|63&G)<<g[3&F++]):(G=65536+((1023&G)<<10|1023&N.charCodeAt(++K)),ie[F>>>2]|=(240|G>>>18)<<g[3&F++],ie[F>>>2]|=(128|G>>>12&63)<<g[3&F++],ie[F>>>2]|=(128|G>>>6&63)<<g[3&F++],ie[F>>>2]|=(128|63&G)<<g[3&F++]);this.lastByteIndex=F,this.bytes+=F-this.start,F>=64?(this.block=ie[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}},U.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var N=this.blocks,Z=this.lastByteIndex;N[16]=this.block,N[Z>>>2]|=y[3&Z],this.block=N[16],Z>=56&&(this.hashed||this.hash(),N[0]=this.block,N[16]=N[1]=N[2]=N[3]=N[4]=N[5]=N[6]=N[7]=N[8]=N[9]=N[10]=N[11]=N[12]=N[13]=N[14]=N[15]=0),N[14]=this.hBytes<<3|this.bytes>>>29,N[15]=this.bytes<<3,this.hash()}},U.prototype.hash=function(){var N,Z,ce,G,F,K,J,ie,he,Se=this.h0,Ne=this.h1,Y=this.h2,ae=this.h3,de=this.h4,Oe=this.h5,$=this.h6,be=this.h7,xe=this.blocks;for(N=16;N<64;++N)Z=((F=xe[N-15])>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,ce=((F=xe[N-2])>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,xe[N]=xe[N-16]+Z+xe[N-7]+ce|0;for(he=Ne&Y,N=0;N<64;N+=4)this.first?(this.is224?(K=300032,be=(F=xe[0]-1413257819)-150054599|0,ae=F+24177077|0):(K=704751109,be=(F=xe[0]-210244248)-1521486534|0,ae=F+143694565|0),this.first=!1):(Z=(Se>>>2|Se<<30)^(Se>>>13|Se<<19)^(Se>>>22|Se<<10),G=(K=Se&Ne)^Se&Y^he,be=ae+(F=be+(ce=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&Oe^~de&$)+E[N]+xe[N])|0,ae=F+(Z+G)|0),Z=(ae>>>2|ae<<30)^(ae>>>13|ae<<19)^(ae>>>22|ae<<10),G=(J=ae&Se)^ae&Ne^K,$=Y+(F=$+(ce=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&de^~be&Oe)+E[N+1]+xe[N+1])|0,Z=((Y=F+(Z+G)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),G=(ie=Y&ae)^Y&Se^J,Oe=Ne+(F=Oe+(ce=($>>>6|$<<26)^($>>>11|$<<21)^($>>>25|$<<7))+($&be^~$&de)+E[N+2]+xe[N+2])|0,Z=((Ne=F+(Z+G)|0)>>>2|Ne<<30)^(Ne>>>13|Ne<<19)^(Ne>>>22|Ne<<10),G=(he=Ne&Y)^Ne&ae^ie,de=Se+(F=de+(ce=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&$^~Oe&be)+E[N+3]+xe[N+3])|0,Se=F+(Z+G)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Se|0,this.h1=this.h1+Ne|0,this.h2=this.h2+Y|0,this.h3=this.h3+ae|0,this.h4=this.h4+de|0,this.h5=this.h5+Oe|0,this.h6=this.h6+$|0,this.h7=this.h7+be|0},U.prototype.hex=function(){this.finalize();var N=this.h0,Z=this.h1,ce=this.h2,G=this.h3,F=this.h4,K=this.h5,J=this.h6,ie=this.h7,he=m[N>>>28&15]+m[N>>>24&15]+m[N>>>20&15]+m[N>>>16&15]+m[N>>>12&15]+m[N>>>8&15]+m[N>>>4&15]+m[15&N]+m[Z>>>28&15]+m[Z>>>24&15]+m[Z>>>20&15]+m[Z>>>16&15]+m[Z>>>12&15]+m[Z>>>8&15]+m[Z>>>4&15]+m[15&Z]+m[ce>>>28&15]+m[ce>>>24&15]+m[ce>>>20&15]+m[ce>>>16&15]+m[ce>>>12&15]+m[ce>>>8&15]+m[ce>>>4&15]+m[15&ce]+m[G>>>28&15]+m[G>>>24&15]+m[G>>>20&15]+m[G>>>16&15]+m[G>>>12&15]+m[G>>>8&15]+m[G>>>4&15]+m[15&G]+m[F>>>28&15]+m[F>>>24&15]+m[F>>>20&15]+m[F>>>16&15]+m[F>>>12&15]+m[F>>>8&15]+m[F>>>4&15]+m[15&F]+m[K>>>28&15]+m[K>>>24&15]+m[K>>>20&15]+m[K>>>16&15]+m[K>>>12&15]+m[K>>>8&15]+m[K>>>4&15]+m[15&K]+m[J>>>28&15]+m[J>>>24&15]+m[J>>>20&15]+m[J>>>16&15]+m[J>>>12&15]+m[J>>>8&15]+m[J>>>4&15]+m[15&J];return this.is224||(he+=m[ie>>>28&15]+m[ie>>>24&15]+m[ie>>>20&15]+m[ie>>>16&15]+m[ie>>>12&15]+m[ie>>>8&15]+m[ie>>>4&15]+m[15&ie]),he},U.prototype.toString=U.prototype.hex,U.prototype.digest=function(){this.finalize();var N=this.h0,Z=this.h1,ce=this.h2,G=this.h3,F=this.h4,K=this.h5,J=this.h6,ie=this.h7,he=[N>>>24&255,N>>>16&255,N>>>8&255,255&N,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,ce>>>24&255,ce>>>16&255,ce>>>8&255,255&ce,G>>>24&255,G>>>16&255,G>>>8&255,255&G,F>>>24&255,F>>>16&255,F>>>8&255,255&F,K>>>24&255,K>>>16&255,K>>>8&255,255&K,J>>>24&255,J>>>16&255,J>>>8&255,255&J];return this.is224||he.push(ie>>>24&255,ie>>>16&255,ie>>>8&255,255&ie),he},U.prototype.array=U.prototype.digest,U.prototype.arrayBuffer=function(){this.finalize();var N=new ArrayBuffer(this.is224?28:32),Z=new DataView(N);return Z.setUint32(0,this.h0),Z.setUint32(4,this.h1),Z.setUint32(8,this.h2),Z.setUint32(12,this.h3),Z.setUint32(16,this.h4),Z.setUint32(20,this.h5),Z.setUint32(24,this.h6),this.is224||Z.setUint32(28,this.h7),N},le.prototype=new U,le.prototype.finalize=function(){if(U.prototype.finalize.call(this),this.inner){this.inner=!1;var N=this.array();U.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(N),U.prototype.finalize.call(this)}};var re=C();re.sha256=re,re.sha224=C(!0),re.sha256.hmac=se(),re.sha224.hmac=se(!0),u?jf.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();rc.exports;rc.exports.sha224;var V0=rc.exports.sha256;function Vf(i){return O1(i)}function w1(i){if(!/^[0-9A-Fa-f]+$/.test(i))return!1;const s=/^[0-9A-F]+$/.test(i),a=/^[0-9a-f]+$/.test(i);return s||a?i.length%2===0:!1}function S1(i){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(i)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(i)}function E1(i){return w1(i)?"hex":S1(i)?"b64":""}function j1(i){if(i.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(i.length/2);for(let s=0;s<i.length;s+=2)t[s/2]=parseInt(i.substring(s,s+2),16);return t}function A1(i){i=i.replace(/-/g,"+"),i=i.replace(/_/g,"/");const t=atob(i);return Uint8Array.from(t,s=>s.charCodeAt(0))}function O1(i){switch(E1(i)){case"hex":return j1(i);case"b64":return A1(i)}return null}function T1(i,t){const s=typeof i=="string"?Vf(i):i,a=typeof t=="string"?Vf(t):t;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 Ky{constructor(t,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=t,this.requestSubject=s,this.received=0,this.token=ii.next(),a&&(this.ctx=new Error)}}class N1 extends Ky{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=it(),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
-
34
- ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===Dn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Dn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Dn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class Xy extends Ky{constructor(s,a,o={timeout:1e3},u=!0){super(s,a,u);v(this,"deferred");v(this,"timer");this.deferred=it(),this.timer=zr(o.timeout,u)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
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||me.errorForCode(oe.Cancelled))}}const k1="$JS.API";function C1(i){return i=i||{},i.domain&&(i.apiPrefix=`$JS.${i.domain}.API`,delete i.domain),sc({apiPrefix:k1,timeout:5e3},i)}class sl{constructor(t,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=t,this.opts=C1(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=qn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,s=null,a){a=a||{},a.timeout=this.timeout;let o=on;s&&(o=this.jc.encode(s));let{retries:u}=a;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const d=fh();for(let m=0;m<u;m++)try{const y=await this.nc.request(t,o,a);return this.parseJsResponse(y)}catch(y){const g=y;if((g.code==="503"||g.code===oe.Timeout)&&m+1<u)await Lr(d.backoff(m));else throw y}}async findStream(t){const s={subject:t},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(t){const s=this.jc.decode(t.data),a=s;if(a.error){const o=Jy(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Va{constructor(t,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(!t)throw new Error("subject is required");this.subject=t,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 t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const s=await this.jsm._request(this.subject,t,{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(t){var s,a,o;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=t.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=t.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((o=t.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const s of t)yield s;t=await this.next()}}}function Ri(i=""){const t=i.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${i}' is not a semver value`)}function Ff(i,t){return i.major<t.major?-1:i.major>t.major?1:i.minor<t.minor?-1:i.minor>t.minor?1:i.micro<t.micro?-1:i.micro>t.micro?1:0}var Le;(function(i){i.JS_KV="js_kv",i.JS_OBJECTSTORE="js_objectstore",i.JS_PULL_MAX_BYTES="js_pull_max_bytes",i.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",i.JS_ALLOW_DIRECT="js_allow_direct",i.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",i.JS_SIMPLIFICATION="js_simplification",i.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",i.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",i.JS_STREAM_FIRST_SEQ="js_stream_first_seq",i.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",i.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",i.JS_STREAM_COMPRESSION="js_stream_compression",i.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",i.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Le||(Le={}));class M1{constructor(t){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=Ri(t)),this.server=t,this.set(Le.JS_KV,"2.6.2"),this.set(Le.JS_OBJECTSTORE,"2.6.3"),this.set(Le.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Le.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Le.JS_ALLOW_DIRECT,"2.9.0"),this.set(Le.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Le.JS_SIMPLIFICATION,"2.9.4"),this.set(Le.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Le.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Le.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Le.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Le.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Le.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Le.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Le.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(t,s){this.features.set(t,{min:s,ok:Ff(this.server,Ri(s))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var s;return((s=this.get(t))==null?void 0:s.ok)||!1}require(t){return typeof t=="string"&&(t=Ri(t)),Ff(this.server,t)>=0}}class Ko extends sl{constructor(t,s){super(t,s)}async add(t,s,a=Jo.Create){if(Ut(t),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=t,o.action=a,o.config.durable_name&&Cr(o.config.durable_name);const u=this.nc;let{min:d,ok:m}=u.features.get(Le.JS_NEW_CONSUMER_CREATE_API);const y=s.name===""?void 0:s.name;if(y&&!m)throw new Error(`consumer 'name' requires server ${d}`);if(y)try{ic("name",y)}catch(T){const q=T.message,C=q.indexOf("cannot contain");throw C!==-1?new Error(`consumer 'name' ${q.substring(C)}`):T}let g,E="";if(Array.isArray(s.filter_subjects)){const{min:T,ok:q}=u.features.get(Le.JS_MULTIPLE_CONSUMER_FILTER);if(!q)throw new Error(`consumer 'filter_subjects' requires server ${T}`);m=!1}if(s.metadata){const{min:T,ok:q}=u.features.get(Le.JS_STREAM_CONSUMER_METADATA);if(!q)throw new Error(`consumer 'metadata' requires server ${T}`)}if(m&&(E=s.name??s.durable_name??""),E!==""){let T=s.filter_subject??void 0;T===">"&&(T=void 0),g=T!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${E}.${T}`:`${this.prefix}.CONSUMER.CREATE.${t}.${E}`}else g=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(g,o)}async update(t,s,a){const o=await this.info(t,s),u=a;return this.add(t,Object.assign(o.config,u),Jo.Update)}async info(t,s){return Ut(t),Cr(s),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${s}`)}async delete(t,s){return Ut(t),Cr(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${s}`)).success}list(t){Ut(t);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${t}`;return new Va(a,s,this)}pause(t,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${t}.${s}`,u={pause_until:a.toISOString()};return this._request(o,u)}resume(t,s){return this.pause(t,s,new Date(0))}}function _r(i,t,s=!1){if(s===!0&&!i)throw me.errorForCode(oe.ApiError,new Error(`${t} is not a function`));if(i&&typeof i!="function")throw me.errorForCode(oe.ApiError,new Error(`${t} is not a function`))}class R1 extends Tt{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");_r(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&_r(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(_r(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(_r(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(_r(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&_r(o.cleanupFn,"cleanupFn");let u=(E,_)=>{this.callback(E,_)};if(o.callback){const E=o.callback;u=(_,T)=>{const[q,C]=this.adapter(_,T);if(q){E(q,null);return}const{ingest:R}=this.ingestionFilterFn?this.ingestionFilterFn(C,this):{ingest:!0};R&&(!this.protocolFilterFn||this.protocolFilterFn(C))&&(E(q,C),this.dispatchedFn&&C&&this.dispatchedFn(C))}}const{max:d,queue:m,timeout:y}=o,g={queue:m,timeout:y,callback:u};d&&d>0&&(g.max=d),this.sub=s.subscribe(a,g),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=it(),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,u]=this.adapter(s,a);o&&this.stop(o),u&&this.push(u)}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 ln;function D1(i){ln=i}function Zy(){return ln!==void 0&&ln.defaultPort!==void 0?ln.defaultPort:4222}function Af(){return ln!==void 0&&ln.urlParseFn?ln.urlParseFn:void 0}function q1(){if(!ln||typeof ln.factory!="function")throw new Error("transport fn is not set");return ln.factory()}function Gf(){return ln!==void 0&&ln.dnsResolveFn?ln.dnsResolveFn:void 0}const Lo=`\r
37
- `,Xo=Br.fromAscii(Lo),z1=new Uint8Array(Xo)[0],U1=new Uint8Array(Xo)[1];function B1(i){for(let t=0;t<i.length;t++){const s=t+1;if(i.byteLength>s&&i[t]===z1&&i[s]===U1)return s+1}return 0}function L1(i){const t=B1(i);if(t>0){const a=new Uint8Array(i).slice(0,t);return an.decode(a)}return""}const P1=4,Wy=48,H1=65,$1=97;function Y1(i,t,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,m)=>{o[m]=d}),o[12]=i,o[13]=t,o[14]=s,o[15]=a,o}function If(i){return V1(i)!==void 0}function V1(i){for(let t=0;t<i.length;t++)switch(i[t]){case".":return eg(i);case":":return F1(i)}}function eg(i){const t=new Uint8Array(4);for(let s=0;s<4;s++){if(i.length===0)return;if(s>0){if(i[0]!==".")return;i=i.substring(1)}const{n:a,c:o,ok:u}=G1(i);if(!u||a>255)return;i=i.substring(o),t[s]=a}return Y1(t[0],t[1],t[2],t[3])}function F1(i){const t=new Uint8Array(16);let s=-1;if(i.length>=2&&i[0]===":"&&i[1]===":"&&(s=0,i=i.substring(2),i.length===0))return t;let a=0;for(;a<16;){const{n:o,c:u,ok:d}=I1(i);if(!d||o>65535)return;if(u<i.length&&i[u]==="."){if(s<0&&a!=12||a+4>16)return;const m=eg(i);if(m===void 0)return;t[a]=m[12],t[a+1]=m[13],t[a+2]=m[14],t[a+3]=m[15],i="",a+=P1;break}if(t[a]=o>>8,t[a+1]=o,a+=2,i=i.substring(u),i.length===0)break;if(i[0]!==":"||i.length==1)return;if(i=i.substring(1),i[0]===":"){if(s>=0)return;if(s=a,i=i.substring(1),i.length===0)break}}if(i.length===0){if(a<16){if(s<0)return;const o=16-a;for(let u=a-1;u>=s;u--)t[u+o]=t[u];for(let u=s+o-1;u>=s;u--)t[u]=0}else if(s>=0)return;return t}}function G1(i){let t=0,s=0;for(t=0;t<i.length&&48<=i.charCodeAt(t)&&i.charCodeAt(t)<=57;t++)if(s=s*10+(i.charCodeAt(t)-Wy),s>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:s,c:t,ok:!0}}function I1(i){let t=0,s=0;for(s=0;s<i.length;s++){if(48<=i.charCodeAt(s)&&i.charCodeAt(s)<=57)t*=16,t+=i.charCodeAt(s)-Wy;else if(97<=i.charCodeAt(s)&&i.charCodeAt(s)<=102)t*=16,t+=i.charCodeAt(s)-$1+10;else if(65<=i.charCodeAt(s)&&i.charCodeAt(s)<=70)t*=16,t+=i.charCodeAt(s)-H1+10;else break;if(t>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:t,c:s,ok:!0}}function Q1(i){return i.indexOf("[")!==-1||i.indexOf("::")!==-1?!1:i.indexOf(".")!==-1||i.split(":").length<=2}function Qf(i){return!Q1(i)}function J1(i){const t="::FFFF:",s=i.toUpperCase().indexOf(t);if(s!==-1&&i.indexOf(".")!==-1){let a=i.substring(s+t.length);return a=a.replace("[",""),a.replace("]","")}return i}function K1(i){i=i.trim(),i.match(/^(.*:\/\/)(.*)/m)&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2")),i=J1(i),Qf(i)&&i.indexOf("[")===-1&&(i=`[${i}]`);const t=Qf(i)?i.match(/(]:)(\d+)/):i.match(/(:)(\d+)/),s=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${i}`);o.port=`${s}`;let u=o.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:o.host,hostname:u,port:s}}class Ja{constructor(t,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=t,this.tlsName="";const a=K1(t);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(t){if(!t.fn||t.resolve===!1)return[this];const s=[];if(If(this.hostname))return[this];{const a=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const u=this.port===80?"https":"http",d=new URL(`${u}://${Qf(o)?"["+o+"]":o}`);d.port=`${this.port}`;const m=new Ja(d.host,!1);m.tlsName=this.hostname,s.push(m)}}return t.randomize&&Iy(s),this.resolves=s,s}}class X1{constructor(t=[],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=Af();t&&(t.forEach(o=>{o=a?a(o):o,this.servers.push(new Ja(o))}),this.randomize&&(this.servers=Iy(this.servers))),this.servers.length===0&&this.addServer(`${Bf}:${Zy()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();If(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,s=!1){const a=Af();t=a?a(t):t;const o=new Ja(t,s);If(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const s=this.servers.indexOf(t);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(t,s){const a=[];let o=[];const u=Af(),d=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(y=>{y=u?u(y,s):y;const g=new Ja(y,!0);d.set(y,g)});const m=[];return this.servers.forEach((y,g)=>{const E=y.listen;y.gossiped&&this.currentServer.listen!==E&&d.get(E)===void 0&&m.push(g),d.delete(E)}),m.reverse(),m.forEach(y=>{const g=this.servers.splice(y,1);o=o.concat(g[0].listen)}),d.forEach((y,g)=>{this.servers.push(y),a.push(g)}),{added:a,deleted:o}}}class Z1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${gs(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const s=t.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,s){if(s&&s.permissionContext){if(t)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(u=>u.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(t,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(t===null&&s.headers&&(t=Qy(s)),o.resolver(t,s))}}}close(){const t=me.errorForCode(oe.Timeout);this.reqs.forEach(s=>{s.resolver(t,{})})}}class W1{constructor(t,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=t,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:kr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=it();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class e_ extends Error{constructor(t){super(t),this.name="AssertionError"}}function t_(i,t="Assertion failed."){if(!i)throw new e_(t)}const F0=32*1024,Of=2**32-2;function ko(i,t,s=0){const a=t.byteLength-s;return i.byteLength>a&&(i=i.subarray(0,a)),t.set(i,s),i.byteLength}class Tf{constructor(t){v(this,"_buf");v(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.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(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const s=this._buf.byteLength;return t<=this.capacity-s?(this._reslice(s+t),s):-1}_reslice(t){t_(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const s=ko(this._buf.subarray(this._off),t);return this._off+=s,s}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(qi.encode(t))}write(t){const s=this._grow(t.byteLength);return ko(t,this._buf,s)}_grow(t){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(t);if(a>=0)return a;const o=this.capacity;if(t<=Math.floor(o/2)-s)ko(this._buf.subarray(this._off),this._buf);else{if(o+t>Of)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*o+t,Of));ko(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(s+t,Of)),s}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const s=this._grow(t);this._reslice(s)}readFrom(t){let s=0;const a=new Uint8Array(F0);for(;;){const o=this.capacity-this.length<F0,u=o?a:new Uint8Array(this._buf.buffer,this.length),d=t.read(u);if(d===null)return s;o?this.write(u.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var Bt;(function(i){i[i.OK=0]="OK",i[i.ERR=1]="ERR",i[i.MSG=2]="MSG",i[i.INFO=3]="INFO",i[i.PING=4]="PING",i[i.PONG=5]="PONG"})(Bt||(Bt={}));function G0(){const i={};return i.sid=-1,i.hdr=-1,i.size=-1,i}const n_=48;class I0{constructor(t){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=t,this.state=ue.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let s;for(s=0;s<t.length;s++){const a=t[s];switch(this.state){case ue.OP_START:switch(a){case fe.M:case fe.m:this.state=ue.OP_M,this.hdr=-1,this.ma=G0();break;case fe.H:case fe.h:this.state=ue.OP_H,this.hdr=0,this.ma=G0();break;case fe.P:case fe.p:this.state=ue.OP_P;break;case fe.PLUS:this.state=ue.OP_PLUS;break;case fe.MINUS:this.state=ue.OP_MINUS;break;case fe.I:case fe.i:this.state=ue.OP_I;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_H:switch(a){case fe.M:case fe.m:this.state=ue.OP_M;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_M:switch(a){case fe.S:case fe.s:this.state=ue.OP_MS;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MS:switch(a){case fe.G:case fe.g:this.state=ue.OP_MSG;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MSG:switch(a){case fe.SPACE:case fe.TAB:this.state=ue.OP_MSG_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MSG_SPC:switch(a){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MSG_ARG,this.as=s}break;case ue.MSG_ARG:switch(a){case fe.CR:this.drop=1;break;case fe.NL:{const o=this.argBuf?this.argBuf.bytes():t.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=ue.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case ue.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Bt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const u=t.length-s;u<o&&(o=u),o>0?(this.msgBuf.write(t.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Bt.MSG,msg:this.ma,data:t.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END);break;case ue.MSG_END:switch(a){case fe.NL:this.drop=0,this.as=s+1,this.state=ue.OP_START;break;default:continue}break;case ue.OP_PLUS:switch(a){case fe.O:case fe.o:this.state=ue.OP_PLUS_O;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PLUS_O:switch(a){case fe.K:case fe.k:this.state=ue.OP_PLUS_OK;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PLUS_OK:switch(a){case fe.NL:this.dispatcher.push({kind:Bt.OK}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_MINUS:switch(a){case fe.E:case fe.e:this.state=ue.OP_MINUS_E;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_E:switch(a){case fe.R:case fe.r:this.state=ue.OP_MINUS_ER;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ER:switch(a){case fe.R:case fe.r:this.state=ue.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ERR:switch(a){case fe.SPACE:case fe.TAB:this.state=ue.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ERR_SPC:switch(a){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MINUS_ERR_ARG,this.as=s}break;case ue.MINUS_ERR_ARG:switch(a){case fe.CR:this.drop=1;break;case fe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Bt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case ue.OP_P:switch(a){case fe.I:case fe.i:this.state=ue.OP_PI;break;case fe.O:case fe.o:this.state=ue.OP_PO;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PO:switch(a){case fe.N:case fe.n:this.state=ue.OP_PON;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PON:switch(a){case fe.G:case fe.g:this.state=ue.OP_PONG;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PONG:switch(a){case fe.NL:this.dispatcher.push({kind:Bt.PONG}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_PI:switch(a){case fe.N:case fe.n:this.state=ue.OP_PIN;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PIN:switch(a){case fe.G:case fe.g:this.state=ue.OP_PING;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PING:switch(a){case fe.NL:this.dispatcher.push({kind:Bt.PING}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_I:switch(a){case fe.N:case fe.n:this.state=ue.OP_IN;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_IN:switch(a){case fe.F:case fe.f:this.state=ue.OP_INF;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INF:switch(a){case fe.O:case fe.o:this.state=ue.OP_INFO;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INFO:switch(a){case fe.SPACE:case fe.TAB:this.state=ue.OP_INFO_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INFO_SPC:switch(a){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.INFO_ARG,this.as=s}break;case ue.INFO_ARG:switch(a){case fe.CR:this.drop=1;break;case fe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Bt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(t.subarray(s))}}(this.state===ue.MSG_ARG||this.state===ue.MINUS_ERR_ARG||this.state===ue.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Tf(t.subarray(this.as,s-this.drop))),this.state===ue.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Tf(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(t+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,t),this.argBuf=new Tf(a),this.ma.subject=a.subarray(0,t),this.ma.reply&&(this.ma.reply=a.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const s=[];let a=-1;for(let o=0;o<t.length;o++)switch(t[o]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:a>=0&&(s.push(t.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(t.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(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${an.decode(t)}`)}processHeaderMsgArgs(t){const s=[];let a=-1;for(let o=0;o<t.length;o++)switch(t[o]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:a>=0&&(s.push(t.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(t.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(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let s=0;for(let a=0;a<t.length;a++){if(t[a]<48||t[a]>57)return-1;s=s*10+(t[a]-n_)}return s}}var ue;(function(i){i[i.OP_START=0]="OP_START",i[i.OP_PLUS=1]="OP_PLUS",i[i.OP_PLUS_O=2]="OP_PLUS_O",i[i.OP_PLUS_OK=3]="OP_PLUS_OK",i[i.OP_MINUS=4]="OP_MINUS",i[i.OP_MINUS_E=5]="OP_MINUS_E",i[i.OP_MINUS_ER=6]="OP_MINUS_ER",i[i.OP_MINUS_ERR=7]="OP_MINUS_ERR",i[i.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",i[i.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",i[i.OP_M=10]="OP_M",i[i.OP_MS=11]="OP_MS",i[i.OP_MSG=12]="OP_MSG",i[i.OP_MSG_SPC=13]="OP_MSG_SPC",i[i.MSG_ARG=14]="MSG_ARG",i[i.MSG_PAYLOAD=15]="MSG_PAYLOAD",i[i.MSG_END=16]="MSG_END",i[i.OP_H=17]="OP_H",i[i.OP_P=18]="OP_P",i[i.OP_PI=19]="OP_PI",i[i.OP_PIN=20]="OP_PIN",i[i.OP_PING=21]="OP_PING",i[i.OP_PO=22]="OP_PO",i[i.OP_PON=23]="OP_PON",i[i.OP_PONG=24]="OP_PONG",i[i.OP_I=25]="OP_I",i[i.OP_IN=26]="OP_IN",i[i.OP_INF=27]="OP_INF",i[i.OP_INFO=28]="OP_INFO",i[i.OP_INFO_SPC=29]="OP_INFO_SPC",i[i.INFO_ARG=30]="INFO_ARG"})(ue||(ue={}));var fe;(function(i){i[i.CR=13]="CR",i[i.E=69]="E",i[i.e=101]="e",i[i.F=70]="F",i[i.f=102]="f",i[i.G=71]="G",i[i.g=103]="g",i[i.H=72]="H",i[i.h=104]="h",i[i.I=73]="I",i[i.i=105]="i",i[i.K=75]="K",i[i.k=107]="k",i[i.M=77]="M",i[i.m=109]="m",i[i.MINUS=45]="MINUS",i[i.N=78]="N",i[i.n=110]="n",i[i.NL=10]="NL",i[i.O=79]="O",i[i.o=111]="o",i[i.P=80]="P",i[i.p=112]="p",i[i.PLUS=43]="PLUS",i[i.R=82]="R",i[i.r=114]="r",i[i.S=83]="S",i[i.s=115]="s",i[i.SPACE=32]="SPACE",i[i.TAB=9]="TAB"})(fe||(fe={}));(function(i){var t=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,w=new Float64Array(16);if(x)for(S=0;S<x.length;S++)w[S]=x[S];return w},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var d=s(),m=s([1]),y=s([56129,1]),g=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]),_=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),T=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 C(x,S){return x<<S|x>>>32-S}function R(x,S){var w=x[S+3]&255;return w=w<<8|x[S+2]&255,w=w<<8|x[S+1]&255,w<<8|x[S+0]&255}function Q(x,S){var w=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],j=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new t(w,j)}function se(x,S,w){var j;for(j=0;j<4;j++)x[S+j]=w&255,w>>>=8}function U(x,S,w){x[S]=w.hi>>24&255,x[S+1]=w.hi>>16&255,x[S+2]=w.hi>>8&255,x[S+3]=w.hi&255,x[S+4]=w.lo>>24&255,x[S+5]=w.lo>>16&255,x[S+6]=w.lo>>8&255,x[S+7]=w.lo&255}function le(x,S,w,j,k){var z,ee=0;for(z=0;z<k;z++)ee|=x[S+z]^w[j+z];return(1&ee-1>>>8)-1}function re(x,S,w,j){return le(x,S,w,j,16)}function N(x,S,w,j){return le(x,S,w,j,32)}function Z(x,S,w,j,k){var z=new Uint32Array(16),ee=new Uint32Array(16),ne=new Uint32Array(16),H=new Uint32Array(4),W,pe,Me;for(W=0;W<4;W++)ee[5*W]=R(j,4*W),ee[1+W]=R(w,4*W),ee[6+W]=R(S,4*W),ee[11+W]=R(w,16+4*W);for(W=0;W<16;W++)ne[W]=ee[W];for(W=0;W<20;W++){for(pe=0;pe<4;pe++){for(Me=0;Me<4;Me++)H[Me]=ee[(5*pe+4*Me)%16];for(H[1]^=C(H[0]+H[3]|0,7),H[2]^=C(H[1]+H[0]|0,9),H[3]^=C(H[2]+H[1]|0,13),H[0]^=C(H[3]+H[2]|0,18),Me=0;Me<4;Me++)z[4*pe+(pe+Me)%4]=H[Me]}for(Me=0;Me<16;Me++)ee[Me]=z[Me]}if(k){for(W=0;W<16;W++)ee[W]=ee[W]+ne[W]|0;for(W=0;W<4;W++)ee[5*W]=ee[5*W]-R(j,4*W)|0,ee[6+W]=ee[6+W]-R(S,4*W)|0;for(W=0;W<4;W++)se(x,4*W,ee[5*W]),se(x,16+4*W,ee[6+W])}else for(W=0;W<16;W++)se(x,4*W,ee[W]+ne[W]|0)}function ce(x,S,w,j){return Z(x,S,w,j,!1),0}function G(x,S,w,j){return Z(x,S,w,j,!0),0}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,w,j,k,z,ee){var ne=new Uint8Array(16),H=new Uint8Array(64),W,pe;if(!k)return 0;for(pe=0;pe<16;pe++)ne[pe]=0;for(pe=0;pe<8;pe++)ne[pe]=z[pe];for(;k>=64;){for(ce(H,ne,ee,F),pe=0;pe<64;pe++)x[S+pe]=(w?w[j+pe]:0)^H[pe];for(W=1,pe=8;pe<16;pe++)W=W+(ne[pe]&255)|0,ne[pe]=W&255,W>>>=8;k-=64,S+=64,w&&(j+=64)}if(k>0)for(ce(H,ne,ee,F),pe=0;pe<k;pe++)x[S+pe]=(w?w[j+pe]:0)^H[pe];return 0}function J(x,S,w,j,k){return K(x,S,null,0,w,j,k)}function ie(x,S,w,j,k){var z=new Uint8Array(32);return G(z,j,k,F),J(x,S,w,j.subarray(16),z)}function he(x,S,w,j,k,z,ee){var ne=new Uint8Array(32);return G(ne,z,ee,F),K(x,S,w,j,k,z.subarray(16),ne)}function Se(x,S){var w,j=0;for(w=0;w<17;w++)j=j+(x[w]+S[w]|0)|0,x[w]=j&255,j>>>=8}var Ne=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(x,S,w,j,k,z){var ee,ne,H,W,pe=new Uint32Array(17),Me=new Uint32Array(17),Ze=new Uint32Array(17),qt=new Uint32Array(17),On=new Uint32Array(17);for(H=0;H<17;H++)Me[H]=Ze[H]=0;for(H=0;H<16;H++)Me[H]=z[H];for(Me[3]&=15,Me[4]&=252,Me[7]&=15,Me[8]&=252,Me[11]&=15,Me[12]&=252,Me[15]&=15;k>0;){for(H=0;H<17;H++)qt[H]=0;for(H=0;H<16&&H<k;++H)qt[H]=w[j+H];for(qt[H]=1,j+=H,k-=H,Se(Ze,qt),ne=0;ne<17;ne++)for(pe[ne]=0,H=0;H<17;H++)pe[ne]=pe[ne]+Ze[H]*(H<=ne?Me[ne-H]:320*Me[ne+17-H]|0)|0|0;for(ne=0;ne<17;ne++)Ze[ne]=pe[ne];for(W=0,H=0;H<16;H++)W=W+Ze[H]|0,Ze[H]=W&255,W>>>=8;for(W=W+Ze[16]|0,Ze[16]=W&3,W=5*(W>>>2)|0,H=0;H<16;H++)W=W+Ze[H]|0,Ze[H]=W&255,W>>>=8;W=W+Ze[16]|0,Ze[16]=W}for(H=0;H<17;H++)On[H]=Ze[H];for(Se(Ze,Ne),ee=-(Ze[16]>>>7)|0,H=0;H<17;H++)Ze[H]^=ee&(On[H]^Ze[H]);for(H=0;H<16;H++)qt[H]=z[H+16];for(qt[16]=0,Se(Ze,qt),H=0;H<16;H++)x[S+H]=Ze[H];return 0}function ae(x,S,w,j,k,z){var ee=new Uint8Array(16);return Y(ee,0,w,j,k,z),re(x,S,ee,0)}function de(x,S,w,j,k){var z;if(w<32)return-1;for(he(x,0,S,0,w,j,k),Y(x,16,x,32,w-32,x),z=0;z<16;z++)x[z]=0;return 0}function Oe(x,S,w,j,k){var z,ee=new Uint8Array(32);if(w<32||(ie(ee,0,32,j,k),ae(S,16,S,32,w-32,ee)!==0))return-1;for(he(x,0,S,0,w,j,k),z=0;z<32;z++)x[z]=0;return 0}function $(x,S){var w;for(w=0;w<16;w++)x[w]=S[w]|0}function be(x){var S,w;for(w=0;w<16;w++)x[w]+=65536,S=Math.floor(x[w]/65536),x[(w+1)*(w<15?1:0)]+=S-1+37*(S-1)*(w===15?1:0),x[w]-=S*65536}function xe(x,S,w){for(var j,k=~(w-1),z=0;z<16;z++)j=k&(x[z]^S[z]),x[z]^=j,S[z]^=j}function je(x,S){var w,j,k,z=s(),ee=s();for(w=0;w<16;w++)ee[w]=S[w];for(be(ee),be(ee),be(ee),j=0;j<2;j++){for(z[0]=ee[0]-65517,w=1;w<15;w++)z[w]=ee[w]-65535-(z[w-1]>>16&1),z[w-1]&=65535;z[15]=ee[15]-32767-(z[14]>>16&1),k=z[15]>>16&1,z[14]&=65535,xe(ee,z,1-k)}for(w=0;w<16;w++)x[2*w]=ee[w]&255,x[2*w+1]=ee[w]>>8}function Pe(x,S){var w=new Uint8Array(32),j=new Uint8Array(32);return je(w,x),je(j,S),N(w,0,j,0)}function _t(x){var S=new Uint8Array(32);return je(S,x),S[0]&1}function jt(x,S){var w;for(w=0;w<16;w++)x[w]=S[2*w]+(S[2*w+1]<<8);x[15]&=32767}function rt(x,S,w){var j;for(j=0;j<16;j++)x[j]=S[j]+w[j]|0}function ct(x,S,w){var j;for(j=0;j<16;j++)x[j]=S[j]-w[j]|0}function Te(x,S,w){var j,k,z=new Float64Array(31);for(j=0;j<31;j++)z[j]=0;for(j=0;j<16;j++)for(k=0;k<16;k++)z[j+k]+=S[j]*w[k];for(j=0;j<15;j++)z[j]+=38*z[j+16];for(j=0;j<16;j++)x[j]=z[j];be(x),be(x)}function wt(x,S){Te(x,S,S)}function Un(x,S){var w=s(),j;for(j=0;j<16;j++)w[j]=S[j];for(j=253;j>=0;j--)wt(w,w),j!==2&&j!==4&&Te(w,w,S);for(j=0;j<16;j++)x[j]=w[j]}function un(x,S){var w=s(),j;for(j=0;j<16;j++)w[j]=S[j];for(j=250;j>=0;j--)wt(w,w),j!==1&&Te(w,w,S);for(j=0;j<16;j++)x[j]=w[j]}function li(x,S,w){var j=new Uint8Array(32),k=new Float64Array(80),z,ee,ne=s(),H=s(),W=s(),pe=s(),Me=s(),Ze=s();for(ee=0;ee<31;ee++)j[ee]=S[ee];for(j[31]=S[31]&127|64,j[0]&=248,jt(k,w),ee=0;ee<16;ee++)H[ee]=k[ee],pe[ee]=ne[ee]=W[ee]=0;for(ne[0]=pe[0]=1,ee=254;ee>=0;--ee)z=j[ee>>>3]>>>(ee&7)&1,xe(ne,H,z),xe(W,pe,z),rt(Me,ne,W),ct(ne,ne,W),rt(W,H,pe),ct(H,H,pe),wt(pe,Me),wt(Ze,ne),Te(ne,W,ne),Te(W,H,Me),rt(Me,ne,W),ct(ne,ne,W),wt(H,ne),ct(W,pe,Ze),Te(ne,W,y),rt(ne,ne,pe),Te(W,W,ne),Te(ne,pe,Ze),Te(pe,H,k),wt(H,Me),xe(ne,H,z),xe(W,pe,z);for(ee=0;ee<16;ee++)k[ee+16]=ne[ee],k[ee+32]=W[ee],k[ee+48]=H[ee],k[ee+64]=pe[ee];var qt=k.subarray(32),On=k.subarray(16);return Un(qt,qt),Te(On,On,qt),je(x,On),0}function fn(x,S){return li(x,S,u)}function zi(x,S){return a(S,32),fn(x,S)}function vs(x,S,w){var j=new Uint8Array(32);return li(j,w,S),G(x,o,j,F)}var ll=de,ol=Oe;function $r(x,S,w,j,k,z){var ee=new Uint8Array(32);return vs(ee,k,z),ll(x,S,w,j,ee)}function Yr(x,S,w,j,k,z){var ee=new Uint8Array(32);return vs(ee,k,z),ol(x,S,w,j,ee)}function Jn(){var x=0,S=0,w=0,j=0,k=65535,z,ee,ne;for(ne=0;ne<arguments.length;ne++)z=arguments[ne].lo,ee=arguments[ne].hi,x+=z&k,S+=z>>>16,w+=ee&k,j+=ee>>>16;return S+=x>>>16,w+=S>>>16,j+=w>>>16,new t(w&k|j<<16,x&k|S<<16)}function cl(x,S){return new t(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ui(){var x=0,S=0,w;for(w=0;w<arguments.length;w++)x^=arguments[w].lo,S^=arguments[w].hi;return new t(S,x)}function tt(x,S){var w,j,k=32-S;return S<32?(w=x.hi>>>S|x.lo<<k,j=x.lo>>>S|x.hi<<k):S<64&&(w=x.lo>>>S|x.hi<<k,j=x.hi>>>S|x.lo<<k),new t(w,j)}function cc(x,S,w){var j=x.hi&S.hi^~x.hi&w.hi,k=x.lo&S.lo^~x.lo&w.lo;return new t(j,k)}function ul(x,S,w){var j=x.hi&S.hi^x.hi&w.hi^S.hi&w.hi,k=x.lo&S.lo^x.lo&w.lo^S.lo&w.lo;return new t(j,k)}function fl(x){return Ui(tt(x,28),tt(x,34),tt(x,39))}function Bi(x){return Ui(tt(x,14),tt(x,18),tt(x,41))}function uc(x){return Ui(tt(x,1),tt(x,8),cl(x,7))}function hl(x){return Ui(tt(x,19),tt(x,61),cl(x,6))}var fc=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function dl(x,S,w){var j=[],k=[],z=[],ee=[],ne,H,W;for(H=0;H<8;H++)j[H]=z[H]=Q(x,8*H);for(var pe=0;w>=128;){for(H=0;H<16;H++)ee[H]=Q(S,8*H+pe);for(H=0;H<80;H++){for(W=0;W<8;W++)k[W]=z[W];for(ne=Jn(z[7],Bi(z[4]),cc(z[4],z[5],z[6]),fc[H],ee[H%16]),k[7]=Jn(ne,fl(z[0]),ul(z[0],z[1],z[2])),k[3]=Jn(k[3],ne),W=0;W<8;W++)z[(W+1)%8]=k[W];if(H%16===15)for(W=0;W<16;W++)ee[W]=Jn(ee[W],ee[(W+9)%16],uc(ee[(W+1)%16]),hl(ee[(W+14)%16]))}for(H=0;H<8;H++)z[H]=Jn(z[H],j[H]),j[H]=z[H];pe+=128,w-=128}for(H=0;H<8;H++)U(x,8*H,j[H]);return w}var oi=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 ut(x,S,w){var j=new Uint8Array(64),k=new Uint8Array(256),z,ee=w;for(z=0;z<64;z++)j[z]=oi[z];for(dl(j,S,w),w%=128,z=0;z<256;z++)k[z]=0;for(z=0;z<w;z++)k[z]=S[ee-w+z];for(k[w]=128,w=256-128*(w<112?1:0),k[w-9]=0,U(k,w-8,new t(ee/536870912|0,ee<<3)),dl(j,k,w),z=0;z<64;z++)x[z]=j[z];return 0}function It(x,S){var w=s(),j=s(),k=s(),z=s(),ee=s(),ne=s(),H=s(),W=s(),pe=s();ct(w,x[1],x[0]),ct(pe,S[1],S[0]),Te(w,w,pe),rt(j,x[0],x[1]),rt(pe,S[0],S[1]),Te(j,j,pe),Te(k,x[3],S[3]),Te(k,k,E),Te(z,x[2],S[2]),rt(z,z,z),ct(ee,j,w),ct(ne,z,k),rt(H,z,k),rt(W,j,w),Te(x[0],ee,ne),Te(x[1],W,H),Te(x[2],H,ne),Te(x[3],ee,W)}function Dt(x,S,w){var j;for(j=0;j<4;j++)xe(x[j],S[j],w)}function Vr(x,S){var w=s(),j=s(),k=s();Un(k,S[2]),Te(w,S[0],k),Te(j,S[1],k),je(x,j),x[31]^=_t(w)<<7}function Fr(x,S,w){var j,k;for($(x[0],d),$(x[1],m),$(x[2],m),$(x[3],d),k=255;k>=0;--k)j=w[k/8|0]>>(k&7)&1,Dt(x,S,j),It(S,x),It(x,x),Dt(x,S,j)}function Li(x,S){var w=[s(),s(),s(),s()];$(w[0],_),$(w[1],T),$(w[2],m),Te(w[3],_,T),Fr(x,w,S)}function _s(x,S,w){var j=new Uint8Array(64),k=[s(),s(),s(),s()],z;for(w||a(S,32),ut(j,S,32),j[0]&=248,j[31]&=127,j[31]|=64,Li(k,j),Vr(x,k),z=0;z<32;z++)S[z+32]=x[z];return 0}var Kn=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 ws(x,S){var w,j,k,z;for(j=63;j>=32;--j){for(w=0,k=j-32,z=j-12;k<z;++k)S[k]+=w-16*S[j]*Kn[k-(j-32)],w=Math.floor((S[k]+128)/256),S[k]-=w*256;S[k]+=w,S[j]=0}for(w=0,k=0;k<32;k++)S[k]+=w-(S[31]>>4)*Kn[k],w=S[k]>>8,S[k]&=255;for(k=0;k<32;k++)S[k]-=w*Kn[k];for(j=0;j<32;j++)S[j+1]+=S[j]>>8,x[j]=S[j]&255}function jn(x){var S=new Float64Array(64),w;for(w=0;w<64;w++)S[w]=x[w];for(w=0;w<64;w++)x[w]=0;ws(x,S)}function ci(x,S,w,j){var k=new Uint8Array(64),z=new Uint8Array(64),ee=new Uint8Array(64),ne,H,W=new Float64Array(64),pe=[s(),s(),s(),s()];ut(k,j,32),k[0]&=248,k[31]&=127,k[31]|=64;var Me=w+64;for(ne=0;ne<w;ne++)x[64+ne]=S[ne];for(ne=0;ne<32;ne++)x[32+ne]=k[32+ne];for(ut(ee,x.subarray(32),w+32),jn(ee),Li(pe,ee),Vr(x,pe),ne=32;ne<64;ne++)x[ne]=j[ne];for(ut(z,x,w+64),jn(z),ne=0;ne<64;ne++)W[ne]=0;for(ne=0;ne<32;ne++)W[ne]=ee[ne];for(ne=0;ne<32;ne++)for(H=0;H<32;H++)W[ne+H]+=z[ne]*k[H];return ws(x.subarray(32),W),Me}function ui(x,S){var w=s(),j=s(),k=s(),z=s(),ee=s(),ne=s(),H=s();return $(x[2],m),jt(x[1],S),wt(k,x[1]),Te(z,k,g),ct(k,k,x[2]),rt(z,x[2],z),wt(ee,z),wt(ne,ee),Te(H,ne,ee),Te(w,H,k),Te(w,w,z),un(w,w),Te(w,w,k),Te(w,w,z),Te(w,w,z),Te(x[0],w,z),wt(j,x[0]),Te(j,j,z),Pe(j,k)&&Te(x[0],x[0],q),wt(j,x[0]),Te(j,j,z),Pe(j,k)?-1:(_t(x[0])===S[31]>>7&&ct(x[0],d,x[0]),Te(x[3],x[0],x[1]),0)}function Gr(x,S,w,j){var k,z=new Uint8Array(32),ee=new Uint8Array(64),ne=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(w<64||ui(H,j))return-1;for(k=0;k<w;k++)x[k]=S[k];for(k=0;k<32;k++)x[k+32]=j[k];if(ut(ee,x,w),jn(ee),Fr(ne,H,ee),Li(H,S.subarray(32)),It(ne,H),Vr(z,ne),w-=64,N(S,0,z,0)){for(k=0;k<w;k++)x[k]=0;return-1}for(k=0;k<w;k++)x[k]=S[k+64];return w}var Pi=32,Ss=24,An=32,Es=16,js=32,fi=32,As=32,Xn=32,hi=32,Ir=Ss,ml=An,Bn=Es,Ke=64,at=32,Qt=64,di=32,Qr=64;i.lowlevel={crypto_core_hsalsa20:G,crypto_stream_xor:he,crypto_stream:ie,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:J,crypto_onetimeauth:Y,crypto_onetimeauth_verify:ae,crypto_verify_16:re,crypto_verify_32:N,crypto_secretbox:de,crypto_secretbox_open:Oe,crypto_scalarmult:li,crypto_scalarmult_base:fn,crypto_box_beforenm:vs,crypto_box_afternm:ll,crypto_box:$r,crypto_box_open:Yr,crypto_box_keypair:zi,crypto_hash:ut,crypto_sign:ci,crypto_sign_keypair:_s,crypto_sign_open:Gr,crypto_secretbox_KEYBYTES:Pi,crypto_secretbox_NONCEBYTES:Ss,crypto_secretbox_ZEROBYTES:An,crypto_secretbox_BOXZEROBYTES:Es,crypto_scalarmult_BYTES:js,crypto_scalarmult_SCALARBYTES:fi,crypto_box_PUBLICKEYBYTES:As,crypto_box_SECRETKEYBYTES:Xn,crypto_box_BEFORENMBYTES:hi,crypto_box_NONCEBYTES:Ir,crypto_box_ZEROBYTES:ml,crypto_box_BOXZEROBYTES:Bn,crypto_sign_BYTES:Ke,crypto_sign_PUBLICKEYBYTES:at,crypto_sign_SECRETKEYBYTES:Qt,crypto_sign_SEEDBYTES:di,crypto_hash_BYTES:Qr,gf:s,D:g,L:Kn,pack25519:je,unpack25519:jt,M:Te,A:rt,S:wt,Z:ct,pow2523:un,add:It,set25519:$,modL:ws,scalarmult:Fr,scalarbase:Li};function pl(x,S){if(x.length!==Pi)throw new Error("bad key size");if(S.length!==Ss)throw new Error("bad nonce size")}function yl(x,S){if(x.length!==As)throw new Error("bad public key size");if(S.length!==Xn)throw new Error("bad secret key size")}function St(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Hi(x){for(var S=0;S<x.length;S++)x[S]=0}i.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},i.secretbox=function(x,S,w){St(x,S,w),pl(w,S);for(var j=new Uint8Array(An+x.length),k=new Uint8Array(j.length),z=0;z<x.length;z++)j[z+An]=x[z];return de(k,j,j.length,S,w),k.subarray(Es)},i.secretbox.open=function(x,S,w){St(x,S,w),pl(w,S);for(var j=new Uint8Array(Es+x.length),k=new Uint8Array(j.length),z=0;z<x.length;z++)j[z+Es]=x[z];return j.length<32||Oe(k,j,j.length,S,w)!==0?null:k.subarray(An)},i.secretbox.keyLength=Pi,i.secretbox.nonceLength=Ss,i.secretbox.overheadLength=Es,i.scalarMult=function(x,S){if(St(x,S),x.length!==fi)throw new Error("bad n size");if(S.length!==js)throw new Error("bad p size");var w=new Uint8Array(js);return li(w,x,S),w},i.scalarMult.base=function(x){if(St(x),x.length!==fi)throw new Error("bad n size");var S=new Uint8Array(js);return fn(S,x),S},i.scalarMult.scalarLength=fi,i.scalarMult.groupElementLength=js,i.box=function(x,S,w,j){var k=i.box.before(w,j);return i.secretbox(x,S,k)},i.box.before=function(x,S){St(x,S),yl(x,S);var w=new Uint8Array(hi);return vs(w,x,S),w},i.box.after=i.secretbox,i.box.open=function(x,S,w,j){var k=i.box.before(w,j);return i.secretbox.open(x,S,k)},i.box.open.after=i.secretbox.open,i.box.keyPair=function(){var x=new Uint8Array(As),S=new Uint8Array(Xn);return zi(x,S),{publicKey:x,secretKey:S}},i.box.keyPair.fromSecretKey=function(x){if(St(x),x.length!==Xn)throw new Error("bad secret key size");var S=new Uint8Array(As);return fn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},i.box.publicKeyLength=As,i.box.secretKeyLength=Xn,i.box.sharedKeyLength=hi,i.box.nonceLength=Ir,i.box.overheadLength=i.secretbox.overheadLength,i.sign=function(x,S){if(St(x,S),S.length!==Qt)throw new Error("bad secret key size");var w=new Uint8Array(Ke+x.length);return ci(w,x,x.length,S),w},i.sign.open=function(x,S){if(St(x,S),S.length!==at)throw new Error("bad public key size");var w=new Uint8Array(x.length),j=Gr(w,x,x.length,S);if(j<0)return null;for(var k=new Uint8Array(j),z=0;z<k.length;z++)k[z]=w[z];return k},i.sign.detached=function(x,S){for(var w=i.sign(x,S),j=new Uint8Array(Ke),k=0;k<j.length;k++)j[k]=w[k];return j},i.sign.detached.verify=function(x,S,w){if(St(x,S,w),S.length!==Ke)throw new Error("bad signature size");if(w.length!==at)throw new Error("bad public key size");var j=new Uint8Array(Ke+x.length),k=new Uint8Array(Ke+x.length),z;for(z=0;z<Ke;z++)j[z]=S[z];for(z=0;z<x.length;z++)j[z+Ke]=x[z];return Gr(k,j,j.length,w)>=0},i.sign.keyPair=function(){var x=new Uint8Array(at),S=new Uint8Array(Qt);return _s(x,S),{publicKey:x,secretKey:S}},i.sign.keyPair.fromSecretKey=function(x){if(St(x),x.length!==Qt)throw new Error("bad secret key size");for(var S=new Uint8Array(at),w=0;w<S.length;w++)S[w]=x[32+w];return{publicKey:S,secretKey:new Uint8Array(x)}},i.sign.keyPair.fromSeed=function(x){if(St(x),x.length!==di)throw new Error("bad seed size");for(var S=new Uint8Array(at),w=new Uint8Array(Qt),j=0;j<32;j++)w[j]=x[j];return _s(S,w,!0),{publicKey:S,secretKey:w}},i.sign.publicKeyLength=at,i.sign.secretKeyLength=Qt,i.sign.seedLength=di,i.sign.signatureLength=Ke,i.hash=function(x){St(x);var S=new Uint8Array(Qr);return ut(S,x,x.length),S},i.hash.hashLength=Qr,i.verify=function(x,S){return St(x,S),x.length===0||S.length===0||x.length!==S.length?!1:le(x,0,S,0,x.length)===0},i.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;i.setPRNG(function(w,j){var k,z=new Uint8Array(j);for(k=0;k<j;k+=S)x.getRandomValues(z.subarray(k,k+Math.min(j-k,S)));for(k=0;k<j;k++)w[k]=z[k];Hi(z)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&i.setPRNG(function(w,j){var k,z=x.randomBytes(j);for(k=0;k<j;k++)w[k]=z[k];Hi(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Co=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Co.sign.keyPair.fromSeed,Co.sign.detached,Co.sign.detached.verify,Co.randomBytes;var Q0;(function(i){i.InvalidPrefixByte="nkeys: invalid prefix byte",i.InvalidKey="nkeys: invalid key",i.InvalidPublicKey="nkeys: invalid public key",i.InvalidSeedLen="nkeys: invalid seed length",i.InvalidSeed="nkeys: invalid seed",i.InvalidEncoding="nkeys: invalid encoded key",i.InvalidSignature="nkeys: signature verification failed",i.CannotSign="nkeys: cannot sign, no private key available",i.PublicKeyOnly="nkeys: no seed or private key available",i.InvalidChecksum="nkeys: invalid checksum",i.SerializationError="nkeys: serialization error",i.ApiError="nkeys: api error",i.ClearedPair="nkeys: pair is cleared"})(Q0||(Q0={}));var J0;(function(i){i[i.Seed=144]="Seed",i[i.Private=120]="Private",i[i.Operator=112]="Operator",i[i.Server=104]="Server",i[i.Cluster=16]="Cluster",i[i.Account=0]="Account",i[i.User=160]="User"})(J0||(J0={}));function s_(i){return t=>{let s={};return i.forEach(a=>{const o=a(t)||{};s=Object.assign(s,o)}),s}}function i_(){return()=>{}}function r_(i,t){return()=>{const s=typeof i=="function"?i():i,a=typeof t=="function"?t():t;return{user:s,pass:a}}}function a_(i){return()=>({auth_token:typeof i=="function"?i():i})}const tg=120*1e3,l_=2,ng=2*1e3;function o_(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:tg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:ng,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function c_(i){const t=[];return typeof i.authenticator=="function"&&t.push(i.authenticator),Array.isArray(i.authenticator)&&t.push(...i.authenticator),i.token&&t.push(a_(i.token)),i.user&&t.push(r_(i.user,i.pass)),t.length===0?i_():s_(t)}function u_(i){const t=`${Bf}:${Zy()}`;if(i=i||{servers:[t]},i.servers=i.servers||[],typeof i.servers=="string"&&(i.servers=[i.servers]),i.servers.length>0&&i.port)throw new me("port and servers options are mutually exclusive",oe.InvalidOption);i.servers.length===0&&i.port&&(i.servers=[`${Bf}:${i.port}`]),i.servers&&i.servers.length===0&&(i.servers=[t]);const s=sc(o_(),i);if(s.authenticator=c_(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new me(`${a} option should be a function`,oe.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{gs(s.inboxPrefix)}catch(a){throw new me(a.message,oe.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Gf()=="function"),s.resolve&&typeof Gf()!="function")throw new me("'resolve' is not supported on this client",oe.InvalidOption);return s}function f_(i,t){const{proto:s,tls_required:a,tls_available:o}=i;if((s===void 0||s<1)&&t.noEcho)throw new me("noEcho",oe.ServerOptionNotAvailable);const u=a||o||!1;if(t.tls&&!u)throw new me("tls",oe.ServerOptionNotAvailable)}const h_=1024*32,d_=/^INFO\s+([^\r\n]+)\r\n/i,m_=Ia(`PONG\r
38
- `),K0=Ia(`PING\r
39
- `);class p_{constructor(t,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=t.version,this.lang=t.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):{})||{};sc(this,o)}}class sg extends Tt{constructor(s,a,o={}){var d;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");sc(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=it();const u=!((d=s.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=zr(o.timeout,u),this.timer.then(()=>{this.timer=void 0}).catch(m=>{this.stop(m),this.noIterator&&this.callback(m,{})})),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}),u=s.protocolFilterFn?s.protocolFilterFn:()=>!0,d=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(m,y)=>{const{ingest:g}=o(y);g&&u(y)&&(a(m,y),d(y))}}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(me.errorForCode(oe.ConnectionClosed)):this.isClosed()?Promise.reject(me.errorForCode(oe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(it()).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 y_{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(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const s=t.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(u=>u.subject===s.subject&&u.queue===s.queue)),s.operation==="publish"&&(o=a.find(u=>u.requestSubject===s.subject)),o)return o.callback(t,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class Zo{constructor(t,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=h_,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=s,this.subscriptions=new y_,this.muxSubscriptions=new Z1,this.outbound=new Br,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new M1({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new X1(a,{randomize:!t.noRandomize}),this.closed=it(),this.parser=new I0(this),this.heartbeats=new W1(this,this.options.pingInterval||tg,this.options.maxPingOut||l_)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const s=me.errorForCode(oe.Disconnect);s.stack="",t.forEach(a=>{a.reject(s)}),this.parser=new I0(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(s=>{s.push(t)})}status(){const t=new Tt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=it();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=s=>{t.reject(s)},this.transport=q1(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:kr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:kr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:ys.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:ys.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===oe.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(t)}async dial(t){const s=this.prepare();let a;try{a=zr(this.options.timeout||2e4);const o=this.transport.connect(t,this.options);await Promise.race([o,a]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().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(t){const{resolve:s}=this.options,a=await t.resolve({fn:Gf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const u of a)try{o=null,this.dispatchStatus({type:kr.Reconnecting,data:u.toString()}),await this.dial(u);return}catch(d){o=d}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():ng;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw t||(this.lastError?this.lastError:me.errorForCode(oe.ConnectionRefused));const u=Date.now();if(o.lastConnect===0||o.lastConnect+s<=u){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(d){if(t=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const m=this.options.maxReconnectAttempts||0;m!==-1&&o.reconnects>=m&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-u),await Lr(a)}}static async connect(t,s){const a=new Zo(t,s);return await a.dialLoop(),a}static toError(t){const s=t?t.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new me(t,oe.PermissionsViolation),o=t.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const u=t.match(/using queue "(\S+)"/);u&&(a.permissionContext.queue=u[1])}return a}else return s.indexOf("authorization violation")!==-1?new me(t,oe.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new me(t,oe.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new me(t,oe.AccountExpired):s.indexOf("authentication timeout")!==-1?new me(t,oe.AuthenticationTimeout):new me(t,oe.ProtocolError)}processMsg(t,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(t.sid);a&&(a.received+=1,a.callback&&a.callback(null,new dh(t,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(t){const s=M0(t),a=Zo.toError(s),o={type:ys.Error,data:a.code};if(a.isPermissionError()){let u=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const d=this.subscriptions.getMux();u=(d==null?void 0:d.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(u,a),u&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(m_)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const s=JSON.parse(M0(t));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(Ri(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:d}=this.transport;try{const m=new p_({version:u,lang:d},this.options,s.nonce);s.headers&&(m.headers=!0,m.no_responders=!0);const y=JSON.stringify(m);this.transport.send(Ia(`CONNECT ${y}${Lo}`)),this.transport.send(K0)}catch(m){this._close(m)}}a&&this.dispatchStatus({type:ys.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:ys.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Bt.MSG:{const{msg:s,data:a}=t;this.processMsg(s,a);break}case Bt.OK:break;case Bt.ERR:this.processError(t.data);break;case Bt.PING:this.processPing();break;case Bt.PONG:this.processPong();break;case Bt.INFO:this.processInfo(t.data);break}}sendCommand(t,...s){const a=this.outbound.length();let o;typeof t=="string"?o=Ia(t):o=t,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,s=on,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=qi.encode(s);else throw me.errorForCode(oe.BadPayload);let u=o.length;a=a||{},a.reply=a.reply||"";let d=on,m=0;if(a.headers){if(this.info&&!this.info.headers)throw new me("headers",oe.ServerOptionNotAvailable);d=a.headers.encode(),m=d.length,u=o.length+m}if(this.info&&u>this.info.max_payload)throw me.errorForCode(oe.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let y;a.headers?(a.reply?y=`HPUB ${t} ${a.reply} ${m} ${u}\r
40
- `:y=`HPUB ${t} ${m} ${u}\r
41
- `,this.sendCommand(y,d,o,Xo)):(a.reply?y=`PUB ${t} ${a.reply} ${u}\r
42
- `:y=`PUB ${t} ${u}\r
43
- `,this.sendCommand(y,o,Xo))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
44
- `):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
45
- `)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,s){this.unsub(t,s),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,s){!t||this.isClosed()||(s?this.sendCommand(`UNSUB ${t.sid} ${s}\r
46
- `):this.sendCommand(`UNSUB ${t.sid}\r
47
- `),t.max=s)}resub(t,s){!t||this.isClosed()||(this.unsub(t),t.subject=s,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=it()),this.pongs.push(t),this.outbound.fill(K0),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?t.push(`SUB ${a.subject} ${a.queue} ${a.sid}${Lo}`):t.push(`SUB ${a.subject} ${a.sid}${Lo}`)}),t.length&&this.transport.send(Ia(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),s=[];return t.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 t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new sg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const g_="$SRV";class X0{constructor(t){v(this,"msg");this.msg=t}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(t,s){return this.msg.respond(t,s)}respondError(t,s,a,o){var u,d;return o=o||{},o.headers=o.headers||bs(),(u=o.headers)==null||u.set(Io,`${t}`),(d=o.headers)==null||d.set(Go,s),this.msg.respond(a,o)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class Wa{constructor(t,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&x_("service group",s);let o="";if(t instanceof il)this.srv=t,o="";else if(t instanceof Wa){const u=t;this.srv=u.srv,a===""&&u.queue!==""&&(a=u.queue),o=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(t,s=""){return s===""?t:t!==""?`${t}.${s}`:s}addEndpoint(t="",s){s=s||{subject:t};const a=typeof s=="function"?{handler:s,subject:t}:s;Ya("endpoint",t);let{subject:o,handler:u,metadata:d,queue:m}=a;o=o||t,m=m||this.queue,b_("endpoint subject",o),o=this.calcSubject(this.subject,o);const y={name:t,subject:o,queue:m,handler:u,metadata:d};return this.srv._addEndpoint(y)}addGroup(t="",s=""){return new Wa(this,t,s)}}function b_(i,t){if(t==="")throw new Error(`${i} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${t}'`);const s=t.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${i} cannot have internal '>': '${t}'`)})}function x_(i,t){if(t.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${t}'`);t.split(".").forEach(a=>{if(a===">")throw new Error(`${i} name cannot contain internal '>': '${t}'`)})}class il{constructor(t,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=t,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Ya("name",this.config.name),Ya("queue",this.config.queue),Ri(this.config.version),this._id=ii.next(),this.internal=[],this._done=it(),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(t,s="",a="",o){const u=o??g_;return s===""&&a===""?`${u}.${t}`:(Ya("control subject name",s),a!==""?(Ya("control subject id",a),`${u}.${t}.${s}.${a}`):`${u}.${t}.${s}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.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(t){const s=bs();if(t instanceof Qo){const a=t;s.set(Go,a.message),s.set(Io,`${a.code}`)}else s.set(Go,t.message),s.set(Io,"500");return s}setupHandler(t,s=!1){const a=s?"":t.queue?t.queue:this.config.queue,{name:o,subject:u,handler:d}=t,m=t;m.internal=s,s&&this.internal.push(m),m.stats=new v_(o,u,a),m.queue=a;const y=d?(g,E)=>{if(g){this.close(g);return}const _=Date.now();try{d(g,new X0(E))}catch(T){m.stats.countError(T),E==null||E.respond(on,{headers:this.errorToHeader(T)})}finally{m.stats.countLatency(_)}}:void 0;return m.sub=this.nc.subscribe(u,{callback:y,queue:a}),m.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(g=>{if(!this._stopped){const E=new Error(`required subscription ${t.subject} errored: ${g.message}`);E.stack=g.stack,this.close(E).catch()}}),m}info(){return{type:Qa.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:s,metadata:a,name:o,queue:u}=t;return{subject:s,metadata:a,name:o,queue_group:u}})}async stats(){const t=[];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)}t.push(s.stats.stats(s.qi))}return{type:Qa.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,s){const a=`${t}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,t,s),this._doAddInternalHandler(`${a}-kind`,t,s,this.name),this._doAddInternalHandler(`${a}`,t,s,this.name,this.id)}_doAddInternalHandler(t,s,a,o="",u=""){const d={};d.name=t,d.subject=il.controlSubject(s,o,u),d.handler=a,this.setupHandler(d,!0)}start(){const t=qn(),s=(d,m)=>d?(this.close(d),Promise.reject(d)):this.stats().then(y=>(m==null||m.respond(t.encode(y)),Promise.resolve())),a=(d,m)=>d?(this.close(d),Promise.reject(d)):(m==null||m.respond(t.encode(this.info())),Promise.resolve()),o=t.encode(this.ping()),u=(d,m)=>d?(this.close(d).then().catch(),Promise.reject(d)):(m.respond(o),Promise.resolve());return this.addInternalHandler(Ws.PING,u),this.addInternalHandler(Ws.STATS,s),this.addInternalHandler(Ws.INFO,a),this.handlers.forEach(d=>{const{subject:m}=d;typeof m=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(t){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(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:Qa.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,s){return new Wa(this,t,s)}addEndpoint(t,s){return new Wa(this).addEndpoint(t,s)}_addEndpoint(t){const s=new Tt;s.noIterator=typeof t.handler=="function",s.noIterator||(t.handler=(o,u)=>{o?this.stop(o).catch():s.push(new X0(u))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(t,!1);return a.qi=s,this.handlers.push(a),s}}class v_{constructor(t,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=t,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(t){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=t;s&&(s.time=0,s.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=st(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:s,average_processing_time:a,num_errors:o,num_requests:u,processing_time:d,last_error:m,data:y,queue:g}=this;return{name:t,subject:s,average_processing_time:a,num_errors:o,num_requests:u,processing_time:d,last_error:m,data:y,queue_group:g}}stats(t){const s=t;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=st(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 __{constructor(t,s={strategy:Dn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=t,this.prefix=a,this.opts=s}ping(t="",s=""){return this.q(Ws.PING,t,s)}stats(t="",s=""){return this.q(Ws.STATS,t,s)}info(t="",s=""){return this.q(Ws.INFO,t,s)}async q(t,s="",a=""){const o=new Tt,u=qn(),d=il.controlSubject(t,s,a,this.prefix),m=await this.nc.requestMany(d,on,this.opts);return(async()=>{for await(const y of m)try{const g=u.decode(y.data);o.push(g)}catch(g){o.push(()=>{o.stop(g)})}o.push(()=>{o.stop()})})().catch(y=>{o.stop(y)}),o}}function ig(){return{key:{encode(i){return i},decode(i){return i}},value:{encode(i){return i},decode(i){return i}}}}function w_(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:ig(),storage:Yf.File}}const Wo="KV-Operation",Z0="$KV",S_=/^[-/=.\w]+$/,E_=/^[-/=.>*\w]+$/,j_=/^[-\w]+$/;function A_(i){if(i.startsWith(".")||i.endsWith(".")||!S_.test(i))throw new Error(`invalid key: ${i}`)}function O_(i){if(i.startsWith(".")||i.endsWith(".")||!E_.test(i))throw new Error(`invalid key: ${i}`)}function T_(i){if(i.startsWith(".")||i.endsWith("."))throw new Error(`invalid key: ${i}`);const t=i.split(".");let s=!1;for(let a=0;a<t.length;a++)switch(t[a]){case"*":s=!0;break;case">":if(a!==t.length-1)throw new Error(`invalid key: ${i}`);s=!0;break}return s}function Po(i){if(!j_.test(i))throw new Error(`invalid bucket name: ${i}`)}var Vn;(function(i){i.MsgIdHdr="Nats-Msg-Id",i.ExpectedStreamHdr="Nats-Expected-Stream",i.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",i.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",i.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Vn||(Vn={}));class el{constructor(t,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",A_);v(this,"validateSearchKey",O_);v(this,"hasWildcards",T_);Po(t),this.js=s,this.jsm=a,this.bucket=t,this.prefix=Z0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,s,a={}){Po(s);const o=await t.jetstreamManager(),u=new el(s,t,o);return await u.init(a),u}static async bind(t,s,a={}){const o=await t.jetstreamManager(),u={config:{allow_direct:a.allow_direct}};Po(s);const d=new el(s,t,o);return u.config.name=a.streamName??d.bucketName(),Object.assign(d,u),d.stream=u.config.name,d.codec=a.codec||ig(),d.direct=u.config.allow_direct??!1,d.initializePrefixes(u),d}async init(t={}){const s=Object.assign(w_(),t);this.codec=s.codec;const a={};this.stream=a.name=t.streamName??this.bucketName(),a.retention=$f.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=t.placementCluster??"";if(o&&(t.placement={},t.placement.cluster=o,t.placement.tags=[]),t.placement&&(a.placement=t.placement),t.republish&&(a.republish=t.republish),t.description&&(a.description=t.description),t.mirror){const _=Object.assign({},t.mirror);_.name.startsWith(rn)||(_.name=`${rn}${_.name}`),a.mirror=_,a.mirror_direct=!0}else if(t.sources){const _=t.sources.map(T=>{const q=Object.assign({},T),C=q.name.startsWith(rn)?q.name.substring(rn.length):q.name;return q.name.startsWith(rn)||(q.name=`${rn}${q.name}`),!T.external&&C!==this.bucket&&(q.subject_transforms=[{src:`$KV.${C}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=_,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];t.metadata&&(a.metadata=t.metadata),typeof t.compression=="boolean"&&(a.compression=t.compression?ri.S2:ri.None);const u=this.js.nc,d=u.getServerVersion(),m=d?Ff(d,Ri("2.7.2"))>=0:!1;a.discard=m?Za.New:Za.Old;const{ok:y,min:g}=u.features.get(Le.JS_ALLOW_DIRECT);if(!y&&t.allow_direct===!0){const _=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${_} - requires ${g}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:y,a.allow_direct=t.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=st(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(_){if(_.message==="stream not found")E=await this.jsm.streams.add(a);else throw _}this.initializePrefixes(E)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=t.config;if(s){let a=s.name;if(a.startsWith(rn)&&(a=a.substring(rn.length)),s.external&&s.external.api!==""){const o=s.name.substring(rn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${rn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,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(t),a.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${Z0}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const s=[];for(const a of t.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(t){const s=[];for(const a of t.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(t,s){const a=s&&s.get(Lt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):t.length}smToEntry(t){return new Y_(this.bucket,this.prefixLen,t)}jmToEntry(t){const s=this.decodeKey(t.subject.substring(this.prefixLen));return new V_(this.bucket,s,t)}async create(t,s){var u;let a;try{const d=await this.put(t,s,{previousSeq:0});return Promise.resolve(d)}catch(d){if(a=d,((u=d==null?void 0:d.api_error)==null?void 0:u.err_code)!==10071)return Promise.reject(d)}let o=0;try{const d=await this.get(t);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(o=d!==null?d.revision:0,this.update(t,s,o)):Promise.reject(a)}catch(d){return Promise.reject(d)}}update(t,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(t,s,{previousSeq:a})}async put(t,s,a={}){var d,m;const o=this.encodeKey(t);this.validateKey(o);const u={};if(a.previousSeq!==void 0){const y=bs();u.headers=y,y.set(Vn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,u)).seq}catch(y){const g=y;return g.isJetStreamError()?(g.message=(d=g.api_error)==null?void 0:d.description,g.code=`${(m=g.api_error)==null?void 0:m.code}`,Promise.reject(g)):Promise.reject(y)}}async get(t,s){const a=this.encodeKey(t);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),o):u=await this.jsm.streams.getMessage(this.bucketName(),o);const d=this.smToEntry(u);return d.key!==a?null:d}catch(d){if(d.code===oe.JetStream404NoMessages)return null;throw d}}purge(t,s){return this._deleteOrPurge(t,"PURGE",s)}delete(t,s){return this._deleteOrPurge(t,"DEL",s)}async purgeDeletes(t=1800*1e3){const s=it(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const y of o)(y.operation==="DEL"||y.operation==="PURGE")&&a.push(y)})().then(),await s,o.stop();const u=Date.now()-t,d=a.map(y=>{const g=this.subjectForKey(y.key);return y.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:g,keep:1}):this.jsm.streams.purge(this.stream,{filter:g,keep:0})}),m=await Promise.all(d);return m.unshift({success:!0,purged:0}),m.reduce((y,g)=>(y.purged+=g.purged,y))}async _deleteOrPurge(t,s,a){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,s,a);const o=await this.keys(t),u=[];for await(const d of o)u.push(this._doDeleteOrPurge(d,s)),u.length===100&&(await Promise.all(u),u.length=0);u.length>0&&await Promise.all(u)}async _doDeleteOrPurge(t,s,a){const o=this.encodeKey(t);this.validateKey(o);const u=bs();u.set(Wo,s),s==="PURGE"&&u.set(Lt.RollupHdr,Lt.RollupValueSubject),a!=null&&a.previousSeq&&u.set(Vn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),on,{headers:u})}_buildCC(t,s,a={}){let u=(Array.isArray(t)?t:[t]).map(y=>{const g=this.encodeKey(y);return this.validateSearchKey(y),this.fullKeyName(g)}),d=dt.LastPerSubject;s===Mn.AllHistory&&(d=dt.All),s===Mn.UpdatesOnly&&(d=dt.New);let m;return u.length===1&&(m=u[0],u=void 0),Object.assign({deliver_policy:d,ack_policy:Ot.None,filter_subjects:u,filter_subject:m,flow_control:!0,idle_heartbeat:st(5*1e3)},a)}remove(t){return this.purge(t)}async history(t={}){const s=t.key??">",a=new Tt,o={};o.headers_only=t.headers_only||!1;let u;u=()=>{a.stop()};let d=0;const m=this._buildCC(s,Mn.AllHistory,o),y=m.filter_subject,g=ti(m);g.bindStream(this.stream),g.orderedConsumer(),g.callback((_,T)=>{if(_){a.stop(_);return}if(T){const q=this.jmToEntry(T);a.push(q),a.received++,(u&&d>0&&a.received>=d||T.info.pending===0)&&(a.push(u),u=void 0)}});const E=await this.js.subscribe(y,g);if(u){const{info:{last:_}}=E,T=_.num_pending+_.delivered.consumer_seq;if(T===0||a.received>=T)try{u()}catch(q){a.stop(q)}finally{u=void 0}else d=T}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(_=>{a.stop(_)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Le.JS_NEW_CONSUMER_CREATE_API);return a}async watch(t={}){const s=t.key??">",a=new Tt,o={};o.headers_only=t.headers_only||!1;let u=Mn.LastValue;t.include===Mn.AllHistory?u=Mn.AllHistory:t.include===Mn.UpdatesOnly&&(u=Mn.UpdatesOnly);const d=t.ignoreDeletes===!0;let m=t.initializedFn,y=0;const g=this._buildCC(s,u,o),E=g.filter_subject,_=ti(g);this.canSetWatcherName()&&_.consumerName(ii.next()),_.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&_.startSequence(t.resumeFromRevision),_.orderedConsumer(),_.callback((q,C)=>{if(q){a.stop(q);return}if(C){const R=this.jmToEntry(C);if(d&&R.operation==="DEL")return;a.push(R),a.received++,m&&(y>0&&a.received>=y||C.info.pending===0)&&(a.push(m),m=void 0)}});const T=await this.js.subscribe(E,_);if(m){const{info:{last:q}}=T,C=q.num_pending+q.delivered.consumer_seq;if(C===0||a.received>=C)try{m()}catch(R){a.stop(R)}finally{m=void 0}else y=C}return a._data=T,a.iterClosed.then(()=>{T.unsubscribe()}),T.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(t=">"){const s=new Tt,a=this._buildCC(t,Mn.LastValue,{headers_only:!0}),o=Array.isArray(t)?">":a.filter_subject,u=ti(a);u.bindStream(this.stream),u.orderedConsumer();const d=await this.js.subscribe(o,u);return(async()=>{var y;for await(const g of d){const E=(y=g.headers)==null?void 0:y.get(Wo);if(E!=="DEL"&&E!=="PURGE"){const _=this.decodeKey(g.subject.substring(this.prefixLen));s.push(_)}g.info.pending===0&&d.unsubscribe()}})().then(()=>{s.stop()}).catch(y=>{s.stop(y)}),d.info.last.num_pending===0&&d.unsubscribe(),s}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var u;const s=((u=this.js.nc.info)==null?void 0:u.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new rg(o,s)}}class rg{constructor(t,s=""){v(this,"si");v(this,"cluster");this.si=t,this.cluster=s}get bucket(){return this.si.config.name.startsWith(rn)?this.si.config.name.substring(rn.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 hh(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 t;return((t=this.si.config.placement)==null?void 0:t.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!==ri.None:!1}}const ph="OBJ_",W0="SHA-256=";function N_(i){return Po(i),`${ph}${i}`}function k_(i){return i.startsWith(ph)?i.substring(4):i}class Jf{constructor(t){v(this,"si");v(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return k_(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!==ri.None:!1}}function Mo(i){if(i===void 0)return;const{domain:t}=i;if(t===void 0)return i;const s=Object.assign({},i);if(delete s.domain,t==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${t}.API`},s}var wn;(function(i){i[i.Unset=-1]="Unset",i[i.Consume=0]="Consume",i[i.Fetch=1]="Fetch"})(wn||(wn={}));var Fn;(function(i){i.HeartbeatsMissed="heartbeats_missed",i.ConsumerNotFound="consumer_not_found",i.StreamNotFound="stream_not_found",i.ConsumerDeleted="consumer_deleted",i.OrderedConsumerRecreated="ordered_consumer_recreated",i.NoResponders="no_responders"})(Fn||(Fn={}));var Dr;(function(i){i.DebugEvent="debug",i.Discard="discard",i.Reset="reset",i.Next="next"})(Dr||(Dr={}));const ey=Uint8Array.of(43,65,67,75),C_=Uint8Array.of(45,78,65,75),Ba=Uint8Array.of(43,87,80,73),M_=Uint8Array.of(43,78,88,84),R_=Uint8Array.of(43,84,69,82,77),D_=Uint8Array.of(32);function tl(i,t=5e3){return new X_(i,t)}class Nf extends Tt{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 u=a;this.opts=this.parseOptions(a,o),this.callback=u.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=gs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=u.abort_on_missing_resource===!0,this.bind=u.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:u,threshold_messages:d}=this.opts;this.closed().then(y=>{if(this.cleanupHandler)try{this.cleanupHandler(y)}catch{}});const{sub:m}=this;m&&m.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(y,g)=>{var _,T,q,C;if(y){this.stop(y);return}if((_=this.monitor)==null||_.work(),g.subject===this.inbox){if(Hf(g))return;const R=(T=g.headers)==null?void 0:T.code,Q=((C=(q=g.headers)==null?void 0:q.description)==null?void 0:C.toLowerCase())||"unknown",{msgsLeft:se,bytesLeft:U}=this.parseDiscard(g.headers);if(se>0||U>0)this.pending.msgs-=se,this.pending.bytes-=U,this.pending.requests--,this.notify(Dr.Discard,{msgsLeft:se,bytesLeft:U});else if(R===400){this.stop(new me(Q,`${R}`));return}else if(R===409&&Q==="consumer deleted"){if(this.notify(Fn.ConsumerDeleted,`${R} ${Q}`),!this.refilling||this.abortOnMissingResource){const le=new me(Q,`${R}`);this.stop(le);return}}else if(R===503){if(this.notify(Fn.NoResponders,`${R} No Responders`),!this.refilling||this.abortOnMissingResource){const le=new me("no responders",`${R}`);this.stop(le);return}}else this.notify(Dr.DebugEvent,`${R} ${Q}`)}else this._push(tl(g,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=g.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=d||a&&this.pending.bytes<=u){const R=this.pullOptions();this.pull(R)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new mh(o,y=>(this.notify(Fn.HeartbeatsMissed,y),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var g;const y=this.consumer.api.nc.status();this.statusIterator=y;for await(const E of y)switch(E.type){case ys.Disconnect:(g=this.monitor)==null||g.cancel();break;case ys.Reconnect:this.resetPending().then(_=>{var T;_&&((T=this.monitor)==null||T.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=fh([this.opts.expires]);let u=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(d){if(d.message==="stream not found"){if(a++,this.notify(Fn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(s++,this.notify(Fn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(d),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const m=o.backoff(u),y=Lr(m);await Promise.race([y,this.consumer.api.nc.closed()]),y.cancel(),u++}}}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(Dr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=st(this.opts.idle_heartbeat),u=st(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:u}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Lt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const u=s==null?void 0:s.get(Lt.PendingBytesHdr);return u&&(a.bytesLeft=parseInt(u)),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(u=>{u.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 u=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||u;const d=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||d}return o}status(){const s=new Tt;return this.listeners.push(s),Promise.resolve(s)}}class q_ extends Tt{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 Tt;return this.listeners.push(s),Promise.resolve(s)}}class Kf{constructor(t,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=t,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Nf(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const s=new Nf(this,t,!1),a=Math.round(s.opts.expires*1.05),o=zr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(t={expires:3e4}){const s=it(),a=t;a.max_messages=1;const o=new Nf(this,a,!1),u=Math.round(o.opts.expires*1.05);u>=6e4&&(async()=>{for await(const m of await o.status())if(m.type===Fn.HeartbeatsMissed&&m.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const m of o){s.resolve(m);break}})().catch(()=>{});const d=zr(u);return o.closed().then(m=>{m?s.reject(m):s.resolve(null)}).catch(m=>{s.reject(m)}).finally(()=>{d.cancel()}),d.catch(m=>{s.resolve(null),o.close().catch()}),o.trackTimeout(d),s}delete(){const{stream_name:t,name:s}=this._info;return this.api.delete(t,s)}info(t=!1){if(t)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 z_{constructor(t,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=t,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=ii.next(),typeof a.name_prefix=="string"&&(ic("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=wn.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(t){this.serial++;const s=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const a={name:s,deliver_policy:dt.StartSequence,opt_start_seq:t,ack_policy:Ot.None,inactive_threshold:st(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),t===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||dt.StartSequence,(this.consumerOpts.deliver_policy===dt.LastPerSubject||this.consumerOpts.deliver_policy===dt.New||this.consumerOpts.deliver_policy===dt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===dt.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=dt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=st(this.consumerOpts.inactive_threshold))),a}async resetConsumer(t=0){var d,m,y,g,E;ii.next();const s=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(t);a.max_deliver=1,a.mem_storage=!0;const o=fh([((m=this.opts)==null?void 0:m.expires)||3e4]);let u;for(let _=0;;_++)try{u=await this.api.add(this.stream,a),(y=this.iter)==null||y.notify(Fn.OrderedConsumerRecreated,u.name);break}catch(T){if(T.message==="stream not found"&&((g=this.iter)==null||g.notify(Fn.StreamNotFound,_),this.type===wn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(T),Promise.reject(T);if(s&&_>=this.maxInitialReset)throw T;await Lr(o.backoff(_+1))}return u}internalHandler(t){return s=>{var o;if(this.serial!==t)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(t={max_messages:100,expires:3e4},s){var y,g;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===wn.Fetch&&o){(y=this.iter)==null||y.src.stop(),await((g=this.iter)==null?void 0:g.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 q_),this.consumer=new Kf(this.api,this.currentConsumer);const u=t;u.callback=this.internalHandler(this.serial);let d=null;this.type===wn.Fetch&&a?d=await this.consumer.fetch(t):this.type===wn.Consume&&(d=await this.consumer.consume(t));const m=d;m.forOrderedConsumer=!0,m.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(m)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(Dr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===wn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===wn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=t;return a&&(this.userCallback=a),this.type=wn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var o;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===wn.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}=t;return a&&(this.userCallback=a),this.type=wn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const s=t;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=it();return s.callback=u=>{this.userCallback=null,a.resolve(u)},(await this.fetch(s)).iterClosed.then(u=>{u&&a.reject(u),a.resolve(null)}).catch(u=>{a.reject(u)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Xf{constructor(t){v(this,"api");v(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Le.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Kf(this.api,t)}async get(t,s={}){return typeof s=="object"?this.ordered(t,s):(await this.checkVersion(),this.api.info(t,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Kf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(t,s){await this.checkVersion();const a=this.api;return new yh(a.nc,a.opts).info(t).then(u=>Promise.resolve(new z_(this.api,t,s))).catch(u=>Promise.reject(u))}}class ac{constructor(t,s){v(this,"api");v(this,"_info");this.api=t,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new ac(this.api,t)}else return this}info(t=!1,s){return t?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(t){return new Xf(new Ko(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new Xf(new Ko(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,s){return this.api.deleteMessage(this.name,t,s)}}class yh extends sl{constructor(t,s){super(t,s)}checkStreamConfigVersions(t){const s=this.nc;if(t.metadata){const{min:o,ok:u}=s.features.get(Le.JS_STREAM_CONSUMER_METADATA);if(!u)throw new Error(`stream 'metadata' requires server ${o}`)}if(t.first_seq){const{min:o,ok:u}=s.features.get(Le.JS_STREAM_FIRST_SEQ);if(!u)throw new Error(`stream 'first_seq' requires server ${o}`)}if(t.subject_transform){const{min:o,ok:u}=s.features.get(Le.JS_STREAM_SUBJECT_TRANSFORM);if(!u)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(t.compression){const{min:o,ok:u}=s.features.get(Le.JS_STREAM_COMPRESSION);if(!u)throw new Error(`stream 'compression' requires server ${o}`)}if(t.consumer_limits){const{min:o,ok:u}=s.features.get(Le.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,u){var m;if((((m=u==null?void 0:u.subject_transforms)==null?void 0:m.length)||0)>0){const{min:y,ok:g}=s.features.get(Le.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!g)throw new Error(`${o} 'subject_transforms' requires server ${y}`)}}t.sources&&t.sources.forEach(o=>{a("stream sources",o)}),t.mirror&&a("stream mirror",t.mirror)}async add(t={}){var o;this.checkStreamConfigVersions(t),Ut(t.name),t.mirror=Mo(t.mirror),t.sources=(o=t.sources)==null?void 0:o.map(Mo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(a),a}async delete(t){return Ut(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,s={}){var m;if(typeof t=="object"){const y=t;t=y.name,s=y,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),Ut(t);const a=await this.info(t),o=Object.assign(a.config,s);o.mirror=Mo(o.mirror),o.sources=(m=o.sources)==null?void 0:m.map(Mo);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,o);return this._fixInfo(d),d}async info(t,s){Ut(t);const a=`${this.prefix}.STREAM.INFO.${t}`;let u=await this._request(a,s),{total:d,limit:m}=u,y=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(d&&d>y){const g=[u],E=s||{};let _=0;for(;d>y;){_++,E.offset=m*_;const q=await this._request(a,E);d=q.total,g.push(q);const C=Object.getOwnPropertyNames(q.state.subjects).length;if(y+=C,C<m)break}let T={};for(let q=0;q<g.length;q++)u=g[q],u.state.subjects&&(T=Object.assign(T,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=T}return this._fixInfo(u),u}list(t=""){const s=t!=null&&t.length?{subject:t}:{},a=u=>{const d=u;return d.streams.forEach(m=>{this._fixInfo(m)}),d.streams},o=`${this.prefix}.STREAM.LIST`;return new Va(o,a,this,s)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,s){if(s){const{keep:o,seq:u}=s;if(typeof o=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return Ut(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,s)}async deleteMessage(t,s,a=!0){Ut(t);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,o)).success}async getMessage(t,s){Ut(t);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,s);return new ag(o)}find(t){return this.findStream(t)}listKvs(){const t=a=>{var y;const u=a.streams.filter(g=>g.config.name.startsWith(rn));u.forEach(g=>{this._fixInfo(g)});let d="";return u.length&&(d=((y=this.nc.info)==null?void 0:y.cluster)??""),u.map(g=>new rg(g,d))},s=`${this.prefix}.STREAM.LIST`;return new Va(s,t,this)}listObjectStores(){const t=a=>{const u=a.streams.filter(m=>m.config.name.startsWith(ph));return u.forEach(m=>{this._fixInfo(m)}),u.map(m=>new Jf(m))},s=`${this.prefix}.STREAM.LIST`;return new Va(s,t,this)}names(t=""){const s=t!=null&&t.length?{subject:t}:{},a=u=>u.streams,o=`${this.prefix}.STREAM.NAMES`;return new Va(o,a,this,s)}async get(t){const s=await this.info(t);return Promise.resolve(new ac(this,s))}}class U_ extends sl{constructor(t,s){super(t,s)}async getMessage(t,s){Ut(t);let a=s;const{last_by_subj:o}=a;o&&(a=null);const u=a?this.jc.encode(a):on,d=this.opts.apiPrefix||"$JS.API",m=o?`${d}.DIRECT.GET.${t}.${o}`:`${d}.DIRECT.GET.${t}`,y=await this.nc.request(m,u,{timeout:this.timeout}),g=Mr(y);if(g)return Promise.reject(g);const E=new Zf(y);return Promise.resolve(E)}async getBatch(t,s){Ut(t);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const u=JSON.stringify(s,(y,g)=>y==="up_to_time"&&g instanceof Date?g.toISOString():g),d=new Tt,m=await this.nc.requestMany(o,u,{strategy:Dn.SentinelMsg});return(async()=>{var _,T,q;let y=!1,g=!1,E;for await(const C of m){if(!y){y=!0;const R=((_=C.headers)==null?void 0:_.code)||0;if(R!==0&&R<200||R>299){E=(T=C.headers)==null?void 0:T.description.toLowerCase();break}if(((q=C.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){g=!0;break}}if(C.data.length===0)break;d.push(new Zf(C))}d.push(()=>{if(g)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);d.stop()})})(),Promise.resolve(d)}}class Zf{constructor(t){v(this,"data");v(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Ar.Subject)}get seq(){const t=this.header.last(Ar.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ar.TimeStamp)}get stream(){return this.header.last(Ar.Stream)}json(t){return qn(t).decode(this.data)}string(){return an.decode(this.data)}}v(Zf,"jc");class B_ extends sl{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new yh(s,a),this.consumers=new Ko(s,a),this.direct=new U_(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Tt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const u=this.parseJsResponse(o),d=u.type.split("."),m=d[d.length-1];s.push({kind:m,data:u})}catch(u){s.stop(u)}}}),s}}class ag{constructor(t){v(this,"_header");v(this,"smr");this.smr=t}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):on}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=ei.decode(t)}else this._header=bs();return this._header}_parse(t){const s=atob(t),a=s.length,o=new Uint8Array(a);for(let u=0;u<a;u++)o[u]=s.charCodeAt(u);return o}json(t){return qn(t).decode(this.data)}string(){return an.decode(this.data)}}v(ag,"jc");class L_{constructor(t){v(this,"api");this.api=t}get(t){return this.api.info(t).then(s=>new ac(this.api,s))}}class kf{constructor(t){v(this,"info");v(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=ei.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 t,s;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function ty(i){const t={name:i.name,description:i.description??"",options:i.options,metadata:i.metadata};if(i.headers){const s=i.headers;t.headers=s.toRecord()}return t}function P_(){return new ReadableStream({pull(i){i.enqueue(new Uint8Array(0)),i.close()}})}class Ka{constructor(t,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=t,this.jsm=s,this.js=a}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const s=await this.rawInfo(t);return s?new kf(s):null}async list(){const t=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;t.push(a)}return Promise.resolve(t)}async rawInfo(t){const{name:s,error:a}=this._checkNotEmpty(t);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),m=qn().decode(u.data);return m.revision=u.seq,m}catch(u){return u.code==="404"?null:Promise.reject(u)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new Jf(t)))}async status(t){const s=await this._si(t);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Jf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,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:u,previousRevision:d}=a,m=this.js.nc.info,y=(m==null?void 0:m.max_payload)||1024;t=t||{},t.options=t.options||{};let g=((re=t.options)==null?void 0:re.max_chunk_size)||128*1024;g=g>y?y:g,t.options.max_chunk_size=g;const E=await this.info(t.name),{name:_,error:T}=this._checkNotEmpty(t.name);if(T)return Promise.reject(T);const q=ii.next(),C=this._chunkSubject(q),R=this._metaSubject(_),Q=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},ty(t)),se=it(),U=[],le=new Br;try{const N=s?s.getReader():null,Z=V0.create();for(;;){const{done:ce,value:G}=N?await N.read():{done:!0,value:void 0};if(ce){if(le.size()>0){const ie=le.drain();Z.update(ie),Q.chunks++,Q.size+=ie.length,U.push(this.js.publish(C,ie,{timeout:u}))}await Promise.all(U),U.length=0,Q.mtime=new Date().toISOString();const F=Rr.encode(Z.digest());Q.digest=`${W0}${F}`,Q.deleted=!1;const K=bs();typeof d=="number"&&K.set(Vn.ExpectedLastSubjectSequenceHdr,`${d}`),K.set(Lt.RollupHdr,Lt.RollupValueSubject);const J=await this.js.publish(R,qn().encode(Q),{headers:K,timeout:u});if(Q.revision=J.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}se.resolve(new kf(Q));break}if(G)for(le.fill(G);le.size()>g;){Q.chunks++,Q.size+=g;const F=le.drain(t.options.max_chunk_size);Z.update(F),U.push(this.js.publish(C,F,{timeout:u}))}}}catch(N){await this.jsm.streams.purge(this.stream,{filter:C}),se.reject(N)}return se}putBlob(t,s,a){function o(u){return new ReadableStream({pull(d){d.enqueue(u),d.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(t,o(s),a)}put(t,s,a){var o;return(o=t==null?void 0:t.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,s,a)}async getBlob(t){async function s(u){const d=new Br,m=u.getReader();for(;;){const{done:y,value:g}=await m.read();if(y)return d.drain();g&&g.length&&d.fill(g)}}const a=await this.get(t);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(t){const s=await this.rawInfo(t);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const _=s.options.link.name||"";if(_==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Ka.create(this.js,s.options.link.bucket):this).get(_)}if(!s.digest.startsWith(W0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Vf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=it(),u={info:new kf(s),error:o};if(s.size===0)return u.data=P_(),o.resolve(null),Promise.resolve(u);let d;const m=ti();m.orderedConsumer();const y=V0.create(),g=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(g,m);return(async()=>{for await(const _ of E)_.data.length>0&&(y.update(_.data),d.enqueue(_.data)),_.info.pending===0&&(T1(a,y.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(_=>{d.error(_),o.reject(_)}),u.data=new ReadableStream({start(_){d=_},cancel(){E.unsubscribe()}}),u}linkStore(t,s){if(!(s instanceof Ka))return Promise.reject("bucket required");const a=s,{name:o,error:u}=this._checkNotEmpty(t);if(u)return Promise.reject(u);const d={name:o,options:{link:{bucket:a.name}}};return this._put(d,null)}async link(t,s){const{name:a,error:o}=this._checkNotEmpty(t);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 u=await this.rawInfo(t);if(u!==null&&!u.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:s.bucket,name:s.name},m={name:a,bucket:s.bucket,options:{link:d}};await this.js.publish(this._metaSubject(t),JSON.stringify(m));const y=await this.info(t);return Promise.resolve(y)}async delete(t){const s=await this.rawInfo(t);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=qn(),o=bs();return o.set(Lt.RollupHdr,Lt.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(t,s={}){const a=await this.rawInfo(t);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:u}=this._checkNotEmpty(s.name);if(u)return Promise.reject(u);if(t!==s.name){const y=await this.info(s.name);if(y&&!y.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const d=Object.assign({},a,ty(s)),m=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return t!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(m)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let s=!1;const a=new Tt,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(y){y.code==="404"?(a.push(null),s=!0):a.stop(y)}const u=qn(),d=ti();d.orderedConsumer(),t.includeHistory?d.deliverLastPerSubject():(s=!0,d.deliverNew()),d.callback((y,g)=>{var E;if(y){a.stop(y);return}if(g!==null){const _=u.decode(g.data);_.deleted&&t.ignoreDeletes===!0||a.push(_),((E=g.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const m=await this.js.subscribe(o,d);return a._data=m,a.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{a.stop()}).catch(y=>{a.stop(y)}),a}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Rr.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=N_(this.name)}catch(o){return Promise.reject(o)}const s=(t==null?void 0:t.ttl)||0;delete t.ttl;const a=Object.assign({max_age:s},t);a.name=this.stream,a.num_replicas=t.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Za.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(a.placement=t.placement),t.metadata&&(a.metadata=t.metadata),typeof t.compression=="boolean"&&(a.compression=t.compression?ri.S2:ri.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(t,s,a={}){const o=await t.jetstreamManager(),u=new Ka(s,o,t);return await u.init(a),Promise.resolve(u)}}class H_{constructor(t){v(this,"js");this.js=t}kv(t,s={}){const a=this.js,{ok:o,min:u}=a.nc.features.get(Le.JS_KV);return o?s.bindOnly?el.bind(this.js,t,s):el.create(this.js,t,s):Promise.reject(new Error(`kv is only supported on servers ${u} or better`))}os(t,s={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.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:u}=a.nc.features.get(Le.JS_OBJECTSTORE);return o?Ka.create(this.js,t,s):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class gh extends sl{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new Ko(s,a),this.streamAPI=new yh(s,a),this.consumers=new Xf(this.consumerAPI),this.streams=new L_(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 H_(this)}async publish(s,a=on,o){o=o||{},o.expect=o.expect||{};const u=(o==null?void 0:o.headers)||bs();o&&(o.msgID&&u.set(Vn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&u.set(Vn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&u.set(Vn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&u.set(Vn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&u.set(Vn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const d=o.timeout||this.timeout,m={};d&&(m.timeout=d),o&&(m.headers=u);let{retries:y,retry_delay:g}=o;y=y||1,g=g||250;let E;for(let T=0;T<y;T++)try{E=await this.nc.request(s,a,m);break}catch(q){if(q.code==="503"&&T+1<y)await Lr(g);else throw q}const _=this.parseJsResponse(E);if(_.stream==="")throw me.errorForCode(oe.JetStreamInvalidAck);return _.duplicate=_.duplicate?_.duplicate:!1,_}async pull(s,a,o=0){Ut(s),Cr(a);let u=this.timeout;o>u&&(u=o),o=o<0?0:st(o);const d={batch:1,no_wait:o===0,expires:o},m=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(d),{noMux:!0,timeout:u}),y=Mr(m);if(y)throw y;return tl(m,this.timeout)}fetch(s,a,o={}){Ut(s),Cr(a);let u=null;const d=(o.max_bytes??0)>0;let m=0;const y=d?o.max_bytes:0;let g=null;const E={};if(E.batch=o.batch||1,y){const U=this.nc.features.get(Le.JS_PULL_MAX_BYTES);if(!U.ok)throw new Error(`max_bytes is only supported on servers ${U.min} or better`);E.max_bytes=y}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const _=o.expires||0;if(_&&(E.expires=st(_)),_===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const T=o.idle_heartbeat||0;T&&(E.idle_heartbeat=st(T),o.delay_heartbeat===!0&&(E.idle_heartbeat=st(T*4)));const q=new Tt,C=E.batch;let R=0;q.protocolFilterFn=(U,le=!1)=>Hf(U.msg)?(g==null||g.work(),!1):!0,q.dispatchedFn=U=>{if(U){if(d&&(m+=U.data.length),R++,u&&U.info.pending===0)return;(q.getPending()===1&&U.info.pending===0||C===R||y>0&&m>=y)&&q.stop()}};const Q=gs(this.nc.options.inboxPrefix),se=this.nc.subscribe(Q,{max:o.batch,callback:(U,le)=>{U===null&&(U=Mr(le)),U!==null?(u&&(u.cancel(),u=null),c1(U)?q.stop(og(U)===null?void 0:U):q.stop(U)):(g==null||g.work(),q.received++,q.push(tl(le,this.timeout)))}});return _&&(u=zr(_),u.catch(()=>{se.isClosed()||(se.drain().catch(()=>{}),u=null),g&&g.cancel()})),(async()=>{try{T&&(g=new mh(T,U=>(q.push(()=>{q.err=new me(`${Sn.IdleHeartbeatMissed}: ${U}`,oe.JetStreamIdleHeartBeat)}),!0)))}catch{}await se.closed,u!==null&&(u.cancel(),u=null),g&&g.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:Q}),q}async pullSubscribe(s,a=ti()){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 u=o.config.ack_policy;if(u===Ot.None||u===Ot.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(o),m=new F_(this,o.deliver,d);m.info=o;try{await this._maybeCreateConsumer(o)}catch(y){throw m.unsubscribe(),y}return m}async subscribe(s,a=ti()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(o),d=new lg(this,o.deliver,u);d.info=o;try{await this._maybeCreateConsumer(o)}catch(m){throw d.unsubscribe(),m}return d._maybeSetupHbMonitoring(),d}async _processOptions(s,a=ti()){const o=P0(a)?a.getOpts():a;if(o.isBind=P0(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!==Ot.NotSet&&o.config.ack_policy!==Ot.None)throw new me("ordered consumer: ack_policy can only be set to 'none'",oe.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new me("ordered consumer: durable_name cannot be set",oe.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new me("ordered consumer: deliver_subject cannot be set",oe.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new me("ordered consumer: max_deliver cannot be set",oe.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new me("ordered consumer: deliver_group cannot be set",oe.ApiError);o.config.deliver_subject=gs(this.nc.options.inboxPrefix),o.config.ack_policy=Ot.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||st(5e3),o.config.ack_wait=st(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===Ot.NotSet&&(o.config.ack_policy=Ot.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 u=await this.consumerAPI.info(o.stream,o.config.durable_name);if(u){if(u.config.filter_subject&&u.config.filter_subject!==s)throw new Error("subject does not match consumer");const d=o.config.deliver_group??"";if(d===""&&u.push_bound===!0)throw new Error("duplicate subscription");const m=u.config.deliver_group??"";if(d!==m)throw m===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${m}'`);o.last=u,o.config=u.config,o.attached=!0,o.config.durable_name||(o.name=u.name)}}catch(u){if(u.code!=="404")throw u}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||gs(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=G_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=gh.ingestionFn(s.ordered),a.protocolFilterFn=(o,u=!1)=>{const d=o;return Pf(d.msg)?(u||d.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Ot.None&&(a.dispatchedFn=J_),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:dt.All,ack_policy:Ot.Explicit,ack_wait:st(30*1e3),replay_policy:Ur.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 y;const u=o;if(!a)return{ingest:!1,protocol:!1};const d=a;if(Mr(d.msg)||(y=u.monitor)==null||y.work(),Hf(d.msg)){const g=s?u._checkHbOrderConsumer(d.msg):!0;return s||u.info.flow_control.heartbeat_count++,{ingest:g,protocol:!0}}else if(Pf(d.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?u._checkOrderedConsumer(a):!0,protocol:!1}}}}class bh{constructor(t){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=u_(t),this.listeners=[]}static connect(t={}){return new Promise((s,a)=>{const o=new bh(t);Zo.connect(o.options,o).then(u=>{o.protocol=u,(async function(){for await(const d of u.status())o.listeners.forEach(m=>{m.push(d)})})(),s(o)}).catch(u=>{a(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,s,a){if(this.isClosed())throw me.errorForCode(oe.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw me.errorForCode(oe.ConnectionDraining);if(t=t||"",t.length===0)throw me.errorForCode(oe.BadSubject)}publish(t,s,a){this._check(t,!1,!0),this.protocol.publish(t,s,a)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,s={}){this._check(t,!0,!1);const a=new sg(this.protocol,t,s);return this.protocol.subscribe(a),a}_resub(t,s,a){this._check(s,!0,!1);const o=t;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(t,s=on,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(y){return Promise.reject(y)}if(a.strategy=a.strategy||Dn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new me("timeout",oe.InvalidOption));const u=new Tt;function d(y){u.push(()=>{u.stop(y)})}function m(y,g){y||g===null?d(y===null?void 0:y):u.push(g)}if(a.noMux){const y=o?new Error().stack:null;let g=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(gs(this.options.inboxPrefix),{callback:(C,R)=>{var Q,se;if(((Q=R==null?void 0:R.data)==null?void 0:Q.length)===0&&((se=R==null?void 0:R.headers)==null?void 0:se.status)===oe.NoResponders&&(C=me.errorForCode(oe.NoResponders)),C){y&&(C.stack+=`
48
-
49
- ${y}`),_(C);return}m(null,R),a.strategy===Dn.Count&&(g--,g===0&&_()),a.strategy===Dn.JitterTimer&&(q(),T=setTimeout(()=>{_()},300)),a.strategy===Dn.SentinelMsg&&R&&R.data.length===0&&_()}});E.requestSubject=t,E.closed.then(()=>{d()}).catch(C=>{u.stop(C)});const _=C=>{C&&u.push(()=>{throw C}),q(),E.drain().then(()=>{d()}).catch(R=>{d()})};u.iterClosed.then(()=>{q(),E==null||E.unsubscribe()}).catch(C=>{q(),E==null||E.unsubscribe()});try{this.publish(t,s,{reply:E.getSubject()})}catch(C){_(C)}let T=setTimeout(()=>{_()},a.maxWait);const q=()=>{T&&clearTimeout(T)}}else{const y=a;y.callback=m,u.iterClosed.then(()=>{g.cancel()}).catch(E=>{g.cancel(E)});const g=new N1(this.protocol.muxSubscriptions,t,y);this.protocol.request(g);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${g.token}`,headers:a.headers})}catch(E){g.cancel(E)}}return Promise.resolve(u)}request(t,s,a={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(u){return Promise.reject(u)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new me("timeout",oe.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new me("reply can only be used with noMux",oe.InvalidOption));if(a.noMux){const u=a.reply?a.reply:gs(this.options.inboxPrefix),d=it(),m=o?new Error:null,y=this.subscribe(u,{max:1,timeout:a.timeout,callback:(g,E)=>{g?(m&&g.code!==oe.Timeout&&(g.stack+=`
50
-
51
- ${m.stack}`),y.unsubscribe(),d.reject(g)):(g=Qy(E),g?(m&&(g.stack+=`
52
-
53
- ${m.stack}`),d.reject(g)):d.resolve(E))}});return y.requestSubject=t,this.protocol.publish(t,s,{reply:u,headers:a.headers}),d}else{const u=new Xy(this.protocol.muxSubscriptions,t,a,o);this.protocol.request(u);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:a.headers})}catch(m){u.cancel(m)}const d=Promise.race([u.timer,u.deferred]);return d.catch(()=>{u.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(me.errorForCode(oe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(me.errorForCode(oe.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(oe.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new Tt;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}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(t={}){const s=new B_(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===oe.NoResponders&&(o.code=oe.JetStreamNotEnabled),o}return s}jetstream(t={}){return new gh(this,t)}getServerVersion(){const t=this.info;return t?Ri(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw me.errorForCode(oe.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new $_(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(me.errorForCode(oe.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(oe.ConnectionDraining)):this.protocol.reconnect()}}class $_{constructor(t){v(this,"nc");this.nc=t}add(t){try{return new il(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new __(this.nc,t,s)}}class Y_{constructor(t,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=t,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(Wo)||"PUT"}get length(){const t=this.sm.header.get(Lt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class V_{constructor(t,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=t,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(hh(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(Wo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Lt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class lg extends R1{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=gs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const u=this.info;u.config.name=ii.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=a,u.config.deliver_subject=a,u.config.deliver_policy=dt.StartSequence,u.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=u.config;const m=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(m,d,{retries:-1}).then(y=>{const g=y,E=this.sub.info;E.last=g,this.info.config=g.config,this.info.name=g.name}).catch(y=>{const g=new me(`unable to recreate ordered consumer ${u.stream} at seq ${s}`,oe.RequestError,y);this.sub.callback(g,{})})}_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(hh(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const u=this.sub,d=m=>{var E,_,T,q;const y=d1(409,`${Sn.IdleHeartbeatMissed}: ${m}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,y);else{if(!this.js.nc.protocol.connected)return!1;const C=((T=(_=this.info)==null?void 0:_.ordered_consumer_sequence)==null?void 0:T.stream_seq)||0;return this._resetOrderedConsumer(C+1),(q=this.monitor)==null||q.restart(),!1}return!u.noIterator};this.monitor=new mh(s,d,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Lt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Lt.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,u=s.info.deliverySequence;return u!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=u,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}`,u=await s.api._request(o);return s.last=u,u}}class F_ extends lg{constructor(t,s,a){super(t,s,a)}pull(t={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,u=a.durable_name??o,d={};if(d.batch=t.batch||1,d.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const g=this.js.nc.features.get(Le.JS_PULL_MAX_BYTES);if(!g.ok)throw new Error(`max_bytes is only supported on servers ${g.min} or better`);d.max_bytes=t.max_bytes}let m=0;t.expires&&t.expires>0&&(m=t.expires,d.expires=st(m));let y=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(y=t.idle_heartbeat,d.idle_heartbeat=st(y)),y&&m===0)throw new Error("idle_heartbeat requires expires");if(y>m)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),m&&y&&(this.monitor?this.monitor._change(y,m):this._setupHbMonitoring(y,m));const g=this.info.api,E=`${g.prefix}.CONSUMER.MSG.NEXT.${s}.${u}`,_=this.sub.subject;g.nc.publish(E,g.jc.encode(d),{reply:_})}}}function G_(i,t){return i?Q_(t):I_(t)}function I_(i){return(t,s)=>t?[t,null]:(t=Mr(s),t?[t,null]:[null,tl(s,i)])}function Q_(i){return(t,s)=>{if(t)return[t,null];const a=Mr(s);return a!==null?[og(a),null]:[null,tl(s,i)]}}function og(i){if(i!==null)switch(i.code){case oe.JetStream404NoMessages:case oe.JetStream408RequestTimeout:return null;case oe.JetStream409:return m1(i)?i:null;default:return i}return null}function J_(i){i&&i.ack()}function K_(i){const t=i.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class X_{constructor(t,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=t,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=K_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Ba[0]&&t[1]===Ba[1]&&t[2]===Ba[2]&&t[3]===Ba[3]}async ackAck(t){var a;t=t||{},t.timeout=t.timeout||this.timeout;const s=it();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,d=!((a=u.options)!=null&&a.noAsyncTraces),m=new Xy(u.muxSubscriptions,this.msg.reply,{timeout:t.timeout},d);u.request(m);try{u.publish(this.msg.reply,ey,{reply:`${u.muxSubscriptions.baseInbox}${m.token}`})}catch(y){m.cancel(y)}try{await Promise.race([m.timer,m.deferred]),s.resolve(!0)}catch(y){m.cancel(y),s.reject(y)}}else s.resolve(!1);return s}ack(){this.doAck(ey)}nak(t){let s=C_;t&&(s=Lf().encode(`-NAK ${JSON.stringify({delay:st(t)})}`)),this.doAck(s)}working(){this.doAck(Ba)}next(t,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=st(s.expires));const o=qn().encode(a),u=Br.concat(M_,D_,o),d=t?{reply:t}:void 0;this.msg.respond(u,d)}term(t=""){let s=R_;(t==null?void 0:t.length)>0&&(s=Lf().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const Z_="1.30.3",W_="nats.ws";class ew{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=Z_,this.lang=W_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=it(),this.closedNotification=it()}async connect(t,s){const a=it();if(s.tls)return a.reject(new me("tls",oe.InvalidOption)),a;this.options=s;const o=t.src;if(s.wsFactory){const{socket:u,encrypted:d}=await s.wsFactory(t.src,s);this.socket=u,this.encrypted=d}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=u=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(u.data)),this.peeked){this.signal.resolve();return}const d=Br.concat(...this.yields),m=L1(d);if(m!==""){const y=d_.exec(m);if(!y){s.debug&&console.error("!!!",No(d)),a.reject(new Error("unexpected response from server"));return}try{const g=JSON.parse(y[1]);f_(g,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(g){a.reject(g);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(u.wasClean||(d=new Error(u.reason)),this._closed(d))},this.socket.onerror=u=>{if(this.isDiscarded())return;const d=u,m=new me(d.message,oe.Unknown,new Error(d.error));a.reject(m)},a}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Lr(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}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 t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${No(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=it())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${No(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${No(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function tw(i,t){/^(.*:\/\/)(.*)/.test(i)||(typeof t=="boolean"?i=`${t===!0?"https":"http"}://${i}`:i=`https://${i}`);let a=new URL(i);const o=a.protocol.toLowerCase();o==="ws:"&&(t=!1),o==="wss:"&&(t=!0),o!=="https:"&&o!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${i}`));let u,d;const m=a.hostname,y=a.pathname,g=a.search||"";switch(o){case"http:":case"ws:":case"nats:":d=a.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":d=a.port||"443",u="wss:";break;default:d=a.port||t===!0?"443":"80",u=t===!0?"wss:":"ws:";break}return`${u}//${m}:${d}${y}${g}`}function nw(i={}){return D1({defaultPort:443,urlParseFn:tw,factory:()=>new ew}),bh.connect(i)}const sw=null,iw=null,cg="lt.events";function ug(i,t){const s=i.split("."),a=t.split(".");for(let o=0;o<a.length;o++){const u=a[o];if(u===">")return!0;if(o>=s.length||u!=="*"&&u!==s[o])return!1}return s.length===a.length}const rl=A.createContext({connected:!1,subscribe:()=>()=>{}});function rw(){const{connected:i}=A.useContext(rl);return{connected:i}}function fg(i,t){const{subscribe:s}=A.useContext(rl),a=A.useRef(t);a.current=t,A.useEffect(()=>s(i,u=>a.current(u)),[s,i])}const aw=A.createContext({connected:!1,subscribe:()=>()=>{}}),lw=Lf();function ow({children:i,url:t,token:s}){const a=A.useRef(null),o=A.useRef(null),[u,d]=A.useState(!1),m=A.useRef(null),y=A.useRef(new Map),g=A.useCallback((T,q)=>{const C=y.current;return C.has(T)||C.set(T,new Set),C.get(T).add(q),()=>{const R=C.get(T);R&&(R.delete(q),R.size===0&&C.delete(T))}},[]),E=A.useCallback((T,q)=>{for(const[C,R]of y.current)if(ug(T,C))for(const Q of R)try{Q(q)}catch{}},[]),_=A.useCallback(async()=>{try{if(a.current)return;const T=t||sw;if(!T){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await nw({servers:T,token:s||iw||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,d(!0);const C=q.subscribe("lt.>");o.current=C,(async()=>{for await(const R of C)try{const Q=JSON.parse(lw.decode(R.data));E(R.subject,Q)}catch{}})(),(async()=>{for await(const R of q.status())R.type==="disconnect"||R.type==="error"?d(!1):R.type==="reconnect"&&d(!0)})()}catch{d(!1),m.current=setTimeout(_,3e3)}},[E]);return A.useEffect(()=>(_(),()=>{m.current&&clearTimeout(m.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),d(!1)}),[_]),h.jsx(aw.Provider,{value:{connected:u,subscribe:g},children:h.jsx(rl.Provider,{value:{connected:u,subscribe:g},children:i})})}const In=Object.create(null);In.open="0";In.close="1";In.ping="2";In.pong="3";In.message="4";In.upgrade="5";In.noop="6";const Ho=Object.create(null);Object.keys(In).forEach(i=>{Ho[In[i]]=i});const Wf={type:"error",data:"parser error"},hg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",dg=typeof ArrayBuffer=="function",mg=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,xh=({type:i,data:t},s,a)=>hg&&t instanceof Blob?s?a(t):ny(t,a):dg&&(t instanceof ArrayBuffer||mg(t))?s?a(t):ny(new Blob([t]),a):a(In[i]+(t||"")),ny=(i,t)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];t("b"+(a||""))},s.readAsDataURL(i)};function sy(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Cf;function cw(i,t){if(hg&&i.data instanceof Blob)return i.data.arrayBuffer().then(sy).then(t);if(dg&&(i.data instanceof ArrayBuffer||mg(i.data)))return t(sy(i.data));xh(i,!1,s=>{Cf||(Cf=new TextEncoder),t(Cf.encode(s))})}const iy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<iy.length;i++)Fa[iy.charCodeAt(i)]=i;const uw=i=>{let t=i.length*.75,s=i.length,a,o=0,u,d,m,y;i[i.length-1]==="="&&(t--,i[i.length-2]==="="&&t--);const g=new ArrayBuffer(t),E=new Uint8Array(g);for(a=0;a<s;a+=4)u=Fa[i.charCodeAt(a)],d=Fa[i.charCodeAt(a+1)],m=Fa[i.charCodeAt(a+2)],y=Fa[i.charCodeAt(a+3)],E[o++]=u<<2|d>>4,E[o++]=(d&15)<<4|m>>2,E[o++]=(m&3)<<6|y&63;return g},fw=typeof ArrayBuffer=="function",vh=(i,t)=>{if(typeof i!="string")return{type:"message",data:pg(i,t)};const s=i.charAt(0);return s==="b"?{type:"message",data:hw(i.substring(1),t)}:Ho[s]?i.length>1?{type:Ho[s],data:i.substring(1)}:{type:Ho[s]}:Wf},hw=(i,t)=>{if(fw){const s=uw(i);return pg(s,t)}else return{base64:!0,data:i}},pg=(i,t)=>{switch(t){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},yg="",dw=(i,t)=>{const s=i.length,a=new Array(s);let o=0;i.forEach((u,d)=>{xh(u,!1,m=>{a[d]=m,++o===s&&t(a.join(yg))})})},mw=(i,t)=>{const s=i.split(yg),a=[];for(let o=0;o<s.length;o++){const u=vh(s[o],t);if(a.push(u),u.type==="error")break}return a};function pw(){return new TransformStream({transform(i,t){cw(i,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 u=new DataView(o.buffer);u.setUint8(0,126),u.setUint16(1,a)}else{o=new Uint8Array(9);const u=new DataView(o.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(a))}i.data&&typeof i.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(s)})}})}let Mf;function Ro(i){return i.reduce((t,s)=>t+s.length,0)}function Do(i,t){if(i[0].length===t)return i.shift();const s=new Uint8Array(t);let a=0;for(let o=0;o<t;o++)s[o]=i[0][a++],a===i[0].length&&(i.shift(),a=0);return i.length&&a<i[0].length&&(i[0]=i[0].slice(a)),s}function yw(i,t){Mf||(Mf=new TextDecoder);const s=[];let a=0,o=-1,u=!1;return new TransformStream({transform(d,m){for(s.push(d);;){if(a===0){if(Ro(s)<1)break;const y=Do(s,1);u=(y[0]&128)===128,o=y[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(Ro(s)<2)break;const y=Do(s,2);o=new DataView(y.buffer,y.byteOffset,y.length).getUint16(0),a=3}else if(a===2){if(Ro(s)<8)break;const y=Do(s,8),g=new DataView(y.buffer,y.byteOffset,y.length),E=g.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue(Wf);break}o=E*Math.pow(2,32)+g.getUint32(4),a=3}else{if(Ro(s)<o)break;const y=Do(s,o);m.enqueue(vh(u?y:Mf.decode(y),t)),a=0}if(o===0||o>i){m.enqueue(Wf);break}}}})}const gg=4;function xt(i){if(i)return gw(i)}function gw(i){for(var t in xt.prototype)i[t]=xt.prototype[t];return i}xt.prototype.on=xt.prototype.addEventListener=function(i,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(t),this};xt.prototype.once=function(i,t){function s(){this.off(i,s),t.apply(this,arguments)}return s.fn=t,this.on(i,s),this};xt.prototype.off=xt.prototype.removeListener=xt.prototype.removeAllListeners=xt.prototype.removeEventListener=function(i,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+i];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===t||a.fn===t){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+i],this};xt.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+i],a=1;a<arguments.length;a++)t[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,t)}return this};xt.prototype.emitReserved=xt.prototype.emit;xt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};xt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const lc=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),En=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),bw="arraybuffer";function bg(i,...t){return t.reduce((s,a)=>(i.hasOwnProperty(a)&&(s[a]=i[a]),s),{})}const xw=En.setTimeout,vw=En.clearTimeout;function oc(i,t){t.useNativeTimers?(i.setTimeoutFn=xw.bind(En),i.clearTimeoutFn=vw.bind(En)):(i.setTimeoutFn=En.setTimeout.bind(En),i.clearTimeoutFn=En.clearTimeout.bind(En))}const _w=1.33;function ww(i){return typeof i=="string"?Sw(i):Math.ceil((i.byteLength||i.size)*_w)}function Sw(i){let t=0,s=0;for(let a=0,o=i.length;a<o;a++)t=i.charCodeAt(a),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(a++,s+=4);return s}function xg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ew(i){let t="";for(let s in i)i.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(i[s]));return t}function jw(i){let t={},s=i.split("&");for(let a=0,o=s.length;a<o;a++){let u=s[a].split("=");t[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return t}class Aw extends Error{constructor(t,s,a){super(t),this.description=s,this.context=a,this.type="TransportError"}}class _h extends xt{constructor(t){super(),this.writable=!1,oc(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,a){return super.emitReserved("error",new Aw(t,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(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=vh(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_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(t){const s=Ew(t);return s.length?"?"+s:""}}class Ow extends _h{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};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(t){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)};mw(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,dw(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=xg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let vg=!1;try{vg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Tw=vg;function Nw(){}class kw extends Ow{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||a!==t.port}}doWrite(t,s){const a=this.request({method:"POST",data:t});a.on("success",s),a.on("error",(o,u)=>{this.onError("xhr post error",o,u)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=t}}class Gn extends xt{constructor(t,s,a){super(),this.createRequest=t,oc(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 t;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{}(t=this._opts.cookieJar)===null||t===void 0||t.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=Gn.requestsCount++,Gn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Nw,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Gn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Gn.requestsCount=0;Gn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ry);else if(typeof addEventListener=="function"){const i="onpagehide"in En?"pagehide":"unload";addEventListener(i,ry,!1)}}function ry(){for(let i in Gn.requests)Gn.requests.hasOwnProperty(i)&&Gn.requests[i].abort()}const Cw=(function(){const i=_g({xdomain:!1});return i&&i.responseType!==null})();class Mw extends kw{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=Cw&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Gn(_g,this.uri(),t)}}function _g(i){const t=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Tw))return new XMLHttpRequest}catch{}if(!t)try{return new En[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const wg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Rw extends _h{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,a=wg?{}: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(t,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=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const a=t[s],o=s===t.length-1;xh(a,this.supportsBinary,u=>{try{this.doWrite(a,u)}catch{}o&&lc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=xg()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const Rf=En.WebSocket||En.MozWebSocket;class Dw extends Rw{createSocket(t,s,a){return wg?new Rf(t,s,a):s?new Rf(t,s):new Rf(t)}doWrite(t,s){this.ws.send(s)}}class qw extends _h{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=yw(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=t.readable.pipeThrough(s).getReader(),o=pw();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const u=()=>{a.read().then(({done:m,value:y})=>{m||(this.onPacket(y),u())}).catch(m=>{})};u();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const a=t[s],o=s===t.length-1;this._writer.write(a).then(()=>{o&&lc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const zw={websocket:Dw,webtransport:qw,polling:Mw},Uw=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Bw=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function eh(i){if(i.length>8e3)throw"URI too long";const t=i,s=i.indexOf("["),a=i.indexOf("]");s!=-1&&a!=-1&&(i=i.substring(0,s)+i.substring(s,a).replace(/:/g,";")+i.substring(a,i.length));let o=Uw.exec(i||""),u={},d=14;for(;d--;)u[Bw[d]]=o[d]||"";return s!=-1&&a!=-1&&(u.source=t,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=Lw(u,u.path),u.queryKey=Pw(u,u.query),u}function Lw(i,t){const s=/\/{2,9}/g,a=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&a.splice(0,1),t.slice(-1)=="/"&&a.splice(a.length-1,1),a}function Pw(i,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,u){o&&(s[o]=u)}),s}const th=typeof addEventListener=="function"&&typeof removeEventListener=="function",$o=[];th&&addEventListener("offline",()=>{$o.forEach(i=>i())},!1);class ni extends xt{constructor(t,s){if(super(),this.binaryType=bw,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const a=eh(t);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=eh(s.host).host);oc(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=jw(this.opts.query)),th&&(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"})},$o.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=gg,s.transport=t,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[t]);return new this._transportsByName[t](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ni.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.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",ni.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.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=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),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 t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.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+=ww(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,lc(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,a){return this._sendPacket("message",t,s,a),this}send(t,s,a){return this._sendPacket("message",t,s,a),this}_sendPacket(t,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 u={type:t,data:s,options:a};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},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():t()}):this.upgrading?a():t()),this}_onError(t){if(ni.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,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(),th&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=$o.indexOf(this._offlineEventListener);a!==-1&&$o.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}ni.protocol=gg;class Hw extends ni{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),a=!1;ni.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",_=>{if(!a)if(_.type==="pong"&&_.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;ni.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 T=new Error("probe error");T.transport=s.name,this.emitReserved("upgradeError",T)}}))};function u(){a||(a=!0,E(),s.close(),s=null)}const d=_=>{const T=new Error("probe error: "+_);T.transport=s.name,u(),this.emitReserved("upgradeError",T)};function m(){d("transport closed")}function y(){d("socket closed")}function g(_){s&&_.name!==s.name&&u()}const E=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",m),this.off("close",y),this.off("upgrading",g)};s.once("open",o),s.once("error",d),s.once("close",m),this.once("close",y),this.once("upgrading",g),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let a=0;a<t.length;a++)~this.transports.indexOf(t[a])&&s.push(t[a]);return s}}let $w=class extends Hw{constructor(t,s={}){const a=typeof t=="object"?t:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>zw[o]).filter(o=>!!o)),super(t,a)}};function Yw(i,t="",s){let a=i;s=s||typeof location<"u"&&location,i==null&&(i=s.protocol+"//"+s.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=s.protocol+i:i=s.host+i),/^(https?|wss?):\/\//.test(i)||(typeof s<"u"?i=s.protocol+"//"+i:i="https://"+i),a=eh(i)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const u=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+u+":"+a.port+t,a.href=a.protocol+"://"+u+(s&&s.port===a.port?"":":"+a.port),a}const Vw=typeof ArrayBuffer=="function",Fw=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Sg=Object.prototype.toString,Gw=typeof Blob=="function"||typeof Blob<"u"&&Sg.call(Blob)==="[object BlobConstructor]",Iw=typeof File=="function"||typeof File<"u"&&Sg.call(File)==="[object FileConstructor]";function wh(i){return Vw&&(i instanceof ArrayBuffer||Fw(i))||Gw&&i instanceof Blob||Iw&&i instanceof File}function Yo(i,t){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let s=0,a=i.length;s<a;s++)if(Yo(i[s]))return!0;return!1}if(wh(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Yo(i.toJSON(),!0);for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&Yo(i[s]))return!0;return!1}function Qw(i){const t=[],s=i.data,a=i;return a.data=nh(s,t),a.attachments=t.length,{packet:a,buffers:t}}function nh(i,t){if(!i)return i;if(wh(i)){const s={_placeholder:!0,num:t.length};return t.push(i),s}else if(Array.isArray(i)){const s=new Array(i.length);for(let a=0;a<i.length;a++)s[a]=nh(i[a],t);return s}else if(typeof i=="object"&&!(i instanceof Date)){const s={};for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=nh(i[a],t));return s}return i}function Jw(i,t){return i.data=sh(i.data,t),delete i.attachments,i}function sh(i,t){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<t.length)return t[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let s=0;s<i.length;s++)i[s]=sh(i[s],t);else if(typeof i=="object")for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(i[s]=sh(i[s],t));return i}const Kw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Be;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(Be||(Be={}));class Xw{constructor(t){this.replacer=t}encode(t){return(t.type===Be.EVENT||t.type===Be.ACK)&&Yo(t)?this.encodeAsBinary({type:t.type===Be.EVENT?Be.BINARY_EVENT:Be.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Be.BINARY_EVENT||t.type===Be.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=Qw(t),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class Sh extends xt{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const a=s.type===Be.BINARY_EVENT;a||s.type===Be.BINARY_ACK?(s.type=a?Be.EVENT:Be.ACK,this.reconstructor=new Zw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(wh(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),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: "+t)}decodeString(t){let s=0;const a={type:Number(t.charAt(0))};if(Be[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===Be.BINARY_EVENT||a.type===Be.BINARY_ACK){const u=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const d=t.substring(u,s);if(d!=Number(d)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(d);if(!Ww(m)||m<0)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=m}if(t.charAt(s+1)==="/"){const u=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););a.nsp=t.substring(u,s)}else a.nsp="/";const o=t.charAt(s+1);if(o!==""&&Number(o)==o){const u=s+1;for(;++s;){const d=t.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===t.length)break}a.id=Number(t.substring(u,s+1))}if(t.charAt(++s)){const u=this.tryParse(t.substr(s));if(Sh.isPayloadValid(a.type,u))a.data=u;else throw new Error("invalid payload")}return a}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Be.CONNECT:return ay(s);case Be.DISCONNECT:return s===void 0;case Be.CONNECT_ERROR:return typeof s=="string"||ay(s);case Be.EVENT:case Be.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Kw.indexOf(s[0])===-1);case Be.ACK:case Be.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Zw{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=Jw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Ww=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function ay(i){return Object.prototype.toString.call(i)==="[object Object]"}const eS=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Sh,Encoder:Xw,get PacketType(){return Be}},Symbol.toStringTag,{value:"Module"}));function Rn(i,t,s){return i.on(t,s),function(){i.off(t,s)}}const tS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Eg extends xt{constructor(t,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=t,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 t=this.io;this.subs=[Rn(t,"open",this.onopen.bind(this)),Rn(t,"packet",this.onpacket.bind(this)),Rn(t,"error",this.onerror.bind(this)),Rn(t,"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(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var a,o,u;if(tS.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Be.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,_=s.pop();this._registerAckCallback(E,_),d.id=E}const m=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,y=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!m||(y?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[t]=s;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===t&&this.sendBuffer.splice(m,1);s.call(this,new Error("operation has timed out"))},o),d=(...m)=>{this.io.clearTimeoutFn(u),s.apply(this,m)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...s){return new Promise((a,o)=>{const u=(d,m)=>d?o(d):a(m);u.withError=!0,s.push(u),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...u)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...u)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(a=>String(a.id)===t)){const a=this.acks[t];delete this.acks[t],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Be.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.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 Be.EVENT:case Be.BINARY_EVENT:this.onevent(t);break;case Be.ACK:case Be.BINARY_ACK:this.onack(t);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const a=new Error(t.data.message);a.data=t.data.data,this.emitReserved("connect_error",a);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:Be.ACK,id:t,data:o}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(t===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(t===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,t.data)}}}function Pr(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Pr.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*i);i=(Math.floor(t*10)&1)==0?i-s:i+s}return Math.min(i,this.max)|0};Pr.prototype.reset=function(){this.attempts=0};Pr.prototype.setMin=function(i){this.ms=i};Pr.prototype.setMax=function(i){this.max=i};Pr.prototype.setJitter=function(i){this.jitter=i};class ih extends xt{constructor(t,s){var a;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,oc(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 Pr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const o=s.parser||eS;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new $w(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Rn(s,"open",function(){a.onopen(),t&&t()}),u=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),t?t(m):this.maybeReconnectOnOpen()},d=Rn(s,"error",u);if(this._timeout!==!1){const m=this._timeout,y=this.setTimeoutFn(()=>{o(),u(new Error("timeout")),s.close()},m);this.opts.autoUnref&&y.unref(),this.subs.push(()=>{this.clearTimeoutFn(y)})}return this.subs.push(o),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Rn(t,"ping",this.onping.bind(this)),Rn(t,"data",this.ondata.bind(this)),Rn(t,"error",this.onerror.bind(this)),Rn(t,"close",this.onclose.bind(this)),Rn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){lc(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let a=this.nsps[t];return a?this._autoConnect&&!a.active&&a.connect():(a=new Eg(this,t,s),this.nsps[t]=a),a}_destroy(t){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let a=0;a<s.length;a++)this.engine.write(s[a],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=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(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const La={};function Vo(i,t){typeof i=="object"&&(t=i,i=void 0),t=t||{};const s=Yw(i,t.path||"/socket.io"),a=s.source,o=s.id,u=s.path,d=La[o]&&u in La[o].nsps,m=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let y;return m?y=new ih(a,t):(La[o]||(La[o]=new ih(a,t)),y=La[o]),s.query&&!t.query&&(t.query=s.queryKey),y.socket(s.path,t)}Object.assign(Vo,{Manager:ih,Socket:Eg,io:Vo,connect:Vo});const nS=A.createContext({connected:!1,subscribe:()=>()=>{}});function sS({children:i}){const t=A.useRef(null),[s,a]=A.useState(!1),o=A.useRef(new Map),u=A.useCallback((m,y)=>{const g=o.current;return g.has(m)||g.set(m,new Set),g.get(m).add(y),()=>{const E=g.get(m);E&&(E.delete(y),E.size===0&&g.delete(m))}},[]),d=A.useCallback((m,y)=>{for(const[g,E]of o.current)if(ug(m,g))for(const _ of E)try{_(y)}catch{}},[]);return A.useEffect(()=>{const m=Vy(),y=Vo({path:`${Gt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...m?{auth:{token:m}}:{}});return t.current=y,console.log("[lt-socketio] connecting..."),y.on("connect",()=>{console.log("[lt-socketio] connected, id:",y.id),a(!0)}),y.on("disconnect",g=>{console.log("[lt-socketio] disconnected:",g),a(!1)}),y.on("connect_error",g=>{console.warn("[lt-socketio] connect error:",g.message),a(!1)}),y.onAny((g,E)=>{if(g.startsWith("lt."))try{const _=typeof E=="string"?JSON.parse(E):E;d(g,_)}catch{}}),()=>{y.removeAllListeners(),y.disconnect(),t.current=null,a(!1)}},[d]),h.jsx(nS.Provider,{value:{connected:s,subscribe:u},children:h.jsx(rl.Provider,{value:{connected:s,subscribe:u},children:i})})}function iS({children:i}){const[t,s]=A.useState(null),[a,o]=A.useState({url:null,token:null});return A.useEffect(()=>{let u=!1;async function d(){var m;try{console.log("[lt-transport] detecting event transport...");const y=await fetch(`${Gt}/api/settings`);if(!y.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),u||s("socketio");return}const g=await y.json(),E=(m=g==null?void 0:g.events)==null?void 0:m.transport;if(console.log("[lt-transport] server reports:",E),!u){if(E==="nats"){let _=g.events.natsWsUrl??null,T=null;const q=Vy();if(q)try{const C=await fetch(`${Gt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(C.ok){const R=await C.json();_=R.natsWsUrl??_,T=R.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:_,token:T})}s(E==="nats"?"nats":"socketio")}}catch(y){console.warn("[lt-transport] settings fetch error, falling back to socketio",y),u||s("socketio")}}return d(),()=>{u=!0}},[]),t==="nats"?h.jsx(ow,{url:a.url,token:a.token,children:i}):t==="socketio"?h.jsx(sS,{children:i}):h.jsx(h.Fragment,{children:i})}const Eh="lt_view_as",jh="lt_ai_override";function jg(){try{const i=localStorage.getItem(jh);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function rS(i){try{localStorage.setItem(jh,String(i))}catch{}}function aS(){try{localStorage.removeItem(jh)}catch{}}function Ah(){try{const i=localStorage.getItem(Eh);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function lS(i){try{localStorage.setItem(Eh,i)}catch{}window.location.reload()}function Ag(){try{localStorage.removeItem(Eh)}catch{}window.location.reload()}function Og(){const{isSuperAdmin:i,hasRoleType:t,hasRole:s}=zn(),a=Ah(),o=i||s("engineer"),u=t("admin"),d=i||t("admin");return{isBuilder:a?!1:o,isOps:a?a==="admin"||a==="engineer":u,canBulk:a?!1:d,viewAs:a,realIsBuilder:o}}function Tg(){const{isSuperAdmin:i,hasRoleType:t,hasRole:s}=zn(),a=i?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",o=Ah(),u=o==="admin"||o==="engineer"||o==="operator"?o:null,d=u??a;return{tier:d,realTier:a,viewAs:u,canSeePaceBoard:d==="superadmin"||d==="admin",canSeeWorkflows:d==="superadmin"||d==="engineer",showTaskQueueCards:d==="operator",taskQueueSource:a==="superadmin"||a==="admin"?"manual":"membership"}}const oS="lt_ai_override";function cS(){return Ae("/settings")}function uS(){try{if(localStorage.getItem(oS)==="off")return!1}catch{}return null}function Hr(){var s;const i=mt({queryKey:["settings"],queryFn:cS,staleTime:1/0}),t=uS();return i.data&&t===!1&&((s=i.data.ai)!=null&&s.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}const Ng=A.createContext(null),ly="lt_sidebar_collapsed";function fS({children:i}){const[t,s]=A.useState(()=>{try{return localStorage.getItem(ly)==="true"}catch{return!1}}),a=A.useCallback(()=>{s(o=>{const u=!o;try{localStorage.setItem(ly,String(u))}catch{}return u})},[]);return h.jsx(Ng.Provider,{value:{collapsed:t,toggle:a},children:i})}function Oh(){const i=A.useContext(Ng);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}function kg(i,t){var s,a,o,u,d;t.facets&&Object.keys(t.facets).length&&i.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&i.set("block",JSON.stringify(t.block)),(a=t.range)!=null&&a.length&&i.set("range",JSON.stringify(t.range)),(o=t.exists)!=null&&o.length&&i.set("exists",JSON.stringify(t.exists)),(u=t.roles)!=null&&u.length&&i.set("roles",JSON.stringify(t.roles)),(d=t.orderBy)!=null&&d.length&&i.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&i.set("available",String(t.available)),t.jeopardy===!0&&i.set("jeopardy","1")}function cA(i,t){const s=i??"24h";return mt({queryKey:["stationMetrics",s],queryFn:()=>Ae(`/escalations/station-metrics?period=${s}`),staleTime:5e3,enabled:(t==null?void 0:t.enabled)??!0})}function uA(i){const t=i?`?period=${i}`:"";return mt({queryKey:["escalationStats",i],queryFn:()=>Ae(`/escalations/stats${t}`)})}function fA(){return mt({queryKey:["escalationTypes"],queryFn:()=>Ae("/escalations/types")})}function hA(i=!0){return mt({queryKey:["escalationFacetKeys"],queryFn:()=>Ae("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function Cg(i){const{enabled:t=!0,staleTime:s,...a}=i,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),a.search&&o.set("search",a.search),kg(o,a),mt({queryKey:["escalations",a],queryFn:()=>Ae(`/escalations?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function Mg(i){const{enabled:t=!0,staleTime:s,...a}=i,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),a.search&&o.set("search",a.search),kg(o,a),mt({queryKey:["escalations","available",a],queryFn:()=>Ae(`/escalations/available?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function dA(i){return mt({queryKey:["escalations","by-workflow",i],queryFn:()=>Ae(`/escalations/by-workflow/${i}`),enabled:!!i})}function mA(i){return mt({queryKey:["escalations",i],queryFn:()=>Ae(`/escalations/${i}`),enabled:!!i})}function pA(){const i=vt();return Nt({mutationFn:({id:t,durationMinutes:s})=>Ae(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function yA(){const i=vt();return Nt({mutationFn:t=>Ae(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function gA(){const i=vt();return Nt({mutationFn:({id:t,resolverPayload:s})=>Ae(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]}),i.resetQueries({queryKey:["tasks"]}),i.resetQueries({queryKey:["jobs"]})}})}function bA(){const i=vt();return Nt({mutationFn:({id:t,targetRole:s})=>Ae(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function xA(){const i=vt();return Nt({mutationFn:({ids:t,priority:s})=>Ae("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function vA(){const i=vt();return Nt({mutationFn:({ids:t,durationMinutes:s})=>Ae("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function _A(){const i=vt();return Nt({mutationFn:({ids:t,targetUserId:s,durationMinutes:a})=>Ae("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function wA(){const i=vt();return Nt({mutationFn:({ids:t,targetRole:s})=>Ae("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:t,targetRole:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function SA(){const i=vt();return Nt({mutationFn:({ids:t,hint:s})=>Ae("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function EA(){const i=vt();return Nt({mutationFn:t=>Ae(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function jA(){const i=vt();return Nt({mutationFn:({ids:t})=>Ae("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function hS(){const{user:i}=zn(),t=i==null?void 0:i.userId,s=vt(),a=A.useRef(null),o=A.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);fg(`${cg}.system.escalation.>`,o);const{data:u}=Mg({limit:1}),{data:d}=Cg({assigned_to:t,status:"pending",limit:1});return{available:(u==null?void 0:u.total)??0,mine:(d==null?void 0:d.total)??0}}function Th({size:i="sm",hideLabel:t=!1,className:s="",appName:a="LongTail"}){const o=i==="lg",u=o?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",d=o?"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 h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":a,className:`logo-mark shrink-0 z-0 ${u}`,style:{"--logo-url":`url(${Gt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${d} ${t?"opacity-0":""}`,children:a})]})}function AA(){return mt({queryKey:["roles"],queryFn:()=>Ae("/roles")})}function OA(){return mt({queryKey:["roles","escalation-chains"],queryFn:()=>Ae("/roles/escalation-chains")})}function TA(i){return mt({queryKey:["roles",i,"escalation-targets"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/escalation-targets`),enabled:!!i})}function NA(){const i=vt();return Nt({mutationFn:t=>Ae("/roles/escalation-chains",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function kA(){const i=vt();return Nt({mutationFn:t=>Ae("/roles/escalation-chains",{method:"DELETE",body:JSON.stringify(t)}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function Nh(i){return mt({queryKey:["roles","details"],queryFn:()=>Ae("/roles/details"),enabled:(i==null?void 0:i.enabled)??!0})}function CA(i,t,s=!0){return mt({queryKey:["roles",i,"schema",t??"latest"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!i})}function MA(i){return mt({queryKey:["roles",i,"schema-versions"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/schema/versions`),enabled:!!i})}function RA(i,t,s=!0){return mt({queryKey:["roles",i,"list-schema",t??"latest"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!i})}function DA(i){return mt({queryKey:["roles",i,"list-schema-versions"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/list-schema/versions`),enabled:!!i})}function qA(){const i=vt();return Nt({mutationFn:t=>Ae("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function zA(){const i=vt();return Nt({mutationFn:({role:t,...s})=>Ae(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await i.cancelQueries({queryKey:["roles","details"]});const a=i.getQueryData(["roles","details"]);return a&&i.setQueryData(["roles","details"],{roles:a.roles.map(o=>o.role===t?{...o,...s}:o)}),{previous:a}},onError:(t,s,a)=>{a!=null&&a.previous&&i.setQueryData(["roles","details"],a.previous)},onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function UA(){const i=vt();return Nt({mutationFn:t=>Ae(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}const Rg="lt:task-queues:roles",rh="lt:task-queues-changed",dS=["superadmin","admin","engineer"];function Dg(i){return dS.includes(i)}function Di(){try{const i=localStorage.getItem(Rg);if(!i)return[];const t=JSON.parse(i);return Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}catch{return[]}}function qg(i){try{localStorage.setItem(Rg,JSON.stringify(i))}catch{}try{window.dispatchEvent(new CustomEvent(rh))}catch{}}function mS(i){return Di().includes(i)}function pS(i){const t=Di();t.includes(i)||qg([...t,i].sort((s,a)=>s.localeCompare(a)))}function yS(i){const t=Di();t.includes(i)&&qg(t.filter(s=>s!==i))}function gS(i){return mS(i)?(yS(i),!1):(pS(i),!0)}const bS=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],xS=["operator","engineer","admin","superadmin"];function oy(i){return xS.indexOf(i)}function vS(i,t){return oy(i)>=oy(t)}function _S({onClose:i}){var G,F,K,J,ie;const{isSuperAdmin:t,hasRoleType:s,hasRole:a}=zn(),{data:o}=Hr(),u=Ah(),d=!!((G=o==null?void 0:o.ai)!=null&&G.enabled),m=jg(),y=m!==null?m:d,[g,E]=A.useState(y),_=t?"superadmin":s("admin")?"admin":a("engineer")?"engineer":"operator",T=((F=o==null?void 0:o.branding)==null?void 0:F.appName)??"LongTail",q=(K=o==null?void 0:o.environment)==null?void 0:K.longTailVersion,C=(J=o==null?void 0:o.environment)==null?void 0:J.hotmeshVersion,R=(ie=o==null?void 0:o.environment)==null?void 0:ie.nodeEnv;A.useEffect(()=>{const he=Se=>{Se.key==="Escape"&&i()};return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[i]);const Q=bS.filter(he=>vS(_,he.minTier)),se=Q.length>1,U=_==="admin"||_==="superadmin",le=[...se?[{id:"viewas",label:"View As",icon:vv}]:[],{id:"ai",label:"AI",icon:_v},...U?[{id:"queues",label:"Task Queues",icon:lh}]:[]],[re,N]=A.useState(le[0].id),Z=he=>{he===null?Ag():lS(he)},ce=()=>{const he=!g;E(he),he===d?aS():rS(he),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:he=>he.stopPropagation(),children:[h.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(si,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Gt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:T}),q&&h.jsxs("p",{className:"mt-1 text-[11px] text-text-tertiary",children:["v",q,C&&h.jsxs(h.Fragment,{children:[" · HotMesh v",C]}),R&&R!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:R})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),le.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:le.map(he=>{const Se=re===he.id;return h.jsxs("button",{role:"tab","aria-selected":Se,onClick:()=>N(he.id),title:he.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Se?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(he.icon,{className:`w-5 h-5 ${he.id==="queues"?"rotate-90":""}`,strokeWidth:1.5,...Se?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-[10px] font-medium",children:he.label})]},he.id)})}),re==="viewas"&&se&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),Q.map(he=>{const Se=u===he.id,Ne=he.id===null?`Your view · ${_}`:he.label;return h.jsxs("button",{onClick:()=>Z(he.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${Se?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Se&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${Se?"text-accent":"text-text-primary group-hover:text-accent"}`,children:Ne}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:he.description})]})]},String(he.id))})]}),re==="ai"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:g?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${g?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${g?"translate-x-4":"translate-x-0"}`})})]})]}),re==="queues"&&U&&h.jsx(wS,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-[10px] text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}function wS(){const{data:i}=Nh(),[t,s]=A.useState(Di),a=((i==null?void 0:i.roles)??[]).filter(u=>!Dg(u.role)).sort((u,d)=>(u.title||u.role).localeCompare(d.title||d.role)),o=u=>{gS(u),s(Di())};return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-1",children:"Task Queues"}),h.jsx("p",{className:"text-xs text-text-secondary mb-4",children:"Pick the lanes to pin to your sidebar."}),a.length===0?h.jsx("p",{className:"text-xs text-text-tertiary py-2",children:"No roles yet."}):h.jsx("div",{className:"space-y-0.5 -mx-1",children:a.map(u=>{const d=t.includes(u.role);return h.jsxs("button",{onClick:()=>o(u.role),className:"w-full text-left flex items-center justify-between py-2 px-1 group",children:[h.jsxs("span",{className:"min-w-0",children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors truncate",children:u.title||u.role}),u.title&&h.jsx("span",{className:"block text-[10px] text-text-quaternary truncate",children:u.role})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${d?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${d?"translate-x-4":"translate-x-0"}`})})]},u.role)})})]})}const zg=["violet","red","green","blue","rose","orange"],cy="blue",SS={violet:"#7B3BE0",red:"#DC382D",green:"#059669",blue:"#2563EB",rose:"#D6246E",orange:"#E85D04"},uy={violet:"Violet",red:"Brick",green:"Emerald",blue:"Electric",rose:"Raspberry",orange:"Harvest"},Ug="lt.theme";function ES(i){return zg.includes(i)}function Bg(){try{const i=localStorage.getItem(Ug);return ES(i)?i:cy}catch{return cy}}function Lg(i){document.documentElement.dataset.theme=i}function jS(i){try{localStorage.setItem(Ug,i)}catch{}Lg(i)}function AS(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function OS(i){var t;return((t=i.title)==null?void 0:t.trim())||AS(i.role)}const Pg=800,Hg=270,Or=40,TS=76,kh=24,NS=72,Fo=Pg-Or-TS,$g=Hg-kh-NS,Cn=kh+$g,fy=Or+Fo,nn="0.5s cubic-bezier(0.4, 0, 0.2, 1)",hy=9;function kS(i){return`M ${(i.x-hy).toFixed(1)} ${i.y.toFixed(1)} L ${(i.x+hy).toFixed(1)} ${i.y.toFixed(1)}`}function Tr(i){if(i.length===0)return"";if(i.length===1)return kS(i[0]);const t=[];for(let s=0;s<i.length-1;s++){const a=i[Math.max(0,s-1)],o=i[s],u=i[s+1],d=i[Math.min(i.length-1,s+2)],m=(o.x+(u.x-a.x)/6).toFixed(1),y=(o.y+(u.y-a.y)/6).toFixed(1),g=(u.x-(d.x-o.x)/6).toFixed(1),E=(u.y-(d.y-o.y)/6).toFixed(1);s===0&&t.push(`M ${o.x.toFixed(1)} ${o.y.toFixed(1)}`),t.push(`C ${m} ${y}, ${g} ${E}, ${u.x.toFixed(1)} ${u.y.toFixed(1)}`)}return t.join(" ")}function CS(i,t){if(i.length<2||t.length<2)return"";const s=Tr(i),a=[...t].reverse(),o=Tr(a),u=o.slice(o.indexOf("C"));return`${s} L ${a[0].x.toFixed(1)} ${a[0].y.toFixed(1)} ${u} Z`}function MS(i){return i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${(i/1e3).toFixed(1)}k`:String(i)}function qo(i){return i.length>0?i[i.length-1]:void 0}const jr="#f97316",Ga="#0ea5e9",wr="#16a34a",zo="#94a3b8",BA="#DC2626",RS=13;function DS(i,t){const s=[...i].sort((d,m)=>d.y-m.y);let a=-1/0;const o=s.map(d=>{const m=Math.max(d.y+3,a+RS);return a=m,{...d,labelY:m}}),u=o.length>0?o[o.length-1].labelY-t:0;if(u>0)for(const d of o)d.labelY-=u;return o}function LA({stations:i,selectedRole:t,onSelect:s,onUpstreamSelect:a,onCmdClick:o,periodHours:u}){const[d,m]=A.useState(null),y=i.length;if(y===0)return null;const g=$=>y===1?Or+Fo/2:Or+$/(y-1)*Fo,E=new Map(i.map(($,be)=>[$.role,g(be)])),_=i.map(($,be)=>{var Pe,_t,jt,rt;const xe=$.target_per_hour??null,je=xe!=null?xe*u:null;return{idx:be,x:g(be),expected:je,actual:((Pe=$.metric)==null?void 0:Pe.resolved)??0,active:((_t=$.metric)==null?void 0:_t.claimed)??0,pending:((jt=$.metric)==null?void 0:jt.pending)??0,priorityCount:((rt=$.metric)==null?void 0:rt.priority_count)??0}}),T=_.some($=>$.expected!=null),C=Math.max(1,..._.map($=>$.expected??0),..._.map($=>$.actual),..._.map($=>$.expected!=null?$.pending:0))*1.15,R=$=>kh+$g*(1-Math.max(0,Math.min($,C))/C),Q=_.filter($=>$.expected!=null),se=Q.map($=>({...$,y:R($.expected)})),U=Q.map($=>({...$,y:R($.actual)})),le=Q.map($=>({...$,y:R($.active)})),re=Q.map($=>({...$,y:R($.pending)})),N=Tr(se),Z=Tr(U),ce=Tr(le),G=Tr(re),F=qo(U),K=qo(se),J=qo(le),ie=qo(re),he=U.length>=2&&F?`${Z} L ${F.x.toFixed(1)} ${Cn} L ${U[0].x.toFixed(1)} ${Cn} Z`:"",Se=Q.some($=>$.pending>0||$.active>0),Ne=Se&&le.length>=2&&J?`${ce} L ${J.x.toFixed(1)} ${Cn} L ${le[0].x.toFixed(1)} ${Cn} Z`:"",Y=Se?CS(re,le):"",ae=Q.some($=>$.active>0),de=Q.some($=>$.pending>$.active),Oe=DS([K?{key:"target",text:"Target",color:zo,y:K.y}:null,F?{key:"actual",text:"Resolved",color:wr,y:F.y}:null,ae&&J?{key:"active",text:"Claimed",color:jr,y:J.y}:null,de&&ie?{key:"queued",text:"Pending",color:Ga,y:ie.y}:null].filter(Boolean),Cn+4);return h.jsxs("svg",{viewBox:`0 0 ${Pg} ${Hg}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",style:{display:"block"},children:[i.map($=>{if(!$.parent_role)return null;const be=E.get($.parent_role);if(be==null)return null;const xe=g(i.findIndex(je=>je.role===$.role));return h.jsx("line",{x1:be,y1:Cn,x2:xe,y2:Cn,stroke:"#e2e8f0",strokeWidth:.75},`dep-${$.role}`)}),he&&h.jsx("path",{d:he,fill:wr,opacity:.05,style:{transition:`d ${nn}`}}),Ne&&h.jsx("path",{d:Ne,fill:jr,opacity:.12,style:{transition:`d ${nn}`}}),Y&&h.jsx("path",{d:Y,fill:Ga,opacity:.12,style:{transition:`d ${nn}`}}),N&&h.jsx("path",{d:N,fill:"none",stroke:zo,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.7,style:{transition:`d ${nn}`}}),se.map($=>h.jsxs("g",{transform:`translate(${$.x} ${$.y})`,style:{transition:`transform ${nn}`},children:[h.jsx("circle",{r:2,fill:zo,opacity:.8}),h.jsx("text",{y:-5,textAnchor:"middle",fontSize:6.5,fill:zo,fontFamily:"ui-monospace, monospace",fontWeight:"500",opacity:.7,children:Math.round($.expected)})]},`tval-${$.idx}`)),Se&&G&&h.jsx("path",{d:G,fill:"none",stroke:Ga,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.55,style:{transition:`d ${nn}`}}),ce&&h.jsx("path",{d:ce,fill:"none",stroke:jr,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.5,style:{transition:`d ${nn}`}}),Z&&h.jsx("path",{d:Z,fill:"none",stroke:wr,strokeWidth:.6,strokeLinejoin:"round",strokeLinecap:"round",opacity:.65,style:{transition:`d ${nn}`}}),le.map(($,be)=>{if($.pending<=0&&$.active<=0)return null;const xe=Math.max(2.5,Math.min(5,2.5+$.active/10)),je=$.pending>$.active,Pe=Math.min(re[be].y-4,$.y-xe-4);return h.jsxs("g",{children:[$.pending>0&&h.jsx("text",{x:$.x,y:Pe,textAnchor:"middle",fontSize:7.5,fill:je?Ga:"#64748b",fontFamily:"ui-monospace, monospace",fontWeight:"600",style:{transition:`y ${nn}`},children:$.pending}),h.jsxs("g",{transform:`translate(${$.x} ${$.y})`,style:{transition:`transform ${nn}`},children:[h.jsx("circle",{r:xe,fill:jr,opacity:.85}),$.active>0&&h.jsx("text",{y:xe+9,textAnchor:"middle",fontSize:7.5,fill:jr,fontFamily:"ui-monospace, monospace",fontWeight:"600",children:$.active})]})]},`active-${$.idx}`)}),_.map($=>{var Un;const be=i[$.idx],xe=$.x,je=$.expected!=null?R($.actual):Cn,Pe=Math.max(2.25,Math.min(4,2.25+$.actual/160)),_t=be.role===t,jt=d===$.idx,rt=$.expected==null?"idle · set a target rate to plot pace":`${$.actual} resolved · target ${Math.round($.expected)}`+($.pending>$.active?` · ${$.pending-$.active} pending`:"")+($.active>0?` · ${$.active} claimed`:"")+($.priorityCount>0?` · ${$.priorityCount} in jeopardy`:""),ct=rt.length*5.5+20,Te=Math.max(Or+ct/2+4,Math.min(fy-ct/2-4,xe)),wt=je-Pe-10;return h.jsxs("g",{onClick:un=>{un.metaKey||un.ctrlKey?(un.stopPropagation(),o==null||o(be.role)):s(be.role)},onMouseEnter:()=>m($.idx),onMouseLeave:()=>m(null),style:{cursor:"pointer"},children:[h.jsxs("g",{transform:`translate(${xe} ${je})`,style:{transition:`transform ${nn}`},children:[h.jsx("circle",{r:22,fill:"transparent"}),h.jsx("circle",{r:Pe,fill:wr,opacity:.9,style:{transition:`r ${nn}`}}),$.expected!=null&&h.jsx("text",{y:-Pe-5,textAnchor:"middle",fontSize:9.5,fill:wr,fontFamily:"ui-monospace, monospace",fontWeight:"500",children:MS($.actual)}),jt&&!_t&&h.jsx("circle",{r:Pe+3,fill:"none",stroke:wr,strokeWidth:1,opacity:.4}),_t&&h.jsx("circle",{r:Pe+4,fill:"none",stroke:"#6366f1",strokeWidth:2})]}),(((Un=be.upstream_roles)==null?void 0:Un.length)??0)>0&&h.jsxs("g",{transform:`translate(${xe-20} ${Cn})`,onClick:un=>{un.stopPropagation(),a==null||a(be.upstream_roles[0])},style:{cursor:"pointer"},children:[h.jsx("title",{children:`Fed by ${be.upstream_roles.join(", ")} — click to view that sequence`}),h.jsx("circle",{r:9,cy:-6,fill:"transparent"}),h.jsx("path",{d:"M -7 -14 C -3 -14 -1 -9 0 -2",fill:"none",stroke:"#94a3b8",strokeWidth:1,strokeDasharray:"2 2",strokeLinecap:"round"}),h.jsx("path",{d:"M 0 -2 L 8 -2",stroke:"#94a3b8",strokeWidth:1,strokeLinecap:"round"}),h.jsx("path",{d:"M 8 -2 l -3.5 -2 v 4 z",fill:"#94a3b8"})]}),h.jsx("text",{x:xe,y:Cn+($.idx%2===0?14:27),textAnchor:"middle",fontSize:9.5,fill:"#475569",fontFamily:"ui-sans-serif, sans-serif",fontWeight:"500",children:OS(be)}),jt&&h.jsxs("g",{children:[h.jsx("rect",{x:Te-ct/2,y:wt-16,width:ct,height:19,rx:3,fill:"#0f172a",opacity:.88}),h.jsx("text",{x:Te,y:wt-3,textAnchor:"middle",fontSize:8.5,fill:"white",fontFamily:"ui-monospace, monospace",children:rt})]})]},be.role)}),!T&&h.jsx("text",{x:Or+Fo/2,y:Cn+48,textAnchor:"middle",fontSize:8.5,fill:"#94a3b8",fontFamily:"ui-sans-serif, sans-serif",children:"Set target_per_hour on each role in Admin → Roles to enable the pace chart"}),Oe.map($=>h.jsx("text",{x:fy+6,y:$.labelY,fontSize:8,fill:$.color,fontFamily:"ui-sans-serif, sans-serif",fontWeight:$.key==="actual"?700:500,opacity:$.key==="active"?.85:1,style:{transition:`y ${nn}`},children:$.text},$.key))]})}const Yg="lt:bookmarks";function qS(){try{const i=localStorage.getItem(Yg);if(!i)return[];const t=JSON.parse(i);return Array.isArray(t)?t:[]}catch{return[]}}function dy(i){try{localStorage.setItem(Yg,JSON.stringify(i))}catch{}}function zS({onToggleEventFeed:i,onToggleDocs:t}){var K;const{user:s,logout:a}=zn(),{isBuilder:o,isOps:u,viewAs:d,realIsBuilder:m}=Og(),{available:y,mine:g}=hS(),{connected:E}=rw(),{data:_}=Hr(),T=Qn(),[q,C]=A.useState(!1),[R,Q]=A.useState(!1),[se,U]=A.useState(Bg),[le,re]=A.useState(qS),N=A.useRef(null),Z=(K=_==null?void 0:_.branding)==null?void 0:K.appName,ce=J=>{jS(J),U(J)},G=()=>{const J=window.prompt("Bookmark label:");if(!(J!=null&&J.trim()))return;const ie=T.pathname+T.search,he=[...le,{label:J.trim(),url:ie}].sort((Se,Ne)=>Se.label.localeCompare(Ne.label));re(he),dy(he),C(!1)},F=J=>{const ie=le.filter(he=>!(he.label===J.label&&he.url===J.url));re(ie),dy(ie)};return A.useEffect(()=>{if(!q)return;const J=ie=>{N.current&&!N.current.contains(ie.target)&&C(!1)};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[q]),h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative z-30",children:[h.jsx(Mi,{to:"/","aria-label":"Home",onClick:J=>{(J.ctrlKey||J.metaKey)&&(J.preventDefault(),Q(!0))},children:h.jsx(Th,{appName:Z})}),h.jsxs("div",{className:"flex items-center gap-5",children:[h.jsxs(Mi,{to:"/escalations/available",className:"flex items-center gap-1.5 text-[11px] transition-colors text-text-quaternary hover:text-text-secondary",style:y>0?{color:Ga}:void 0,title:"All escalations",children:[h.jsx(v0,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"all",y>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:y})]}),h.jsxs(Mi,{to:"/escalations/queue",className:"flex items-center gap-1.5 text-[11px] transition-colors text-text-quaternary hover:text-text-secondary",style:g>0?{color:jr}:void 0,title:"My escalation queue",children:[h.jsx(v0,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",g>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),(o||u)&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-px h-4 bg-surface-border"}),h.jsxs("button",{type:"button",onClick:()=>{E?i==null||i():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${E?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:E?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[h.jsx(By,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]})]}),m&&h.jsx(h.Fragment,{children:h.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[h.jsx(Ly,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})}),d&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-[10px] text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[d," View"]}),h.jsx("button",{onClick:Ag,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(si,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&h.jsxs("div",{className:"relative",ref:N,children:[h.jsxs("button",{onClick:()=>C(J=>!J),className:"btn-ghost text-xs flex items-center gap-1",children:[h.jsx(wv,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,h.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),q&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[h.jsx(Mi,{to:"/credentials",onClick:()=>C(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2",children:zg.map(J=>h.jsx("button",{type:"button",onClick:()=>ce(J),title:uy[J],"aria-label":`${uy[J]} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${se===J?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:SS[J]}},J))})]}),h.jsx("button",{onClick:()=>{C(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[le.map(J=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(Mi,{to:J.url,onClick:()=>C(!1),title:J.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:J.label}),h.jsx("button",{type:"button",onClick:()=>F(J),title:`Remove "${J.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:h.jsx(si,{className:"w-3 h-3"})})]},`${J.label}::${J.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:G,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(Sv,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),R&&h.jsx(_S,{onClose:()=>Q(!1)})]})}function Ch({open:i,children:t}){const[s,a]=A.useState(i);return A.useEffect(()=>{i&&a(!0)},[i]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||a(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function ah(i){return({isActive:t})=>{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 i?`${s} justify-center w-10 h-10 mx-auto ${t?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${t?a:o}`}}function US(){return({isActive:i})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${i?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function BS({group:i,collapsed:t}){const{pathname:s}=Qn(),a=i.matchPaths.some(m=>s.startsWith(m)),[o,u]=A.useState(a),d=o||a;return t?h.jsx(h.Fragment,{children:i.items.map(m=>h.jsx(qr,{to:m.to,className:ah(!0),title:m.label,children:m.icon&&h.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>u(m=>!m),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:[h.jsxs("span",{className:"flex items-center gap-3",children:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:i.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(Ch,{open:d,children:i.items.map(m=>h.jsxs(qr,{to:m.to,end:m.end,className:US(),children:[m.icon&&h.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:m.label})]},m.to))})]})}function LS(i){return i.kind==="group"}function PS({entry:i,collapsed:t}){const{pathname:s,search:a}=Qn(),o=i.to.includes("?"),u=i.icon&&h.jsx(i.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${i.iconClassName??""}`,strokeWidth:1.5,...i.solid?{fill:"currentColor"}:{}});if(o){const[d,m]=i.to.split("?"),y=s===d&&a===`?${m}`,g=ah(t)({isActive:y});return h.jsxs(qr,{to:i.to,className:g,title:t?i.label:void 0,children:[u,!t&&h.jsx("span",{children:i.label})]})}return h.jsxs(qr,{to:i.to,end:i.end,className:ah(t),title:t?i.label:void 0,children:[u,!t&&h.jsx("span",{children:i.label})]})}function ai({heading:i,entries:t}){const{collapsed:s}=Oh();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:i}),t.map(a=>LS(a)?h.jsx(BS,{group:a,collapsed:s},a.label):h.jsx(PS,{entry:a,collapsed:s},a.to))]})}function HS({aiEnabled:i=!1,isBuilder:t=!1,isOps:s=!1,viewAs:a=null,canSeePaceBoard:o=!1}){const u={to:"/operations",label:"Pace Board",icon:Ev};if(!t&&(!s||a==="engineer"||a==="operator"))return null;if(!t)return h.jsx(ai,{heading:"Monitor",entries:o?[u]:[]});const d=[...o?[u]:[],{to:"/topics",label:"Event Topics",icon:By},{to:"/agents",label:i?"Agents":"Automations",icon:jv},{to:"/capabilities",label:"Capabilities",icon:Av}];return h.jsx(ai,{heading:"Monitor",entries:d})}function $S(){const{user:i}=zn(),{taskQueueSource:t}=Tg(),s=A.useMemo(()=>{const u=((i==null?void 0:i.roles)??[]).map(d=>d.role).filter(d=>!Dg(d));return Array.from(new Set(u)).sort((d,m)=>d.localeCompare(m))},[i]),[a,o]=A.useState(Di);return A.useEffect(()=>{if(t!=="manual")return;const u=()=>o(Di());return u(),window.addEventListener(rh,u),window.addEventListener("storage",u),()=>{window.removeEventListener(rh,u),window.removeEventListener("storage",u)}},[t]),t==="manual"?a:s}function YS(){const i=$S(),{data:t}=Nh({enabled:i.length>0}),s=A.useMemo(()=>new Map(((t==null?void 0:t.roles)??[]).map(o=>[o.role,o.title])),[t]),a=A.useMemo(()=>i.map(o=>({to:`/escalations/available?role=${encodeURIComponent(o)}`,label:s.get(o)||o,icon:lh,solid:!0,iconClassName:"rotate-90"})),[i,s]);return a.length===0?null:h.jsx(ai,{heading:"Task Queues",entries:a})}function VS(){return mt({queryKey:["me","preferences"],queryFn:()=>Ae("/me/preferences"),staleTime:6e4})}function FS(){const i=vt();return Nt({mutationFn:t=>Ae("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{i.setQueryData(["me","preferences"],t)}})}const Sr=i=>{if(i)try{return JSON.parse(i)}catch{return}},ki=i=>i==null||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0;function GS(i){const t={},s=Sr(i.get("facets"));ki(s)||(t.facets=s);const a=Sr(i.get("block"));ki(a)||(t.block=a);const o=Sr(i.get("range"));ki(o)||(t.range=o);const u=Sr(i.get("exists"));ki(u)||(t.exists=u);const d=Sr(i.get("roles"));ki(d)||(t.roles=d);const m=Sr(i.get("orderBy"));ki(m)||(t.orderBy=m),i.get("available")!=null&&(t.available=i.get("available")==="true");const y=i.get("jeopardy");return(y==="1"||y==="true")&&(t.jeopardy=!0),t}function PA(i,t){const s=(a,o)=>ki(o)?i.delete(a):i.set(a,JSON.stringify(o));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?i.delete("available"):i.set("available",String(t.available)),t.jeopardy===!0?i.set("jeopardy","1"):i.delete("jeopardy")}function HA(i,t,s){const a=typeof t=="object"&&t!==null?JSON.stringify(t):t,o=encodeURIComponent(JSON.stringify({[i]:a}));return s?`/escalations/available?role=${encodeURIComponent(s)}&facets=${o}&status=all`:`/escalations/available?facets=${o}&status=all`}function $A(i){var t,s,a;return Object.keys(i.facets??{}).length+(((t=i.block)==null?void 0:t.length)??0)+(((s=i.range)==null?void 0:s.length)??0)+(((a=i.exists)==null?void 0:a.length)??0)+(i.available!=null?1:0)+(i.jeopardy===!0?1:0)}function IS(i,t){const s=(i==null?void 0:i.pinnedViews)??[],a=new Set((i==null?void 0:i.hiddenRolePins)??[]),o=new Set(s.map(m=>m.label)),u=[...s],d=new Set;for(const{role:m,pins:y}of t)for(const g of y)o.has(g.label)||a.has(g.label)||d.has(g.label)||(d.add(g.label),u.push({...g,id:`role:${m}:${g.label}`,fromRole:m}));return u}function QS(i){let t;try{t=new URL(i,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const s=t.searchParams,a=GS(s),o=s.get("status")||void 0,u=t.pathname==="/escalations/available"&&(o===void 0||o==="available");return{available:u,params:{...a,role:s.get("role")||void 0,type:s.get("type")||void 0,priority:s.get("priority")?parseInt(s.get("priority"),10):void 0,status:u||o==="all"?void 0:o,search:s.get("search")||void 0}}}function JS(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function KS(){var se;const{collapsed:i}=Oh(),{user:t}=zn(),s=VS(),a=FS(),o=A.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(U=>U.role)),[t]),{data:u}=Nh({enabled:o.size>0}),d=vt();fg(`${cg}.system.escalation.>`,()=>{d.invalidateQueries({queryKey:["escalations"]})});const m=(se=s.data)==null?void 0:se.preferences,y=A.useMemo(()=>((u==null?void 0:u.roles)??[]).filter(U=>o.has(U.role)&&Array.isArray(U.default_pins)&&U.default_pins.length>0).map(U=>({role:U.role,pins:U.default_pins})),[u,o]),g=A.useMemo(()=>IS(m,y),[m,y]),E=(m==null?void 0:m.pinnedViews)??[],_=A.useRef(null),T=U=>a.mutate({pinnedViews:U}),q=U=>T(E.filter(le=>le.id!==U)),C=U=>T([...E,{id:JS(),label:U.label,url:U.url,badge:U.badge}]),R=U=>a.mutate({hiddenRolePins:[...(m==null?void 0:m.hiddenRolePins)??[],U]}),Q=(U,le)=>{if(U===le)return;const re=[...E],[N]=re.splice(U,1);re.splice(le,0,N),T(re)};return g.length===0?null:h.jsxs("div",{className:"space-y-1",children:[i?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:"Pinned"}),g.map(U=>{const le=U.fromRole?-1:E.findIndex(re=>re.id===U.id);return h.jsx(XS,{pin:U,collapsed:i,draggable:le!==-1,onDragStart:()=>{_.current=le},onDropOn:()=>{_.current!==null&&le!==-1&&Q(_.current,le),_.current=null},onRemove:U.fromRole?void 0:()=>q(U.id),onPromote:U.fromRole?()=>C(U):void 0,onHide:U.fromRole?()=>R(U.label):void 0},U.id)})]})}function XS({pin:i,collapsed:t,draggable:s,onDragStart:a,onDropOn:o,onRemove:u,onPromote:d,onHide:m}){const{pathname:y,search:g}=Qn(),[E,_=""]=i.url.split("?"),T=y===E&&g===(_?`?${_}`:""),q="group flex items-center rounded-md transition-colors duration-150",C=T?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?h.jsx(qr,{to:i.url,className:`${q} ${C} justify-center w-10 h-10 mx-auto`,title:i.label,children:h.jsx(_0,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${q} ${C}`,draggable:s,onDragStart:a,onDragOver:R=>R.preventDefault(),onDrop:o,children:[h.jsxs(qr,{to:i.url,className:"flex items-center gap-3 pl-4 py-2 text-sm flex-1 min-w-0",children:[h.jsx(_0,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5,...i.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate",children:i.label}),i.badge&&h.jsx(ZS,{url:i.url}),i.fromRole&&h.jsx("span",{className:"shrink-0 text-[9px] uppercase tracking-wider text-text-quaternary",title:`Provided by the ${i.fromRole} role`,children:"role"})]}),h.jsxs("span",{className:"flex items-center pr-2 gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[d&&h.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(Py,{className:"w-3 h-3"})}),m&&h.jsx("button",{onClick:m,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Ov,{className:"w-3 h-3"})}),u&&h.jsx("button",{onClick:u,title:`Remove "${i.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(si,{className:"w-3 h-3"})})]})]})}function ZS({url:i}){var d;const t=A.useMemo(()=>QS(i),[i]),s={limit:1,staleTime:15e3},a=Mg({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),o=Cg({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const u=t.available?a:o;return u.isError||((d=u.data)==null?void 0:d.total)===void 0?null:h.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-accent/10 text-accent text-[10px] font-semibold tabular-nums",children:u.data.total})}function WS(){const i=[{kind:"group",label:"Procedural",icon:Tv,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Registry",icon:w0},{to:"/workflows/durable/invoke",label:"Invoke",icon:S0},{to:"/workflows/executions",label:"Executions",icon:E0}]},{kind:"group",label:"Graph",icon:oh,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:w0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:S0},{to:"/mcp/executions",label:"Executions",icon:E0}]}];return h.jsx(ai,{heading:"Orchestrate",entries:i})}const e2=[{to:"/mcp/queries",label:"Designer",icon:Nv},{to:"/mcp/servers",label:"Servers & Tools",icon:kv}];function t2(){return h.jsx(ai,{heading:"Design",entries:e2})}const n2=[{to:"/files",label:"Files",icon:Cv},{to:"/knowledge",label:"Knowledge",icon:Mv}];function s2(){return h.jsx(ai,{heading:"Storage",entries:n2})}function i2({isBuilder:i=!1,isOps:t=!1}){var d;const{data:s}=Hr(),a=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:Rv},...i||t?[{to:"/admin/roles",label:"Roles",icon:Dv}]:[]],u=[{to:"/admin/controlplane",label:"Routers",icon:qv},{to:"/admin/streams",label:"Messages",icon:zv},...a?[{to:"/admin/maintenance",label:"DB Maintenance",icon:lh}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(ai,{heading:"Identity & Access",entries:o}),i&&h.jsx(ai,{heading:"Infrastructure",entries:u})]})}const Vg="lt_event_feed_patterns";function r2(i){if(i.startsWith("/topics/")){const u=decodeURIComponent(i.replace("/topics/",""));if(u&&!u.includes("/"))return`lt.events.${u}`}const t=i.match(/^\/escalations\/detail\/(.+)/);if(t)return`lt.events.system.escalation.${t[1]}.>`;if(i.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=i.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const o=i.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function a2(){try{const i=localStorage.getItem(Vg);return i?JSON.parse(i):[]}catch{return[]}}function Df(i){try{localStorage.setItem(Vg,JSON.stringify(i))}catch{}}function l2(){const{pathname:i}=Qn(),[t,s]=A.useState(a2),a=A.useMemo(()=>r2(i),[i]),o=A.useMemo(()=>{const y=new Set([a,...t]);return Array.from(y)},[a,t]),u=A.useCallback(y=>{const g=y.startsWith("lt.events.")?y:`lt.events.${y}`;s(E=>{if(E.includes(g))return E;const _=[...E,g];return Df(_),_})},[]),d=A.useCallback(y=>{s(g=>{const E=g.filter(_=>_!==y);return Df(E),E})},[]),m=A.useCallback(()=>{s([]),Df([])},[]);return{patterns:o,pagePattern:a,userPatterns:t,addPattern:u,removePattern:d,clearUserPatterns:m}}function o2({children:i,className:t=""}){return h.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:i})}const qf=280,my="cubic-bezier(0.4, 0, 0.2, 1)",Uo=40;function c2(i){if(!i)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,a=t-Uo*2,o=s-Uo*2,u=i.width/a,d=i.height/o,m=i.left+i.width/2-(Uo+a/2),y=i.top+i.height/2-(Uo+o/2);return`translate(${m}px, ${y}px) scale(${u}, ${d})`}function Fg({open:i,onClose:t,sourceRef:s,children:a}){const[o,u]=A.useState(null),d=A.useRef(null),m=A.useRef(!1);A.useEffect(()=>{var T,q;i&&!m.current?(d.current=((T=s==null?void 0:s.current)==null?void 0:T.getBoundingClientRect())??null,u("entering")):!i&&m.current&&o==="open"&&(d.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,u("exiting")),m.current=i},[i,s,o]),A.useEffect(()=>{if(o!=="entering")return;const T=requestAnimationFrame(()=>{requestAnimationFrame(()=>u("open"))});return()=>cancelAnimationFrame(T)},[o]),A.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),A.useEffect(()=>{if(!o)return;const T=q=>{q.key==="Escape"&&t()};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[o,t]);const y=A.useCallback(T=>{T.propertyName==="transform"&&o==="exiting"&&u(null)},[o]);if(A.useEffect(()=>{if(o!=="exiting")return;const T=setTimeout(()=>u(null),qf+50);return()=>clearTimeout(T)},[o]),!o)return null;const g=o==="entering"||o==="exiting",E=g?c2(d.current):"none",_=g?0:1;return zy.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${qf}ms ${my}, opacity ${qf}ms ${my}`,transform:E,opacity:_,backgroundColor:"#FFFFFF"},onTransitionEnd:y,children:a}),document.body)}function u2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function f2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function h2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 d2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function m2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 p2({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.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 y2(i){const t=i.trim().split(`
54
- `);if(t.length<2)return i;const s=m=>m.split("|").map(y=>y.trim()).filter(Boolean),a=s(t[0]),o=t.slice(2),u=a.map(m=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${m}</th>`).join(""),d=o.map(m=>`<tr class="border-t border-surface-border">${s(m).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">${u}</tr></thead><tbody>${d}</tbody></table>`}function Bo(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function g2(i){const t=[];let s=i.replace(/```(\w*)\n([\s\S]*?)```/g,(y,g,E)=>{const _=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${_}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(y,g,E,_)=>y2(`${g}
55
- ${E}
56
- ${_.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(y,g)=>`<h4 id="${Bo(g)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${g}</h4>`).replace(/^### (.+)$/gm,(y,g)=>`<h3 id="${Bo(g)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${g}</h3>`).replace(/^## (.+)$/gm,(y,g)=>`<h2 id="${Bo(g)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${g}</h2>`).replace(/^# (.+)$/gm,(y,g)=>`<h1 id="${Bo(g)}" class="text-lg font-bold text-text-primary mb-3">${g}</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,y=>{const g=y.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(g),_=/note:|ℹ️|info/i.test(g);return`<div class="${E?"bg-status-warning/5":_?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":_?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${g}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=y=>new RegExp(`(${o(y)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(u('<li class="ml-8 list-disc'),y=>`<ul class="mb-3">${y}</ul>`),s=s.replace(u('<li class="ml-4 list-disc'),y=>`<ul class="mb-3">${y}</ul>`),s=s.replace(u('<li class="ml-4 list-decimal'),y=>`<ol class="list-decimal mb-3">${y}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(y,g)=>t[parseInt(g,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",m=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(y=>{const g=y.trim();if(!g)return"";const E=[];let _=g,T;for(;(T=m.exec(_))!==null;){const q=T.index+T[0].length;E.push(_.slice(0,q)),_=_.slice(q).replace(/^<br\/>/,"").trim(),m.lastIndex=0}return _&&E.push(_),E.map(q=>{const C=q.trim();return C?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(C)?C:`<p class="${d}">${C}</p>`:""}).join("")}).join(""),s}const b2=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function x2(i){return b2.test(i)}function Mh({content:i,className:t,onClick:s}){const a=A.useMemo(()=>g2(i),[i]);return h.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function ec({data:i,depth:t=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:t>0,[u,d]=A.useState(o),[m,y]=A.useState(s);if(s!==void 0&&s!==m&&(y(s),d(s%2===0&&t>0)),i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',i,'"']});if(typeof i=="number"||typeof i=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):u?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",i.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:i.map((g,E)=>h.jsxs("div",{children:[h.jsx(ec,{data:g,depth:t+1,generation:s}),E<i.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof i=="object"){const g=Object.entries(i);return g.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):u?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:g.map(([E,_],T)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:E}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(ec,{data:_,depth:t+1,generation:s}),T<g.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(i)})}function Xa({data:i,depth:t=0}){if(i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&x2(i)?h.jsx(Mh,{content:i}):h.jsx("span",{className:"text-text-primary",children:i});if(typeof i=="number"||typeof i=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:i.map((s,a)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(Xa,{data:s,depth:t+1})})]},a))});if(typeof i=="object"){const s=Object.entries(i);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const u=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),u?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Xa,{data:o,depth:t+1})}):h.jsx(Xa,{data:o,depth:t+1})]},a)})})}return h.jsx("span",{children:String(i)})}function py({mode:i,setMode:t,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:u,onFullscreen:d,onClose:m,large:y}){const g=y?"w-5 h-5":"w-3.5 h-3.5",E=`${y?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[i==="json"&&h.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?h.jsx(p2,{className:g}):h.jsx(m2,{className:g})}),h.jsx("button",{onClick:()=>t(i==="json"?"tree":"json"),className:E,title:i==="json"?"Outline view":"JSON view",children:i==="json"?h.jsx(u2,{className:g}):h.jsx(f2,{className:g})}),h.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:u?h.jsx(d2,{className:`${g} text-status-success`}):h.jsx(h2,{className:g})}),d&&h.jsx("button",{onClick:d,className:E,title:"Fullscreen",children:h.jsx(Hy,{className:g})}),m&&h.jsx("button",{onClick:m,className:E,title:"Close (Esc)",children:h.jsx($y,{className:g})})]})}function v2({data:i,label:t,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const u=A.useRef(null),[d,m]=A.useState(o??"json"),[y,g]=A.useState(!1),[E,_]=A.useState(!1),[T,q]=A.useState(a?0:1),[C,R]=A.useState(1),Q=T%2===0,se=C%2===0,U=A.useCallback(()=>q(K=>K+1),[]),le=A.useCallback(()=>R(K=>K+1),[]);let re=i;if(typeof i=="string")try{re=JSON.parse(i)}catch{}const N=async()=>{const K=typeof i=="string"?i:JSON.stringify(re,null,2);await navigator.clipboard.writeText(K),g(!0),setTimeout(()=>g(!1),2e3)},Z=A.useCallback(()=>{R(1),_(!0)},[]),ce=s==="panel",G=ce?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",F=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 h.jsxs("div",{className:G,children:[t&&h.jsx(o2,{children:t}),h.jsxs("div",{ref:u,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(py,{mode:d,setMode:m,isCollapsed:Q,onToggleCollapse:U,onCopy:N,copied:y,onFullscreen:Z})}),h.jsx("div",{className:F,children:d==="json"?h.jsx(ec,{data:re,generation:T}):h.jsx(Xa,{data:re})})]}),h.jsxs(Fg,{open:E,onClose:()=>_(!1),sourceRef:u,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(py,{mode:d,setMode:m,isCollapsed:se,onToggleCollapse:le,onCopy:N,copied:y,onClose:()=>_(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(ec,{data:re,generation:C}):h.jsx(Xa,{data:re})})]})]})}const _2=100,yy=500;let w2=0;const Gg={"escalation.created":"text-status-active","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-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function Ig(i){const t=i.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:i}function gy({event:i,forceExpanded:t=!1}){var T,q;const[s,a]=A.useState(t),o=Gg[Ig(i.type)]||"text-text-tertiary";A.useEffect(()=>{a(t)},[t]);const u=t,d=u?"text-xs":"text-[9px]",m=u?"text-xs":"text-[9px]",y=u?"text-xs":"text-[9px]",g=u?"w-3.5 h-3.5":"w-2.5 h-2.5",E=u?"py-2 px-4":"py-1 px-3",_=u?"pb-4 px-4":"pb-2 px-3";return h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${d} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(i.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${m} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:i.type}),h.jsxs("span",{className:`${y} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(T=i.data)!=null&&T.workflowId?String(i.data.workflowId):"",(q=i.data)!=null&&q.escalationId?` esc:${String(i.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${g} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Ch,{open:s,children:h.jsx("div",{className:_,children:h.jsx(v2,{data:i.data})})})]})}function S2({open:i,onToggle:t,configOpen:s,onToggleConfig:a}){const[o,u]=A.useState([]),[d,m]=A.useState(!1),[y,g]=A.useState(""),E=A.useRef(null),_=A.useRef(new Map),{subscribe:T}=A.useContext(rl),{patterns:q,pagePattern:C,userPatterns:R,addPattern:Q,removePattern:se}=l2(),U=A.useCallback(re=>{const N=String(re.type||"unknown");if(N.startsWith("mesh."))return;const Z=`${N}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ce=Date.now(),G=_.current.get(Z);if(!(G&&ce-G<yy)){if(_.current.set(Z,ce),_.current.size>200)for(const[F,K]of _.current)ce-K>yy*2&&_.current.delete(F);u(F=>[{id:++w2,type:N,timestamp:re.timestamp||new Date().toISOString(),data:re},...F].slice(0,_2))}},[]),le=A.useRef(U);return le.current=U,A.useEffect(()=>{const re=q.map(N=>T(N,Z=>le.current(Z)));return()=>re.forEach(N=>N())},[T,q.join(",")]),A.useEffect(()=>{i&&E.current&&(E.current.scrollTop=0)},[o.length,i]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[i?h.jsx(Uv,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(Bv,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!i&&h.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Gg[Ig(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.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:h.jsx(Lv,{className:"w-3 h-3"})}),o.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),m(!0)},children:h.jsx(Hy,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),u([])},children:h.jsx(Pv,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:C.replace("lt.events.","")}),R.map(re=>h.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.",""),h.jsx("button",{onClick:()=>se(re),className:"text-text-quaternary hover:text-status-error",children:h.jsx(si,{className:"w-2 h-2"})})]},re))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:y,onChange:re=>g(re.target.value),onKeyDown:re=>{re.key==="Enter"&&y.trim()&&(Q(y.trim()),g(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{y.trim()&&(Q(y.trim()),g(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(Py,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Ch,{open:i,children:h.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>h.jsx(gy,{event:re},re.id))})}),h.jsxs(Fg,{open:d,onClose:()=>m(!1),sourceRef:E,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>m(!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:h.jsx($y,{className:"w-5 h-5"})})}),o.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>h.jsx(gy,{event:re,forceExpanded:!0},re.id))]})]})}function E2(){return mt({queryKey:["docs"],queryFn:()=>Ae("/docs"),staleTime:5*6e4})}function j2(i){return mt({queryKey:["docs",i],queryFn:()=>Ae(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function A2(){const[i,t]=A.useState([]),[s,a]=A.useState([]),[o,u]=A.useState(null),d=A.useRef(o),m=A.useRef(i),y=A.useRef(s);d.current=o,m.current=i,y.current=s;const g=A.useCallback((C,R)=>{var se;const Q=d.current;if(Q){const U=((se=R==null?void 0:R.current)==null?void 0:se.scrollTop)??0;t([...m.current,{...Q,scrollTop:U}])}a([]),u({path:C,scrollTop:0})},[]),E=A.useCallback(C=>{var U;const R=m.current;if(R.length===0)return;const Q=R[R.length-1],se=d.current;if(se){const le=((U=C==null?void 0:C.current)==null?void 0:U.scrollTop)??0;a([...y.current,{...se,scrollTop:le}])}t(R.slice(0,-1)),u(Q),requestAnimationFrame(()=>{C!=null&&C.current&&(C.current.scrollTop=Q.scrollTop)})},[]),_=A.useCallback(C=>{var U;const R=y.current;if(R.length===0)return;const Q=R[R.length-1],se=d.current;if(se){const le=((U=C==null?void 0:C.current)==null?void 0:U.scrollTop)??0;t([...m.current,{...se,scrollTop:le}])}a(R.slice(0,-1)),u(Q),requestAnimationFrame(()=>{C!=null&&C.current&&(C.current.scrollTop=Q.scrollTop)})},[]),T=A.useCallback(C=>{var se,U;const R=d.current;if(!R)return;const Q=((se=C==null?void 0:C.current)==null?void 0:se.scrollTop)??0;t([...m.current,{...R,scrollTop:Q}]),a([]),u({...R,scrollTop:((U=C==null?void 0:C.current)==null?void 0:U.scrollTop)??0})},[]),q=A.useCallback(()=>{t([]),a([]),u(null)},[]);return{current:o,backStack:i,forwardStack:s,navigate:g,goBack:E,goForward:_,pushScrollPosition:T,reset:q}}function O2(i,t){const[s,a]=i.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((t?t.replace(/[^/]+$/,""):"")+o).split("/"),m=[];for(const y of d)y===".."?m.pop():y&&y!=="."&&m.push(y);o=m.join("/")}return{path:o,anchor:a}}function T2(i){if(!i.startsWith("#docs"))return null;const t=i.slice(1).split(":"),s=t[1]||"README.md",a=t[2]||void 0;return{path:s,anchor:a}}function N2(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function k2({content:i,currentPath:t,onNavigate:s,onAnchorClick:a}){const o=u=>{var g;const d=u.target,m=d.closest("[data-anchor]");if(m){u.preventDefault(),a();const E=m.dataset.anchor,_=(g=m.closest(".docs-content"))==null?void 0:g.querySelector(`#${CSS.escape(E)}`);_==null||_.scrollIntoView({behavior:"smooth",block:"start"});return}const y=d.closest("[data-doc-link]");if(y){u.preventDefault();const{path:E,anchor:_}=O2(y.dataset.docLink,t);s(E,_);return}};return h.jsx(Mh,{content:i,className:"docs-content",onClick:o})}function C2(i){const t=[],s=new Map;for(const a of i){const o=a.path.split("/");if(o.length===1){t.push(a);continue}let u=s;for(let d=0;d<o.length-1;d++){const m=o[d];u.has(m)||u.set(m,{label:m,children:[],subdirs:new Map});const y=u.get(m);d===o.length-2?y.children.push(a):u=y.subdirs}}return{topLevel:t,dirs:s}}function M2({docs:i,selected:t,onSelect:s}){const{topLevel:a,dirs:o}=C2(i),u=m=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===m?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(m,y){return h.jsxs("details",{open:!0,children:[h.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:[h.jsx(Hv,{className:"w-3 h-3",strokeWidth:1.5}),m.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...m.subdirs.values()].map(g=>d(g)),m.children.map(g=>h.jsx("button",{className:u(g.path),onClick:()=>s(g.path),children:g.title},g.path))]})]},m.label)}return h.jsxs("div",{className:"space-y-0.5",children:[a.map(m=>h.jsx("button",{className:u(m.path),onClick:()=>s(m.path),children:m.title},m.path)),[...o.values()].map(m=>d(m))]})}function R2({open:i,onClose:t}){var ce,G,F;const[s,a]=A.useState(!1),{data:o}=E2(),u=A2(),{data:d,isLoading:m}=j2(((ce=u.current)==null?void 0:ce.path)??null),y=A.useRef(null),[g,E]=A.useState(null);A.useEffect(()=>{g&&(d!=null&&d.content)&&y.current&&requestAnimationFrame(()=>{var J;const K=(J=y.current)==null?void 0:J.querySelector(`#${CSS.escape(g)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[g,d]);const _=A.useCallback(()=>{var ie;const K=T2(window.location.hash),J=(K==null?void 0:K.path)??"README.md";((ie=u.current)==null?void 0:ie.path)!==J&&u.navigate(J,y),K!=null&&K.anchor&&E(K.anchor)},[u]),T=A.useRef(!0);A.useEffect(()=>{if(!i||!u.current)return;if(T.current){T.current=!1;return}const K=N2(u.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[i,(G=u.current)==null?void 0:G.path]),A.useEffect(()=>{if(!i)return;const K=()=>{window.location.hash.startsWith("#docs")&&_()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[i,_]);const q=A.useCallback((K,J)=>{J&&E(J),u.navigate(K,y)},[u]),C=A.useCallback(K=>{u.navigate(K,y)},[u]),R=A.useCallback(()=>{u.goBack(y)},[u]),Q=A.useCallback(()=>{u.goForward(y)},[u]),se=A.useCallback(()=>{u.pushScrollPosition(y)},[u]);if(A.useEffect(()=>{if(i){T.current=!0,_();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[i]),!(i||s))return null;const le=()=>{a(!1),setTimeout(()=>{t(),u.reset()},200)},re=((F=u.current)==null?void 0:F.path)??null,N=u.backStack.length>0,Z=u.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&i?"opacity-100":"opacity-0"}`,onClick:le}),h.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&&i?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:R,disabled:!N,className:`p-0.5 transition-colors ${N?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx($v,{className:"w-4 h-4"})}),h.jsx("button",{onClick:Q,disabled:!Z,className:`p-0.5 transition-colors ${Z?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(j0,{className:"w-4 h-4"})}),h.jsx(Ly,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:le,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(si,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?h.jsx(M2,{docs:o.docs,selected:re,onSelect:C}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:y,className:"flex-1 overflow-y-auto px-6 py-4",children:re?m?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):d!=null&&d.content?h.jsx(k2,{content:d.content,currentPath:re,onNavigate:q,onAnchorClick:se}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(j0,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function D2(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const by=2e3;function q2(i){const s=i.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
57
- ${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
58
- `)}
59
- [End prior conversation]
60
-
61
- `}function z2(i){const t=i.summary,s=i.title;if(t){const a=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?t.slice(0,a).trim():t}return s||(typeof i=="string"?i:"Query completed.")}const Qg=A.createContext(null);function U2({children:i}){const t=Qn(),[s,a]=A.useState(!1),[o,u]=A.useState([]),[d,m]=A.useState(null),[y,g]=A.useState({}),E=A.useRef(null),_={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...y,suggestedTags:y.suggestedTags??D2(t.pathname)};A.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const T=A.useCallback(()=>a(se=>!se),[]),q=A.useCallback(se=>{g(se)},[]),C=A.useCallback(()=>{u([]),m(null)},[]),R=A.useCallback(async se=>{var G;const U=new Date().toISOString(),le={id:`user-${Date.now()}`,role:"user",content:se,timestamp:U},re={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:U,pending:!0};u(F=>[...F,le,re]);const N={..._};(G=N.entities)!=null&&G.yamlContent&&N.entities.yamlContent.length>by&&(N.entities={...N.entities,yamlContent:N.entities.yamlContent.slice(0,by)+`
62
- ... (truncated)`});const ce=`${q2(o.concat(le))}${se}`;try{const K=(await Ae("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ce,tags:N.suggestedTags,context:N,wait:!1,direct:!0})})).workflow_id;m(K),u(J=>J.map(ie=>ie.id===re.id?{...ie,workflowId:K}:ie)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var J;try{const ie=await Ae(`/workflows/${K}/result`),he=(J=ie==null?void 0:ie.result)==null?void 0:J.data;if(he){E.current&&clearInterval(E.current),E.current=null,m(null);const Se=z2(he);let Ne;try{Ne=(await Ae(`/workflow-states/${K}/execution`)).duration_ms}catch{}u(Y=>Y.map(ae=>ae.id===re.id?{...ae,content:Se,timestamp:new Date().toISOString(),pending:!1,durationMs:Ne}:ae))}}catch{}},3e3)}catch{u(F=>F.map(K=>K.id===re.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,_]),Q=A.useCallback(async se=>{const U=o.find(N=>N.id===se);if(!(U!=null&&U.workflowId)||U.compilationStatus==="compiling"||U.compilationStatus==="done")return;const le=o.indexOf(U),re=o.slice(0,le).reverse().find(N=>N.role==="user");if(re){u(N=>N.map(Z=>Z.id===se?{...Z,compilationStatus:"compiling"}:Z));try{const N=await Ae("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:U.content})}),Z=await Ae("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:U.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:N.tool_name,description:N.description,tags:N.tags,app_id:""})});await Ae(`/yaml-workflows/${Z.id}/deploy`,{method:"POST"}),u(ce=>ce.map(G=>G.id===se?{...G,compilationStatus:"done"}:G))}catch(N){const Z=N instanceof Error?N.message:"Compilation failed";u(ce=>ce.map(G=>G.id===se?{...G,compilationStatus:"error",compilationError:Z}:G))}}},[o]);return h.jsx(Qg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:T,messages:o,sendMessage:R,pageContext:_,setPageContext:q,activeWorkflowId:d,clearMessages:C,compileMessage:Q},children:i})}function Jg(){const i=A.useContext(Qg);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function B2(){const{helpOpen:i,toggleHelp:t}=Jg();return h.jsx("button",{onClick:t,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":i?"Close help":"Ask for help",children:i?h.jsx(si,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Gt}/logo512.png)`}})})}const Kg=6048e5,L2=864e5,xy=6e4,vy=525600,_y=43200,wy=1440,Sy=Symbol.for("constructDateFrom");function xs(i,t){return typeof i=="function"?i(t):i&&typeof i=="object"&&Sy in i?i[Sy](t):i instanceof Date?new i.constructor(t):new Date(t)}function cn(i,t){return xs(t||i,i)}let P2={};function al(){return P2}function nl(i,t){var m,y,g,E;const s=al(),a=(t==null?void 0:t.weekStartsOn)??((y=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:y.weekStartsOn)??s.weekStartsOn??((E=(g=s.locale)==null?void 0:g.options)==null?void 0:E.weekStartsOn)??0,o=cn(i,t==null?void 0:t.in),u=o.getDay(),d=(u<a?7:0)+u-a;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function tc(i,t){return nl(i,{...t,weekStartsOn:1})}function Xg(i,t){const s=cn(i,t==null?void 0:t.in),a=s.getFullYear(),o=xs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const u=tc(o),d=xs(s,0);d.setFullYear(a,0,4),d.setHours(0,0,0,0);const m=tc(d);return s.getTime()>=u.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function nc(i){const t=cn(i),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+i-+s}function Zg(i,...t){const s=xs.bind(null,i||t.find(a=>typeof a=="object"));return t.map(s)}function Ey(i,t){const s=cn(i,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function H2(i,t,s){const[a,o]=Zg(s==null?void 0:s.in,i,t),u=Ey(a),d=Ey(o),m=+u-nc(u),y=+d-nc(d);return Math.round((m-y)/L2)}function $2(i,t){const s=Xg(i,t),a=xs(i,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),tc(a)}function Y2(i,t){const s=+cn(i)-+cn(t);return s<0?-1:s>0?1:s}function V2(i){return xs(i,Date.now())}function F2(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function G2(i){return!(!F2(i)&&typeof i!="number"||isNaN(+cn(i)))}function I2(i){return t=>{const a=(i?Math[i]:Math.trunc)(t);return a===0?0:a}}function Q2(i,t){const s=cn(i,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const J2={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"}},K2=(i,t,s)=>{let a;const o=J2[i];return typeof o=="string"?a=o:t===1?a=o.one:a=o.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function zf(i){return(t={})=>{const s=t.width?String(t.width):i.defaultWidth;return i.formats[s]||i.formats[i.defaultWidth]}}const X2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Z2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},W2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},eE={date:zf({formats:X2,defaultWidth:"full"}),time:zf({formats:Z2,defaultWidth:"full"}),dateTime:zf({formats:W2,defaultWidth:"full"})},tE={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},nE=(i,t,s,a)=>tE[i];function Pa(i){return(t,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&i.formattingValues){const d=i.defaultFormattingWidth||i.defaultWidth,m=s!=null&&s.width?String(s.width):d;o=i.formattingValues[m]||i.formattingValues[d]}else{const d=i.defaultWidth,m=s!=null&&s.width?String(s.width):i.defaultWidth;o=i.values[m]||i.values[d]}const u=i.argumentCallback?i.argumentCallback(t):t;return o[u]}}const sE={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},iE={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},rE={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"]},aE={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"]},lE={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"}},oE={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"}},cE=(i,t)=>{const s=Number(i),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"},uE={ordinalNumber:cE,era:Pa({values:sE,defaultWidth:"wide"}),quarter:Pa({values:iE,defaultWidth:"wide",argumentCallback:i=>i-1}),month:Pa({values:rE,defaultWidth:"wide"}),day:Pa({values:aE,defaultWidth:"wide"}),dayPeriod:Pa({values:lE,defaultWidth:"wide",formattingValues:oE,defaultFormattingWidth:"wide"})};function Ha(i){return(t,s={})=>{const a=s.width,o=a&&i.matchPatterns[a]||i.matchPatterns[i.defaultMatchWidth],u=t.match(o);if(!u)return null;const d=u[0],m=a&&i.parsePatterns[a]||i.parsePatterns[i.defaultParseWidth],y=Array.isArray(m)?hE(m,_=>_.test(d)):fE(m,_=>_.test(d));let g;g=i.valueCallback?i.valueCallback(y):y,g=s.valueCallback?s.valueCallback(g):g;const E=t.slice(d.length);return{value:g,rest:E}}}function fE(i,t){for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&t(i[s]))return s}function hE(i,t){for(let s=0;s<i.length;s++)if(t(i[s]))return s}function dE(i){return(t,s={})=>{const a=t.match(i.matchPattern);if(!a)return null;const o=a[0],u=t.match(i.parsePattern);if(!u)return null;let d=i.valueCallback?i.valueCallback(u[0]):u[0];d=s.valueCallback?s.valueCallback(d):d;const m=t.slice(o.length);return{value:d,rest:m}}}const mE=/^(\d+)(th|st|nd|rd)?/i,pE=/\d+/i,yE={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},gE={any:[/^b/i,/^(a|c)/i]},bE={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xE={any:[/1/i,/2/i,/3/i,/4/i]},vE={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},_E={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]},wE={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},SE={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]},EE={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},jE={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}},AE={ordinalNumber:dE({matchPattern:mE,parsePattern:pE,valueCallback:i=>parseInt(i,10)}),era:Ha({matchPatterns:yE,defaultMatchWidth:"wide",parsePatterns:gE,defaultParseWidth:"any"}),quarter:Ha({matchPatterns:bE,defaultMatchWidth:"wide",parsePatterns:xE,defaultParseWidth:"any",valueCallback:i=>i+1}),month:Ha({matchPatterns:vE,defaultMatchWidth:"wide",parsePatterns:_E,defaultParseWidth:"any"}),day:Ha({matchPatterns:wE,defaultMatchWidth:"wide",parsePatterns:SE,defaultParseWidth:"any"}),dayPeriod:Ha({matchPatterns:EE,defaultMatchWidth:"any",parsePatterns:jE,defaultParseWidth:"any"})},Wg={code:"en-US",formatDistance:K2,formatLong:eE,formatRelative:nE,localize:uE,match:AE,options:{weekStartsOn:0,firstWeekContainsDate:1}};function OE(i,t){const s=cn(i,t==null?void 0:t.in);return H2(s,Q2(s))+1}function TE(i,t){const s=cn(i,t==null?void 0:t.in),a=+tc(s)-+$2(s);return Math.round(a/Kg)+1}function eb(i,t){var E,_,T,q;const s=cn(i,t==null?void 0:t.in),a=s.getFullYear(),o=al(),u=(t==null?void 0:t.firstWeekContainsDate)??((_=(E=t==null?void 0:t.locale)==null?void 0:E.options)==null?void 0:_.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(T=o.locale)==null?void 0:T.options)==null?void 0:q.firstWeekContainsDate)??1,d=xs((t==null?void 0:t.in)||i,0);d.setFullYear(a+1,0,u),d.setHours(0,0,0,0);const m=nl(d,t),y=xs((t==null?void 0:t.in)||i,0);y.setFullYear(a,0,u),y.setHours(0,0,0,0);const g=nl(y,t);return+s>=+m?a+1:+s>=+g?a:a-1}function NE(i,t){var m,y,g,E;const s=al(),a=(t==null?void 0:t.firstWeekContainsDate)??((y=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:y.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(g=s.locale)==null?void 0:g.options)==null?void 0:E.firstWeekContainsDate)??1,o=eb(i,t),u=xs((t==null?void 0:t.in)||i,0);return u.setFullYear(o,0,a),u.setHours(0,0,0,0),nl(u,t)}function kE(i,t){const s=cn(i,t==null?void 0:t.in),a=+nl(s,t)-+NE(s,t);return Math.round(a/Kg)+1}function Ge(i,t){const s=i<0?"-":"",a=Math.abs(i).toString().padStart(t,"0");return s+a}const Xs={y(i,t){const s=i.getFullYear(),a=s>0?s:1-s;return Ge(t==="yy"?a%100:a,t.length)},M(i,t){const s=i.getMonth();return t==="M"?String(s+1):Ge(s+1,2)},d(i,t){return Ge(i.getDate(),t.length)},a(i,t){const s=i.getHours()/12>=1?"pm":"am";switch(t){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(i,t){return Ge(i.getHours()%12||12,t.length)},H(i,t){return Ge(i.getHours(),t.length)},m(i,t){return Ge(i.getMinutes(),t.length)},s(i,t){return Ge(i.getSeconds(),t.length)},S(i,t){const s=t.length,a=i.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ge(o,t.length)}},Er={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},jy={G:function(i,t,s){const a=i.getFullYear()>0?1:0;switch(t){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(i,t,s){if(t==="yo"){const a=i.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Xs.y(i,t)},Y:function(i,t,s,a){const o=eb(i,a),u=o>0?o:1-o;if(t==="YY"){const d=u%100;return Ge(d,2)}return t==="Yo"?s.ordinalNumber(u,{unit:"year"}):Ge(u,t.length)},R:function(i,t){const s=Xg(i);return Ge(s,t.length)},u:function(i,t){const s=i.getFullYear();return Ge(s,t.length)},Q:function(i,t,s){const a=Math.ceil((i.getMonth()+1)/3);switch(t){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(i,t,s){const a=Math.ceil((i.getMonth()+1)/3);switch(t){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(i,t,s){const a=i.getMonth();switch(t){case"M":case"MM":return Xs.M(i,t);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(i,t,s){const a=i.getMonth();switch(t){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(i,t,s,a){const o=kE(i,a);return t==="wo"?s.ordinalNumber(o,{unit:"week"}):Ge(o,t.length)},I:function(i,t,s){const a=TE(i);return t==="Io"?s.ordinalNumber(a,{unit:"week"}):Ge(a,t.length)},d:function(i,t,s){return t==="do"?s.ordinalNumber(i.getDate(),{unit:"date"}):Xs.d(i,t)},D:function(i,t,s){const a=OE(i);return t==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ge(a,t.length)},E:function(i,t,s){const a=i.getDay();switch(t){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(i,t,s,a){const o=i.getDay(),u=(o-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(u);case"ee":return Ge(u,2);case"eo":return s.ordinalNumber(u,{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(i,t,s,a){const o=i.getDay(),u=(o-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(u);case"cc":return Ge(u,t.length);case"co":return s.ordinalNumber(u,{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(i,t,s){const a=i.getDay(),o=a===0?7:a;switch(t){case"i":return String(o);case"ii":return Ge(o,t.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(i,t,s){const o=i.getHours()/12>=1?"pm":"am";switch(t){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(i,t,s){const a=i.getHours();let o;switch(a===12?o=Er.noon:a===0?o=Er.midnight:o=a/12>=1?"pm":"am",t){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(i,t,s){const a=i.getHours();let o;switch(a>=17?o=Er.evening:a>=12?o=Er.afternoon:a>=4?o=Er.morning:o=Er.night,t){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(i,t,s){if(t==="ho"){let a=i.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Xs.h(i,t)},H:function(i,t,s){return t==="Ho"?s.ordinalNumber(i.getHours(),{unit:"hour"}):Xs.H(i,t)},K:function(i,t,s){const a=i.getHours()%12;return t==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,t.length)},k:function(i,t,s){let a=i.getHours();return a===0&&(a=24),t==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,t.length)},m:function(i,t,s){return t==="mo"?s.ordinalNumber(i.getMinutes(),{unit:"minute"}):Xs.m(i,t)},s:function(i,t,s){return t==="so"?s.ordinalNumber(i.getSeconds(),{unit:"second"}):Xs.s(i,t)},S:function(i,t){return Xs.S(i,t)},X:function(i,t,s){const a=i.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return Oy(a);case"XXXX":case"XX":return Ci(a);case"XXXXX":case"XXX":default:return Ci(a,":")}},x:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"x":return Oy(a);case"xxxx":case"xx":return Ci(a);case"xxxxx":case"xxx":default:return Ci(a,":")}},O:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ay(a,":");case"OOOO":default:return"GMT"+Ci(a,":")}},z:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ay(a,":");case"zzzz":default:return"GMT"+Ci(a,":")}},t:function(i,t,s){const a=Math.trunc(+i/1e3);return Ge(a,t.length)},T:function(i,t,s){return Ge(+i,t.length)}};function Ay(i,t=""){const s=i>0?"-":"+",a=Math.abs(i),o=Math.trunc(a/60),u=a%60;return u===0?s+String(o):s+String(o)+t+Ge(u,2)}function Oy(i,t){return i%60===0?(i>0?"-":"+")+Ge(Math.abs(i)/60,2):Ci(i,t)}function Ci(i,t=""){const s=i>0?"-":"+",a=Math.abs(i),o=Ge(Math.trunc(a/60),2),u=Ge(a%60,2);return s+o+t+u}const Ty=(i,t)=>{switch(i){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},tb=(i,t)=>{switch(i){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},CE=(i,t)=>{const s=i.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return Ty(i,t);let u;switch(a){case"P":u=t.dateTime({width:"short"});break;case"PP":u=t.dateTime({width:"medium"});break;case"PPP":u=t.dateTime({width:"long"});break;case"PPPP":default:u=t.dateTime({width:"full"});break}return u.replace("{{date}}",Ty(a,t)).replace("{{time}}",tb(o,t))},ME={p:tb,P:CE},RE=/^D+$/,DE=/^Y+$/,qE=["D","DD","YY","YYYY"];function zE(i){return RE.test(i)}function UE(i){return DE.test(i)}function BE(i,t,s){const a=LE(i,t,s);if(console.warn(a),qE.includes(i))throw new RangeError(a)}function LE(i,t,s){const a=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${t}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const PE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,HE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,$E=/^'([^]*?)'?$/,YE=/''/g,VE=/[a-zA-Z]/;function Rh(i,t,s){var E,_,T,q;const a=al(),o=a.locale??Wg,u=a.firstWeekContainsDate??((_=(E=a.locale)==null?void 0:E.options)==null?void 0:_.firstWeekContainsDate)??1,d=a.weekStartsOn??((q=(T=a.locale)==null?void 0:T.options)==null?void 0:q.weekStartsOn)??0,m=cn(i,s==null?void 0:s.in);if(!G2(m))throw new RangeError("Invalid time value");let y=t.match(HE).map(C=>{const R=C[0];if(R==="p"||R==="P"){const Q=ME[R];return Q(C,o.formatLong)}return C}).join("").match(PE).map(C=>{if(C==="''")return{isToken:!1,value:"'"};const R=C[0];if(R==="'")return{isToken:!1,value:FE(C)};if(jy[R])return{isToken:!0,value:C};if(R.match(VE))throw new RangeError("Format string contains an unescaped latin alphabet character `"+R+"`");return{isToken:!1,value:C}});o.localize.preprocessor&&(y=o.localize.preprocessor(m,y));const g={firstWeekContainsDate:u,weekStartsOn:d,locale:o};return y.map(C=>{if(!C.isToken)return C.value;const R=C.value;(UE(R)||zE(R))&&BE(R,t,String(i));const Q=jy[R[0]];return Q(m,R,o.localize,g)}).join("")}function FE(i){const t=i.match($E);return t?t[1].replace(YE,"'"):i}function GE(i,t,s){const a=al(),o=(s==null?void 0:s.locale)??a.locale??Wg,u=Y2(i,t);if(isNaN(u))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:u}),[m,y]=Zg(s==null?void 0:s.in,...u>0?[t,i]:[i,t]),g=I2((s==null?void 0:s.roundingMethod)??"round"),E=y.getTime()-m.getTime(),_=E/xy,T=nc(y)-nc(m),q=(E-T)/xy,C=s==null?void 0:s.unit;let R;if(C?R=C:_<1?R="second":_<60?R="minute":_<wy?R="hour":q<_y?R="day":q<vy?R="month":R="year",R==="second"){const Q=g(E/1e3);return o.formatDistance("xSeconds",Q,d)}else if(R==="minute"){const Q=g(_);return o.formatDistance("xMinutes",Q,d)}else if(R==="hour"){const Q=g(_/60);return o.formatDistance("xHours",Q,d)}else if(R==="day"){const Q=g(q/wy);return o.formatDistance("xDays",Q,d)}else if(R==="month"){const Q=g(q/_y);return Q===12&&C!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",Q,d)}else{const Q=g(q/vy);return o.formatDistance("xYears",Q,d)}}function IE(i,t){return GE(i,V2(i),t)}function YA(i){return i.toLocaleString()}function VA(i){return i>=1e9?`${(i/1e9).toFixed(1).replace(/\.0$/,"")}B`:i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}M`:i>=1e4?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}K`:i.toLocaleString()}function QE(i){const t=new Date(i);return t.getTime()>Date.now()?"just now":IE(t,{addSuffix:!0})}function FA(i){const t=Date.now()-new Date(i).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const a=Math.floor(s/60);if(a<60)return`${a}m`;const o=Math.floor(a/60);if(o<24)return`${o}h`;const u=Math.floor(o/24);return u<7?`${u}d`:u<30?`${Math.floor(u/7)}w`:u<365?`${Math.floor(u/30)}mo`:`${Math.floor(u/365)}y`}function GA(i){return i<=0?"Expired":Dh(i)}function JE(i){return i==null?"--":Dh(i)}function IA(i){return i?Rh(new Date(i),"MMM d, yyyy h:mm a"):"--"}function Dh(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const d=i/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const t=Math.floor(i/1e3),s=Math.floor(t/86400),a=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),u=t%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:u>0?`${o}m ${u}s`:`${o}m`}function QA(i,t){const s=new Date(i).getTime(),a=t?new Date(t).getTime():Date.now();return Dh(a-s)}function nb({options:i,children:t,className:s=""}){const[a,o]=A.useState(!1),[u,d]=A.useState(null),[m,y]=A.useState(null),g=A.useRef(null),E=A.useRef(void 0),_=A.useRef(void 0),T=220,q=A.useCallback(()=>{if(!g.current)return;const se=g.current.getBoundingClientRect(),U=window.innerWidth-T-8,le=Math.max(8,Math.min(se.left,U));y({top:se.bottom+4,left:le})},[]),C=A.useCallback(async(se,U)=>{try{await navigator.clipboard.writeText(se),d(U),clearTimeout(E.current),E.current=setTimeout(()=>d(null),1200)}catch{}},[]),R=A.useCallback(()=>{clearTimeout(_.current),q(),o(!0)},[q]),Q=A.useCallback(()=>{_.current=setTimeout(()=>o(!1),150)},[]);return A.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(_.current)},[]),h.jsxs("span",{ref:g,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:R,onMouseLeave:Q,children:[t,a&&m&&zy.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:m.top,left:m.left},onMouseEnter:R,onMouseLeave:Q,children:i.map(se=>h.jsxs("button",{onClick:U=>{U.stopPropagation(),C(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:[h.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:se.label}),h.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:u===se.label?"✓":se.value})]},se.label))}),document.body)]})}function KE(i,t){const s=new Date(i);switch(t){case"relative":return QE(i);case"datetime":return Rh(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function XE(i){const t=new Date(i);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:Rh(t,"MMM d, yyyy h:mm:ss a")}]}function ZE({date:i,format:t="relative",className:s=""}){const[,a]=A.useState(0);A.useEffect(()=>{if(t!=="relative")return;const u=setInterval(()=>a(d=>d+1),3e4);return()=>clearInterval(u)},[t]);const o=A.useMemo(()=>XE(i),[i]);return h.jsx(nb,{options:o,children:h.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${s}`,children:KE(i,t)})})}function WE({ms:i,className:t=""}){const s=JE(i),a=A.useMemo(()=>i==null?[]:[{label:"ms",value:String(i)},{label:"sec",value:`${(i/1e3).toFixed(3)}s`},{label:"text",value:s}],[i,s]);return i==null?h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):h.jsx(nb,{options:a,children:h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const ej=["sm","md","lg","full"],Ny={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"},ky={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function tj({which:i}){const t="stroke-current";switch(i){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function nj({msg:i}){const[t,s]=A.useState(0);A.useEffect(()=>{const d=new Date(i.timestamp).getTime(),m=()=>s(Math.floor((Date.now()-d)/1e3));m();const y=setInterval(m,1e3);return()=>clearInterval(y)},[i.timestamp]);const a=Math.floor(t/60),o=t%60,u=a>0?`${a}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:u})]}),i.workflowId&&h.jsxs(Mi,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[h.jsx(oh,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function sj({msg:i,compileMessage:t}){const s=i.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(ZE,{date:i.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),i.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),h.jsx(WE,{ms:i.durationMs,className:"!text-[9px] text-text-muted/50"})]}),i.workflowId&&h.jsx(Mi,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(oh,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&i.workflowId&&!i.pending&&h.jsx("button",{onClick:()=>t(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(Yv,{className:`w-2.5 h-2.5 ${i.compilationStatus==="done"?"text-status-success":i.compilationStatus==="error"?"text-status-error":i.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function ij(){const{helpOpen:i,setHelpOpen:t,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:u,clearMessages:d,compileMessage:m}=Jg(),[y,g]=A.useState(""),[E,_]=A.useState("md"),[T,q]=A.useState(!0),C=A.useRef(null),R=A.useRef(null);if(A.useEffect(()=>{C.current&&(C.current.scrollTop=C.current.scrollHeight)},[s]),A.useEffect(()=>{i&&R.current&&R.current.focus()},[i]),A.useEffect(()=>{if(!i)return;const N=Z=>{Z.key==="Escape"&&(E==="full"?_("lg"):E==="lg"?_("md"):E==="md"?_("sm"):t(!1))};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i,E,t]),!i)return null;const Q=()=>{const N=y.trim();!N||u||(a(N),g(""),R.current&&(R.current.style.height="auto"))},se=N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),Q())},U=E==="full",le=o.page.replace(/-/g," "),re=U?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${U?Ny.full:`right-6 ${Ny[E]}`} ${T?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${T?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:le})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:ej.map(N=>h.jsx("button",{onClick:()=>_(N),className:`p-1 rounded transition-colors ${N===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":N===E,"aria-label":ky[N],title:ky[N],children:h.jsx(tj,{which:N})},N))}),s.length>0&&h.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(Vv,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(si,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:C,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${T?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(N=>h.jsxs("div",{className:`text-xs leading-relaxed ${N.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${N.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:N.pending?h.jsx(nj,{msg:N}):N.role==="assistant"?h.jsx(Mh,{content:N.content}):N.content}),!N.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(sj,{msg:N,compileMessage:m})})]},N.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${T?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:R,value:y,onChange:N=>{g(N.target.value);const Z=N.target;Z.style.height="auto",Z.style.height=`${Math.min(Z.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:!!u}),h.jsx("button",{onClick:Q,disabled:!y.trim()||!!u,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:h.jsx(Fv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function rj(){var se;const{isBuilder:i,isOps:t,viewAs:s}=Og(),{canSeePaceBoard:a}=Tg(),{data:o}=Hr(),u=jg(),d=u!==null?u:!!((se=o==null?void 0:o.ai)!=null&&se.enabled),{collapsed:m,toggle:y}=Oh(),[g,E]=A.useState(!1),[_,T]=A.useState(!1),[q,C]=A.useState(()=>window.location.hash.startsWith("#docs")),R=Qn(),Q=A.useRef(null);return A.useEffect(()=>{const U=Q.current;U&&(U.classList.remove("animate-page-in"),U.offsetWidth,U.classList.add("animate-page-in"))},[R.pathname]),A.useEffect(()=>{const U=()=>{window.location.hash.startsWith("#docs")&&C(!0)};return window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)},[]),h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(zS,{onToggleEventFeed:()=>E(U=>!U),onToggleDocs:()=>C(U=>!U)}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsxs("aside",{className:`${m?"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:[h.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[h.jsx(HS,{aiEnabled:d,isBuilder:i,isOps:t,viewAs:s,canSeePaceBoard:a}),h.jsx(YS,{}),h.jsx(KS,{}),i&&h.jsx(WS,{}),i&&d&&h.jsx(t2,{}),i&&h.jsx(s2,{}),(i||t)&&h.jsx(i2,{isBuilder:i,isOps:t})]}),h.jsx("button",{onClick:y,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${m?"flex justify-center":"flex items-center px-7"}`,"aria-label":m?"Expand sidebar":"Collapse sidebar",children:m?h.jsx(Gv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(Iv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!m&&(o==null?void 0:o.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-[10px] leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 overflow-y-auto",children:h.jsx("div",{ref:Q,className:"w-full px-10 py-10 pb-16 animate-page-in h-full flex flex-col",children:h.jsx(Nr,{})})})]}),h.jsx(S2,{open:g,onToggle:()=>E(U=>!U),configOpen:_,onToggleConfig:()=>T(U=>!U)}),h.jsx(R2,{open:q,onClose:()=>{C(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(B2,{}),d&&h.jsx(ij,{})]})}function aj(){const{isAuthenticated:i}=zn(),t=Qn();return i?h.jsx(fS,{children:h.jsx(U2,{children:h.jsx(rj,{})})}):h.jsx(Yn,{to:"/login",state:{from:t.pathname},replace:!0})}function sb({provider:i,className:t="w-5 h-5"}){switch(i){case"google":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.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"}),h.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"}),h.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"}),h.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 h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.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 h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.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 h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function lj(){return Ae("/auth/oauth/providers")}async function oj(i,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return Ae(`/auth/oauth/connections/${i}${s}`,{method:"DELETE"})}function JA(){return mt({queryKey:["oauth-connections"],queryFn:()=>Ae("/auth/oauth/connections")})}function KA(){const i=vt();return Nt({mutationFn:({provider:t,label:s})=>oj(t,s),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function cj(){var ce;const{login:i,isAuthenticated:t}=zn(),s=Uy(),a=Qn(),o=new URLSearchParams(a.search),u=o.get("token"),d=o.get("error"),m=((ce=a.state)==null?void 0:ce.from)??o.get("returnTo")??"/",y=A.useRef(!1);u&&!y.current&&(y.current=!0,i(u,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[g,E]=A.useState(""),[_,T]=A.useState(""),[q,C]=A.useState(d||""),[R,Q]=A.useState(!1),[se,U]=A.useState(!!u),[le,re]=A.useState([]),N=A.useRef(!1);if(A.useEffect(()=>{u||N.current||(N.current=!0,(async()=>{var G,F,K,J;try{const ie=await fetch(`${Gt}/api/settings`);if(!ie.ok)return;const he=await ie.json();if(!((G=he.auth)!=null&&G.sso))return;const Se=await fetch(`${Gt}/api/auth/sso`,{method:"POST"});if(!Se.ok){C("Host authentication required — please log in to your organization first");return}const Ne=await Se.json();Ne.token&&((F=he.auth)!=null&&F.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",he.auth.ssoLogoutUrl),U(!0),i(Ne.token,void 0,{displayName:(K=Ne.user)==null?void 0:K.display_name,username:(J=Ne.user)==null?void 0:J.external_id}))}catch{}})())},[]),A.useEffect(()=>{u||lj().then(re).catch(()=>{})},[]),A.useEffect(()=>{if(!se)return;const G=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(G)},[se]),t&&!se)return h.jsx(Yn,{to:m,replace:!0});const Z=async G=>{var F,K;if(G.preventDefault(),C(""),!g.trim()||!_){C("Username and password are required");return}Q(!0);try{const J=await fetch(`${Gt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g.trim(),password:_})}),ie=await J.json();if(!J.ok){C(ie.error||"Login failed");return}U(!0),i(ie.token,{username:g.trim(),password:_},{displayName:(F=ie.user)==null?void 0:F.display_name,username:(K=ie.user)==null?void 0:K.external_id})}catch{C("Unable to connect to server")}finally{Q(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${se?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Th,{size:"lg",hideLabel:se})}),h.jsxs("form",{onSubmit:Z,className:`space-y-5 transition-opacity duration-300 ${se?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:g,onChange:G=>E(G.target.value),className:"input",placeholder:"Enter your username",autoFocus:!se,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:_,onChange:G=>T(G.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&h.jsx("p",{className:"text-sm text-status-error",children:q}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:R||se,children:R?"Signing in...":"Sign In"}),le.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:le.filter(G=>G.provider!=="anthropic").map(G=>h.jsxs("a",{href:`${Gt}/api/auth/oauth/${G.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(sb,{provider:G.provider}),"Sign in with ",G.name]},G.provider))})]})]})]})})}function Cy(){const{isAuthenticated:i}=zn(),t=Uy(),s=Qn(),a=new URLSearchParams(s.search),o=a.get("state")||"";A.useEffect(()=>{i||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[i]);const[u,d]=A.useState(""),[m,y]=A.useState(a.get("label")||"default"),[g,E]=A.useState(""),[_,T]=A.useState(!1),q=u.trim().startsWith("sk-ant-oat"),C=u.trim().startsWith("sk-ant-api"),R=Q=>{Q.preventDefault();const se=u.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}T(!0),E("");const U=`${Gt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(se)}&state=${encodeURIComponent(o)}`;window.location.href=U};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Th,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(sb,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),h.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."}),h.jsxs("form",{onSubmit:R,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:u,onChange:Q=>d(Q.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),C&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:m,onChange:Q=>y(Q.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.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").'})]}),g&&h.jsx("p",{className:"text-sm text-status-error",children:g}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:_,children:_?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.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."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.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 $a({roleTypes:i,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:u}=zn();return a?h.jsx(Nr,{}):i&&i.some(d=>u(d))?h.jsx(Nr,{}):t&&t.some(d=>o(d))?h.jsx(Nr,{}):h.jsx(Yn,{to:s,replace:!0})}function uj({redirectTo:i="/"}){var a;const{data:t,isLoading:s}=Hr();return s||!t?null:(a=t.ai)!=null&&a.enabled?h.jsx(Nr,{}):h.jsx(Yn,{to:i,replace:!0})}function fj({flag:i,redirectTo:t="/"}){var o;const{data:s,isLoading:a}=Hr();return a||!s?null:((o=s.features)==null?void 0:o[i])===!1?h.jsx(Yn,{to:t,replace:!0}):h.jsx(Nr,{})}const hj=A.lazy(()=>Ee(()=>import("./ProcessesListPage-CoQEi_Su.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(i=>({default:i.ProcessesListPage}))),dj=A.lazy(()=>Ee(()=>import("./ProcessDetailPage-D8pAWUXx.js"),__vite__mapDeps([18,1,2,4,19,15,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),mj=A.lazy(()=>Ee(()=>import("./McpOverview-BDZC9Hvl.js"),__vite__mapDeps([24,1,25,26,27,28,14,15,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),pj=A.lazy(()=>Ee(()=>import("./McpRunsPage-f5hDbpLo.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,15,32,14,13,12,16,33]),import.meta.url).then(i=>({default:i.McpRunsPage}))),yj=A.lazy(()=>Ee(()=>import("./McpRunDetailPage-BM3mUSlH.js"),__vite__mapDeps([34,1,26,20,14,15,35,6,36,37,13,38,39,16]),import.meta.url).then(i=>({default:i.McpRunDetailPage}))),gj=A.lazy(()=>Ee(()=>import("./McpQueryPage-CsKNXUhb.js"),__vite__mapDeps([40,1,14,15,9,10,13,12,16,8,11,32,17,33,5,6,4,41]),import.meta.url).then(i=>({default:i.McpQueryPage}))),bj=A.lazy(()=>Ee(()=>import("./McpQueryDetailPage-CXhgX1pS.js"),__vite__mapDeps([42,1,14,15,20,41,6,27,4,43,36,26,3,2,44,45,46,47,48,49,35,50,38,39]),import.meta.url).then(i=>({default:i.McpQueryDetailPage}))),xj=A.lazy(()=>Ee(()=>import("./EscalationsOverview-D8NrATg2.js"),__vite__mapDeps([51,1,4,14,15,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),vj=A.lazy(()=>Ee(()=>import("./AvailableEscalationsPage-DDVuivEE.js"),__vite__mapDeps([52,1,6,4,53,54,55,15,20,12,56,5,7,8,9,10,23,57,13,58,21,17,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),_j=A.lazy(()=>Ee(()=>import("./OperatorDashboard-_axS17fp.js"),__vite__mapDeps([59,1,4,5,6,7,8,9,10,14,15,12,33,57,13,58,21,17,56,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),wj=A.lazy(()=>Ee(()=>import("./index-BJ0jjFsI.js"),__vite__mapDeps([60,1,53,54,6,55,14,15,16,56,3,4,61,20,21,35,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),Sj=A.lazy(()=>Ee(()=>import("./WorkflowsOverview-D8MkSMex.js"),__vite__mapDeps([62,1,3,4,14,15,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),Ej=A.lazy(()=>Ee(()=>import("./index-CDHDoHYz.js"),__vite__mapDeps([63,1,3,14,15,13,17,64,47,48,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),jj=A.lazy(()=>Ee(()=>import("./index-CDHDoHYz.js"),__vite__mapDeps([63,1,3,14,15,13,17,64,47,48,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),Aj=A.lazy(()=>Ee(()=>import("./WorkflowsDashboard-C0Bbrd5M.js"),__vite__mapDeps([65,1,32,3,31,28,6,4,5,8,9,10,17,15,14,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"durable"})}))),Oj=A.lazy(()=>Ee(()=>import("./WorkflowsDashboard-C0Bbrd5M.js"),__vite__mapDeps([65,1,32,3,31,28,6,4,5,8,9,10,17,15,14,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"all"})}))),Tj=A.lazy(()=>Ee(()=>import("./YamlWorkflowsPage-9Ki54d-9.js"),__vite__mapDeps([66,1,27,5,6,14,15,13,10,49,64,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),Nj=A.lazy(()=>Ee(()=>import("./GraphInvokePage-DbHvggQ_.js"),__vite__mapDeps([67,1,27,14,15,44,46,47,48,45,6,49,64]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),kj=A.lazy(()=>Ee(()=>import("./YamlWorkflowDetailPage-BcbrYhDI.js"),__vite__mapDeps([68,1,27,20,64,15,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),Cj=A.lazy(()=>Ee(()=>import("./TasksListPage-DySfZFgs.js"),__vite__mapDeps([69,1,2,3,5,6,9,10,20,58,50,12,13,14,15,17]),import.meta.url).then(i=>({default:i.TasksListPage}))),Mj=A.lazy(()=>Ee(()=>import("./TaskDetailPage-DnjhW7qv.js"),__vite__mapDeps([70,1,2,20,58,14,15,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),My=A.lazy(()=>Ee(()=>import("./WorkflowExecutionPage-CDDLled5.js"),__vite__mapDeps([71,1,3,4,37,13,38,20,6,39,15,2,14,36,16,61,35]),import.meta.url).then(i=>({default:i.WorkflowExecutionPage}))),Rj=A.lazy(()=>Ee(()=>import("./AdminDashboard-Dy031e9g.js"),__vite__mapDeps([72,1,2,4,25,19,15,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),Dj=A.lazy(()=>Ee(()=>import("./index-B68A3v-S.js"),__vite__mapDeps([73,1,3,9,10,13,33,5,6,14,15,74,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),qj=A.lazy(()=>Ee(()=>import("./index-iOb3sGsC.js"),__vite__mapDeps([75,1,3,13,76,54,6,21,15,17,14,47,48,64]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),Ry=A.lazy(()=>Ee(()=>import("./index-iOb3sGsC.js"),__vite__mapDeps([75,1,3,13,76,54,6,21,15,17,14,47,48,64]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),zj=A.lazy(()=>Ee(()=>import("./index-BOJMUk4F.js"),__vite__mapDeps([77,1,25,10,76,54,6,14,15,13,12,5,78,46,47,48,49,45,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),Dy=A.lazy(()=>Ee(()=>import("./index-BAi89Xpm.js"),__vite__mapDeps([79,1,25,14,15,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),Uj=A.lazy(()=>Ee(()=>import("./index-D5n_e59T.js"),__vite__mapDeps([80,1,23,5,6,9,10,12,13,76,54,33,14,15,21,48,11,50]),import.meta.url).then(i=>({default:i.UsersPage}))),Bj=A.lazy(()=>Ee(()=>import("./RolesPage-CxpXm4Sw.js"),__vite__mapDeps([81,1,14,15,54,6]),import.meta.url).then(i=>({default:i.RolesPage}))),Lj=A.lazy(()=>Ee(()=>import("./RoleDetailPage-ufbypNNR.js"),__vite__mapDeps([82,1,76,54,6,23,15]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),Pj=A.lazy(()=>Ee(()=>import("./EscalationSchemaPage-C7dHgG8e.js"),__vite__mapDeps([83,1,15,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),Hj=A.lazy(()=>Ee(()=>import("./EscalationListSchemaPage-CIJ-OgVC.js"),__vite__mapDeps([84,1,15,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),$j=A.lazy(()=>Ee(()=>import("./index-BrgYykPV.js"),__vite__mapDeps([85,1,14,15,54,6,55]),import.meta.url).then(i=>({default:i.MaintenancePage}))),Yj=A.lazy(()=>Ee(()=>import("./OperationsPage-D37cZ8Qh.js").then(i=>i.O),__vite__mapDeps([86,1,4,14,15,6]),import.meta.url).then(i=>({default:i.OperationsPage}))),Vj=A.lazy(()=>Ee(()=>import("./index-BxgtIqvl.js"),__vite__mapDeps([87,1,19,15,13,5,6,31,28,54,36,74,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),Fj=A.lazy(()=>Ee(()=>import("./index-Dd1RxGNw.js"),__vite__mapDeps([88,1,61,15,39,5,6,31,28,8,9,10,12,13,14,16]),import.meta.url).then(i=>({default:i.StreamMessagesPage}))),Gj=A.lazy(()=>Ee(()=>import("./CredentialsPage-BKxS-1sA.js"),__vite__mapDeps([89,1,14,15,50,76,54,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),Ij=A.lazy(()=>Ee(()=>import("./index-CUZJHXew.js"),__vite__mapDeps([90,1,6,14,15,13,16,8,10,91,50]),import.meta.url).then(i=>({default:i.FilesPage}))),Qj=A.lazy(()=>Ee(()=>import("./index-mcAkQblr.js"),__vite__mapDeps([92,1,14,15,13,16,12,10,91,50,93,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),Jj=A.lazy(()=>Ee(()=>import("./HomePage-BpexnDO_.js"),__vite__mapDeps([94,1,3,26,28,4,21,15,17,16,86,14,6]),import.meta.url).then(i=>({default:i.HomePage}))),Kj=A.lazy(()=>Ee(()=>import("./AgentsPage-CHczRx5N.js"),__vite__mapDeps([95,1,96,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(i=>({default:i.AgentsPage}))),Xj=A.lazy(()=>Ee(()=>import("./AgentDetailPage-oYLBrN74.js"),__vite__mapDeps([97,1,96,98,15,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),qy=A.lazy(()=>Ee(()=>import("./AgentConfigPage-CqmtYBbC.js"),__vite__mapDeps([99,1,96,98,15,14,93,46,47,48,3,27,100,101,17,6]),import.meta.url).then(i=>({default:i.AgentConfigPage}))),Zj=A.lazy(()=>Ee(()=>import("./CapabilitiesPage-lQJGZ_-t.js"),__vite__mapDeps([102,1,100,78,25,46,47,48,15,49,6,45,14,13]),import.meta.url).then(i=>({default:i.CapabilitiesPage}))),Wj=A.lazy(()=>Ee(()=>import("./TopicsPage-5yW63ELl.js"),__vite__mapDeps([103,1,101,14,15,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),eA=A.lazy(()=>Ee(()=>import("./TopicDetailPage-BHccgkU_.js"),__vite__mapDeps([104,1,101,16,15,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function tA(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function we({children:i}){return h.jsx(A.Suspense,{fallback:h.jsx(tA,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const ib=new pv({defaultOptions:{queries:{staleTime:1e4,retry:(i,t)=>t instanceof Error&&t.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{ib.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",t=`${i}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,a=i&&s.startsWith(i)?s.slice(i.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(a)}`}});const nA=bv([{path:"/login",element:h.jsx(cj,{})},{path:"/connect/anthropic",element:h.jsx(Cy,{})},{path:"/connect/:provider",element:h.jsx(Cy,{})},{path:"/",element:h.jsx(aj,{}),children:[{index:!0,element:h.jsx(we,{children:h.jsx(Jj,{})})},{path:"processes/all",element:h.jsx(we,{children:h.jsx(hj,{})})},{path:"processes/detail/:originId",element:h.jsx(we,{children:h.jsx(dj,{})})},{path:"credentials",element:h.jsx(we,{children:h.jsx(Gj,{})})},{path:"connections",element:h.jsx(Yn,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(we,{children:h.jsx(xj,{})})},{path:"escalations/available",element:h.jsx(we,{children:h.jsx(vj,{})})},{path:"escalations/queue",element:h.jsx(we,{children:h.jsx(_j,{})})},{path:"escalations/detail/:id",element:h.jsx(we,{children:h.jsx(wj,{})})},{path:"capabilities",element:h.jsx(we,{children:h.jsx(Zj,{})})},{path:"agents",element:h.jsx(we,{children:h.jsx(Kj,{})})},{path:"agents/new",element:h.jsx(we,{children:h.jsx(qy,{})})},{path:"agents/:id",element:h.jsx(we,{children:h.jsx(Xj,{})})},{path:"agents/:id/edit",element:h.jsx(we,{children:h.jsx(qy,{})})},{path:"topics",element:h.jsx(we,{children:h.jsx(Wj,{})})},{path:"topics/:topic",element:h.jsx(we,{children:h.jsx(eA,{})})},{element:h.jsx($a,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(we,{children:h.jsx(Sj,{})})},{path:"workflows/executions",element:h.jsx(we,{children:h.jsx(Oj,{})})},{path:"workflows/durable/executions",element:h.jsx(we,{children:h.jsx(Aj,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(we,{children:h.jsx(My,{})})},{path:"workflows/tasks",element:h.jsx(we,{children:h.jsx(Cj,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(we,{children:h.jsx(Mj,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(we,{children:h.jsx(My,{})})},{path:"workflows/start",element:h.jsx(we,{children:h.jsx(Ej,{})})},{path:"workflows/durable/invoke",element:h.jsx(we,{children:h.jsx(jj,{})})},{path:"workflows/cron",element:h.jsx(Yn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(we,{children:h.jsx(Dj,{})})},{path:"workflows/registry",element:h.jsx(we,{children:h.jsx(qj,{})})},{path:"workflows/registry/new",element:h.jsx(we,{children:h.jsx(Ry,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(we,{children:h.jsx(Ry,{})})}]},{element:h.jsx($a,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(we,{children:h.jsx(Tj,{})})},{path:"mcp/workflows/invoke",element:h.jsx(we,{children:h.jsx(Nj,{})})},{path:"mcp/workflows/:id",element:h.jsx(we,{children:h.jsx(kj,{})})},{path:"mcp/executions",element:h.jsx(we,{children:h.jsx(pj,{})})},{path:"mcp/executions/:jobId",element:h.jsx(we,{children:h.jsx(yj,{})})},{path:"files",element:h.jsx(we,{children:h.jsx(Ij,{})})},{path:"knowledge",element:h.jsx(we,{children:h.jsx(Qj,{})})},{element:h.jsx(uj,{}),children:[{path:"mcp",element:h.jsx(we,{children:h.jsx(mj,{})})},{path:"mcp/queries",element:h.jsx(we,{children:h.jsx(gj,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(we,{children:h.jsx(bj,{})})},{path:"mcp/tools",element:h.jsx(Yn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(we,{children:h.jsx(zj,{})})},{path:"mcp/servers/new",element:h.jsx(we,{children:h.jsx(Dy,{})})},{path:"mcp/servers/:serverId",element:h.jsx(we,{children:h.jsx(Dy,{})})}]}]},{element:h.jsx($a,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"operations",element:h.jsx(we,{children:h.jsx(Yj,{})})}]},{element:h.jsx($a,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(we,{children:h.jsx(Rj,{})})},{path:"admin/users",element:h.jsx(we,{children:h.jsx(Uj,{})})},{path:"admin/escalation-chains",element:h.jsx(Yn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(we,{children:h.jsx(Bj,{})})},{path:"admin/roles/:role",element:h.jsx(we,{children:h.jsx(Lj,{})})},{path:"admin/roles/:role/schema",element:h.jsx(we,{children:h.jsx(Pj,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(we,{children:h.jsx(Hj,{})})}]},{element:h.jsx($a,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(Yn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(fj,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(we,{children:h.jsx($j,{})})}]},{path:"admin/controlplane",element:h.jsx(we,{children:h.jsx(Vj,{})})},{path:"admin/streams",element:h.jsx(we,{children:h.jsx(Fj,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function sA(){return h.jsx(yv,{client:ib,children:h.jsx(n1,{children:h.jsx(iS,{children:h.jsx(xv,{router:nA})})})})}Lg(Bg());Zv.createRoot(document.getElementById("root")).render(h.jsx(A.StrictMode,{children:h.jsx(sA,{})}));export{GA as $,_A as A,wA as B,Ch as C,WE as D,SA as E,Fg as F,jA as G,AA as H,Nh as I,v2 as J,fA as K,Dg as L,Mh as M,cg as N,OS as O,Mg as P,RA as Q,Dh as R,o2 as S,yA as T,IA as U,mA as V,bA as W,EA as X,TA as Y,Rh as Z,nb as _,QA as a,qA as a0,OA as a1,zA as a2,UA as a3,NA as a4,kA as a5,MA as a6,CA as a7,DA as a8,YA as a9,Gt as aa,Vy as ab,cA as ac,BA as ad,LA as ae,zo as af,Ga as ag,jr as ah,wr as ai,JA as aj,KA as ak,sb as al,$S as am,Tg as an,VA as ao,ZE as b,fg as c,Ae as d,dA as e,JE as f,pA as g,gA as h,uA as i,AS as j,Cg as k,FA as l,HA as m,jg as n,zn as o,GS as p,hA as q,$A as r,VS as s,FS as t,Hr as u,JS as v,PA as w,Og as x,xA as y,vA as z};
63
- //# sourceMappingURL=index-DIgiIoou.js.map