@hotmeshio/long-tail 0.9.6 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/README.md +22 -93
  2. package/build/api/escalations/helpers.d.ts +27 -0
  3. package/build/api/escalations/helpers.js +34 -0
  4. package/build/api/escalations/list.d.ts +2 -0
  5. package/build/api/escalations/list.js +13 -3
  6. package/build/api/escalations/resolve.js +16 -4
  7. package/build/routes/escalations/list.js +2 -0
  8. package/build/services/escalation/crud.d.ts +1 -1
  9. package/build/services/escalation/crud.js +6 -2
  10. package/build/services/escalation/facet-sql.d.ts +8 -1
  11. package/build/services/escalation/facet-sql.js +29 -1
  12. package/build/types/facets.d.ts +9 -0
  13. package/dashboard/dist/assets/{AdminDashboard-DXFIKXO3.js → AdminDashboard-DQS74RL0.js} +2 -2
  14. package/dashboard/dist/assets/{AdminDashboard-DXFIKXO3.js.map → AdminDashboard-DQS74RL0.js.map} +1 -1
  15. package/dashboard/dist/assets/{AgentConfigPage-CQE1mfjk.js → AgentConfigPage-CSMCrFR4.js} +7 -7
  16. package/dashboard/dist/assets/{AgentConfigPage-CQE1mfjk.js.map → AgentConfigPage-CSMCrFR4.js.map} +1 -1
  17. package/dashboard/dist/assets/{AgentDetailPage-DM59ozP_.js → AgentDetailPage-CDiopQ7D.js} +3 -3
  18. package/dashboard/dist/assets/{AgentDetailPage-DM59ozP_.js.map → AgentDetailPage-CDiopQ7D.js.map} +1 -1
  19. package/dashboard/dist/assets/{AgentsPage-DSK2uXI5.js → AgentsPage-CyUXe9n4.js} +2 -2
  20. package/dashboard/dist/assets/{AgentsPage-DSK2uXI5.js.map → AgentsPage-CyUXe9n4.js.map} +1 -1
  21. package/dashboard/dist/assets/AvailableEscalationsPage-AiuiLcz-.js +2 -0
  22. package/dashboard/dist/assets/AvailableEscalationsPage-AiuiLcz-.js.map +1 -0
  23. package/dashboard/dist/assets/BotPicker-BuCGvEed.js +2 -0
  24. package/dashboard/dist/assets/BotPicker-BuCGvEed.js.map +1 -0
  25. package/dashboard/dist/assets/CapabilitiesPage-nTv4STcG.js +2 -0
  26. package/dashboard/dist/assets/{CapabilitiesPage-DFQryGBj.js.map → CapabilitiesPage-nTv4STcG.js.map} +1 -1
  27. package/dashboard/dist/assets/{CollapsibleSection-B7-d5O_x.js → CollapsibleSection-CkOks9Cf.js} +2 -2
  28. package/dashboard/dist/assets/{CollapsibleSection-B7-d5O_x.js.map → CollapsibleSection-CkOks9Cf.js.map} +1 -1
  29. package/dashboard/dist/assets/{ConfirmDeleteModal-D9_1b4MW.js → ConfirmDeleteModal-C0x0HcHX.js} +2 -2
  30. package/dashboard/dist/assets/{ConfirmDeleteModal-D9_1b4MW.js.map → ConfirmDeleteModal-C0x0HcHX.js.map} +1 -1
  31. package/dashboard/dist/assets/CountdownTimer-DdKL8Ryt.js +2 -0
  32. package/dashboard/dist/assets/CountdownTimer-DdKL8Ryt.js.map +1 -0
  33. package/dashboard/dist/assets/CredentialsPage-BwA7k9Cb.js +2 -0
  34. package/dashboard/dist/assets/{CredentialsPage-BWVgxRpZ.js.map → CredentialsPage-BwA7k9Cb.js.map} +1 -1
  35. package/dashboard/dist/assets/{CronLabel-DNnyNqXH.js → CronLabel-jC_i-Lh9.js} +2 -2
  36. package/dashboard/dist/assets/{CronLabel-DNnyNqXH.js.map → CronLabel-jC_i-Lh9.js.map} +1 -1
  37. package/dashboard/dist/assets/{CustomDurationPicker-SNsQZL_U.js → CustomDurationPicker-F6bR2Q5A.js} +2 -2
  38. package/dashboard/dist/assets/{CustomDurationPicker-SNsQZL_U.js.map → CustomDurationPicker-F6bR2Q5A.js.map} +1 -1
  39. package/dashboard/dist/assets/{DropZone-C1TpkVQG.js → DropZone-zxH-9B8c.js} +2 -2
  40. package/dashboard/dist/assets/{DropZone-C1TpkVQG.js.map → DropZone-zxH-9B8c.js.map} +1 -1
  41. package/dashboard/dist/assets/{ElapsedCell-C4r0IvUt.js → ElapsedCell-DZ3RTZFc.js} +2 -2
  42. package/dashboard/dist/assets/{ElapsedCell-C4r0IvUt.js.map → ElapsedCell-DZ3RTZFc.js.map} +1 -1
  43. package/dashboard/dist/assets/{EscalationListSchemaPage-D8Ec8Zhj.js → EscalationListSchemaPage-CaMydHIO.js} +3 -3
  44. package/dashboard/dist/assets/{EscalationListSchemaPage-D8Ec8Zhj.js.map → EscalationListSchemaPage-CaMydHIO.js.map} +1 -1
  45. package/dashboard/dist/assets/{EscalationSchemaPage-BmEv7qU2.js → EscalationSchemaPage-BlMx2WE6.js} +3 -3
  46. package/dashboard/dist/assets/{EscalationSchemaPage-BmEv7qU2.js.map → EscalationSchemaPage-BlMx2WE6.js.map} +1 -1
  47. package/dashboard/dist/assets/{EscalationsOverview-DkIy025e.js → EscalationsOverview-DcMkbiSo.js} +2 -2
  48. package/dashboard/dist/assets/{EscalationsOverview-DkIy025e.js.map → EscalationsOverview-DcMkbiSo.js.map} +1 -1
  49. package/dashboard/dist/assets/{EventTable-Co4RYeKO.js → EventTable-CuZ2Q_wH.js} +2 -2
  50. package/dashboard/dist/assets/{EventTable-Co4RYeKO.js.map → EventTable-CuZ2Q_wH.js.map} +1 -1
  51. package/dashboard/dist/assets/FilterBar-B5Vk5tBF.js +2 -0
  52. package/dashboard/dist/assets/FilterBar-B5Vk5tBF.js.map +1 -0
  53. package/dashboard/dist/assets/{GraphInvokePage-b7ukMy0z.js → GraphInvokePage-CXElQqcV.js} +2 -2
  54. package/dashboard/dist/assets/{GraphInvokePage-b7ukMy0z.js.map → GraphInvokePage-CXElQqcV.js.map} +1 -1
  55. package/dashboard/dist/assets/HomePage-DcWfjZA-.js +2 -0
  56. package/dashboard/dist/assets/HomePage-DcWfjZA-.js.map +1 -0
  57. package/dashboard/dist/assets/ListToolbar-Dmd1UiM-.js +2 -0
  58. package/dashboard/dist/assets/{ListToolbar-DDG6DXVF.js.map → ListToolbar-Dmd1UiM-.js.map} +1 -1
  59. package/dashboard/dist/assets/{McpOverview-P2o3b3mi.js → McpOverview-Cul2LFEw.js} +2 -2
  60. package/dashboard/dist/assets/{McpOverview-P2o3b3mi.js.map → McpOverview-Cul2LFEw.js.map} +1 -1
  61. package/dashboard/dist/assets/{McpQueryDetailPage-C2CeBLb0.js → McpQueryDetailPage-BVlQ0WBa.js} +2 -2
  62. package/dashboard/dist/assets/{McpQueryDetailPage-C2CeBLb0.js.map → McpQueryDetailPage-BVlQ0WBa.js.map} +1 -1
  63. package/dashboard/dist/assets/{McpQueryPage-D_N-3lp0.js → McpQueryPage-B7PmO_V-.js} +2 -2
  64. package/dashboard/dist/assets/{McpQueryPage-D_N-3lp0.js.map → McpQueryPage-B7PmO_V-.js.map} +1 -1
  65. package/dashboard/dist/assets/{McpRunDetailPage-uDw3MWR_.js → McpRunDetailPage-B1RhxxlU.js} +2 -2
  66. package/dashboard/dist/assets/{McpRunDetailPage-uDw3MWR_.js.map → McpRunDetailPage-B1RhxxlU.js.map} +1 -1
  67. package/dashboard/dist/assets/{McpRunsPage-CDTUxghb.js → McpRunsPage-DlSrpxiv.js} +2 -2
  68. package/dashboard/dist/assets/{McpRunsPage-CDTUxghb.js.map → McpRunsPage-DlSrpxiv.js.map} +1 -1
  69. package/dashboard/dist/assets/Modal-D4afnAjc.js +2 -0
  70. package/dashboard/dist/assets/Modal-D4afnAjc.js.map +1 -0
  71. package/dashboard/dist/assets/{NamespacePill--ikKtMvx.js → NamespacePill-BQNMfY0m.js} +2 -2
  72. package/dashboard/dist/assets/{NamespacePill--ikKtMvx.js.map → NamespacePill-BQNMfY0m.js.map} +1 -1
  73. package/dashboard/dist/assets/OperationsPage-vm_ByX41.js +2 -0
  74. package/dashboard/dist/assets/OperationsPage-vm_ByX41.js.map +1 -0
  75. package/dashboard/dist/assets/OperatorDashboard-zviIxH-0.js +2 -0
  76. package/dashboard/dist/assets/{OperatorDashboard-CVRD8nQH.js.map → OperatorDashboard-zviIxH-0.js.map} +1 -1
  77. package/dashboard/dist/assets/{PageHeader-CiFhzGc0.js → PageHeader-BIY1YvKR.js} +2 -2
  78. package/dashboard/dist/assets/{PageHeader-CiFhzGc0.js.map → PageHeader-BIY1YvKR.js.map} +1 -1
  79. package/dashboard/dist/assets/{PageHeaderWithStats-_zOnWAhq.js → PageHeaderWithStats-TUyglVW0.js} +2 -2
  80. package/dashboard/dist/assets/{PageHeaderWithStats-_zOnWAhq.js.map → PageHeaderWithStats-TUyglVW0.js.map} +1 -1
  81. package/dashboard/dist/assets/{ProcessDetailPage-Dt6PAK04.js → ProcessDetailPage-txiMHbMI.js} +2 -2
  82. package/dashboard/dist/assets/{ProcessDetailPage-Dt6PAK04.js.map → ProcessDetailPage-txiMHbMI.js.map} +1 -1
  83. package/dashboard/dist/assets/{ProcessesListPage-CMkjASgs.js → ProcessesListPage-CRttlU3L.js} +2 -2
  84. package/dashboard/dist/assets/{ProcessesListPage-CMkjASgs.js.map → ProcessesListPage-CRttlU3L.js.map} +1 -1
  85. package/dashboard/dist/assets/RoleDetailPage-DBIl_mhK.js +8 -0
  86. package/dashboard/dist/assets/RoleDetailPage-DBIl_mhK.js.map +1 -0
  87. package/dashboard/dist/assets/RolePill-4LO_CuO3.js +2 -0
  88. package/dashboard/dist/assets/RolePill-4LO_CuO3.js.map +1 -0
  89. package/dashboard/dist/assets/RolesPage-DzrSv6m-.js +2 -0
  90. package/dashboard/dist/assets/{RolesPage-DtHIjDss.js.map → RolesPage-DzrSv6m-.js.map} +1 -1
  91. package/dashboard/dist/assets/RunAsSelector-CiLjlmIE.js +2 -0
  92. package/dashboard/dist/assets/{RunAsSelector-C198CpFs.js.map → RunAsSelector-CiLjlmIE.js.map} +1 -1
  93. package/dashboard/dist/assets/{SlidePanel-BcWKelpn.js → SlidePanel-DK4sWXmp.js} +2 -2
  94. package/dashboard/dist/assets/{SlidePanel-BcWKelpn.js.map → SlidePanel-DK4sWXmp.js.map} +1 -1
  95. package/dashboard/dist/assets/StickyPagination-Di6b2GDE.js +2 -0
  96. package/dashboard/dist/assets/{StickyPagination-eZ6WhMrL.js.map → StickyPagination-Di6b2GDE.js.map} +1 -1
  97. package/dashboard/dist/assets/{StreamMessageDetail-7xq_dddO.js → StreamMessageDetail-BbkU45X_.js} +2 -2
  98. package/dashboard/dist/assets/{StreamMessageDetail-7xq_dddO.js.map → StreamMessageDetail-BbkU45X_.js.map} +1 -1
  99. package/dashboard/dist/assets/{SwimlaneTimeline-Yg5QT0nI.js → SwimlaneTimeline-BzsvdstG.js} +2 -2
  100. package/dashboard/dist/assets/{SwimlaneTimeline-Yg5QT0nI.js.map → SwimlaneTimeline-BzsvdstG.js.map} +1 -1
  101. package/dashboard/dist/assets/{TagInput-BaFJCq9A.js → TagInput-CK-JhBG2.js} +2 -2
  102. package/dashboard/dist/assets/{TagInput-BaFJCq9A.js.map → TagInput-CK-JhBG2.js.map} +1 -1
  103. package/dashboard/dist/assets/{TaskDetailPage-Wc3AFnqs.js → TaskDetailPage-Biikk9o_.js} +2 -2
  104. package/dashboard/dist/assets/{TaskDetailPage-Wc3AFnqs.js.map → TaskDetailPage-Biikk9o_.js.map} +1 -1
  105. package/dashboard/dist/assets/{TaskQueuePill-D9e16qkU.js → TaskQueuePill-C_Vo2Clc.js} +2 -2
  106. package/dashboard/dist/assets/{TaskQueuePill-D9e16qkU.js.map → TaskQueuePill-C_Vo2Clc.js.map} +1 -1
  107. package/dashboard/dist/assets/{TasksListPage-V-1J_B_L.js → TasksListPage-t9WAft9-.js} +2 -2
  108. package/dashboard/dist/assets/{TasksListPage-V-1J_B_L.js.map → TasksListPage-t9WAft9-.js.map} +1 -1
  109. package/dashboard/dist/assets/{TimeAgo-XdHghs5F.js → TimeAgo-I7X6jdne.js} +2 -2
  110. package/dashboard/dist/assets/{TimeAgo-XdHghs5F.js.map → TimeAgo-I7X6jdne.js.map} +1 -1
  111. package/dashboard/dist/assets/{TimestampCell-BrzctPWT.js → TimestampCell-Cex9nr0t.js} +2 -2
  112. package/dashboard/dist/assets/{TimestampCell-BrzctPWT.js.map → TimestampCell-Cex9nr0t.js.map} +1 -1
  113. package/dashboard/dist/assets/ToolPill-BCi101Jh.js +2 -0
  114. package/dashboard/dist/assets/{ToolPill-Enc3nyic.js.map → ToolPill-BCi101Jh.js.map} +1 -1
  115. package/dashboard/dist/assets/{ToolTestPanel-CGfGUsaq.js → ToolTestPanel--MGaDY-1.js} +2 -2
  116. package/dashboard/dist/assets/{ToolTestPanel-CGfGUsaq.js.map → ToolTestPanel--MGaDY-1.js.map} +1 -1
  117. package/dashboard/dist/assets/{TopicDetailPage-CcAgD2k5.js → TopicDetailPage-B8pHHweA.js} +3 -3
  118. package/dashboard/dist/assets/{TopicDetailPage-CcAgD2k5.js.map → TopicDetailPage-B8pHHweA.js.map} +1 -1
  119. package/dashboard/dist/assets/{TopicsPage-BOQG7s4P.js → TopicsPage-tiOEQz2m.js} +2 -2
  120. package/dashboard/dist/assets/{TopicsPage-BOQG7s4P.js.map → TopicsPage-tiOEQz2m.js.map} +1 -1
  121. package/dashboard/dist/assets/{UserName-BzxR0Ihp.js → UserName-Cdhyuv5K.js} +2 -2
  122. package/dashboard/dist/assets/{UserName-BzxR0Ihp.js.map → UserName-Cdhyuv5K.js.map} +1 -1
  123. package/dashboard/dist/assets/{WorkflowExecutionPage-hRsDMByj.js → WorkflowExecutionPage-DD1BKj5k.js} +2 -2
  124. package/dashboard/dist/assets/{WorkflowExecutionPage-hRsDMByj.js.map → WorkflowExecutionPage-DD1BKj5k.js.map} +1 -1
  125. package/dashboard/dist/assets/WorkflowPill-DHxrAkp3.js +2 -0
  126. package/dashboard/dist/assets/{WorkflowPill-S6VV2Eax.js.map → WorkflowPill-DHxrAkp3.js.map} +1 -1
  127. package/dashboard/dist/assets/{WorkflowsDashboard-ky0ulsUe.js → WorkflowsDashboard-BeWjDHYW.js} +2 -2
  128. package/dashboard/dist/assets/{WorkflowsDashboard-ky0ulsUe.js.map → WorkflowsDashboard-BeWjDHYW.js.map} +1 -1
  129. package/dashboard/dist/assets/{WorkflowsOverview-CzRJUV58.js → WorkflowsOverview-CkI-Pmj7.js} +2 -2
  130. package/dashboard/dist/assets/{WorkflowsOverview-CzRJUV58.js.map → WorkflowsOverview-CkI-Pmj7.js.map} +1 -1
  131. package/dashboard/dist/assets/{YamlWorkflowDetailPage-Beqzy9Ph.js → YamlWorkflowDetailPage-BQnO8-PQ.js} +2 -2
  132. package/dashboard/dist/assets/{YamlWorkflowDetailPage-Beqzy9Ph.js.map → YamlWorkflowDetailPage-BQnO8-PQ.js.map} +1 -1
  133. package/dashboard/dist/assets/{YamlWorkflowsPage-BzBUU2ug.js → YamlWorkflowsPage-DjmNTQ5r.js} +2 -2
  134. package/dashboard/dist/assets/{YamlWorkflowsPage-BzBUU2ug.js.map → YamlWorkflowsPage-DjmNTQ5r.js.map} +1 -1
  135. package/dashboard/dist/assets/{agents-Dlu4m6jy.js → agents-2DaoprdB.js} +2 -2
  136. package/dashboard/dist/assets/{agents-Dlu4m6jy.js.map → agents-2DaoprdB.js.map} +1 -1
  137. package/dashboard/dist/assets/{bots-C4G5U-6Q.js → bots-BdwLwMUg.js} +2 -2
  138. package/dashboard/dist/assets/{bots-C4G5U-6Q.js.map → bots-BdwLwMUg.js.map} +1 -1
  139. package/dashboard/dist/assets/{capabilities-BSFP_boq.js → capabilities-BsuFeK9J.js} +2 -2
  140. package/dashboard/dist/assets/{capabilities-BSFP_boq.js.map → capabilities-BsuFeK9J.js.map} +1 -1
  141. package/dashboard/dist/assets/{controlplane-qCqoP2ZV.js → controlplane-CxKOrcFO.js} +2 -2
  142. package/dashboard/dist/assets/{controlplane-qCqoP2ZV.js.map → controlplane-CxKOrcFO.js.map} +1 -1
  143. package/dashboard/dist/assets/escalation-columns-y5SQ2Ulh.js +2 -0
  144. package/dashboard/dist/assets/escalation-columns-y5SQ2Ulh.js.map +1 -0
  145. package/dashboard/dist/assets/index-BC1NxetR.js +2 -0
  146. package/dashboard/dist/assets/{index-C0KklOM4.js.map → index-BC1NxetR.js.map} +1 -1
  147. package/dashboard/dist/assets/index-BVZINC_p.js +2 -0
  148. package/dashboard/dist/assets/{index-QL26JxBF.js.map → index-BVZINC_p.js.map} +1 -1
  149. package/dashboard/dist/assets/{index-CGVqW6MI.js → index-BXbt5NHG.js} +2 -2
  150. package/dashboard/dist/assets/{index-CGVqW6MI.js.map → index-BXbt5NHG.js.map} +1 -1
  151. package/dashboard/dist/assets/{index-CuC_mNNA.js → index-BYEkfaUq.js} +2 -2
  152. package/dashboard/dist/assets/{index-CuC_mNNA.js.map → index-BYEkfaUq.js.map} +1 -1
  153. package/dashboard/dist/assets/index-B_68lp-B.js +5 -0
  154. package/dashboard/dist/assets/index-B_68lp-B.js.map +1 -0
  155. package/dashboard/dist/assets/index-BeivyVtT.css +1 -0
  156. package/dashboard/dist/assets/{index-DUhettdV.js → index-CRBXgMsh.js} +2 -2
  157. package/dashboard/dist/assets/{index-DUhettdV.js.map → index-CRBXgMsh.js.map} +1 -1
  158. package/dashboard/dist/assets/{index-BObWYPxd.js → index-Cfq3UKd8.js} +2 -2
  159. package/dashboard/dist/assets/{index-BObWYPxd.js.map → index-Cfq3UKd8.js.map} +1 -1
  160. package/dashboard/dist/assets/{index-D_FNaSoe.js → index-DJ5nhcGB.js} +2 -2
  161. package/dashboard/dist/assets/{index-D_FNaSoe.js.map → index-DJ5nhcGB.js.map} +1 -1
  162. package/dashboard/dist/assets/{index-DCTWUswT.js → index-DVLBkcoD.js} +4 -4
  163. package/dashboard/dist/assets/index-DVLBkcoD.js.map +1 -0
  164. package/dashboard/dist/assets/index-DjI2AUbn.js +5 -0
  165. package/dashboard/dist/assets/{index-DWSNtg28.js.map → index-DjI2AUbn.js.map} +1 -1
  166. package/dashboard/dist/assets/{index-Dzhn5MDY.js → index-DyS2DHqy.js} +2 -2
  167. package/dashboard/dist/assets/{index-Dzhn5MDY.js.map → index-DyS2DHqy.js.map} +1 -1
  168. package/dashboard/dist/assets/index-H6Vp-gPG.js +2 -0
  169. package/dashboard/dist/assets/{index-BtEWQNcP.js.map → index-H6Vp-gPG.js.map} +1 -1
  170. package/dashboard/dist/assets/index-YPLTjeli.js +63 -0
  171. package/dashboard/dist/assets/index-YPLTjeli.js.map +1 -0
  172. package/dashboard/dist/assets/{knowledge-CTdgLX5j.js → knowledge-CLnYcq0Y.js} +2 -2
  173. package/dashboard/dist/assets/{knowledge-CTdgLX5j.js.map → knowledge-CLnYcq0Y.js.map} +1 -1
  174. package/dashboard/dist/assets/{mcp-BEsMr678.js → mcp-C1-iXkg7.js} +2 -2
  175. package/dashboard/dist/assets/{mcp-BEsMr678.js.map → mcp-C1-iXkg7.js.map} +1 -1
  176. package/dashboard/dist/assets/{mcp-query-CmamHKIR.js → mcp-query-DcyDxuGY.js} +2 -2
  177. package/dashboard/dist/assets/{mcp-query-CmamHKIR.js.map → mcp-query-DcyDxuGY.js.map} +1 -1
  178. package/dashboard/dist/assets/{pipelines-taOXA2-y.js → pipelines-BvG5D6bV.js} +2 -2
  179. package/dashboard/dist/assets/{pipelines-taOXA2-y.js.map → pipelines-BvG5D6bV.js.map} +1 -1
  180. package/dashboard/dist/assets/{tasks-DEaDdyBh.js → tasks-qwh8q5q7.js} +2 -2
  181. package/dashboard/dist/assets/{tasks-DEaDdyBh.js.map → tasks-qwh8q5q7.js.map} +1 -1
  182. package/dashboard/dist/assets/{topics-2qRx68Ft.js → topics-MLKKA-Ql.js} +2 -2
  183. package/dashboard/dist/assets/{topics-2qRx68Ft.js.map → topics-MLKKA-Ql.js.map} +1 -1
  184. package/dashboard/dist/assets/{useEventHooks-oXjfKrbI.js → useEventHooks-B8uNFB-l.js} +2 -2
  185. package/dashboard/dist/assets/{useEventHooks-oXjfKrbI.js.map → useEventHooks-B8uNFB-l.js.map} +1 -1
  186. package/dashboard/dist/assets/{useNamespace-YdT1Zouk.js → useNamespace-DjZmztJM.js} +2 -2
  187. package/dashboard/dist/assets/{useNamespace-YdT1Zouk.js.map → useNamespace-DjZmztJM.js.map} +1 -1
  188. package/dashboard/dist/assets/{useYamlActivityEvents-Bt-RZ7Zl.js → useYamlActivityEvents-DIvK20uI.js} +2 -2
  189. package/dashboard/dist/assets/{useYamlActivityEvents-Bt-RZ7Zl.js.map → useYamlActivityEvents-DIvK20uI.js.map} +1 -1
  190. package/dashboard/dist/assets/{users-DbX5JZ_w.js → users-CVjajeDg.js} +2 -2
  191. package/dashboard/dist/assets/{users-DbX5JZ_w.js.map → users-CVjajeDg.js.map} +1 -1
  192. package/dashboard/dist/assets/{vendor-icons-DPmIjhZB.js → vendor-icons-Qk9qLjF_.js} +131 -126
  193. package/dashboard/dist/assets/vendor-icons-Qk9qLjF_.js.map +1 -0
  194. package/dashboard/dist/assets/{workflows-acMcPTC5.js → workflows-BziTcJNq.js} +2 -2
  195. package/dashboard/dist/assets/{workflows-acMcPTC5.js.map → workflows-BziTcJNq.js.map} +1 -1
  196. package/dashboard/dist/assets/{yaml-workflows-D6kzrMYx.js → yaml-workflows-Dr-ZcE_0.js} +2 -2
  197. package/dashboard/dist/assets/{yaml-workflows-D6kzrMYx.js.map → yaml-workflows-Dr-ZcE_0.js.map} +1 -1
  198. package/dashboard/dist/index.html +3 -3
  199. package/docs/dashboard.md +2 -2
  200. package/docs/faceted-routing.md +9 -0
  201. package/docs/hitl/escalation.md +206 -0
  202. package/docs/hitl/form.md +162 -0
  203. package/docs/hitl/iframe.md +170 -0
  204. package/docs/hitl/resolution.md +166 -0
  205. package/docs/hitl/roles.md +72 -0
  206. package/docs/hitl/x-lt-layout.md +167 -0
  207. package/docs/hitl/x-lt-list-schema.md +75 -0
  208. package/docs/hitl/x-lt-show-if.md +128 -0
  209. package/docs/hitl/x-lt-validation.md +168 -0
  210. package/docs/hitl/x-lt-widget.md +152 -0
  211. package/docs/hitl-guide.md +83 -1315
  212. package/docs/iam.md +1 -1
  213. package/package.json +2 -2
  214. package/dashboard/dist/assets/AvailableEscalationsPage-BVgMtftp.js +0 -2
  215. package/dashboard/dist/assets/AvailableEscalationsPage-BVgMtftp.js.map +0 -1
  216. package/dashboard/dist/assets/BotPicker-DJ0YYKZA.js +0 -2
  217. package/dashboard/dist/assets/BotPicker-DJ0YYKZA.js.map +0 -1
  218. package/dashboard/dist/assets/CapabilitiesPage-DFQryGBj.js +0 -2
  219. package/dashboard/dist/assets/CountdownTimer-BTJmh4Xw.js +0 -2
  220. package/dashboard/dist/assets/CountdownTimer-BTJmh4Xw.js.map +0 -1
  221. package/dashboard/dist/assets/CredentialsPage-BWVgxRpZ.js +0 -2
  222. package/dashboard/dist/assets/FilterBar-DDIn8TOs.js +0 -2
  223. package/dashboard/dist/assets/FilterBar-DDIn8TOs.js.map +0 -1
  224. package/dashboard/dist/assets/HomePage-K0U3yMdU.js +0 -2
  225. package/dashboard/dist/assets/HomePage-K0U3yMdU.js.map +0 -1
  226. package/dashboard/dist/assets/ListToolbar-DDG6DXVF.js +0 -2
  227. package/dashboard/dist/assets/Modal-CSrxpXeM.js +0 -2
  228. package/dashboard/dist/assets/Modal-CSrxpXeM.js.map +0 -1
  229. package/dashboard/dist/assets/OperationsPage-Daah4pNk.js +0 -2
  230. package/dashboard/dist/assets/OperationsPage-Daah4pNk.js.map +0 -1
  231. package/dashboard/dist/assets/OperatorDashboard-CVRD8nQH.js +0 -2
  232. package/dashboard/dist/assets/RoleDetailPage-6H1AY6sK.js +0 -8
  233. package/dashboard/dist/assets/RoleDetailPage-6H1AY6sK.js.map +0 -1
  234. package/dashboard/dist/assets/RolePill-CUIJSgRq.js +0 -2
  235. package/dashboard/dist/assets/RolePill-CUIJSgRq.js.map +0 -1
  236. package/dashboard/dist/assets/RolesPage-DtHIjDss.js +0 -2
  237. package/dashboard/dist/assets/RunAsSelector-C198CpFs.js +0 -2
  238. package/dashboard/dist/assets/StickyPagination-eZ6WhMrL.js +0 -2
  239. package/dashboard/dist/assets/ToolPill-Enc3nyic.js +0 -2
  240. package/dashboard/dist/assets/WorkflowPill-S6VV2Eax.js +0 -2
  241. package/dashboard/dist/assets/escalation-columns-Ck7ZOd7Z.js +0 -2
  242. package/dashboard/dist/assets/escalation-columns-Ck7ZOd7Z.js.map +0 -1
  243. package/dashboard/dist/assets/index-BtEWQNcP.js +0 -2
  244. package/dashboard/dist/assets/index-C0KklOM4.js +0 -2
  245. package/dashboard/dist/assets/index-CY3hpJR-.js +0 -5
  246. package/dashboard/dist/assets/index-CY3hpJR-.js.map +0 -1
  247. package/dashboard/dist/assets/index-DCTWUswT.js.map +0 -1
  248. package/dashboard/dist/assets/index-DWSNtg28.js +0 -5
  249. package/dashboard/dist/assets/index-DcQiD6OF.js +0 -63
  250. package/dashboard/dist/assets/index-DcQiD6OF.js.map +0 -1
  251. package/dashboard/dist/assets/index-QL26JxBF.js +0 -2
  252. package/dashboard/dist/assets/index-waKF7bKZ.css +0 -1
  253. package/dashboard/dist/assets/roles-BiUJAsVM.js +0 -2
  254. package/dashboard/dist/assets/roles-BiUJAsVM.js.map +0 -1
  255. package/dashboard/dist/assets/vendor-icons-DPmIjhZB.js.map +0 -1
@@ -0,0 +1,63 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CRttlU3L.js","./vendor-query-B2UbickB.js","./tasks-qwh8q5q7.js","./workflows-BziTcJNq.js","./useEventHooks-B8uNFB-l.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./useDebouncedValue-BA5S7V54.js","./api-path-u2Jf9QXS.js","./DataTable-Byn3oyT9.js","./EmptyState-BcsfPq9T.js","./TimestampCell-Cex9nr0t.js","./StickyPagination-Di6b2GDE.js","./FilterBar-B5Vk5tBF.js","./PageHeader-BIY1YvKR.js","./vendor-icons-Qk9qLjF_.js","./ListToolbar-Dmd1UiM-.js","./WorkflowPill-DHxrAkp3.js","./ProcessDetailPage-txiMHbMI.js","./PageHeaderWithStats-TUyglVW0.js","./StatusBadge-CEQMRmSQ.js","./RolePill-4LO_CuO3.js","./UserName-Cdhyuv5K.js","./users-CVjajeDg.js","./McpOverview-Cul2LFEw.js","./mcp-C1-iXkg7.js","./pipelines-BvG5D6bV.js","./yaml-workflows-Dr-ZcE_0.js","./controlplane-CxKOrcFO.js","./StatCard-DrdlUeQz.js","./McpRunsPage-DlSrpxiv.js","./useNamespace-DjZmztJM.js","./ElapsedCell-DZ3RTZFc.js","./RowActions-BA9L9djf.js","./McpRunDetailPage-B1RhxxlU.js","./CopyableId-uot2mE_g.js","./CollapsibleSection-CkOks9Cf.js","./EventTable-CuZ2Q_wH.js","./SwimlaneTimeline-BzsvdstG.js","./StreamMessageDetail-BbkU45X_.js","./McpQueryPage-B7PmO_V-.js","./mcp-query-DcyDxuGY.js","./McpQueryDetailPage-BVlQ0WBa.js","./TagInput-CK-JhBG2.js","./useYamlActivityEvents-DIvK20uI.js","./helpers-DzO-OGPe.js","./RunAsSelector-CiLjlmIE.js","./BotPicker-BuCGvEed.js","./bots-BdwLwMUg.js","./ToolPill-BCi101Jh.js","./TimeAgo-I7X6jdne.js","./EscalationsOverview-DcMkbiSo.js","./AvailableEscalationsPage-AiuiLcz-.js","./CountdownTimer-DdKL8Ryt.js","./CustomDurationPicker-F6bR2Q5A.js","./Modal-D4afnAjc.js","./constants-BHkpVaqx.js","./escalation-columns-y5SQ2Ulh.js","./PriorityBadge-B4ykBH7f.js","./OperatorDashboard-zviIxH-0.js","./index-B_68lp-B.js","./SlidePanel-DK4sWXmp.js","./WorkflowsOverview-CkI-Pmj7.js","./index-DVLBkcoD.js","./NamespacePill-BQNMfY0m.js","./WorkflowsDashboard-BeWjDHYW.js","./YamlWorkflowsPage-DjmNTQ5r.js","./GraphInvokePage-CXElQqcV.js","./YamlWorkflowDetailPage-BQnO8-PQ.js","./TasksListPage-t9WAft9-.js","./TaskDetailPage-Biikk9o_.js","./WorkflowExecutionPage-DD1BKj5k.js","./AdminDashboard-DQS74RL0.js","./index-BVZINC_p.js","./TaskQueuePill-C_Vo2Clc.js","./index-DjI2AUbn.js","./ConfirmDeleteModal-C0x0HcHX.js","./index-BYEkfaUq.js","./ToolTestPanel--MGaDY-1.js","./index-CRBXgMsh.js","./index-BC1NxetR.js","./RolesPage-DzrSv6m-.js","./RoleDetailPage-DBIl_mhK.js","./EscalationSchemaPage-BlMx2WE6.js","./EscalationListSchemaPage-CaMydHIO.js","./index-DyS2DHqy.js","./OperationsPage-vm_ByX41.js","./index-DJ5nhcGB.js","./index-Cfq3UKd8.js","./CredentialsPage-BwA7k9Cb.js","./index-H6Vp-gPG.js","./DropZone-zxH-9B8c.js","./index-BXbt5NHG.js","./knowledge-CLnYcq0Y.js","./HomePage-DcWfjZA-.js","./AgentsPage-CyUXe9n4.js","./agents-2DaoprdB.js","./AgentDetailPage-CDiopQ7D.js","./CronLabel-jC_i-Lh9.js","./AgentConfigPage-CSMCrFR4.js","./capabilities-BsuFeK9J.js","./topics-MLKKA-Ql.js","./CapabilitiesPage-nTv4STcG.js","./TopicsPage-tiOEQz2m.js","./TopicDetailPage-B8pHHweA.js"])))=>i.map(i=>d[i]);
2
+ var iv=Object.defineProperty;var rv=(i,n,s)=>n in i?iv(i,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[n]=s;var v=(i,n,s)=>rv(i,typeof n!="symbol"?n+"":n,s);import{r as av,a as j,j as h,u as xt,b as Tt,c as Rt,Q as lv,d as ov}from"./vendor-query-B2UbickB.js";import{r as cv,u as xs,L as Ni,N as Yo,a as Cy,b as $n,O as Or,c as My,d as uv,R as fv}from"./vendor-react-CXumBFUA.js";import{E as hv,S as dv,D as rh,X as Mi,I as y0,R as Ry,B as Dy,U as mv,a as pv,L as yv,b as gv,Z as bv,c as g0,P as b0,d as x0,C as xv,W as ah,e as vv,f as _v,F as wv,g as Sv,h as Ev,T as Av,N as jv,i as Ov,M as qy,j as zy,k as Tv,l as kv,m as Nv,n as Cv,o as Mv,p as Rv,q as Dv,r as v0,G as qv,s as zv,t as Uv,u as Bv,v as Lv}from"./vendor-icons-Qk9qLjF_.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var bf={exports:{}},Ra={},xf={exports:{}},vf={};/**
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 _0;function Hv(){return _0||(_0=1,(function(i){function n($,re){var de=$.length;$.push(re);e:for(;0<de;){var je=de-1>>>1,P=$[je];if(0<o(P,re))$[je]=re,$[de]=P,de=je;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var re=$[0],de=$.pop();if(de!==re){$[0]=de;e:for(var je=0,P=$.length,be=P>>>1;je<be;){var xe=2*(je+1)-1,Ae=$[xe],He=xe+1,vt=$[He];if(0>o(Ae,de))He<P&&0>o(vt,Ae)?($[je]=vt,$[He]=de,je=He):($[je]=Ae,$[xe]=de,je=xe);else if(He<P&&0>o(vt,de))$[je]=vt,$[He]=de,je=He;else break e}}return re}function o($,re){var de=$.sortIndex-re.sortIndex;return de!==0?de:$.id-re.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var d=Date,m=d.now();i.unstable_now=function(){return d.now()-m}}var y=[],g=[],E=1,_=null,T=3,z=!1,M=!1,D=!1,J=!1,ie=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,ce=typeof setImmediate<"u"?setImmediate:null;function ae($){for(var re=s(g);re!==null;){if(re.callback===null)a(g);else if(re.startTime<=$)a(g),re.sortIndex=re.expirationTime,n(y,re);else break;re=s(g)}}function k($){if(D=!1,ae($),!M)if(s(y)!==null)M=!0,Z||(Z=!0,se());else{var re=s(g);re!==null&&ke(k,re.startTime-$)}}var Z=!1,oe=-1,F=5,V=-1;function K(){return J?!0:!(i.unstable_now()-V<F)}function Q(){if(J=!1,Z){var $=i.unstable_now();V=$;var re=!0;try{e:{M=!1,D&&(D=!1,G(oe),oe=-1),z=!0;var de=T;try{t:{for(ae($),_=s(y);_!==null&&!(_.expirationTime>$&&K());){var je=_.callback;if(typeof je=="function"){_.callback=null,T=_.priorityLevel;var P=je(_.expirationTime<=$);if($=i.unstable_now(),typeof P=="function"){_.callback=P,ae($),re=!0;break t}_===s(y)&&a(y),ae($)}else a(y);_=s(y)}if(_!==null)re=!0;else{var be=s(g);be!==null&&ke(k,be.startTime-$),re=!1}}break e}finally{_=null,T=de,z=!1}re=void 0}}finally{re?se():Z=!1}}}var se;if(typeof ce=="function")se=function(){ce(Q)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,Se=he.port2;he.port1.onmessage=Q,se=function(){Se.postMessage(null)}}else se=function(){ie(Q,0)};function ke($,re){oe=ie(function(){$(i.unstable_now())},re)}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($){$.callback=null},i.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<$?Math.floor(1e3/$):5},i.unstable_getCurrentPriorityLevel=function(){return T},i.unstable_next=function($){switch(T){case 1:case 2:case 3:var re=3;break;default:re=T}var de=T;T=re;try{return $()}finally{T=de}},i.unstable_requestPaint=function(){J=!0},i.unstable_runWithPriority=function($,re){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var de=T;T=$;try{return re()}finally{T=de}},i.unstable_scheduleCallback=function($,re,de){var je=i.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?je+de:je):de=je,$){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=de+P,$={id:E++,callback:re,priorityLevel:$,startTime:de,expirationTime:P,sortIndex:-1},de>je?($.sortIndex=de,n(g,$),s(y)===null&&$===s(g)&&(D?(G(oe),oe=-1):D=!0,ke(k,de-je))):($.sortIndex=P,n(y,$),M||z||(M=!0,Z||(Z=!0,se()))),$},i.unstable_shouldYield=K,i.unstable_wrapCallback=function($){var re=T;return function(){var de=T;T=re;try{return $.apply(this,arguments)}finally{T=de}}}})(vf)),vf}var w0;function Pv(){return w0||(w0=1,xf.exports=Hv()),xf.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 S0;function $v(){if(S0)return Ra;S0=1;var i=Pv(),n=av(),s=cv();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(f(e)!==e)throw Error(a(188))}function g(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var r=e,l=t;;){var c=r.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){r=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===r)return y(c),e;if(u===l)return y(c),t;u=u.sibling}throw Error(a(188))}if(r.return!==l.return)r=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===r){p=!0,r=c,l=u;break}if(b===l){p=!0,l=c,r=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===r){p=!0,r=u,l=c;break}if(b===l){p=!0,l=u,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:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var _=Object.assign,T=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),J=Symbol.for("react.strict_mode"),ie=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),ce=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),oe=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||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 D:return"Fragment";case ie:return"Profiler";case J:return"StrictMode";case k:return"Suspense";case Z:return"SuspenseList";case V:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case ce:return e.displayName||"Context";case G:return(e._context.displayName||"Context")+".Consumer";case ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case oe:return t=e.displayName||null,t!==null?t:Se(e.type)||"Memo";case F:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}var ke=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},je=[],P=-1;function be(e){return{current:e}}function xe(e){0>P||(e.current=je[P],je[P]=null,P--)}function Ae(e,t){P++,je[P]=e.current,e.current=t}var He=be(null),vt=be(null),Et=be(null),rt=be(null);function ct(e,t){switch(Ae(Et,t),Ae(vt,e),Ae(He,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Lp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Lp(t),e=Hp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}xe(He),Ae(He,e)}function Oe(){xe(He),xe(vt),xe(Et)}function _t(e){e.memoizedState!==null&&Ae(rt,e);var t=He.current,r=Hp(t,e.type);t!==r&&(Ae(vt,e),Ae(He,r))}function zn(e){vt.current===e&&(xe(He),xe(vt)),rt.current===e&&(xe(rt),ka._currentValue=de)}var un,ai;function fn(e){if(un===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);un=t&&t[1]||"",ai=-1<r.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+un+e+ai}var qi=!1;function vs(e,t){if(!e||qi)return"";qi=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){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(Y){var L=Y}Reflect.construct(e,[],te)}else{try{te.call()}catch(Y){L=Y}e.call(te.prototype)}}else{try{throw Error()}catch(Y){L=Y}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(Y){if(Y&&L&&typeof Y.stack=="string")return[Y.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var O=p.split(`
21
+ `),B=b.split(`
22
+ `);for(c=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;if(l===O.length||c===B.length)for(l=O.length-1,c=B.length-1;1<=l&&0<=c&&O[l]!==B[c];)c--;for(;1<=l&&0<=c;l--,c--)if(O[l]!==B[c]){if(l!==1||c!==1)do if(l--,c--,0>c||O[l]!==B[c]){var 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{qi=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?fn(r):""}function il(e,t){switch(e.tag){case 26:case 27:case 5:return fn(e.type);case 16:return fn("Lazy");case 13:return e.child!==t&&t!==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 rl(e){try{var t="",r=null;do t+=il(e,r),r=e,e=e.return;while(e);return t}catch(l){return`
24
+ Error generating stack: `+l.message+`
25
+ `+l.stack}}var Lr=Object.prototype.hasOwnProperty,Hr=i.unstable_scheduleCallback,Qn=i.unstable_cancelCallback,al=i.unstable_shouldYield,zi=i.unstable_requestPaint,tt=i.unstable_now,lc=i.unstable_getCurrentPriorityLevel,ll=i.unstable_ImmediatePriority,ol=i.unstable_UserBlockingPriority,Ui=i.unstable_NormalPriority,oc=i.unstable_LowPriority,cl=i.unstable_IdlePriority,cc=i.log,ul=i.unstable_setDisableYieldValue,li=null,ut=null;function It(e){if(typeof cc=="function"&&ul(e),ut&&typeof ut.setStrictMode=="function")try{ut.setStrictMode(li,e)}catch{}}var Dt=Math.clz32?Math.clz32:Bi,Pr=Math.log,$r=Math.LN2;function Bi(e){return e>>>=0,e===0?32:31-(Pr(e)/$r|0)|0}var _s=256,Jn=262144,ws=4194304;function An(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function oi(e,t,r){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=An(l):(p&=b,p!==0?c=An(p):r||(r=b&~e,r!==0&&(c=An(r))))):(b=l&~u,b!==0?c=An(b):p!==0?c=An(p):r||(r=l&~e,r!==0&&(c=An(r)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,r=t&-t,u>=r||u===32&&(r&4194048)!==0)?t:c}function ci(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Yr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Li(){var e=ws;return ws<<=1,(ws&62914560)===0&&(ws=4194304),e}function Ss(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function jn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Es(e,t,r,l,c,u){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,B=e.hiddenUpdates;for(r=p&~r;0<r;){var I=31-Dt(r),te=1<<I;b[I]=0,O[I]=-1;var L=B[I];if(L!==null)for(B[I]=null,I=0;I<L.length;I++){var Y=L[I];Y!==null&&(Y.lane&=-536870913)}r&=~te}l!==0&&As(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function As(e,t,r){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Dt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|r&261930}function ui(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var l=31-Dt(r),c=1<<l;c&t|e[l]&t&&(e[l]|=t),r&=~c}}function js(e,t){var r=t&-t;return r=(r&42)!==0?1:Kn(r),(r&(e.suspendedLanes|t))!==0?0:r}function Kn(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 fi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Vr(){var e=re.p;return e!==0?e:(e=window.event,e===void 0?32:c0(e.type))}function fl(e,t){var r=re.p;try{return re.p=e,t()}finally{re.p=r}}var Un=Math.random().toString(36).slice(2),Ke="__reactFiber$"+Un,at="__reactProps$"+Un,Qt="__reactContainer$"+Un,hi="__reactEvents$"+Un,Gr="__reactListeners$"+Un,hl="__reactHandles$"+Un,dl="__reactResources$"+Un,wt="__reactMarker$"+Un;function Hi(e){delete e[Ke],delete e[at],delete e[hi],delete e[Gr],delete e[hl]}function x(e){var t=e[Ke];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Qt]||r[Ke]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Ip(e);e!==null;){if(r=e[Ke])return r;e=Ip(e)}return t}e=r,r=e.parentNode}return null}function S(e){if(e=e[Ke]||e[Qt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function w(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[dl];return t||(t=e[dl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[wt]=!0}var q=new Set,ee={};function ne(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(ee[e]=t,e=0;e<t.length;e++)q.add(t[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 Lr.call(Me,e)?!0:Lr.call(pe,e)?!1:W.test(e)?Me[e]=!0:(pe[e]=!0,!1)}function qt(e,t,r){if(Ze(t))if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+r)}}function On(e,t,r){if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+r)}}function Xn(e,t,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(t,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 Ch(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xg(e,t,r){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){r=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(p){r=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function uc(e){if(!e._valueTracker){var t=Ch(e)?"checked":"value";e._valueTracker=Xg(e,t,""+e[t])}}function Mh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),l="";return e&&(l=Ch(e)?e.checked?"true":"false":e.value),e=l,e!==r?(t.setValue(e),!0):!1}function ml(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 Zg=/[\n"\\]/g;function dn(e){return e.replace(Zg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function fc(e,t,r,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+hn(t)):e.value!==""+hn(t)&&(e.value=""+hn(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?hc(e,p,hn(t)):r!=null?hc(e,p,hn(r)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+hn(b):e.removeAttribute("name")}function Rh(e,t,r,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||r!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){uc(e);return}r=r!=null?""+hn(r):"",t=t!=null?""+hn(t):r,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),uc(e)}function hc(e,t,r){t==="number"&&ml(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function Pi(e,t,r,l){if(e=e.options,t){t={};for(var c=0;c<r.length;c++)t["$"+r[c]]=!0;for(r=0;r<e.length;r++)c=t.hasOwnProperty("$"+e[r].value),e[r].selected!==c&&(e[r].selected=c),c&&l&&(e[r].defaultSelected=!0)}else{for(r=""+hn(r),t=null,c=0;c<e.length;c++){if(e[c].value===r){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function Dh(e,t,r){if(t!=null&&(t=""+hn(t),t!==e.value&&(e.value=t),r==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=r!=null?""+hn(r):""}function qh(e,t,r,l){if(t==null){if(l!=null){if(r!=null)throw Error(a(92));if(ke(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),t=r}r=hn(t),e.defaultValue=r,l=e.textContent,l===r&&l!==""&&l!==null&&(e.value=l),uc(e)}function $i(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Wg=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 zh(e,t,r){var l=t.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,r):typeof r!="number"||r===0||Wg.has(t)?t==="float"?e.cssFloat=r:e[t]=(""+r).trim():e[t]=r+"px"}function Uh(e,t,r){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&r[c]!==l&&zh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&zh(e,u,t[u])}function dc(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 eb=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"]]),tb=/^[\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 pl(e){return tb.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Zn(){}var mc=null;function pc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yi=null,Vi=null;function Bh(e){var t=S(e);if(t&&(e=t.stateNode)){var r=e[at]||null;e:switch(e=t.stateNode,t.type){case"input":if(fc(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+dn(""+t)+'"][type="radio"]'),t=0;t<r.length;t++){var l=r[t];if(l!==e&&l.form===e.form){var c=l[at]||null;if(!c)throw Error(a(90));fc(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<r.length;t++)l=r[t],l.form===e.form&&Mh(l)}break e;case"textarea":Dh(e,r.value,r.defaultValue);break e;case"select":t=r.value,t!=null&&Pi(e,!!r.multiple,t,!1)}}}var yc=!1;function Lh(e,t,r){if(yc)return e(t,r);yc=!0;try{var l=e(t);return l}finally{if(yc=!1,(Yi!==null||Vi!==null)&&(no(),Yi&&(t=Yi,e=Vi,Vi=Yi=null,Bh(t),e)))for(t=0;t<e.length;t++)Bh(e[t])}}function Fr(e,t){var r=e.stateNode;if(r===null)return null;var l=r[at]||null;if(l===null)return null;r=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(a(231,t,typeof r));return r}var Wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gc=!1;if(Wn)try{var Ir={};Object.defineProperty(Ir,"passive",{get:function(){gc=!0}}),window.addEventListener("test",Ir,Ir),window.removeEventListener("test",Ir,Ir)}catch{gc=!1}var Os=null,bc=null,yl=null;function Hh(){if(yl)return yl;var e,t=bc,r=t.length,l,c="value"in Os?Os.value:Os.textContent,u=c.length;for(e=0;e<r&&t[e]===c[e];e++);var p=r-e;for(l=1;l<=p&&t[r-l]===c[u-l];l++);return yl=c.slice(e,1<l?1-l:void 0)}function gl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function bl(){return!0}function Ph(){return!1}function Ht(e){function t(r,l,c,u,p){this._reactName=r,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(r=e[b],this[b]=r?r(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?bl:Ph,this.isPropagationStopped=Ph,this}return _(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=bl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=bl)},persist:function(){},isPersistent:bl}),t}var di={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xl=Ht(di),Qr=_({},di,{view:0,detail:0}),nb=Ht(Qr),xc,vc,Jr,vl=_({},Qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wc,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!==Jr&&(Jr&&e.type==="mousemove"?(xc=e.screenX-Jr.screenX,vc=e.screenY-Jr.screenY):vc=xc=0,Jr=e),xc)},movementY:function(e){return"movementY"in e?e.movementY:vc}}),$h=Ht(vl),sb=_({},vl,{dataTransfer:0}),ib=Ht(sb),rb=_({},Qr,{relatedTarget:0}),_c=Ht(rb),ab=_({},di,{animationName:0,elapsedTime:0,pseudoElement:0}),lb=Ht(ab),ob=_({},di,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),cb=Ht(ob),ub=_({},di,{data:0}),Yh=Ht(ub),fb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hb={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"},db={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=db[e])?!!t[e]:!1}function wc(){return mb}var pb=_({},Qr,{key:function(e){if(e.key){var t=fb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?hb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wc,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),yb=Ht(pb),gb=_({},vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Vh=Ht(gb),bb=_({},Qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wc}),xb=Ht(bb),vb=_({},di,{propertyName:0,elapsedTime:0,pseudoElement:0}),_b=Ht(vb),wb=_({},vl,{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}),Sb=Ht(wb),Eb=_({},di,{newState:0,oldState:0}),Ab=Ht(Eb),jb=[9,13,27,32],Sc=Wn&&"CompositionEvent"in window,Kr=null;Wn&&"documentMode"in document&&(Kr=document.documentMode);var Ob=Wn&&"TextEvent"in window&&!Kr,Gh=Wn&&(!Sc||Kr&&8<Kr&&11>=Kr),Fh=" ",Ih=!1;function Qh(e,t){switch(e){case"keyup":return jb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gi=!1;function Tb(e,t){switch(e){case"compositionend":return Jh(t);case"keypress":return t.which!==32?null:(Ih=!0,Fh);case"textInput":return e=t.data,e===Fh&&Ih?null:e;default:return null}}function kb(e,t){if(Gi)return e==="compositionend"||!Sc&&Qh(e,t)?(e=Hh(),yl=bc=Os=null,Gi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Gh&&t.locale!=="ko"?null:t.data;default:return null}}var Nb={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Kh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Nb[e.type]:t==="textarea"}function Xh(e,t,r,l){Yi?Vi?Vi.push(l):Vi=[l]:Yi=l,t=co(t,"onChange"),0<t.length&&(r=new xl("onChange","change",null,r,l),e.push({event:r,listeners:t}))}var Xr=null,Zr=null;function Cb(e){Rp(e,0)}function _l(e){var t=w(e);if(Mh(t))return e}function Zh(e,t){if(e==="change")return t}var Wh=!1;if(Wn){var Ec;if(Wn){var Ac="oninput"in document;if(!Ac){var ed=document.createElement("div");ed.setAttribute("oninput","return;"),Ac=typeof ed.oninput=="function"}Ec=Ac}else Ec=!1;Wh=Ec&&(!document.documentMode||9<document.documentMode)}function td(){Xr&&(Xr.detachEvent("onpropertychange",nd),Zr=Xr=null)}function nd(e){if(e.propertyName==="value"&&_l(Zr)){var t=[];Xh(t,Zr,e,pc(e)),Lh(Cb,t)}}function Mb(e,t,r){e==="focusin"?(td(),Xr=t,Zr=r,Xr.attachEvent("onpropertychange",nd)):e==="focusout"&&td()}function Rb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _l(Zr)}function Db(e,t){if(e==="click")return _l(t)}function qb(e,t){if(e==="input"||e==="change")return _l(t)}function zb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jt=typeof Object.is=="function"?Object.is:zb;function Wr(e,t){if(Jt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),l=Object.keys(t);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var c=r[l];if(!Lr.call(t,c)||!Jt(e[c],t[c]))return!1}return!0}function sd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function id(e,t){var r=sd(e);e=0;for(var l;r;){if(r.nodeType===3){if(l=e+r.textContent.length,e<=t&&l>=t)return{node:r,offset:t-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=sd(r)}}function rd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?rd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ad(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ml(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ml(e.document)}return t}function jc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Ub=Wn&&"documentMode"in document&&11>=document.documentMode,Fi=null,Oc=null,ea=null,Tc=!1;function ld(e,t,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Tc||Fi==null||Fi!==ml(l)||(l=Fi,"selectionStart"in l&&jc(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}),ea&&Wr(ea,l)||(ea=l,l=co(Oc,"onSelect"),0<l.length&&(t=new xl("onSelect","select",null,t,r),e.push({event:t,listeners:l}),t.target=Fi)))}function mi(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Ii={animationend:mi("Animation","AnimationEnd"),animationiteration:mi("Animation","AnimationIteration"),animationstart:mi("Animation","AnimationStart"),transitionrun:mi("Transition","TransitionRun"),transitionstart:mi("Transition","TransitionStart"),transitioncancel:mi("Transition","TransitionCancel"),transitionend:mi("Transition","TransitionEnd")},kc={},od={};Wn&&(od=document.createElement("div").style,"AnimationEvent"in window||(delete Ii.animationend.animation,delete Ii.animationiteration.animation,delete Ii.animationstart.animation),"TransitionEvent"in window||delete Ii.transitionend.transition);function pi(e){if(kc[e])return kc[e];if(!Ii[e])return e;var t=Ii[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in od)return kc[e]=t[r];return e}var cd=pi("animationend"),ud=pi("animationiteration"),fd=pi("animationstart"),Bb=pi("transitionrun"),Lb=pi("transitionstart"),Hb=pi("transitioncancel"),hd=pi("transitionend"),dd=new Map,Nc="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(" ");Nc.push("scrollEnd");function Tn(e,t){dd.set(e,t),ne(t,[e])}var wl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},mn=[],Qi=0,Cc=0;function Sl(){for(var e=Qi,t=Cc=Qi=0;t<e;){var r=mn[t];mn[t++]=null;var l=mn[t];mn[t++]=null;var c=mn[t];mn[t++]=null;var u=mn[t];if(mn[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&md(r,c,u)}}function El(e,t,r,l){mn[Qi++]=e,mn[Qi++]=t,mn[Qi++]=r,mn[Qi++]=l,Cc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Mc(e,t,r,l){return El(e,t,r,l),Al(e)}function yi(e,t){return El(e,null,null,t),Al(e)}function md(e,t,r){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r);for(var c=!1,u=e.return;u!==null;)u.childLanes|=r,l=u.alternate,l!==null&&(l.childLanes|=r),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Dt(r),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=r|536870912),u):null}function Al(e){if(50<wa)throw wa=0,Pu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ji={};function Pb(e,t,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=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(e,t,r,l){return new Pb(e,t,r,l)}function Rc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function es(e,t){var r=e.alternate;return r===null?(r=Kt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,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,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function pd(e,t){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=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,t=r.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function jl(e,t,r,l,c,u){var p=0;if(l=e,typeof e=="function")Rc(e)&&(p=1);else if(typeof e=="string")p=Fx(e,r,He.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case V:return e=Kt(31,r,t,c),e.elementType=V,e.lanes=u,e;case D:return gi(r.children,c,u,t);case J:p=8,c|=24;break;case ie:return e=Kt(12,r,t,c|2),e.elementType=ie,e.lanes=u,e;case k:return e=Kt(13,r,t,c),e.elementType=k,e.lanes=u,e;case Z:return e=Kt(19,r,t,c),e.elementType=Z,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ce:p=10;break e;case G:p=9;break e;case ae:p=11;break e;case oe:p=14;break e;case F:p=16,l=null;break e}p=29,r=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Kt(p,r,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function gi(e,t,r,l){return e=Kt(7,e,l,t),e.lanes=r,e}function Dc(e,t,r){return e=Kt(6,e,null,t),e.lanes=r,e}function yd(e){var t=Kt(18,null,null,0);return t.stateNode=e,t}function qc(e,t,r){return t=Kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gd=new WeakMap;function pn(e,t){if(typeof e=="object"&&e!==null){var r=gd.get(e);return r!==void 0?r:(t={value:e,source:t,stack:rl(t)},gd.set(e,t),t)}return{value:e,source:t,stack:rl(t)}}var Ki=[],Xi=0,Ol=null,ta=0,yn=[],gn=0,Ts=null,Bn=1,Ln="";function ts(e,t){Ki[Xi++]=ta,Ki[Xi++]=Ol,Ol=e,ta=t}function bd(e,t,r){yn[gn++]=Bn,yn[gn++]=Ln,yn[gn++]=Ts,Ts=e;var l=Bn;e=Ln;var c=32-Dt(l)-1;l&=~(1<<c),r+=1;var u=32-Dt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Bn=1<<32-Dt(t)+c|r<<c|l,Ln=u+e}else Bn=1<<u|r<<c|l,Ln=e}function zc(e){e.return!==null&&(ts(e,1),bd(e,1,0))}function Uc(e){for(;e===Ol;)Ol=Ki[--Xi],Ki[Xi]=null,ta=Ki[--Xi],Ki[Xi]=null;for(;e===Ts;)Ts=yn[--gn],yn[gn]=null,Ln=yn[--gn],yn[gn]=null,Bn=yn[--gn],yn[gn]=null}function xd(e,t){yn[gn++]=Bn,yn[gn++]=Ln,yn[gn++]=Ts,Bn=t.id,Ln=t.overflow,Ts=e}var kt=null,We=null,Ue=!1,ks=null,bn=!1,Bc=Error(a(519));function Ns(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw na(pn(t,e)),Bc}function vd(e){var t=e.stateNode,r=e.type,l=e.memoizedProps;switch(t[Ke]=e,t[at]=l,r){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(r=0;r<Ea.length;r++)De(Ea[r],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),Rh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),qh(t,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||t.textContent===""+r||l.suppressHydrationWarning===!0||Up(t.textContent,r)?(l.popover!=null&&(De("beforetoggle",t),De("toggle",t)),l.onScroll!=null&&De("scroll",t),l.onScrollEnd!=null&&De("scrollend",t),l.onClick!=null&&(t.onclick=Zn),t=!0):t=!1,t||Ns(e,!0)}function _d(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 Zi(e){if(e!==kt)return!1;if(!Ue)return _d(e),Ue=!0,!1;var t=e.tag,r;if((r=t!==3&&t!==27)&&((r=t===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||nf(e.type,e.memoizedProps)),r=!r),r&&We&&Ns(e),_d(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));We=Fp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));We=Fp(e)}else t===27?(t=We,Vs(e.type)?(e=of,of=null,We=e):We=t):We=kt?vn(e.stateNode.nextSibling):null;return!0}function bi(){We=kt=null,Ue=!1}function Lc(){var e=ks;return e!==null&&(Vt===null?Vt=e:Vt.push.apply(Vt,e),ks=null),e}function na(e){ks===null?ks=[e]:ks.push(e)}var Hc=be(null),xi=null,ns=null;function Cs(e,t,r){Ae(Hc,t._currentValue),t._currentValue=r}function ss(e){e._currentValue=Hc.current,xe(Hc)}function Pc(e,t,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===r)break;e=e.return}}function $c(e,t,r,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=r,b=u.alternate,b!==null&&(b.lanes|=r),Pc(u.return,r,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=r,u=p.alternate,u!==null&&(u.lanes|=r),Pc(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 Wi(e,t,r,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;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(ka):e=[ka])}c=c.return}e!==null&&$c(t,e,r,l),t.flags|=262144}function Tl(e){for(e=e.firstContext;e!==null;){if(!Jt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function vi(e){xi=e,ns=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Nt(e){return wd(xi,e)}function kl(e,t){return xi===null&&vi(e),wd(e,t)}function wd(e,t){var r=t._currentValue;if(t={context:t,memoizedValue:r,next:null},ns===null){if(e===null)throw Error(a(308));ns=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ns=ns.next=t;return r}var $b=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(r,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(r){return r()})}},Yb=i.unstable_scheduleCallback,Vb=i.unstable_NormalPriority,mt={$$typeof:ce,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yc(){return{controller:new $b,data:new Map,refCount:0}}function sa(e){e.refCount--,e.refCount===0&&Yb(Vb,function(){e.controller.abort()})}var ia=null,Vc=0,er=0,tr=null;function Gb(e,t){if(ia===null){var r=ia=[];Vc=0,er=Iu(),tr={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Vc++,t.then(Sd,Sd),t}function Sd(){if(--Vc===0&&ia!==null){tr!==null&&(tr.status="fulfilled");var e=ia;ia=null,er=0,tr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Fb(e,t){var r=[],l={status:"pending",value:null,reason:null,then:function(c){r.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<r.length;c++)(0,r[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<r.length;c++)(0,r[c])(void 0)}),l}var Ed=$.S;$.S=function(e,t){lp=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Gb(e,t),Ed!==null&&Ed(e,t)};var _i=be(null);function Gc(){var e=_i.current;return e!==null?e:Xe.pooledCache}function Nl(e,t){t===null?Ae(_i,_i.current):Ae(_i,t.pool)}function Ad(){var e=Gc();return e===null?null:{parent:mt._currentValue,pool:e}}var nr=Error(a(460)),Fc=Error(a(474)),Cl=Error(a(542)),Ml={then:function(){}};function jd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Od(e,t,r){switch(r=e[r],r===void 0?e.push(t):r!==t&&(t.then(Zn,Zn),t=r),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,kd(e),e;default:if(typeof t.status=="string")t.then(Zn,Zn);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,kd(e),e}throw Si=t,nr}}function wi(e){try{var t=e._init;return t(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Si=r,nr):r}}var Si=null;function Td(){if(Si===null)throw Error(a(459));var e=Si;return Si=null,e}function kd(e){if(e===nr||e===Cl)throw Error(a(483))}var sr=null,ra=0;function Rl(e){var t=ra;return ra+=1,sr===null&&(sr=[]),Od(sr,e,t)}function aa(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Dl(e,t){throw t.$$typeof===T?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Nd(e){function t(R,C){if(e){var U=R.deletions;U===null?(R.deletions=[C],R.flags|=16):U.push(C)}}function r(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function l(R){for(var C=new Map;R!==null;)R.key!==null?C.set(R.key,R):C.set(R.index,R),R=R.sibling;return C}function c(R,C){return R=es(R,C),R.index=0,R.sibling=null,R}function u(R,C,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<C?(R.flags|=67108866,C):U):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,C,U,X){return C===null||C.tag!==6?(C=Dc(U,R.mode,X),C.return=R,C):(C=c(C,U),C.return=R,C)}function O(R,C,U,X){var ve=U.type;return ve===D?I(R,C,U.props.children,X,U.key):C!==null&&(C.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===F&&wi(ve)===C.type)?(C=c(C,U.props),aa(C,U),C.return=R,C):(C=jl(U.type,U.key,U.props,null,R.mode,X),aa(C,U),C.return=R,C)}function B(R,C,U,X){return C===null||C.tag!==4||C.stateNode.containerInfo!==U.containerInfo||C.stateNode.implementation!==U.implementation?(C=qc(U,R.mode,X),C.return=R,C):(C=c(C,U.children||[]),C.return=R,C)}function I(R,C,U,X,ve){return C===null||C.tag!==7?(C=gi(U,R.mode,X,ve),C.return=R,C):(C=c(C,U),C.return=R,C)}function te(R,C,U){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=Dc(""+C,R.mode,U),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case z:return U=jl(C.type,C.key,C.props,null,R.mode,U),aa(U,C),U.return=R,U;case M:return C=qc(C,R.mode,U),C.return=R,C;case F:return C=wi(C),te(R,C,U)}if(ke(C)||se(C))return C=gi(C,R.mode,U,null),C.return=R,C;if(typeof C.then=="function")return te(R,Rl(C),U);if(C.$$typeof===ce)return te(R,kl(R,C),U);Dl(R,C)}return null}function L(R,C,U,X){var ve=C!==null?C.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ve!==null?null:b(R,C,""+U,X);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case z:return U.key===ve?O(R,C,U,X):null;case M:return U.key===ve?B(R,C,U,X):null;case F:return U=wi(U),L(R,C,U,X)}if(ke(U)||se(U))return ve!==null?null:I(R,C,U,X,null);if(typeof U.then=="function")return L(R,C,Rl(U),X);if(U.$$typeof===ce)return L(R,C,kl(R,U),X);Dl(R,U)}return null}function Y(R,C,U,X,ve){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return R=R.get(U)||null,b(C,R,""+X,ve);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case z:return R=R.get(X.key===null?U:X.key)||null,O(C,R,X,ve);case M:return R=R.get(X.key===null?U:X.key)||null,B(C,R,X,ve);case F:return X=wi(X),Y(R,C,U,X,ve)}if(ke(X)||se(X))return R=R.get(U)||null,I(C,R,X,ve,null);if(typeof X.then=="function")return Y(R,C,U,Rl(X),ve);if(X.$$typeof===ce)return Y(R,C,U,kl(C,X),ve);Dl(C,X)}return null}function ye(R,C,U,X){for(var ve=null,Pe=null,ge=C,Ce=C=0,ze=null;ge!==null&&Ce<U.length;Ce++){ge.index>Ce?(ze=ge,ge=null):ze=ge.sibling;var $e=L(R,ge,U[Ce],X);if($e===null){ge===null&&(ge=ze);break}e&&ge&&$e.alternate===null&&t(R,ge),C=u($e,C,Ce),Pe===null?ve=$e:Pe.sibling=$e,Pe=$e,ge=ze}if(Ce===U.length)return r(R,ge),Ue&&ts(R,Ce),ve;if(ge===null){for(;Ce<U.length;Ce++)ge=te(R,U[Ce],X),ge!==null&&(C=u(ge,C,Ce),Pe===null?ve=ge:Pe.sibling=ge,Pe=ge);return Ue&&ts(R,Ce),ve}for(ge=l(ge);Ce<U.length;Ce++)ze=Y(ge,R,Ce,U[Ce],X),ze!==null&&(e&&ze.alternate!==null&&ge.delete(ze.key===null?Ce:ze.key),C=u(ze,C,Ce),Pe===null?ve=ze:Pe.sibling=ze,Pe=ze);return e&&ge.forEach(function(Js){return t(R,Js)}),Ue&&ts(R,Ce),ve}function _e(R,C,U,X){if(U==null)throw Error(a(151));for(var ve=null,Pe=null,ge=C,Ce=C=0,ze=null,$e=U.next();ge!==null&&!$e.done;Ce++,$e=U.next()){ge.index>Ce?(ze=ge,ge=null):ze=ge.sibling;var Js=L(R,ge,$e.value,X);if(Js===null){ge===null&&(ge=ze);break}e&&ge&&Js.alternate===null&&t(R,ge),C=u(Js,C,Ce),Pe===null?ve=Js:Pe.sibling=Js,Pe=Js,ge=ze}if($e.done)return r(R,ge),Ue&&ts(R,Ce),ve;if(ge===null){for(;!$e.done;Ce++,$e=U.next())$e=te(R,$e.value,X),$e!==null&&(C=u($e,C,Ce),Pe===null?ve=$e:Pe.sibling=$e,Pe=$e);return Ue&&ts(R,Ce),ve}for(ge=l(ge);!$e.done;Ce++,$e=U.next())$e=Y(ge,R,Ce,$e.value,X),$e!==null&&(e&&$e.alternate!==null&&ge.delete($e.key===null?Ce:$e.key),C=u($e,C,Ce),Pe===null?ve=$e:Pe.sibling=$e,Pe=$e);return e&&ge.forEach(function(sv){return t(R,sv)}),Ue&&ts(R,Ce),ve}function Je(R,C,U,X){if(typeof U=="object"&&U!==null&&U.type===D&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case z:e:{for(var ve=U.key;C!==null;){if(C.key===ve){if(ve=U.type,ve===D){if(C.tag===7){r(R,C.sibling),X=c(C,U.props.children),X.return=R,R=X;break e}}else if(C.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===F&&wi(ve)===C.type){r(R,C.sibling),X=c(C,U.props),aa(X,U),X.return=R,R=X;break e}r(R,C);break}else t(R,C);C=C.sibling}U.type===D?(X=gi(U.props.children,R.mode,X,U.key),X.return=R,R=X):(X=jl(U.type,U.key,U.props,null,R.mode,X),aa(X,U),X.return=R,R=X)}return p(R);case M:e:{for(ve=U.key;C!==null;){if(C.key===ve)if(C.tag===4&&C.stateNode.containerInfo===U.containerInfo&&C.stateNode.implementation===U.implementation){r(R,C.sibling),X=c(C,U.children||[]),X.return=R,R=X;break e}else{r(R,C);break}else t(R,C);C=C.sibling}X=qc(U,R.mode,X),X.return=R,R=X}return p(R);case F:return U=wi(U),Je(R,C,U,X)}if(ke(U))return ye(R,C,U,X);if(se(U)){if(ve=se(U),typeof ve!="function")throw Error(a(150));return U=ve.call(U),_e(R,C,U,X)}if(typeof U.then=="function")return Je(R,C,Rl(U),X);if(U.$$typeof===ce)return Je(R,C,kl(R,U),X);Dl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,C!==null&&C.tag===6?(r(R,C.sibling),X=c(C,U),X.return=R,R=X):(r(R,C),X=Dc(U,R.mode,X),X.return=R,R=X),p(R)):r(R,C)}return function(R,C,U,X){try{ra=0;var ve=Je(R,C,U,X);return sr=null,ve}catch(ge){if(ge===nr||ge===Cl)throw ge;var Pe=Kt(29,ge,null,R.mode);return Pe.lanes=X,Pe.return=R,Pe}finally{}}}var Ei=Nd(!0),Cd=Nd(!1),Ms=!1;function Ic(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Rs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ds(e,t,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ye&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=Al(e),md(e,null,r),t}return El(e,l,t,r),Al(e)}function la(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,ui(e,r)}}function Jc(e,t){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var c=null,u=null;if(r=r.firstBaseUpdate,r!==null){do{var p={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,r=r.next}while(r!==null);u===null?c=u=t:u=u.next=t}else c=u=t;r={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var Kc=!1;function oa(){if(Kc){var e=tr;if(e!==null)throw e}}function ca(e,t,r,l){Kc=!1;var c=e.updateQueue;Ms=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var O=b,B=O.next;O.next=null,p===null?u=B:p.next=B,p=O;var I=e.alternate;I!==null&&(I=I.updateQueue,b=I.lastBaseUpdate,b!==p&&(b===null?I.firstBaseUpdate=B:b.next=B,I.lastBaseUpdate=O))}if(u!==null){var te=c.baseState;p=0,I=B=O=null,b=u;do{var L=b.lane&-536870913,Y=L!==b.lane;if(Y?(qe&L)===L:(l&L)===L){L!==0&&L===er&&(Kc=!0),I!==null&&(I=I.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ye=e,_e=b;L=t;var Je=r;switch(_e.tag){case 1:if(ye=_e.payload,typeof ye=="function"){te=ye.call(Je,te,L);break e}te=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=_e.payload,L=typeof ye=="function"?ye.call(Je,te,L):ye,L==null)break e;te=_({},te,L);break e;case 2:Ms=!0}}L=b.callback,L!==null&&(e.flags|=64,Y&&(e.flags|=8192),Y=c.callbacks,Y===null?c.callbacks=[L]:Y.push(L))}else Y={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},I===null?(B=I=Y,O=te):I=I.next=Y,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;Y=b,b=Y.next,Y.next=null,c.lastBaseUpdate=Y,c.shared.pending=null}}while(!0);I===null&&(O=te),c.baseState=O,c.firstBaseUpdate=B,c.lastBaseUpdate=I,u===null&&(c.shared.lanes=0),Ls|=p,e.lanes=p,e.memoizedState=te}}function Md(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function Rd(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Md(r[e],t)}var ir=be(null),ql=be(0);function Dd(e,t){e=hs,Ae(ql,e),Ae(ir,t),hs=e|t.baseLanes}function Xc(){Ae(ql,hs),Ae(ir,ir.current)}function Zc(){hs=ql.current,xe(ir),xe(ql)}var Xt=be(null),xn=null;function qs(e){var t=e.alternate;Ae(ft,ft.current&1),Ae(Xt,e),xn===null&&(t===null||ir.current!==null||t.memoizedState!==null)&&(xn=e)}function Wc(e){Ae(ft,ft.current),Ae(Xt,e),xn===null&&(xn=e)}function qd(e){e.tag===22?(Ae(ft,ft.current),Ae(Xt,e),xn===null&&(xn=e)):zs()}function zs(){Ae(ft,ft.current),Ae(Xt,Xt.current)}function Zt(e){xe(Xt),xn===e&&(xn=null),xe(ft)}var ft=be(0);function zl(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||af(r)||lf(r)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var is=0,Ne=null,Ie=null,pt=null,Ul=!1,rr=!1,Ai=!1,Bl=0,ua=0,ar=null,Ib=0;function lt(){throw Error(a(321))}function eu(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Jt(e[r],t[r]))return!1;return!0}function tu(e,t,r,l,c,u){return is=u,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?bm:yu,Ai=!1,u=r(l,c),Ai=!1,rr&&(u=Ud(t,r,l,c)),zd(e),u}function zd(e){$.H=da;var t=Ie!==null&&Ie.next!==null;if(is=0,pt=Ie=Ne=null,Ul=!1,ua=0,ar=null,t)throw Error(a(300));e===null||yt||(e=e.dependencies,e!==null&&Tl(e)&&(yt=!0))}function Ud(e,t,r,l){Ne=e;var c=0;do{if(rr&&(ar=null),ua=0,rr=!1,25<=c)throw Error(a(301));if(c+=1,pt=Ie=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=xm,u=t(r,l)}while(rr);return u}function Qb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?fa(t):t,e=e.useState()[0],(Ie!==null?Ie.memoizedState:null)!==e&&(Ne.flags|=1024),t}function nu(){var e=Bl!==0;return Bl=0,e}function su(e,t,r){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r}function iu(e){if(Ul){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ul=!1}is=0,pt=Ie=Ne=null,rr=!1,ua=Bl=0,ar=null}function zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pt===null?Ne.memoizedState=pt=e:pt=pt.next=e,pt}function ht(){if(Ie===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Ie.next;var t=pt===null?Ne.memoizedState:pt.next;if(t!==null)pt=t,Ie=e;else{if(e===null)throw Ne.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},pt===null?Ne.memoizedState=pt=e:pt=pt.next=e}return pt}function Ll(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fa(e){var t=ua;return ua+=1,ar===null&&(ar=[]),e=Od(ar,e,t),t=Ne,(pt===null?t.memoizedState:pt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?bm:yu),e}function Hl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return fa(e);if(e.$$typeof===ce)return Nt(e)}throw Error(a(438,String(e)))}function ru(e){var t=null,r=Ne.updateQueue;if(r!==null&&(t=r.memoCache),t==null){var l=Ne.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),r===null&&(r=Ll(),Ne.updateQueue=r),r.memoCache=t,r=t.data[t.index],r===void 0)for(r=t.data[t.index]=Array(e),l=0;l<e;l++)r[l]=K;return t.index++,r}function rs(e,t){return typeof t=="function"?t(e):t}function Pl(e){var t=ht();return au(t,Ie,e)}function au(e,t,r){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,O=null,B=t,I=!1;do{var te=B.lane&-536870913;if(te!==B.lane?(qe&te)===te:(is&te)===te){var L=B.revertLane;if(L===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),te===er&&(I=!0);else if((is&L)===L){B=B.next,L===er&&(I=!0);continue}else te={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=te,p=u):O=O.next=te,Ne.lanes|=L,Ls|=L;te=B.action,Ai&&r(u,te),u=B.hasEagerState?B.eagerState:r(u,te)}else L={lane:te,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=L,p=u):O=O.next=L,Ne.lanes|=te,Ls|=te;B=B.next}while(B!==null&&B!==t);if(O===null?p=u:O.next=b,!Jt(u,e.memoizedState)&&(yt=!0,I&&(r=tr,r!==null)))throw r;e.memoizedState=u,e.baseState=p,e.baseQueue=O,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function lu(e){var t=ht(),r=t.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=e;var l=r.dispatch,c=r.pending,u=t.memoizedState;if(c!==null){r.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Jt(u,t.memoizedState)||(yt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),r.lastRenderedState=u}return[u,l]}function Bd(e,t,r){var l=Ne,c=ht(),u=Ue;if(u){if(r===void 0)throw Error(a(407));r=r()}else r=t();var p=!Jt((Ie||c).memoizedState,r);if(p&&(c.memoizedState=r,yt=!0),c=c.queue,uu(Pd.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||pt!==null&&pt.memoizedState.tag&1){if(l.flags|=2048,lr(9,{destroy:void 0},Hd.bind(null,l,c,r,t),null),Xe===null)throw Error(a(349));u||(is&127)!==0||Ld(l,t,r)}return r}function Ld(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Ne.updateQueue,t===null?(t=Ll(),Ne.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Hd(e,t,r,l){t.value=r,t.getSnapshot=l,$d(t)&&Yd(e)}function Pd(e,t,r){return r(function(){$d(t)&&Yd(e)})}function $d(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Jt(e,r)}catch{return!0}}function Yd(e){var t=yi(e,2);t!==null&&Gt(t,e,2)}function ou(e){var t=zt();if(typeof e=="function"){var r=e;if(e=r(),Ai){It(!0);try{r()}finally{It(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:e},t}function Vd(e,t,r,l){return e.baseState=r,au(e,Ie,typeof l=="function"?l:rs)}function Jb(e,t,r,l,c){if(Vl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?r(!0):u.isTransition=!1,l(u),r=t.pending,r===null?(u.next=t.pending=u,Gd(t,u)):(u.next=r.next,t.pending=r.next=u)}}function Gd(e,t){var r=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=r(c,l),O=$.S;O!==null&&O(p,b),Fd(e,t,b)}catch(B){cu(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=r(c,l),Fd(e,t,u)}catch(B){cu(e,t,B)}}function Fd(e,t,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){Id(e,t,l)},function(l){return cu(e,t,l)}):Id(e,t,r)}function Id(e,t,r){t.status="fulfilled",t.value=r,Qd(t),e.state=r,t=e.pending,t!==null&&(r=t.next,r===t?e.pending=null:(r=r.next,t.next=r,Gd(e,r)))}function cu(e,t,r){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=r,Qd(t),t=t.next;while(t!==l)}e.action=null}function Qd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Jd(e,t){return t}function Kd(e,t){if(Ue){var r=Xe.formState;if(r!==null){e:{var l=Ne;if(Ue){if(We){t:{for(var c=We,u=bn;c.nodeType!==8;){if(!u){c=null;break t}if(c=vn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){We=vn(c.nextSibling),l=c.data==="F!";break e}}Ns(l)}l=!1}l&&(t=r[0])}}return r=zt(),r.memoizedState=r.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jd,lastRenderedState:t},r.queue=l,r=pm.bind(null,Ne,l),l.dispatch=r,l=ou(!1),u=pu.bind(null,Ne,!1,l.queue),l=zt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,r=Jb.bind(null,Ne,c,u,r),c.dispatch=r,l.memoizedState=e,[t,r,!1]}function Xd(e){var t=ht();return Zd(t,Ie,e)}function Zd(e,t,r){if(t=au(e,t,Jd)[0],e=Pl(rs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=fa(t)}catch(p){throw p===nr?Cl:p}else l=t;t=ht();var c=t.queue,u=c.dispatch;return r!==t.memoizedState&&(Ne.flags|=2048,lr(9,{destroy:void 0},Kb.bind(null,c,r),null)),[l,u,e]}function Kb(e,t){e.action=t}function Wd(e){var t=ht(),r=Ie;if(r!==null)return Zd(t,r,e);ht(),t=t.memoizedState,r=ht();var l=r.queue.dispatch;return r.memoizedState=e,[t,l,!1]}function lr(e,t,r,l){return e={tag:e,create:r,deps:l,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=Ll(),Ne.updateQueue=t),r=t.lastEffect,r===null?t.lastEffect=e.next=e:(l=r.next,r.next=e,e.next=l,t.lastEffect=e),e}function em(){return ht().memoizedState}function $l(e,t,r,l){var c=zt();Ne.flags|=e,c.memoizedState=lr(1|t,{destroy:void 0},r,l===void 0?null:l)}function Yl(e,t,r,l){var c=ht();l=l===void 0?null:l;var u=c.memoizedState.inst;Ie!==null&&l!==null&&eu(l,Ie.memoizedState.deps)?c.memoizedState=lr(t,u,r,l):(Ne.flags|=e,c.memoizedState=lr(1|t,u,r,l))}function tm(e,t){$l(8390656,8,e,t)}function uu(e,t){Yl(2048,8,e,t)}function Xb(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=Ll(),Ne.updateQueue=t,t.events=[e];else{var r=t.events;r===null?t.events=[e]:r.push(e)}}function nm(e){var t=ht().memoizedState;return Xb({ref:t,nextImpl:e}),function(){if((Ye&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function sm(e,t){return Yl(4,2,e,t)}function im(e,t){return Yl(4,4,e,t)}function rm(e,t){if(typeof t=="function"){e=e();var r=t(e);return function(){typeof r=="function"?r():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function am(e,t,r){r=r!=null?r.concat([e]):null,Yl(4,4,rm.bind(null,t,e),r)}function fu(){}function lm(e,t){var r=ht();t=t===void 0?null:t;var l=r.memoizedState;return t!==null&&eu(t,l[1])?l[0]:(r.memoizedState=[e,t],e)}function om(e,t){var r=ht();t=t===void 0?null:t;var l=r.memoizedState;if(t!==null&&eu(t,l[1]))return l[0];if(l=e(),Ai){It(!0);try{e()}finally{It(!1)}}return r.memoizedState=[l,t],l}function hu(e,t,r){return r===void 0||(is&1073741824)!==0&&(qe&261930)===0?e.memoizedState=t:(e.memoizedState=r,e=cp(),Ne.lanes|=e,Ls|=e,r)}function cm(e,t,r,l){return Jt(r,t)?r:ir.current!==null?(e=hu(e,r,l),Jt(e,t)||(yt=!0),e):(is&42)===0||(is&1073741824)!==0&&(qe&261930)===0?(yt=!0,e.memoizedState=r):(e=cp(),Ne.lanes|=e,Ls|=e,t)}function um(e,t,r,l,c){var u=re.p;re.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,pu(e,!1,t,r);try{var O=c(),B=$.S;if(B!==null&&B(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var I=Fb(O,l);ha(e,t,I,tn(e))}else ha(e,t,l,tn(e))}catch(te){ha(e,t,{then:function(){},status:"rejected",reason:te},tn())}finally{re.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function Zb(){}function du(e,t,r,l){if(e.tag!==5)throw Error(a(476));var c=fm(e).queue;um(e,c,t,de,r===null?Zb:function(){return hm(e),r(l)})}function fm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:de},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function hm(e){var t=fm(e);t.next===null&&(t=e.alternate.memoizedState),ha(e,t.next.queue,{},tn())}function mu(){return Nt(ka)}function dm(){return ht().memoizedState}function mm(){return ht().memoizedState}function Wb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=tn();e=Rs(r);var l=Ds(t,e,r);l!==null&&(Gt(l,t,r),la(l,t,r)),t={cache:Yc()},e.payload=t;return}t=t.return}}function ex(e,t,r){var l=tn();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Vl(e)?ym(t,r):(r=Mc(e,t,r,l),r!==null&&(Gt(r,e,l),gm(r,t,l)))}function pm(e,t,r){var l=tn();ha(e,t,r,l)}function ha(e,t,r,l){var c={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Vl(e))ym(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,r);if(c.hasEagerState=!0,c.eagerState=b,Jt(b,p))return El(e,t,c,0),Xe===null&&Sl(),!1}catch{}finally{}if(r=Mc(e,t,c,l),r!==null)return Gt(r,e,l),gm(r,t,l),!0}return!1}function pu(e,t,r,l){if(l={lane:2,revertLane:Iu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Vl(e)){if(t)throw Error(a(479))}else t=Mc(e,r,l,2),t!==null&&Gt(t,e,2)}function Vl(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function ym(e,t){rr=Ul=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function gm(e,t,r){if((r&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,ui(e,r)}}var da={readContext:Nt,use:Hl,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};da.useEffectEvent=lt;var bm={readContext:Nt,use:Hl,useCallback:function(e,t){return zt().memoizedState=[e,t===void 0?null:t],e},useContext:Nt,useEffect:tm,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,$l(4194308,4,rm.bind(null,t,e),r)},useLayoutEffect:function(e,t){return $l(4194308,4,e,t)},useInsertionEffect:function(e,t){$l(4,2,e,t)},useMemo:function(e,t){var r=zt();t=t===void 0?null:t;var l=e();if(Ai){It(!0);try{e()}finally{It(!1)}}return r.memoizedState=[l,t],l},useReducer:function(e,t,r){var l=zt();if(r!==void 0){var c=r(t);if(Ai){It(!0);try{r(t)}finally{It(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=ex.bind(null,Ne,e),[l.memoizedState,e]},useRef:function(e){var t=zt();return e={current:e},t.memoizedState=e},useState:function(e){e=ou(e);var t=e.queue,r=pm.bind(null,Ne,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:fu,useDeferredValue:function(e,t){var r=zt();return hu(r,e,t)},useTransition:function(){var e=ou(!1);return e=um.bind(null,Ne,e.queue,!0,!1),zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var l=Ne,c=zt();if(Ue){if(r===void 0)throw Error(a(407));r=r()}else{if(r=t(),Xe===null)throw Error(a(349));(qe&127)!==0||Ld(l,t,r)}c.memoizedState=r;var u={value:r,getSnapshot:t};return c.queue=u,tm(Pd.bind(null,l,u,e),[e]),l.flags|=2048,lr(9,{destroy:void 0},Hd.bind(null,l,u,r,t),null),r},useId:function(){var e=zt(),t=Xe.identifierPrefix;if(Ue){var r=Ln,l=Bn;r=(l&~(1<<32-Dt(l)-1)).toString(32)+r,t="_"+t+"R_"+r,r=Bl++,0<r&&(t+="H"+r.toString(32)),t+="_"}else r=Ib++,t="_"+t+"r_"+r.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:mu,useFormState:Kd,useActionState:Kd,useOptimistic:function(e){var t=zt();t.memoizedState=t.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=r,t=pu.bind(null,Ne,!0,r),r.dispatch=t,[e,t]},useMemoCache:ru,useCacheRefresh:function(){return zt().memoizedState=Wb.bind(null,Ne)},useEffectEvent:function(e){var t=zt(),r={impl:e};return t.memoizedState=r,function(){if((Ye&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},yu={readContext:Nt,use:Hl,useCallback:lm,useContext:Nt,useEffect:uu,useImperativeHandle:am,useInsertionEffect:sm,useLayoutEffect:im,useMemo:om,useReducer:Pl,useRef:em,useState:function(){return Pl(rs)},useDebugValue:fu,useDeferredValue:function(e,t){var r=ht();return cm(r,Ie.memoizedState,e,t)},useTransition:function(){var e=Pl(rs)[0],t=ht().memoizedState;return[typeof e=="boolean"?e:fa(e),t]},useSyncExternalStore:Bd,useId:dm,useHostTransitionStatus:mu,useFormState:Xd,useActionState:Xd,useOptimistic:function(e,t){var r=ht();return Vd(r,Ie,e,t)},useMemoCache:ru,useCacheRefresh:mm};yu.useEffectEvent=nm;var xm={readContext:Nt,use:Hl,useCallback:lm,useContext:Nt,useEffect:uu,useImperativeHandle:am,useInsertionEffect:sm,useLayoutEffect:im,useMemo:om,useReducer:lu,useRef:em,useState:function(){return lu(rs)},useDebugValue:fu,useDeferredValue:function(e,t){var r=ht();return Ie===null?hu(r,e,t):cm(r,Ie.memoizedState,e,t)},useTransition:function(){var e=lu(rs)[0],t=ht().memoizedState;return[typeof e=="boolean"?e:fa(e),t]},useSyncExternalStore:Bd,useId:dm,useHostTransitionStatus:mu,useFormState:Wd,useActionState:Wd,useOptimistic:function(e,t){var r=ht();return Ie!==null?Vd(r,Ie,e,t):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:ru,useCacheRefresh:mm};xm.useEffectEvent=nm;function gu(e,t,r,l){t=e.memoizedState,r=r(l,t),r=r==null?t:_({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var bu={enqueueSetState:function(e,t,r){e=e._reactInternals;var l=tn(),c=Rs(l);c.payload=t,r!=null&&(c.callback=r),t=Ds(e,c,l),t!==null&&(Gt(t,e,l),la(t,e,l))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var l=tn(),c=Rs(l);c.tag=1,c.payload=t,r!=null&&(c.callback=r),t=Ds(e,c,l),t!==null&&(Gt(t,e,l),la(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=tn(),l=Rs(r);l.tag=2,t!=null&&(l.callback=t),t=Ds(e,l,r),t!==null&&(Gt(t,e,r),la(t,e,r))}};function vm(e,t,r,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Wr(r,l)||!Wr(c,u):!0}function _m(e,t,r,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,l),t.state!==e&&bu.enqueueReplaceState(t,t.state,null)}function ji(e,t){var r=t;if("ref"in t){r={};for(var l in t)l!=="ref"&&(r[l]=t[l])}if(e=e.defaultProps){r===t&&(r=_({},r));for(var c in e)r[c]===void 0&&(r[c]=e[c])}return r}function wm(e){wl(e)}function Sm(e){console.error(e)}function Em(e){wl(e)}function Gl(e,t){try{var r=e.onUncaughtError;r(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Am(e,t,r){try{var l=e.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function xu(e,t,r){return r=Rs(r),r.tag=3,r.payload={element:null},r.callback=function(){Gl(e,t)},r}function jm(e){return e=Rs(e),e.tag=3,e}function Om(e,t,r,l){var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){Am(t,r,l)}}var p=r.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Am(t,r,l),typeof c!="function"&&(Hs===null?Hs=new Set([this]):Hs.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function tx(e,t,r,l,c){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=r.alternate,t!==null&&Wi(t,r,c,!0),r=Xt.current,r!==null){switch(r.tag){case 31:case 13:return xn===null?so():r.alternate===null&&ot===0&&(ot=3),r.flags&=-257,r.flags|=65536,r.lanes=c,l===Ml?r.flags|=16384:(t=r.updateQueue,t===null?r.updateQueue=new Set([l]):t.add(l),Vu(e,l,c)),!1;case 22:return r.flags|=65536,l===Ml?r.flags|=16384:(t=r.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=t):(r=t.retryQueue,r===null?t.retryQueue=new Set([l]):r.add(l)),Vu(e,l,c)),!1}throw Error(a(435,r.tag))}return Vu(e,l,c),so(),!1}if(Ue)return t=Xt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Bc&&(e=Error(a(422),{cause:l}),na(pn(e,r)))):(l!==Bc&&(t=Error(a(423),{cause:l}),na(pn(t,r))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=pn(l,r),c=xu(e.stateNode,l,c),Jc(e,c),ot!==4&&(ot=2)),!1;var u=Error(a(520),{cause:l});if(u=pn(u,r),_a===null?_a=[u]:_a.push(u),ot!==4&&(ot=2),t===null)return!0;l=pn(l,r),r=t;do{switch(r.tag){case 3:return r.flags|=65536,e=c&-c,r.lanes|=e,e=xu(r.stateNode,l,e),Jc(r,e),!1;case 1:if(t=r.type,u=r.stateNode,(r.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Hs===null||!Hs.has(u))))return r.flags|=65536,c&=-c,r.lanes|=c,c=jm(c),Om(c,e,r,l),Jc(r,c),!1}r=r.return}while(r!==null);return!1}var vu=Error(a(461)),yt=!1;function Ct(e,t,r,l){t.child=e===null?Cd(t,null,r,l):Ei(t,e.child,r,l)}function Tm(e,t,r,l,c){r=r.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return vi(t),l=tu(e,t,r,p,u,c),b=nu(),e!==null&&!yt?(su(e,t,c),as(e,t,c)):(Ue&&b&&zc(t),t.flags|=1,Ct(e,t,l,c),t.child)}function km(e,t,r,l,c){if(e===null){var u=r.type;return typeof u=="function"&&!Rc(u)&&u.defaultProps===void 0&&r.compare===null?(t.tag=15,t.type=u,Nm(e,t,u,l,c)):(e=jl(r.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Tu(e,c)){var p=u.memoizedProps;if(r=r.compare,r=r!==null?r:Wr,r(p,l)&&e.ref===t.ref)return as(e,t,c)}return t.flags|=1,e=es(u,l),e.ref=t.ref,e.return=t,t.child=e}function Nm(e,t,r,l,c){if(e!==null){var u=e.memoizedProps;if(Wr(u,l)&&e.ref===t.ref)if(yt=!1,t.pendingProps=l=u,Tu(e,c))(e.flags&131072)!==0&&(yt=!0);else return t.lanes=e.lanes,as(e,t,c)}return _u(e,t,r,l,c)}function Cm(e,t,r,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|r:r,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return Mm(e,t,u,r,l)}if((r&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Nl(t,u!==null?u.cachePool:null),u!==null?Dd(t,u):Xc(),qd(t);else return l=t.lanes=536870912,Mm(e,t,u!==null?u.baseLanes|r:r,r,l)}else u!==null?(Nl(t,u.cachePool),Dd(t,u),zs(),t.memoizedState=null):(e!==null&&Nl(t,null),Xc(),zs());return Ct(e,t,c,r),t.child}function ma(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Mm(e,t,r,l,c){var u=Gc();return u=u===null?null:{parent:mt._currentValue,pool:u},t.memoizedState={baseLanes:r,cachePool:u},e!==null&&Nl(t,null),Xc(),qd(t),e!==null&&Wi(e,t,l,!0),t.childLanes=c,null}function Fl(e,t){return t=Ql({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Rm(e,t,r){return Ei(t,e.child,null,r),e=Fl(t,t.pendingProps),e.flags|=2,Zt(t),t.memoizedState=null,e}function nx(e,t,r){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ue){if(l.mode==="hidden")return e=Fl(t,l),t.lanes=536870912,ma(null,e);if(Wc(t),(e=We)?(e=Gp(e,bn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ts!==null?{id:Bn,overflow:Ln}:null,retryLane:536870912,hydrationErrors:null},r=yd(e),r.return=t,t.child=r,kt=t,We=null)):e=null,e===null)throw Ns(t);return t.lanes=536870912,null}return Fl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Wc(t),c)if(t.flags&256)t.flags&=-257,t=Rm(e,t,r);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(yt||Wi(e,t,r,!1),c=(r&e.childLanes)!==0,yt||c){if(l=Xe,l!==null&&(p=js(l,r),p!==0&&p!==u.retryLane))throw u.retryLane=p,yi(e,p),Gt(l,e,p),vu;so(),t=Rm(e,t,r)}else e=u.treeContext,We=vn(p.nextSibling),kt=t,Ue=!0,ks=null,bn=!1,e!==null&&xd(t,e),t=Fl(t,l),t.flags|=4096;return t}return e=es(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Il(e,t){var r=t.ref;if(r===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(e===null||e.ref!==r)&&(t.flags|=4194816)}}function _u(e,t,r,l,c){return vi(t),r=tu(e,t,r,l,void 0,c),l=nu(),e!==null&&!yt?(su(e,t,c),as(e,t,c)):(Ue&&l&&zc(t),t.flags|=1,Ct(e,t,r,c),t.child)}function Dm(e,t,r,l,c,u){return vi(t),t.updateQueue=null,r=Ud(t,l,r,c),zd(e),l=nu(),e!==null&&!yt?(su(e,t,u),as(e,t,u)):(Ue&&l&&zc(t),t.flags|=1,Ct(e,t,r,u),t.child)}function qm(e,t,r,l,c){if(vi(t),t.stateNode===null){var u=Ji,p=r.contextType;typeof p=="object"&&p!==null&&(u=Nt(p)),u=new r(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=bu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Ic(t),p=r.contextType,u.context=typeof p=="object"&&p!==null?Nt(p):Ji,u.state=t.memoizedState,p=r.getDerivedStateFromProps,typeof p=="function"&&(gu(t,r,p,l),u.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&bu.enqueueReplaceState(u,u.state,null),ca(t,l,u,c),oa(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=ji(r,b);u.props=O;var B=u.context,I=r.contextType;p=Ji,typeof I=="object"&&I!==null&&(p=Nt(I));var te=r.getDerivedStateFromProps;I=typeof te=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,I||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&_m(t,u,l,p),Ms=!1;var L=t.memoizedState;u.state=L,ca(t,l,u,c),oa(),B=t.memoizedState,b||L!==B||Ms?(typeof te=="function"&&(gu(t,r,te,l),B=t.memoizedState),(O=Ms||vm(t,r,O,l,L,B,p))?(I||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=p,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Qc(e,t),p=t.memoizedProps,I=ji(r,p),u.props=I,te=t.pendingProps,L=u.context,B=r.contextType,O=Ji,typeof B=="object"&&B!==null&&(O=Nt(B)),b=r.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==te||L!==O)&&_m(t,u,l,O),Ms=!1,L=t.memoizedState,u.state=L,ca(t,l,u,c),oa();var Y=t.memoizedState;p!==te||L!==Y||Ms||e!==null&&e.dependencies!==null&&Tl(e.dependencies)?(typeof b=="function"&&(gu(t,r,b,l),Y=t.memoizedState),(I=Ms||vm(t,r,I,l,L,Y,O)||e!==null&&e.dependencies!==null&&Tl(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,Y,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,Y,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=Y),u.props=l,u.state=Y,u.context=O,l=I):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Il(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=Ei(t,e.child,null,c),t.child=Ei(t,null,r,c)):Ct(e,t,r,c),t.memoizedState=u.state,e=t.child):e=as(e,t,c),e}function zm(e,t,r,l){return bi(),t.flags|=256,Ct(e,t,r,l),t.child}var wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Su(e){return{baseLanes:e,cachePool:Ad()}}function Eu(e,t,r){return e=e!==null?e.childLanes&~r:0,t&&(e|=en),e}function Um(e,t,r){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ft.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ue){if(c?qs(t):zs(),(e=We)?(e=Gp(e,bn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ts!==null?{id:Bn,overflow:Ln}:null,retryLane:536870912,hydrationErrors:null},r=yd(e),r.return=t,t.child=r,kt=t,We=null)):e=null,e===null)throw Ns(t);return lf(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(zs(),c=t.mode,b=Ql({mode:"hidden",children:b},c),l=gi(l,c,r,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=Su(r),l.childLanes=Eu(e,p,r),t.memoizedState=wu,ma(null,l)):(qs(t),Au(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(qs(t),t.flags&=-257,t=ju(e,t,r)):t.memoizedState!==null?(zs(),t.child=e.child,t.flags|=128,t=null):(zs(),b=l.fallback,c=t.mode,l=Ql({mode:"visible",children:l.children},c),b=gi(b,c,r,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,Ei(t,e.child,null,r),l=t.child,l.memoizedState=Su(r),l.childLanes=Eu(e,p,r),t.memoizedState=wu,t=ma(null,l));else if(qs(t),lf(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,na({value:l,source:null,stack:null}),t=ju(e,t,r)}else if(yt||Wi(e,t,r,!1),p=(r&e.childLanes)!==0,yt||p){if(p=Xe,p!==null&&(l=js(p,r),l!==0&&l!==O.retryLane))throw O.retryLane=l,yi(e,l),Gt(p,e,l),vu;af(b)||so(),t=ju(e,t,r)}else af(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,We=vn(b.nextSibling),kt=t,Ue=!0,ks=null,bn=!1,e!==null&&xd(t,e),t=Au(t,l.children),t.flags|=4096);return t}return c?(zs(),b=l.fallback,c=t.mode,O=e.child,B=O.sibling,l=es(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,B!==null?b=es(B,b):(b=gi(b,c,r,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,ma(null,l),l=t.child,b=e.child.memoizedState,b===null?b=Su(r):(c=b.cachePool,c!==null?(O=mt._currentValue,c=c.parent!==O?{parent:O,pool:O}:c):c=Ad(),b={baseLanes:b.baseLanes|r,cachePool:c}),l.memoizedState=b,l.childLanes=Eu(e,p,r),t.memoizedState=wu,ma(e.child,l)):(qs(t),r=e.child,e=r.sibling,r=es(r,{mode:"visible",children:l.children}),r.return=t,r.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=r,t.memoizedState=null,r)}function Au(e,t){return t=Ql({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ql(e,t){return e=Kt(22,e,null,t),e.lanes=0,e}function ju(e,t,r){return Ei(t,e.child,null,r),e=Au(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Bm(e,t,r){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Pc(e.return,t,r)}function Ou(e,t,r,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=r,p.tailMode=c,p.treeForkCount=u)}function Lm(e,t,r){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ft.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Ae(ft,p),Ct(e,t,l,r),l=Ue?ta:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Bm(e,r,t);else if(e.tag===19)Bm(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(r=t.child,c=null;r!==null;)e=r.alternate,e!==null&&zl(e)===null&&(c=r),r=r.sibling;r=c,r===null?(c=t.child,t.child=null):(c=r.sibling,r.sibling=null),Ou(t,!1,c,r,u,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&zl(e)===null){t.child=c;break}e=c.sibling,c.sibling=r,r=c,c=e}Ou(t,!0,r,null,u,l);break;case"together":Ou(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function as(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Ls|=t.lanes,(r&t.childLanes)===0)if(e!==null){if(Wi(e,t,r,!1),(r&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,r=es(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=es(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Tu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Tl(e)))}function sx(e,t,r){switch(t.tag){case 3:ct(t,t.stateNode.containerInfo),Cs(t,mt,e.memoizedState.cache),bi();break;case 27:case 5:_t(t);break;case 4:ct(t,t.stateNode.containerInfo);break;case 10:Cs(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Wc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(qs(t),t.flags|=128,null):(r&t.child.childLanes)!==0?Um(e,t,r):(qs(t),e=as(e,t,r),e!==null?e.sibling:null);qs(t);break;case 19:var c=(e.flags&128)!==0;if(l=(r&t.childLanes)!==0,l||(Wi(e,t,r,!1),l=(r&t.childLanes)!==0),c){if(l)return Lm(e,t,r);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Ae(ft,ft.current),l)break;return null;case 22:return t.lanes=0,Cm(e,t,r,t.pendingProps);case 24:Cs(t,mt,e.memoizedState.cache)}return as(e,t,r)}function Hm(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps)yt=!0;else{if(!Tu(e,r)&&(t.flags&128)===0)return yt=!1,sx(e,t,r);yt=(e.flags&131072)!==0}else yt=!1,Ue&&(t.flags&1048576)!==0&&bd(t,ta,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=wi(t.elementType),t.type=e,typeof e=="function")Rc(e)?(l=ji(e,l),t.tag=1,t=qm(null,t,e,l,r)):(t.tag=0,t=_u(null,t,e,l,r));else{if(e!=null){var c=e.$$typeof;if(c===ae){t.tag=11,t=Tm(null,t,e,l,r);break e}else if(c===oe){t.tag=14,t=km(null,t,e,l,r);break e}}throw t=Se(e)||e,Error(a(306,t,""))}}return t;case 0:return _u(e,t,t.type,t.pendingProps,r);case 1:return l=t.type,c=ji(l,t.pendingProps),qm(e,t,l,c,r);case 3:e:{if(ct(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,Qc(e,t),ca(t,l,null,r);var p=t.memoizedState;if(l=p.cache,Cs(t,mt,l),l!==u.cache&&$c(t,[mt],r,!0),oa(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=zm(e,t,l,r);break e}else if(l!==c){c=pn(Error(a(424)),t),na(c),t=zm(e,t,l,r);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(We=vn(e.firstChild),kt=t,Ue=!0,ks=null,bn=!0,r=Cd(t,null,l,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(bi(),l===c){t=as(e,t,r);break e}Ct(e,t,l,r)}t=t.child}return t;case 26:return Il(e,t),e===null?(r=Xp(t.type,null,t.pendingProps,null))?t.memoizedState=r:Ue||(r=t.type,e=t.pendingProps,l=uo(Et.current).createElement(r),l[Ke]=t,l[at]=e,Mt(l,r,e),N(l),t.stateNode=l):t.memoizedState=Xp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return _t(t),e===null&&Ue&&(l=t.stateNode=Qp(t.type,t.pendingProps,Et.current),kt=t,bn=!0,c=We,Vs(t.type)?(of=c,We=vn(l.firstChild)):We=c),Ct(e,t,t.pendingProps.children,r),Il(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ue&&((c=l=We)&&(l=Rx(l,t.type,t.pendingProps,bn),l!==null?(t.stateNode=l,kt=t,We=vn(l.firstChild),bn=!1,c=!0):c=!1),c||Ns(t)),_t(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,nf(c,u)?l=null:p!==null&&nf(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=tu(e,t,Qb,null,null,r),ka._currentValue=c),Il(e,t),Ct(e,t,l,r),t.child;case 6:return e===null&&Ue&&((e=r=We)&&(r=Dx(r,t.pendingProps,bn),r!==null?(t.stateNode=r,kt=t,We=null,e=!0):e=!1),e||Ns(t)),null;case 13:return Um(e,t,r);case 4:return ct(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ei(t,null,l,r):Ct(e,t,l,r),t.child;case 11:return Tm(e,t,t.type,t.pendingProps,r);case 7:return Ct(e,t,t.pendingProps,r),t.child;case 8:return Ct(e,t,t.pendingProps.children,r),t.child;case 12:return Ct(e,t,t.pendingProps.children,r),t.child;case 10:return l=t.pendingProps,Cs(t,t.type,l.value),Ct(e,t,l.children,r),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,vi(t),c=Nt(c),l=l(c),t.flags|=1,Ct(e,t,l,r),t.child;case 14:return km(e,t,t.type,t.pendingProps,r);case 15:return Nm(e,t,t.type,t.pendingProps,r);case 19:return Lm(e,t,r);case 31:return nx(e,t,r);case 22:return Cm(e,t,r,t.pendingProps);case 24:return vi(t),l=Nt(mt),e===null?(c=Gc(),c===null&&(c=Xe,u=Yc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=r),c=u),t.memoizedState={parent:l,cache:c},Ic(t),Cs(t,mt,c)):((e.lanes&r)!==0&&(Qc(e,t),ca(t,null,null,r),oa()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Cs(t,mt,l)):(l=u.cache,Cs(t,mt,l),l!==c.cache&&$c(t,[mt],r,!0))),Ct(e,t,t.pendingProps.children,r),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ls(e){e.flags|=4}function ku(e,t,r,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(dp())e.flags|=8192;else throw Si=Ml,Fc}else e.flags&=-16777217}function Pm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!n0(t))if(dp())e.flags|=8192;else throw Si=Ml,Fc}function Jl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Li():536870912,e.lanes|=t,fr|=t)}function pa(e,t){if(!Ue)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.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?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function et(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,l=0;if(t)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,t}function ix(e,t,r){var l=t.pendingProps;switch(Uc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(t),null;case 1:return et(t),null;case 3:return r=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ss(mt),Oe(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Zi(t)?ls(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Lc())),et(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ls(t),u!==null?(et(t),Pm(t,u)):(et(t),ku(t,c,null,l,r))):u?u!==e.memoizedState?(ls(t),et(t),Pm(t,u)):(et(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ls(t),et(t),ku(t,c,e,l,r)),null;case 27:if(zn(t),r=Et.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return et(t),null}e=He.current,Zi(t)?vd(t):(e=Qp(c,l,r),t.stateNode=e,ls(t))}return et(t),null;case 5:if(zn(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return et(t),null}if(u=He.current,Zi(t))vd(t);else{var p=uo(Et.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Ke]=t,u[at]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(Mt(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ls(t)}}return et(t),ku(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ls(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=Et.current,Zi(t)){if(e=t.stateNode,r=t.memoizedProps,l=null,c=kt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Ke]=t,e=!!(e.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||Up(e.nodeValue,r)),e||Ns(t,!0)}else e=uo(e).createTextNode(l),e[Ke]=t,t.stateNode=e}return et(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(l=Zi(t),r!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Ke]=t}else bi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),e=!1}else r=Lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(Zt(t),t):(Zt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return et(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Zi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Ke]=t}else bi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),c=!1}else c=Lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Zt(t),t):(Zt(t),null)}return Zt(t),(t.flags&128)!==0?(t.lanes=r,t):(r=l!==null,e=e!==null&&e.memoizedState!==null,r&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),Jl(t,t.updateQueue),et(t),null);case 4:return Oe(),e===null&&Xu(t.stateNode.containerInfo),et(t),null;case 10:return ss(t.type),et(t),null;case 19:if(xe(ft),l=t.memoizedState,l===null)return et(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)pa(l,!1);else{if(ot!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=zl(e),u!==null){for(t.flags|=128,pa(l,!1),e=u.updateQueue,t.updateQueue=e,Jl(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)pd(r,e),r=r.sibling;return Ae(ft,ft.current&1|2),Ue&&ts(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&tt()>eo&&(t.flags|=128,c=!0,pa(l,!1),t.lanes=4194304)}else{if(!c)if(e=zl(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Jl(t,e),pa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Ue)return et(t),null}else 2*tt()-l.renderingStartTime>eo&&r!==536870912&&(t.flags|=128,c=!0,pa(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=tt(),e.sibling=null,r=ft.current,Ae(ft,c?r&1|2:r&1),Ue&&ts(t,l.treeForkCount),e):(et(t),null);case 22:case 23:return Zt(t),Zc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(r&536870912)!==0&&(t.flags&128)===0&&(et(t),t.subtreeFlags&6&&(t.flags|=8192)):et(t),r=t.updateQueue,r!==null&&Jl(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==r&&(t.flags|=2048),e!==null&&xe(_i),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ss(mt),et(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function rx(e,t){switch(Uc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ss(mt),Oe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zn(t),null;case 31:if(t.memoizedState!==null){if(Zt(t),t.alternate===null)throw Error(a(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Zt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xe(ft),null;case 4:return Oe(),null;case 10:return ss(t.type),null;case 22:case 23:return Zt(t),Zc(),e!==null&&xe(_i),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ss(mt),null;case 25:return null;default:return null}}function $m(e,t){switch(Uc(t),t.tag){case 3:ss(mt),Oe();break;case 26:case 27:case 5:zn(t);break;case 4:Oe();break;case 31:t.memoizedState!==null&&Zt(t);break;case 13:Zt(t);break;case 19:xe(ft);break;case 10:ss(t.type);break;case 22:case 23:Zt(t),Zc(),e!==null&&xe(_i);break;case 24:ss(mt)}}function ya(e,t){try{var r=t.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 u=r.create,p=r.inst;l=u(),p.destroy=l}r=r.next}while(r!==c)}}catch(b){Ge(t,t.return,b)}}function Us(e,t,r){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var O=r,B=b;try{B()}catch(I){Ge(c,O,I)}}}l=l.next}while(l!==u)}}catch(I){Ge(t,t.return,I)}}function Ym(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Rd(t,r)}catch(l){Ge(e,e.return,l)}}}function Vm(e,t,r){r.props=ji(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(l){Ge(e,t,l)}}function ga(e,t){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){Ge(e,t,c)}}function Hn(e,t){var r=e.ref,l=e.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(c){Ge(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(c){Ge(e,t,c)}else r.current=null}function Gm(e){var t=e.type,r=e.memoizedProps,l=e.stateNode;try{e:switch(t){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){Ge(e,e.return,c)}}function Nu(e,t,r){try{var l=e.stateNode;Ox(l,e.type,r,t),l[at]=t}catch(c){Ge(e,e.return,c)}}function Fm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Vs(e.type)||e.tag===4}function Cu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fm(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 Mu(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,t):(t=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,t.appendChild(e),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Zn));else if(l!==4&&(l===27&&Vs(e.type)&&(r=e.stateNode,t=null),e=e.child,e!==null))for(Mu(e,t,r),e=e.sibling;e!==null;)Mu(e,t,r),e=e.sibling}function Kl(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(l!==4&&(l===27&&Vs(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Kl(e,t,r),e=e.sibling;e!==null;)Kl(e,t,r),e=e.sibling}function Im(e){var t=e.stateNode,r=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Mt(t,l,r),t[Ke]=e,t[at]=r}catch(u){Ge(e,e.return,u)}}var os=!1,gt=!1,Ru=!1,Qm=typeof WeakSet=="function"?WeakSet:Set,At=null;function ax(e,t){if(e=e.containerInfo,ef=bo,e=ad(e),jc(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,u=l.focusNode;l=l.focusOffset;try{r.nodeType,u.nodeType}catch{r=null;break e}var p=0,b=-1,O=-1,B=0,I=0,te=e,L=null;t:for(;;){for(var Y;te!==r||c!==0&&te.nodeType!==3||(b=p+c),te!==u||l!==0&&te.nodeType!==3||(O=p+l),te.nodeType===3&&(p+=te.nodeValue.length),(Y=te.firstChild)!==null;)L=te,te=Y;for(;;){if(te===e)break t;if(L===r&&++B===c&&(b=p),L===u&&++I===l&&(O=p),(Y=te.nextSibling)!==null)break;te=L,L=te.parentNode}te=Y}r=b===-1||O===-1?null:{start:b,end:O}}else r=null}r=r||{start:0,end:0}}else r=null;for(tf={focusedElem:e,selectionRange:r},bo=!1,At=t;At!==null;)if(t=At,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,At=e;else for(;At!==null;){switch(t=At,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(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&&u!==null){e=void 0,r=t,c=u.memoizedProps,u=u.memoizedState,l=r.stateNode;try{var ye=ji(r.type,c);e=l.getSnapshotBeforeUpdate(ye,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(_e){Ge(r,r.return,_e)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,r=e.nodeType,r===9)rf(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":rf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,At=e;break}At=t.return}}function Jm(e,t,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:us(e,r),l&4&&ya(5,r);break;case 1:if(us(e,r),l&4)if(e=r.stateNode,t===null)try{e.componentDidMount()}catch(p){Ge(r,r.return,p)}else{var c=ji(r.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ge(r,r.return,p)}}l&64&&Ym(r),l&512&&ga(r,r.return);break;case 3:if(us(e,r),l&64&&(e=r.updateQueue,e!==null)){if(t=null,r.child!==null)switch(r.child.tag){case 27:case 5:t=r.child.stateNode;break;case 1:t=r.child.stateNode}try{Rd(e,t)}catch(p){Ge(r,r.return,p)}}break;case 27:t===null&&l&4&&Im(r);case 26:case 5:us(e,r),t===null&&l&4&&Gm(r),l&512&&ga(r,r.return);break;case 12:us(e,r);break;case 31:us(e,r),l&4&&Zm(e,r);break;case 13:us(e,r),l&4&&Wm(e,r),l&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=px.bind(null,r),qx(e,r))));break;case 22:if(l=r.memoizedState!==null||os,!l){t=t!==null&&t.memoizedState!==null||gt,c=os;var u=gt;os=l,(gt=t)&&!u?fs(e,r,(r.subtreeFlags&8772)!==0):us(e,r),os=c,gt=u}break;case 30:break;default:us(e,r)}}function Km(e){var t=e.alternate;t!==null&&(e.alternate=null,Km(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Hi(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var nt=null,Pt=!1;function cs(e,t,r){for(r=r.child;r!==null;)Xm(e,t,r),r=r.sibling}function Xm(e,t,r){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(li,r)}catch{}switch(r.tag){case 26:gt||Hn(r,t),cs(e,t,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:gt||Hn(r,t);var l=nt,c=Pt;Vs(r.type)&&(nt=r.stateNode,Pt=!1),cs(e,t,r),ja(r.stateNode),nt=l,Pt=c;break;case 5:gt||Hn(r,t);case 6:if(l=nt,c=Pt,nt=null,cs(e,t,r),nt=l,Pt=c,nt!==null)if(Pt)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(r.stateNode)}catch(u){Ge(r,t,u)}else try{nt.removeChild(r.stateNode)}catch(u){Ge(r,t,u)}break;case 18:nt!==null&&(Pt?(e=nt,Yp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),xr(e)):Yp(nt,r.stateNode));break;case 4:l=nt,c=Pt,nt=r.stateNode.containerInfo,Pt=!0,cs(e,t,r),nt=l,Pt=c;break;case 0:case 11:case 14:case 15:Us(2,r,t),gt||Us(4,r,t),cs(e,t,r);break;case 1:gt||(Hn(r,t),l=r.stateNode,typeof l.componentWillUnmount=="function"&&Vm(r,t,l)),cs(e,t,r);break;case 21:cs(e,t,r);break;case 22:gt=(l=gt)||r.memoizedState!==null,cs(e,t,r),gt=l;break;default:cs(e,t,r)}}function Zm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{xr(e)}catch(r){Ge(t,t.return,r)}}}function Wm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{xr(e)}catch(r){Ge(t,t.return,r)}}function lx(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qm),t;default:throw Error(a(435,e.tag))}}function Xl(e,t){var r=lx(e);t.forEach(function(l){if(!r.has(l)){r.add(l);var c=yx.bind(null,e,l);l.then(c,c)}})}function $t(e,t){var r=t.deletions;if(r!==null)for(var l=0;l<r.length;l++){var c=r[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Vs(b.type)){nt=b.stateNode,Pt=!1;break e}break;case 5:nt=b.stateNode,Pt=!1;break e;case 3:case 4:nt=b.stateNode.containerInfo,Pt=!0;break e}b=b.return}if(nt===null)throw Error(a(160));Xm(u,p,c),nt=null,Pt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ep(t,e),t=t.sibling}var kn=null;function ep(e,t){var r=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:$t(t,e),Yt(e),l&4&&(Us(3,e,e.return),ya(3,e),Us(5,e,e.return));break;case 1:$t(t,e),Yt(e),l&512&&(gt||r===null||Hn(r,r.return)),l&64&&os&&(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=kn;if($t(t,e),Yt(e),l&512&&(gt||r===null||Hn(r,r.return)),l&4){var u=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":u=c.getElementsByTagName("title")[0],(!u||u[wt]||u[Ke]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),Mt(u,l,r),u[Ke]=e,N(u),l=u;break e;case"link":var p=e0("link","href",c).get(l+(r.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&u.getAttribute("rel")===(r.rel==null?null:r.rel)&&u.getAttribute("title")===(r.title==null?null:r.title)&&u.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),Mt(u,l,r),c.head.appendChild(u);break;case"meta":if(p=e0("meta","content",c).get(l+(r.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(r.content==null?null:""+r.content)&&u.getAttribute("name")===(r.name==null?null:r.name)&&u.getAttribute("property")===(r.property==null?null:r.property)&&u.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&u.getAttribute("charset")===(r.charSet==null?null:r.charSet)){p.splice(b,1);break t}}u=c.createElement(l),Mt(u,l,r),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Ke]=e,N(u),l=u}e.stateNode=l}else t0(c,e.type,e.stateNode);else e.stateNode=Wp(c,l,e.memoizedProps);else u!==l?(u===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):u.count--,l===null?t0(c,e.type,e.stateNode):Wp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Nu(e,e.memoizedProps,r.memoizedProps)}break;case 27:$t(t,e),Yt(e),l&512&&(gt||r===null||Hn(r,r.return)),r!==null&&l&4&&Nu(e,e.memoizedProps,r.memoizedProps);break;case 5:if($t(t,e),Yt(e),l&512&&(gt||r===null||Hn(r,r.return)),e.flags&32){c=e.stateNode;try{$i(c,"")}catch(ye){Ge(e,e.return,ye)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,Nu(e,c,r!==null?r.memoizedProps:c)),l&1024&&(Ru=!0);break;case 6:if($t(t,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){Ge(e,e.return,ye)}}break;case 3:if(mo=null,c=kn,kn=fo(t.containerInfo),$t(t,e),kn=c,Yt(e),l&4&&r!==null&&r.memoizedState.isDehydrated)try{xr(t.containerInfo)}catch(ye){Ge(e,e.return,ye)}Ru&&(Ru=!1,tp(e));break;case 4:l=kn,kn=fo(e.stateNode.containerInfo),$t(t,e),Yt(e),kn=l;break;case 12:$t(t,e),Yt(e);break;case 31:$t(t,e),Yt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 13:$t(t,e),Yt(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Wl=tt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 22:c=e.memoizedState!==null;var O=r!==null&&r.memoizedState!==null,B=os,I=gt;if(os=B||c,gt=I||O,$t(t,e),gt=I,os=B,Yt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(r===null||O||os||gt||Oi(e)),r=null,t=e;;){if(t.tag===5||t.tag===26){if(r===null){O=r=t;try{if(u=O.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=O.stateNode;var te=O.memoizedProps.style,L=te!=null&&te.hasOwnProperty("display")?te.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(ye){Ge(O,O.return,ye)}}}else if(t.tag===6){if(r===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(ye){Ge(O,O.return,ye)}}}else if(t.tag===18){if(r===null){O=t;try{var Y=O.stateNode;c?Vp(Y,!0):Vp(O.stateNode,!1)}catch(ye){Ge(O,O.return,ye)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,Xl(e,r))));break;case 19:$t(t,e),Yt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Xl(e,l)));break;case 30:break;case 21:break;default:$t(t,e),Yt(e)}}function Yt(e){var t=e.flags;if(t&2){try{for(var r,l=e.return;l!==null;){if(Fm(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var c=r.stateNode,u=Cu(e);Kl(e,u,c);break;case 5:var p=r.stateNode;r.flags&32&&($i(p,""),r.flags&=-33);var b=Cu(e);Kl(e,b,p);break;case 3:case 4:var O=r.stateNode.containerInfo,B=Cu(e);Mu(e,B,O);break;default:throw Error(a(161))}}catch(I){Ge(e,e.return,I)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;tp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function us(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Jm(e,t.alternate,t),t=t.sibling}function Oi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Us(4,t,t.return),Oi(t);break;case 1:Hn(t,t.return);var r=t.stateNode;typeof r.componentWillUnmount=="function"&&Vm(t,t.return,r),Oi(t);break;case 27:ja(t.stateNode);case 26:case 5:Hn(t,t.return),Oi(t);break;case 22:t.memoizedState===null&&Oi(t);break;case 30:Oi(t);break;default:Oi(t)}e=e.sibling}}function fs(e,t,r){for(r=r&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:fs(c,u,r),ya(4,u);break;case 1:if(fs(c,u,r),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ge(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)Md(O[c],b)}catch(B){Ge(l,l.return,B)}}r&&p&64&&Ym(u),ga(u,u.return);break;case 27:Im(u);case 26:case 5:fs(c,u,r),r&&l===null&&p&4&&Gm(u),ga(u,u.return);break;case 12:fs(c,u,r);break;case 31:fs(c,u,r),r&&p&4&&Zm(c,u);break;case 13:fs(c,u,r),r&&p&4&&Wm(c,u);break;case 22:u.memoizedState===null&&fs(c,u,r),ga(u,u.return);break;case 30:break;default:fs(c,u,r)}t=t.sibling}}function Du(e,t){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&sa(r))}function qu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&sa(e))}function Nn(e,t,r,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)np(e,t,r,l),t=t.sibling}function np(e,t,r,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Nn(e,t,r,l),c&2048&&ya(9,t);break;case 1:Nn(e,t,r,l);break;case 3:Nn(e,t,r,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&sa(e)));break;case 12:if(c&2048){Nn(e,t,r,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Ge(t,t.return,O)}}else Nn(e,t,r,l);break;case 31:Nn(e,t,r,l);break;case 13:Nn(e,t,r,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?Nn(e,t,r,l):ba(e,t):u._visibility&2?Nn(e,t,r,l):(u._visibility|=2,or(e,t,r,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Du(p,t);break;case 24:Nn(e,t,r,l),c&2048&&qu(t.alternate,t);break;default:Nn(e,t,r,l)}}function or(e,t,r,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=r,O=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:or(u,p,b,O,c),ya(8,p);break;case 23:break;case 22:var I=p.stateNode;p.memoizedState!==null?I._visibility&2?or(u,p,b,O,c):ba(u,p):(I._visibility|=2,or(u,p,b,O,c)),c&&B&2048&&Du(p.alternate,p);break;case 24:or(u,p,b,O,c),c&&B&2048&&qu(p.alternate,p);break;default:or(u,p,b,O,c)}t=t.sibling}}function ba(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var r=e,l=t,c=l.flags;switch(l.tag){case 22:ba(r,l),c&2048&&Du(l.alternate,l);break;case 24:ba(r,l),c&2048&&qu(l.alternate,l);break;default:ba(r,l)}t=t.sibling}}var xa=8192;function cr(e,t,r){if(e.subtreeFlags&xa)for(e=e.child;e!==null;)sp(e,t,r),e=e.sibling}function sp(e,t,r){switch(e.tag){case 26:cr(e,t,r),e.flags&xa&&e.memoizedState!==null&&Ix(r,kn,e.memoizedState,e.memoizedProps);break;case 5:cr(e,t,r);break;case 3:case 4:var l=kn;kn=fo(e.stateNode.containerInfo),cr(e,t,r),kn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=xa,xa=16777216,cr(e,t,r),xa=l):cr(e,t,r));break;default:cr(e,t,r)}}function ip(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function va(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var l=t[r];At=l,ap(l,e)}ip(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)rp(e),e=e.sibling}function rp(e){switch(e.tag){case 0:case 11:case 15:va(e),e.flags&2048&&Us(9,e,e.return);break;case 3:va(e);break;case 12:va(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Zl(e)):va(e);break;default:va(e)}}function Zl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var l=t[r];At=l,ap(l,e)}ip(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Us(8,t,t.return),Zl(t);break;case 22:r=t.stateNode,r._visibility&2&&(r._visibility&=-3,Zl(t));break;default:Zl(t)}e=e.sibling}}function ap(e,t){for(;At!==null;){var r=At;switch(r.tag){case 0:case 11:case 15:Us(8,r,t);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:sa(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,u=l.return;if(Km(l),l===r){At=null;break e}if(c!==null){c.return=u,At=c;break e}At=u}}}var ox={getCacheForType:function(e){var t=Nt(mt),r=t.data.get(e);return r===void 0&&(r=e(),t.data.set(e,r)),r},cacheSignal:function(){return Nt(mt).controller.signal}},cx=typeof WeakMap=="function"?WeakMap:Map,Ye=0,Xe=null,Re=null,qe=0,Ve=0,Wt=null,Bs=!1,ur=!1,zu=!1,hs=0,ot=0,Ls=0,Ti=0,Uu=0,en=0,fr=0,_a=null,Vt=null,Bu=!1,Wl=0,lp=0,eo=1/0,to=null,Hs=null,St=0,Ps=null,hr=null,ds=0,Lu=0,Hu=null,op=null,wa=0,Pu=null;function tn(){return(Ye&2)!==0&&qe!==0?qe&-qe:$.T!==null?Iu():Vr()}function cp(){if(en===0)if((qe&536870912)===0||Ue){var e=Jn;Jn<<=1,(Jn&3932160)===0&&(Jn=262144),en=e}else en=536870912;return e=Xt.current,e!==null&&(e.flags|=32),en}function Gt(e,t,r){(e===Xe&&(Ve===2||Ve===9)||e.cancelPendingCommit!==null)&&(dr(e,0),$s(e,qe,en,!1)),jn(e,r),((Ye&2)===0||e!==Xe)&&(e===Xe&&((Ye&2)===0&&(Ti|=r),ot===4&&$s(e,qe,en,!1)),Pn(e))}function up(e,t,r){if((Ye&6)!==0)throw Error(a(327));var l=!r&&(t&127)===0&&(t&e.expiredLanes)===0||ci(e,t),c=l?hx(e,t):Yu(e,t,!0),u=l;do{if(c===0){ur&&!l&&$s(e,t,0,!1);break}else{if(r=e.current.alternate,u&&!ux(r)){c=Yu(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=_a;var O=b.current.memoizedState.isDehydrated;if(O&&(dr(b,p).flags|=256),p=Yu(b,p,!1),p!==2){if(zu&&!O){b.errorRecoveryDisabledLanes|=u,Ti|=u,c=4;break e}u=Vt,Vt=c,u!==null&&(Vt===null?Vt=u:Vt.push.apply(Vt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){dr(e,0),$s(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:$s(l,t,en,!Bs);break e;case 2:Vt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Wl+300-tt(),10<c)){if($s(l,t,en,!Bs),oi(l,0,!0)!==0)break e;ds=t,l.timeoutHandle=Pp(fp.bind(null,l,r,Vt,to,Bu,t,en,Ti,fr,Bs,u,"Throttled",-0,0),c);break e}fp(l,r,Vt,to,Bu,t,en,Ti,fr,Bs,u,null,-0,0)}}break}while(!0);Pn(e)}function fp(e,t,r,l,c,u,p,b,O,B,I,te,L,Y){if(e.timeoutHandle=-1,te=t.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zn},sp(t,u,te);var ye=(u&62914560)===u?Wl-tt():(u&4194048)===u?lp-tt():0;if(ye=Qx(te,ye),ye!==null){ds=u,e.cancelPendingCommit=ye(xp.bind(null,e,t,u,r,l,c,p,b,O,I,te,null,L,Y)),$s(e,u,p,!B);return}}xp(e,t,u,r,l,c,p,b,O)}function ux(e){for(var t=e;;){var r=t.tag;if((r===0||r===11||r===15)&&t.flags&16384&&(r=t.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var c=r[l],u=c.getSnapshot;c=c.value;try{if(!Jt(u(),c))return!1}catch{return!1}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function $s(e,t,r,l){t&=~Uu,t&=~Ti,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Dt(c),p=1<<u;l[u]=-1,c&=~p}r!==0&&As(e,r,t)}function no(){return(Ye&6)===0?(Sa(0),!1):!0}function $u(){if(Re!==null){if(Ve===0)var e=Re.return;else e=Re,ns=xi=null,iu(e),sr=null,ra=0,e=Re;for(;e!==null;)$m(e.alternate,e),e=e.return;Re=null}}function dr(e,t){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,Nx(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),ds=0,$u(),Xe=e,Re=r=es(e.current,null),qe=t,Ve=0,Wt=null,Bs=!1,ur=ci(e,t),zu=!1,fr=en=Uu=Ti=Ls=ot=0,Vt=_a=null,Bu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Dt(l),u=1<<c;t|=e[c],l&=~u}return hs=t,Sl(),r}function hp(e,t){Ne=null,$.H=da,t===nr||t===Cl?(t=Td(),Ve=3):t===Fc?(t=Td(),Ve=4):Ve=t===vu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Wt=t,Re===null&&(ot=1,Gl(e,pn(t,e.current)))}function dp(){var e=Xt.current;return e===null?!0:(qe&4194048)===qe?xn===null:(qe&62914560)===qe||(qe&536870912)!==0?e===xn:!1}function mp(){var e=$.H;return $.H=da,e===null?da:e}function pp(){var e=$.A;return $.A=ox,e}function so(){ot=4,Bs||(qe&4194048)!==qe&&Xt.current!==null||(ur=!0),(Ls&134217727)===0&&(Ti&134217727)===0||Xe===null||$s(Xe,qe,en,!1)}function Yu(e,t,r){var l=Ye;Ye|=2;var c=mp(),u=pp();(Xe!==e||qe!==t)&&(to=null,dr(e,t)),t=!1;var p=ot;e:do try{if(Ve!==0&&Re!==null){var b=Re,O=Wt;switch(Ve){case 8:$u(),p=6;break e;case 3:case 2:case 9:case 6:Xt.current===null&&(t=!0);var B=Ve;if(Ve=0,Wt=null,mr(e,b,O,B),r&&ur){p=0;break e}break;default:B=Ve,Ve=0,Wt=null,mr(e,b,O,B)}}fx(),p=ot;break}catch(I){hp(e,I)}while(!0);return t&&e.shellSuspendCounter++,ns=xi=null,Ye=l,$.H=c,$.A=u,Re===null&&(Xe=null,qe=0,Sl()),p}function fx(){for(;Re!==null;)yp(Re)}function hx(e,t){var r=Ye;Ye|=2;var l=mp(),c=pp();Xe!==e||qe!==t?(to=null,eo=tt()+500,dr(e,t)):ur=ci(e,t);e:do try{if(Ve!==0&&Re!==null){t=Re;var u=Wt;t:switch(Ve){case 1:Ve=0,Wt=null,mr(e,t,u,1);break;case 2:case 9:if(jd(u)){Ve=0,Wt=null,gp(t);break}t=function(){Ve!==2&&Ve!==9||Xe!==e||(Ve=7),Pn(e)},u.then(t,t);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:jd(u)?(Ve=0,Wt=null,gp(t)):(Ve=0,Wt=null,mr(e,t,u,7));break;case 5:var p=null;switch(Re.tag){case 26:p=Re.memoizedState;case 5:case 27:var b=Re;if(p?n0(p):b.stateNode.complete){Ve=0,Wt=null;var O=b.sibling;if(O!==null)Re=O;else{var B=b.return;B!==null?(Re=B,io(B)):Re=null}break t}}Ve=0,Wt=null,mr(e,t,u,5);break;case 6:Ve=0,Wt=null,mr(e,t,u,6);break;case 8:$u(),ot=6;break e;default:throw Error(a(462))}}dx();break}catch(I){hp(e,I)}while(!0);return ns=xi=null,$.H=l,$.A=c,Ye=r,Re!==null?0:(Xe=null,qe=0,Sl(),ot)}function dx(){for(;Re!==null&&!al();)yp(Re)}function yp(e){var t=Hm(e.alternate,e,hs);e.memoizedProps=e.pendingProps,t===null?io(e):Re=t}function gp(e){var t=e,r=t.alternate;switch(t.tag){case 15:case 0:t=Dm(r,t,t.pendingProps,t.type,void 0,qe);break;case 11:t=Dm(r,t,t.pendingProps,t.type.render,t.ref,qe);break;case 5:iu(t);default:$m(r,t),t=Re=pd(t,hs),t=Hm(r,t,hs)}e.memoizedProps=e.pendingProps,t===null?io(e):Re=t}function mr(e,t,r,l){ns=xi=null,iu(t),sr=null,ra=0;var c=t.return;try{if(tx(e,c,t,r,qe)){ot=1,Gl(e,pn(r,e.current)),Re=null;return}}catch(u){if(c!==null)throw Re=c,u;ot=1,Gl(e,pn(r,e.current)),Re=null;return}t.flags&32768?(Ue||l===1?e=!0:ur||(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))),bp(t,e)):io(t)}function io(e){var t=e;do{if((t.flags&32768)!==0){bp(t,Bs);return}e=t.return;var r=ix(t.alternate,t,hs);if(r!==null){Re=r;return}if(t=t.sibling,t!==null){Re=t;return}Re=t=e}while(t!==null);ot===0&&(ot=5)}function bp(e,t){do{var r=rx(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),!t&&(e=e.sibling,e!==null)){Re=e;return}Re=e=r}while(e!==null);ot=6,Re=null}function xp(e,t,r,l,c,u,p,b,O){e.cancelPendingCommit=null;do ro();while(St!==0);if((Ye&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=Cc,Es(e,r,u,p,b,O),e===Xe&&(Re=Xe=null,qe=0),hr=t,Ps=e,ds=r,Lu=u,Hu=c,op=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,gx(Ui,function(){return Ep(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=re.p,re.p=2,p=Ye,Ye|=4;try{ax(e,t,r)}finally{Ye=p,re.p=c,$.T=l}}St=1,vp(),_p(),wp()}}function vp(){if(St===1){St=0;var e=Ps,t=hr,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=$.T,$.T=null;var l=re.p;re.p=2;var c=Ye;Ye|=4;try{ep(t,e);var u=tf,p=ad(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&rd(b.ownerDocument.documentElement,b)){if(O!==null&&jc(b)){var B=O.start,I=O.end;if(I===void 0&&(I=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(I,b.value.length);else{var te=b.ownerDocument||document,L=te&&te.defaultView||window;if(L.getSelection){var Y=L.getSelection(),ye=b.textContent.length,_e=Math.min(O.start,ye),Je=O.end===void 0?_e:Math.min(O.end,ye);!Y.extend&&_e>Je&&(p=Je,Je=_e,_e=p);var R=id(b,_e),C=id(b,Je);if(R&&C&&(Y.rangeCount!==1||Y.anchorNode!==R.node||Y.anchorOffset!==R.offset||Y.focusNode!==C.node||Y.focusOffset!==C.offset)){var U=te.createRange();U.setStart(R.node,R.offset),Y.removeAllRanges(),_e>Je?(Y.addRange(U),Y.extend(C.node,C.offset)):(U.setEnd(C.node,C.offset),Y.addRange(U))}}}}for(te=[],Y=b;Y=Y.parentNode;)Y.nodeType===1&&te.push({element:Y,left:Y.scrollLeft,top:Y.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}}bo=!!ef,tf=ef=null}finally{Ye=c,re.p=l,$.T=r}}e.current=t,St=2}}function _p(){if(St===2){St=0;var e=Ps,t=hr,r=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||r){r=$.T,$.T=null;var l=re.p;re.p=2;var c=Ye;Ye|=4;try{Jm(e,t.alternate,t)}finally{Ye=c,re.p=l,$.T=r}}St=3}}function wp(){if(St===4||St===3){St=0,zi();var e=Ps,t=hr,r=ds,l=op;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?St=5:(St=0,hr=Ps=null,Sp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Hs=null),fi(r),t=t.stateNode,ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(li,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=re.p,re.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,re.p=c}}(ds&3)!==0&&ro(),Pn(e),c=e.pendingLanes,(r&261930)!==0&&(c&42)!==0?e===Pu?wa++:(wa=0,Pu=e):wa=0,Sa(0)}}function Sp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,sa(t)))}function ro(){return vp(),_p(),wp(),Ep()}function Ep(){if(St!==5)return!1;var e=Ps,t=Lu;Lu=0;var r=fi(ds),l=$.T,c=re.p;try{re.p=32>r?32:r,$.T=null,r=Hu,Hu=null;var u=Ps,p=ds;if(St=0,hr=Ps=null,ds=0,(Ye&6)!==0)throw Error(a(331));var b=Ye;if(Ye|=4,rp(u.current),np(u,u.current,p,r),Ye=b,Sa(0,!1),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(li,u)}catch{}return!0}finally{re.p=c,$.T=l,Sp(e,t)}}function Ap(e,t,r){t=pn(r,t),t=xu(e.stateNode,t,2),e=Ds(e,t,2),e!==null&&(jn(e,2),Pn(e))}function Ge(e,t,r){if(e.tag===3)Ap(e,e,r);else for(;t!==null;){if(t.tag===3){Ap(t,e,r);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Hs===null||!Hs.has(l))){e=pn(r,e),r=jm(2),l=Ds(t,r,2),l!==null&&(Om(r,l,t,e),jn(l,2),Pn(l));break}}t=t.return}}function Vu(e,t,r){var l=e.pingCache;if(l===null){l=e.pingCache=new cx;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(r)||(zu=!0,c.add(r),e=mx.bind(null,e,t,r),t.then(e,e))}function mx(e,t,r){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Xe===e&&(qe&r)===r&&(ot===4||ot===3&&(qe&62914560)===qe&&300>tt()-Wl?(Ye&2)===0&&dr(e,0):Uu|=r,fr===qe&&(fr=0)),Pn(e)}function jp(e,t){t===0&&(t=Li()),e=yi(e,t),e!==null&&(jn(e,t),Pn(e))}function px(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),jp(e,r)}function yx(e,t){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(t),jp(e,r)}function gx(e,t){return Hr(e,t)}var ao=null,pr=null,Gu=!1,lo=!1,Fu=!1,Ys=0;function Pn(e){e!==pr&&e.next===null&&(pr===null?ao=pr=e:pr=pr.next=e),lo=!0,Gu||(Gu=!0,xx())}function Sa(e,t){if(!Fu&&lo){Fu=!0;do for(var r=!1,l=ao;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Dt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(r=!0,Np(l,u))}else u=qe,u=oi(l,l===Xe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ci(l,u)||(r=!0,Np(l,u));l=l.next}while(r);Fu=!1}}function bx(){Op()}function Op(){lo=Gu=!1;var e=0;Ys!==0&&kx()&&(e=Ys);for(var t=tt(),r=null,l=ao;l!==null;){var c=l.next,u=Tp(l,t);u===0?(l.next=null,r===null?ao=c:r.next=c,c===null&&(pr=r)):(r=l,(e!==0||(u&3)!==0)&&(lo=!0)),l=c}St!==0&&St!==5||Sa(e),Ys!==0&&(Ys=0)}function Tp(e,t){for(var r=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Dt(u),b=1<<p,O=c[p];O===-1?((b&r)===0||(b&l)!==0)&&(c[p]=Yr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Xe,r=qe,r=oi(e,e===t?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,r===0||e===t&&(Ve===2||Ve===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Qn(l),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||ci(e,r)){if(t=r&-r,t===e.callbackPriority)return t;switch(l!==null&&Qn(l),fi(r)){case 2:case 8:r=ol;break;case 32:r=Ui;break;case 268435456:r=cl;break;default:r=Ui}return l=kp.bind(null,e),r=Hr(r,l),e.callbackPriority=t,e.callbackNode=r,t}return l!==null&&l!==null&&Qn(l),e.callbackPriority=2,e.callbackNode=null,2}function kp(e,t){if(St!==0&&St!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(ro()&&e.callbackNode!==r)return null;var l=qe;return l=oi(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(up(e,l,t),Tp(e,tt()),e.callbackNode!=null&&e.callbackNode===r?kp.bind(null,e):null)}function Np(e,t){if(ro())return null;up(e,t,!0)}function xx(){Cx(function(){(Ye&6)!==0?Hr(ll,bx):Op()})}function Iu(){if(Ys===0){var e=er;e===0&&(e=_s,_s<<=1,(_s&261888)===0&&(_s=256)),Ys=e}return Ys}function Cp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:pl(""+e)}function Mp(e,t){var r=t.ownerDocument.createElement("input");return r.name=t.name,r.value=t.value,e.id&&r.setAttribute("form",e.id),t.parentNode.insertBefore(r,t),e=new FormData(e),r.parentNode.removeChild(r),e}function vx(e,t,r,l,c){if(t==="submit"&&r&&r.stateNode===c){var u=Cp((c[at]||null).action),p=l.submitter;p&&(t=(t=p[at]||null)?Cp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new xl("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ys!==0){var O=p?Mp(c,p):new FormData(c);du(r,{pending:!0,data:O,method:c.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=p?Mp(c,p):new FormData(c),du(r,{pending:!0,data:O,method:c.method,action:u},u,O))},currentTarget:c}]})}}for(var Qu=0;Qu<Nc.length;Qu++){var Ju=Nc[Qu],_x=Ju.toLowerCase(),wx=Ju[0].toUpperCase()+Ju.slice(1);Tn(_x,"on"+wx)}Tn(cd,"onAnimationEnd"),Tn(ud,"onAnimationIteration"),Tn(fd,"onAnimationStart"),Tn("dblclick","onDoubleClick"),Tn("focusin","onFocus"),Tn("focusout","onBlur"),Tn(Bb,"onTransitionRun"),Tn(Lb,"onTransitionStart"),Tn(Hb,"onTransitionCancel"),Tn(hd,"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 Ea="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(" "),Sx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ea));function Rp(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var l=e[r],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],O=b.instance,B=b.currentTarget;if(b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(I){wl(I)}c.currentTarget=null,u=O}else for(p=0;p<l.length;p++){if(b=l[p],O=b.instance,B=b.currentTarget,b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(I){wl(I)}c.currentTarget=null,u=O}}}}function De(e,t){var r=t[hi];r===void 0&&(r=t[hi]=new Set);var l=e+"__bubble";r.has(l)||(Dp(t,e,2,!1),r.add(l))}function Ku(e,t,r){var l=0;t&&(l|=4),Dp(r,e,l,t)}var oo="_reactListening"+Math.random().toString(36).slice(2);function Xu(e){if(!e[oo]){e[oo]=!0,q.forEach(function(r){r!=="selectionchange"&&(Sx.has(r)||Ku(r,!1,e),Ku(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[oo]||(t[oo]=!0,Ku("selectionchange",!1,t))}}function Dp(e,t,r,l){switch(c0(t)){case 2:var c=Xx;break;case 8:c=Zx;break;default:c=df}r=c.bind(null,t,r,e),c=void 0,!gc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,r,{capture:!0,passive:c}):e.addEventListener(t,r,!0):c!==void 0?e.addEventListener(t,r,{passive:c}):e.addEventListener(t,r,!1)}function Zu(e,t,r,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var O=p.tag;if((O===3||O===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(O=p.tag,O===5||O===6||O===26||O===27){l=u=p;continue e}b=b.parentNode}}l=l.return}Lh(function(){var B=u,I=pc(r),te=[];e:{var L=dd.get(e);if(L!==void 0){var Y=xl,ye=e;switch(e){case"keypress":if(gl(r)===0)break e;case"keydown":case"keyup":Y=yb;break;case"focusin":ye="focus",Y=_c;break;case"focusout":ye="blur",Y=_c;break;case"beforeblur":case"afterblur":Y=_c;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":Y=$h;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=ib;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=xb;break;case cd:case ud:case fd:Y=lb;break;case hd:Y=_b;break;case"scroll":case"scrollend":Y=nb;break;case"wheel":Y=Sb;break;case"copy":case"cut":case"paste":Y=cb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=Vh;break;case"toggle":case"beforetoggle":Y=Ab}var _e=(t&4)!==0,Je=!_e&&(e==="scroll"||e==="scrollend"),R=_e?L!==null?L+"Capture":null:L;_e=[];for(var C=B,U;C!==null;){var X=C;if(U=X.stateNode,X=X.tag,X!==5&&X!==26&&X!==27||U===null||R===null||(X=Fr(C,R),X!=null&&_e.push(Aa(C,X,U))),Je)break;C=C.return}0<_e.length&&(L=new Y(L,ye,null,r,I),te.push({event:L,listeners:_e}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",Y=e==="mouseout"||e==="pointerout",L&&r!==mc&&(ye=r.relatedTarget||r.fromElement)&&(x(ye)||ye[Qt]))break e;if((Y||L)&&(L=I.window===I?I:(L=I.ownerDocument)?L.defaultView||L.parentWindow:window,Y?(ye=r.relatedTarget||r.toElement,Y=B,ye=ye?x(ye):null,ye!==null&&(Je=f(ye),_e=ye.tag,ye!==Je||_e!==5&&_e!==27&&_e!==6)&&(ye=null)):(Y=null,ye=B),Y!==ye)){if(_e=$h,X="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(_e=Vh,X="onPointerLeave",R="onPointerEnter",C="pointer"),Je=Y==null?L:w(Y),U=ye==null?L:w(ye),L=new _e(X,C+"leave",Y,r,I),L.target=Je,L.relatedTarget=U,X=null,x(I)===B&&(_e=new _e(R,C+"enter",ye,r,I),_e.target=U,_e.relatedTarget=Je,X=_e),Je=X,Y&&ye)t:{for(_e=Ex,R=Y,C=ye,U=0,X=R;X;X=_e(X))U++;X=0;for(var ve=C;ve;ve=_e(ve))X++;for(;0<U-X;)R=_e(R),U--;for(;0<X-U;)C=_e(C),X--;for(;U--;){if(R===C||C!==null&&R===C.alternate){_e=R;break t}R=_e(R),C=_e(C)}_e=null}else _e=null;Y!==null&&qp(te,L,Y,_e,!1),ye!==null&&Je!==null&&qp(te,Je,ye,_e,!0)}}e:{if(L=B?w(B):window,Y=L.nodeName&&L.nodeName.toLowerCase(),Y==="select"||Y==="input"&&L.type==="file")var Pe=Zh;else if(Kh(L))if(Wh)Pe=qb;else{Pe=Rb;var ge=Mb}else Y=L.nodeName,!Y||Y.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&dc(B.elementType)&&(Pe=Zh):Pe=Db;if(Pe&&(Pe=Pe(e,B))){Xh(te,Pe,r,I);break e}ge&&ge(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&hc(L,"number",L.value)}switch(ge=B?w(B):window,e){case"focusin":(Kh(ge)||ge.contentEditable==="true")&&(Fi=ge,Oc=B,ea=null);break;case"focusout":ea=Oc=Fi=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,ld(te,r,I);break;case"selectionchange":if(Ub)break;case"keydown":case"keyup":ld(te,r,I)}var Ce;if(Sc)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?Qh(e,r)&&(ze="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(ze="onCompositionStart");ze&&(Gh&&r.locale!=="ko"&&(Gi||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Gi&&(Ce=Hh()):(Os=I,bc="value"in Os?Os.value:Os.textContent,Gi=!0)),ge=co(B,ze),0<ge.length&&(ze=new Yh(ze,e,null,r,I),te.push({event:ze,listeners:ge}),Ce?ze.data=Ce:(Ce=Jh(r),Ce!==null&&(ze.data=Ce)))),(Ce=Ob?Tb(e,r):kb(e,r))&&(ze=co(B,"onBeforeInput"),0<ze.length&&(ge=new Yh("onBeforeInput","beforeinput",null,r,I),te.push({event:ge,listeners:ze}),ge.data=Ce)),vx(te,e,B,r,I)}Rp(te,t)})}function Aa(e,t,r){return{instance:e,listener:t,currentTarget:r}}function co(e,t){for(var r=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Fr(e,r),c!=null&&l.unshift(Aa(e,c,u)),c=Fr(e,t),c!=null&&l.push(Aa(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Ex(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function qp(e,t,r,l,c){for(var u=t._reactName,p=[];r!==null&&r!==l;){var b=r,O=b.alternate,B=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||B===null||(O=B,c?(B=Fr(r,u),B!=null&&p.unshift(Aa(r,B,O))):c||(B=Fr(r,u),B!=null&&p.push(Aa(r,B,O)))),r=r.return}p.length!==0&&e.push({event:t,listeners:p})}var Ax=/\r\n?/g,jx=/\u0000|\uFFFD/g;function zp(e){return(typeof e=="string"?e:""+e).replace(Ax,`
26
+ `).replace(jx,"")}function Up(e,t){return t=zp(t),zp(e)===t}function Qe(e,t,r,l,c,u){switch(r){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||$i(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&$i(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":Uh(e,l,u);break;case"data":if(t!=="object"){On(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||r!=="href")){e.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=pl(""+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 u=="function"&&(r==="formAction"?(t!=="input"&&Qe(e,t,"name",c.name,c,null),Qe(e,t,"formEncType",c.formEncType,c,null),Qe(e,t,"formMethod",c.formMethod,c,null),Qe(e,t,"formTarget",c.formTarget,c,null)):(Qe(e,t,"encType",c.encType,c,null),Qe(e,t,"method",c.method,c,null),Qe(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(r);break}l=pl(""+l),e.setAttribute(r,l);break;case"onClick":l!=null&&(e.onclick=Zn);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=pl(""+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":Xn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Xn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Xn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Xn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Xn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Xn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Xn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Xn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Xn(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=eb.get(r)||r,qt(e,r,l))}}function Wu(e,t,r,l,c,u){switch(r){case"style":Uh(e,l,u);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"?$i(e,l):(typeof l=="number"||typeof l=="bigint")&&$i(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=Zn);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"),t=r.slice(2,c?r.length-7:void 0),u=e[at]||null,u=u!=null?u[r]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(t,l,c);break e}r in e?e[r]=l:l===!0?e.setAttribute(r,""):qt(e,r,l)}}}function Mt(e,t,r){switch(t){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,u;for(u in r)if(r.hasOwnProperty(u)){var p=r[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Qe(e,t,u,p,r,null)}}c&&Qe(e,t,"srcSet",r.srcSet,r,null),l&&Qe(e,t,"src",r.src,r,null);return;case"input":De("invalid",e);var b=u=p=c=null,O=null,B=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":B=I;break;case"value":u=I;break;case"defaultValue":b=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(a(137,t));break;default:Qe(e,t,l,I,r,null)}}Rh(e,u,b,O,B,p,c,!1);return;case"select":De("invalid",e),l=p=u=null;for(c in r)if(r.hasOwnProperty(c)&&(b=r[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Qe(e,t,c,b,r,null)}t=u,r=p,e.multiple=!!l,t!=null?Pi(e,!!l,t,!1):r!=null&&Pi(e,!!l,r,!0);return;case"textarea":De("invalid",e),u=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":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Qe(e,t,p,b,r,null)}qh(e,l,c,u);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,t,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<Ea.length;l++)De(Ea[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(B in r)if(r.hasOwnProperty(B)&&(l=r[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Qe(e,t,B,l,r,null)}return;default:if(dc(t)){for(I in r)r.hasOwnProperty(I)&&(l=r[I],l!==void 0&&Wu(e,t,I,l,r,void 0));return}}for(b in r)r.hasOwnProperty(b)&&(l=r[b],l!=null&&Qe(e,t,b,l,r,null))}function Ox(e,t,r,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,O=null,B=null,I=null;for(Y in r){var te=r[Y];if(r.hasOwnProperty(Y)&&te!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":O=te;default:l.hasOwnProperty(Y)||Qe(e,t,Y,null,l,te)}}for(var L in l){var Y=l[L];if(te=r[L],l.hasOwnProperty(L)&&(Y!=null||te!=null))switch(L){case"type":u=Y;break;case"name":c=Y;break;case"checked":B=Y;break;case"defaultChecked":I=Y;break;case"value":p=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Y!==te&&Qe(e,t,L,Y,l,te)}}fc(e,p,b,O,B,I,u,c);return;case"select":Y=p=b=L=null;for(u in r)if(O=r[u],r.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":Y=O;default:l.hasOwnProperty(u)||Qe(e,t,u,null,l,O)}for(c in l)if(u=l[c],O=r[c],l.hasOwnProperty(c)&&(u!=null||O!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==O&&Qe(e,t,c,u,l,O)}t=b,r=p,l=Y,L!=null?Pi(e,!!r,L,!1):!!l!=!!r&&(t!=null?Pi(e,!!r,t,!0):Pi(e,!!r,r?[]:"",!1));return;case"textarea":Y=L=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,t,b,null,l,c)}for(p in l)if(c=l[p],u=r[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":Y=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Qe(e,t,p,c,l,u)}Dh(e,L,Y);return;case"option":for(var ye in r)if(L=r[ye],r.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:Qe(e,t,ye,null,l,L)}for(O in l)if(L=l[O],Y=r[O],l.hasOwnProperty(O)&&L!==Y&&(L!=null||Y!=null))switch(O){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Qe(e,t,O,L,l,Y)}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)L=r[_e],r.hasOwnProperty(_e)&&L!=null&&!l.hasOwnProperty(_e)&&Qe(e,t,_e,null,l,L);for(B in l)if(L=l[B],Y=r[B],l.hasOwnProperty(B)&&L!==Y&&(L!=null||Y!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Qe(e,t,B,L,l,Y)}return;default:if(dc(t)){for(var Je in r)L=r[Je],r.hasOwnProperty(Je)&&L!==void 0&&!l.hasOwnProperty(Je)&&Wu(e,t,Je,void 0,l,L);for(I in l)L=l[I],Y=r[I],!l.hasOwnProperty(I)||L===Y||L===void 0&&Y===void 0||Wu(e,t,I,L,l,Y);return}}for(var R in r)L=r[R],r.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Qe(e,t,R,null,l,L);for(te in l)L=l[te],Y=r[te],!l.hasOwnProperty(te)||L===Y||L==null&&Y==null||Qe(e,t,te,L,l,Y)}function Bp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Tx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var c=r[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&Bp(p)){for(p=0,b=c.responseEnd,l+=1;l<r.length;l++){var O=r[l],B=O.startTime;if(B>b)break;var I=O.transferSize,te=O.initiatorType;I&&Bp(te)&&(O=O.responseEnd,p+=I*(O<b?1:(b-B)/(O-B)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var ef=null,tf=null;function uo(e){return e.nodeType===9?e:e.ownerDocument}function Lp(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 Hp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function nf(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var sf=null;function kx(){var e=window.event;return e&&e.type==="popstate"?e===sf?!1:(sf=e,!0):(sf=null,!1)}var Pp=typeof setTimeout=="function"?setTimeout:void 0,Nx=typeof clearTimeout=="function"?clearTimeout:void 0,$p=typeof Promise=="function"?Promise:void 0,Cx=typeof queueMicrotask=="function"?queueMicrotask:typeof $p<"u"?function(e){return $p.resolve(null).then(e).catch(Mx)}:Pp;function Mx(e){setTimeout(function(){throw e})}function Vs(e){return e==="head"}function Yp(e,t){var r=t,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),xr(t);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")ja(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,ja(r);for(var u=r.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[wt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||r.removeChild(u),u=p}}else r==="body"&&ja(e.ownerDocument.body);r=c}while(r);xr(t)}function Vp(e,t){var r=e;e=0;do{var l=r.nextSibling;if(r.nodeType===1?t?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(t?(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 rf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var r=t;switch(t=t.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":rf(r),Hi(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function Rx(e,t,r,l){for(;e.nodeType===1;){var c=r;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[wt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=vn(e.nextSibling),e===null)break}return null}function Dx(e,t,r){if(t==="")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 Gp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=vn(e.nextSibling),e===null))return null;return e}function af(e){return e.data==="$?"||e.data==="$~"}function lf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function qx(e,t){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||r.readyState!=="loading")t();else{var l=function(){t(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function vn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var of=null;function Fp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(t===0)return vn(e.nextSibling);t--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||t++}e=e.nextSibling}return null}function Ip(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(t===0)return e;t--}else r!=="/$"&&r!=="/&"||t++}e=e.previousSibling}return null}function Qp(e,t,r){switch(t=uo(r),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ja(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Hi(e)}var _n=new Map,Jp=new Set;function fo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ms=re.d;re.d={f:zx,r:Ux,D:Bx,C:Lx,L:Hx,m:Px,X:Yx,S:$x,M:Vx};function zx(){var e=ms.f(),t=no();return e||t}function Ux(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?hm(t):ms.r(e)}var yr=typeof document>"u"?null:document;function Kp(e,t,r){var l=yr;if(l&&typeof t=="string"&&t){var c=dn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof r=="string"&&(c+='[crossorigin="'+r+'"]'),Jp.has(c)||(Jp.add(c),e={rel:e,crossOrigin:r,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),Mt(t,"link",e),N(t),l.head.appendChild(t)))}}function Bx(e){ms.D(e),Kp("dns-prefetch",e,null)}function Lx(e,t){ms.C(e,t),Kp("preconnect",e,t)}function Hx(e,t,r){ms.L(e,t,r);var l=yr;if(l&&e&&t){var c='link[rel="preload"][as="'+dn(t)+'"]';t==="image"&&r&&r.imageSrcSet?(c+='[imagesrcset="'+dn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(c+='[imagesizes="'+dn(r.imageSizes)+'"]')):c+='[href="'+dn(e)+'"]';var u=c;switch(t){case"style":u=gr(e);break;case"script":u=br(e)}_n.has(u)||(e=_({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),_n.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(Oa(u))||t==="script"&&l.querySelector(Ta(u))||(t=l.createElement("link"),Mt(t,"link",e),N(t),l.head.appendChild(t)))}}function Px(e,t){ms.m(e,t);var r=yr;if(r&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+dn(l)+'"][href="'+dn(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=br(e)}if(!_n.has(u)&&(e=_({rel:"modulepreload",href:e},t),_n.set(u,e),r.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ta(u)))return}l=r.createElement("link"),Mt(l,"link",e),N(l),r.head.appendChild(l)}}}function $x(e,t,r){ms.S(e,t,r);var l=yr;if(l&&e){var c=A(l).hoistableStyles,u=gr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(Oa(u)))b.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":t},r),(r=_n.get(u))&&cf(e,r);var O=p=l.createElement("link");N(O),Mt(O,"link",e),O._p=new Promise(function(B,I){O.onload=B,O.onerror=I}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,ho(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function Yx(e,t){ms.X(e,t);var r=yr;if(r&&e){var l=A(r).hoistableScripts,c=br(e),u=l.get(c);u||(u=r.querySelector(Ta(c)),u||(e=_({src:e,async:!0},t),(t=_n.get(c))&&uf(e,t),u=r.createElement("script"),N(u),Mt(u,"link",e),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Vx(e,t){ms.M(e,t);var r=yr;if(r&&e){var l=A(r).hoistableScripts,c=br(e),u=l.get(c);u||(u=r.querySelector(Ta(c)),u||(e=_({src:e,async:!0,type:"module"},t),(t=_n.get(c))&&uf(e,t),u=r.createElement("script"),N(u),Mt(u,"link",e),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Xp(e,t,r,l){var c=(c=Et.current)?fo(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"?(t=gr(r.href),r=A(c).hoistableStyles,l=r.get(t),l||(l={type:"style",instance:null,count:0,state:null},r.set(t,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=gr(r.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(Oa(e)))&&!u._p&&(p.instance=u,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),u||Gx(c,e,r,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=br(r),r=A(c).hoistableScripts,l=r.get(t),l||(l={type:"script",instance:null,count:0,state:null},r.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function gr(e){return'href="'+dn(e)+'"'}function Oa(e){return'link[rel="stylesheet"]['+e+"]"}function Zp(e){return _({},e,{"data-precedence":e.precedence,precedence:null})}function Gx(e,t,r,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Mt(t,"link",r),N(t),e.head.appendChild(t))}function br(e){return'[src="'+dn(e)+'"]'}function Ta(e){return"script[async]"+e}function Wp(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+dn(r.href)+'"]');if(l)return t.instance=l,N(l),l;var c=_({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),Mt(l,"style",c),ho(l,r.precedence,e),t.instance=l;case"stylesheet":c=gr(r.href);var u=e.querySelector(Oa(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Zp(r),(c=_n.get(c))&&cf(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),Mt(u,"link",l),t.state.loading|=4,ho(u,r.precedence,e),t.instance=u;case"script":return u=br(r.src),(c=e.querySelector(Ta(u)))?(t.instance=c,N(c),c):(l=r,(c=_n.get(u))&&(l=_({},r),uf(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),Mt(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,ho(l,r.precedence,e));return t.instance}function ho(e,t,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=r.nodeType===9?r.head:r,t.insertBefore(e,t.firstChild))}function cf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function uf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var mo=null;function e0(e,t,r){if(mo===null){var l=new Map,c=mo=new Map;c.set(r,l)}else c=mo,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 u=r[c];if(!(u[wt]||u[Ke]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function t0(e,t,r){e=e.ownerDocument||e,e.head.insertBefore(r,t==="title"?e.querySelector("head > title"):null)}function Fx(e,t,r){if(r===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function n0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ix(e,t,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=gr(l.href),u=t.querySelector(Oa(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=po.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=u,N(u);return}u=t.ownerDocument||t,l=Zp(l),(c=_n.get(c))&&cf(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),Mt(u,"link",l),r.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=po.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var ff=0;function Qx(e,t){return e.stylesheets&&e.count===0&&go(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var l=setTimeout(function(){if(e.stylesheets&&go(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&ff===0&&(ff=62500*Tx());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&go(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>ff?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function po(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var yo=null;function go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,yo=new Map,t.forEach(Jx,e),yo=null,po.call(e))}function Jx(e,t){if(!(t.state.loading&4)){var r=yo.get(e);if(r)var l=r.get(null);else{r=new Map,yo.set(e,r);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(r.set(p.dataset.precedence,p),l=p)}l&&r.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=r.get(p)||l,u===l&&r.set(null,c),r.set(p,c),this.count++,l=po.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ka={$$typeof:ce,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function Kx(e,t,r,l,c,u,p,b,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=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=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function s0(e,t,r,l,c,u,p,b,O,B,I,te){return e=new Kx(e,t,r,p,O,B,I,te,b),t=1,u===!0&&(t|=24),u=Kt(3,null,null,t),e.current=u,u.stateNode=e,t=Yc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:r,cache:t},Ic(u),e}function i0(e){return e?(e=Ji,e):Ji}function r0(e,t,r,l,c,u){c=i0(c),l.context===null?l.context=c:l.pendingContext=c,l=Rs(t),l.payload={element:r},u=u===void 0?null:u,u!==null&&(l.callback=u),r=Ds(e,l,t),r!==null&&(Gt(r,e,t),la(r,e,t))}function a0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function hf(e,t){a0(e,t),(e=e.alternate)&&a0(e,t)}function l0(e){if(e.tag===13||e.tag===31){var t=yi(e,67108864);t!==null&&Gt(t,e,67108864),hf(e,67108864)}}function o0(e){if(e.tag===13||e.tag===31){var t=tn();t=Kn(t);var r=yi(e,t);r!==null&&Gt(r,e,t),hf(e,t)}}var bo=!0;function Xx(e,t,r,l){var c=$.T;$.T=null;var u=re.p;try{re.p=2,df(e,t,r,l)}finally{re.p=u,$.T=c}}function Zx(e,t,r,l){var c=$.T;$.T=null;var u=re.p;try{re.p=8,df(e,t,r,l)}finally{re.p=u,$.T=c}}function df(e,t,r,l){if(bo){var c=mf(l);if(c===null)Zu(e,t,l,xo,r),u0(e,l);else if(ev(c,e,t,r,l))l.stopPropagation();else if(u0(e,l),t&4&&-1<Wx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=An(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var O=1<<31-Dt(p);b.entanglements[1]|=O,p&=~O}Pn(u),(Ye&6)===0&&(eo=tt()+500,Sa(0))}}break;case 31:case 13:b=yi(u,2),b!==null&&Gt(b,u,2),no(),hf(u,2)}if(u=mf(l),u===null&&Zu(e,t,l,xo,r),u===c)break;c=u}c!==null&&l.stopPropagation()}else Zu(e,t,l,null,r)}}function mf(e){return e=pc(e),pf(e)}var xo=null;function pf(e){if(xo=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var r=t.tag;if(r===13){if(e=d(t),e!==null)return e;e=null}else if(r===31){if(e=m(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xo=e,null}function c0(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(lc()){case ll:return 2;case ol:return 8;case Ui:case oc:return 32;case cl:return 268435456;default:return 32}default:return 32}}var yf=!1,Gs=null,Fs=null,Is=null,Na=new Map,Ca=new Map,Qs=[],Wx="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 u0(e,t){switch(e){case"focusin":case"focusout":Gs=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":Is=null;break;case"pointerover":case"pointerout":Na.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ca.delete(t.pointerId)}}function Ma(e,t,r,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:r,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&l0(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function ev(e,t,r,l,c){switch(t){case"focusin":return Gs=Ma(Gs,e,t,r,l,c),!0;case"dragenter":return Fs=Ma(Fs,e,t,r,l,c),!0;case"mouseover":return Is=Ma(Is,e,t,r,l,c),!0;case"pointerover":var u=c.pointerId;return Na.set(u,Ma(Na.get(u)||null,e,t,r,l,c)),!0;case"gotpointercapture":return u=c.pointerId,Ca.set(u,Ma(Ca.get(u)||null,e,t,r,l,c)),!0}return!1}function f0(e){var t=x(e.target);if(t!==null){var r=f(t);if(r!==null){if(t=r.tag,t===13){if(t=d(r),t!==null){e.blockedOn=t,fl(e.priority,function(){o0(r)});return}}else if(t===31){if(t=m(r),t!==null){e.blockedOn=t,fl(e.priority,function(){o0(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=mf(e.nativeEvent);if(r===null){r=e.nativeEvent;var l=new r.constructor(r.type,r);mc=l,r.target.dispatchEvent(l),mc=null}else return t=S(r),t!==null&&l0(t),e.blockedOn=r,!1;t.shift()}return!0}function h0(e,t,r){vo(e)&&r.delete(t)}function tv(){yf=!1,Gs!==null&&vo(Gs)&&(Gs=null),Fs!==null&&vo(Fs)&&(Fs=null),Is!==null&&vo(Is)&&(Is=null),Na.forEach(h0),Ca.forEach(h0)}function _o(e,t){e.blockedOn===t&&(e.blockedOn=null,yf||(yf=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,tv)))}var wo=null;function d0(e){wo!==e&&(wo=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){wo===e&&(wo=null);for(var t=0;t<e.length;t+=3){var r=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(pf(l||r)===null)continue;break}var u=S(r);u!==null&&(e.splice(t,3),t-=3,du(u,{pending:!0,data:c,method:r.method,action:l},l,c))}}))}function xr(e){function t(O){return _o(O,e)}Gs!==null&&_o(Gs,e),Fs!==null&&_o(Fs,e),Is!==null&&_o(Is,e),Na.forEach(t),Ca.forEach(t);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);)f0(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],u=r[l+1],p=c[at]||null;if(typeof u=="function")p||d0(r);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[at]||null)b=p.formAction;else if(pf(c)!==null)continue}else b=p.action;typeof b=="function"?r[l+1]=b:(r.splice(l,3),l-=3),d0(r)}}}function m0(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function gf(e){this._internalRoot=e}So.prototype.render=gf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var r=t.current,l=tn();r0(r,l,e,t,null,null)},So.prototype.unmount=gf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;r0(e.current,2,null,e,null,null),no(),t[Qt]=null}};function So(e){this._internalRoot=e}So.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vr();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Qs.length&&t!==0&&t<Qs[r].priority;r++);Qs.splice(r,0,e),r===0&&f0(e)}};var p0=n.version;if(p0!=="19.2.4")throw Error(a(527,p0,"19.2.4"));re.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=g(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var nv={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Eo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Eo.isDisabled&&Eo.supportsFiber)try{li=Eo.inject(nv),ut=Eo}catch{}}return Ra.createRoot=function(e,t){if(!o(e))throw Error(a(299));var r=!1,l="",c=wm,u=Sm,p=Em;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=s0(e,1,!1,null,null,r,l,null,c,u,p,m0),e[Qt]=t.current,Xu(e),new gf(t)},Ra.hydrateRoot=function(e,t,r){if(!o(e))throw Error(a(299));var l=!1,c="",u=wm,p=Sm,b=Em,O=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(u=r.onUncaughtError),r.onCaughtError!==void 0&&(p=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError),r.formState!==void 0&&(O=r.formState)),t=s0(e,1,!0,t,r??null,l,c,O,u,p,b,m0),t.context=i0(null),r=t.current,l=tn(),l=Kn(l),c=Rs(l),c.callback=null,Ds(r,c,l),r=l,t.current.lanes=r,jn(t,r),Pn(t),e[Qt]=t.current,Xu(e),new So(t)},Ra.version="19.2.4",Ra}var E0;function Yv(){if(E0)return bf.exports;E0=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(n){console.error(n)}}return i(),bf.exports=$v(),bf.exports}var Vv=Yv();const Gv="modulepreload",Fv=function(i,n){return new URL(i,n).href},A0={},Ee=function(n,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=Fv(E,a),E in A0)return;A0[E]=!0;const _=E.endsWith(".css"),T=_?'[rel="stylesheet"]':"";if(!!a)for(let D=m.length-1;D>=0;D--){const J=m[D];if(J.href===E&&(!_||J.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${T}`))return;const M=document.createElement("link");if(M.rel=_?"stylesheet":Gv,_||(M.as="script"),M.crossOrigin="",M.href=E,g&&M.setAttribute("nonce",g),document.head.appendChild(M),_)return new Promise((D,J)=>{M.addEventListener("load",D),M.addEventListener("error",()=>J(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(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"&&f(m.reason);return n().catch(f)})};function lh(i){try{const n=i.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function Uy(i){const n=lh(i);return!n||typeof n.exp!="number"?null:n.exp}function oh(i,n=0){const s=Uy(i);return s===null?!0:Date.now()/1e3>=s-n}const Ft=window.__LT_BASE__??"",qf=`${Ft}/api`;let Zs=null;function Ao(i){Zs=i}function By(){return Zs}async function j0(){const i=sessionStorage.getItem("lt_credentials");if(!i)return null;try{const{username:n,password:s}=JSON.parse(i),a=await fetch(`${qf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Ks=null;async function Te(i,n={}){const s={"Content-Type":"application/json",...n.headers};if(Zs){if(oh(Zs)){Ks||(Ks=j0().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(`${qf}${i}`,{...n,headers:s});if(a.status===401&&Zs){Ks||(Ks=j0().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(`${qf}${i}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const Ly=j.createContext(null),Iv=300;function _f(i,n){if(oh(i))return null;const s=lh(i);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function Qv({children:i}){const[n,s]=j.useState(()=>{const _=sessionStorage.getItem("lt_token");return _?oh(_)?(sessionStorage.removeItem("lt_token"),null):(Ao(_),_f(_)):null}),a=j.useRef(void 0),o=j.useCallback(_=>{clearTimeout(a.current);const T=Uy(_);if(!T)return;const z=(T-Iv)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{try{const M=lh(_);if(M!=null&&M.sso){const ae=await fetch(`${Ft}/api/auth/sso`,{method:"POST"});if(!ae.ok)return;const k=await ae.json();k.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:k.token}}));return}const D=sessionStorage.getItem("lt_credentials");if(!D)return;const{username:J,password:ie}=JSON.parse(D),G=await fetch(`${Ft}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:J,password:ie})});if(!G.ok)return;const ce=await G.json();ce.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ce.token}}))}catch{}},z))},[]),f=j.useCallback((_,T,z)=>{const M={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(T==null?void 0:T.username)??null},D=_f(_,M);D&&(Ao(_),sessionStorage.setItem("lt_token",_),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),T&&sessionStorage.setItem("lt_credentials",JSON.stringify(T)),s(D),o(_))},[o]),d=j.useCallback(()=>{clearTimeout(a.current);const _=sessionStorage.getItem("lt_sso_logout_url");Ao(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=_)},[]);j.useEffect(()=>{const _=()=>d(),T=z=>{var J;const M=(J=z.detail)==null?void 0:J.token;if(!M)return;const D=_f(M);D&&(Ao(M),sessionStorage.setItem("lt_token",M),s(D),o(M))};return window.addEventListener("auth:unauthorized",_),window.addEventListener("auth:refreshed",T),()=>{window.removeEventListener("auth:unauthorized",_),window.removeEventListener("auth:refreshed",T)}},[d,o]),j.useEffect(()=>{const _=sessionStorage.getItem("lt_token");return _&&n&&o(_),()=>clearTimeout(a.current)},[]);const m=(n==null?void 0:n.roles.some(_=>_.type==="superadmin"))??!1,y=j.useCallback(_=>(n==null?void 0:n.roles.some(T=>T.role===_))??!1,[n]),g=j.useCallback(_=>(n==null?void 0:n.roles.some(T=>T.type===_))??!1,[n]),E=(n==null?void 0:n.roles.map(_=>_.role))??[];return h.jsx(Ly.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:m,login:f,logout:d,hasRole:y,hasRoleType:g,userRoleNames:E},children:i})}function In(){const i=j.useContext(Ly);if(!i)throw new Error("useAuth must be used within AuthProvider");return i}const on=new Uint8Array(0),Di=new TextEncoder,an=new TextDecoder;function Jv(...i){let n=0;for(let o=0;o<i.length;o++)n+=i[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<i.length;o++)s.set(i[o],a),a+=i[o].length;return s}function Va(...i){const n=[];for(let s=0;s<i.length;s++)n.push(Di.encode(i[s]));return n.length===0?on:n.length===1?n[0]:Jv(...n)}function O0(i){return!i||i.length===0?"":an.decode(i)}const T0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",k0=36,Kv=0xcfd41b9100000,N0=33,Xv=333,C0=22;function Zv(i){for(let n=0;n<i.length;n++)i[n]=Math.floor(Math.random()*255)}function Wv(i){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(i):Zv(i)}class e1{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(C0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Kv),this.inc=Math.floor(Math.random()*(Xv-N0)+N0)}setPre(){const n=new Uint8Array(12);Wv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=T0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=C0-1;s>=12;s--)this.buf[s]=T0.charCodeAt(n%k0),n=Math.floor(n/k0)}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 si=new e1;var ps;(function(i){i.Disconnect="disconnect",i.Reconnect="reconnect",i.Update="update",i.LDM="ldm",i.Error="error"})(ps||(ps={}));var Tr;(function(i){i.Reconnecting="reconnecting",i.PingTimer="pingTimer",i.StaleConnection="staleConnection",i.ClientInitiatedReconnect="client initiated reconnect"})(Tr||(Tr={}));var le;(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"})(le||(le={}));function t1(i){return typeof i.code=="string"}class Hy{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(le.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(le.BadJson,"Bad JSON"),this.messages.set(le.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return n1.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const n1=new Hy;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=Hy.getMessage(s);return new me(o,s,a)}isAuthError(){return this.code===le.AuthenticationExpired||this.code===le.AuthorizationViolation||this.code===le.AccountExpired}isAuthTimeout(){return this.code===le.AuthenticationTimeout}isPermissionError(){return this.code===le.PermissionsViolation}isProtocolError(){return this.code===le.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 Ga;(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"})(Ga||(Ga={}));const Vo="Nats-Service-Error",Go="Nats-Service-Error-Code";class Fo extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Fo.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Go))||"";if(a!==""){const d=parseInt(a)||400,m=((f=s==null?void 0:s.headers)==null?void 0:f.get(Vo))||"";return new Fo(d,m.length?m:a)}return null}}function ys(i=""){if(i=i||"_INBOX",typeof i!="string")throw new Error("prefix must be a string");return i.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${i}'`)}),`${i}.${si.next()}`}const zf="127.0.0.1";var Ws;(function(i){i.PING="PING",i.STATS="STATS",i.INFO="INFO"})(Ws||(Ws={}));function tc(i,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){i[o]=a[o]})}return i}function jo(i){return an.decode(i).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Rr(i,n=!0){const s=n?me.errorForCode(le.Timeout):null;let a,o;const f=new Promise((d,m)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{m(s===null?me.errorForCode(le.Timeout):s)},i)});return Object.assign(f,a)}function zr(i=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},i);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function it(){let i={};const n=new Promise((s,a)=>{i={resolve:s,reject:a}});return Object.assign(n,i)}function Py(i){for(let n=i.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[i[n],i[s]]=[i[s],i[n]]}return i}function s1(i){return i===0?0:Math.floor(i/2+Math.random()*i)}function ch(i=[0,250,250,500,500,3e3,5e3]){Array.isArray(i)||(i=[0,250,250,500,500,3e3,5e3]);const n=i.length-1;return{backoff(s){return s1(s>n?i[n]:i[s])}}}function st(i){return i*1e6}function uh(i){return Math.floor(i/1e6)}function M0(i){let a=!0;const o=new Array(i.length);for(let f=0;f<i.length;f++){let d=i.charCodeAt(f);if(d===58||d<33||d>126)throw new me(`'${i[f]}' is not a valid character for a header key`,le.BadHeader);a&&97<=d&&d<=122?d-=32:!a&&65<=d&&d<=90&&(d+=32),o[f]=d,a=d==45}return String.fromCharCode(...o)}function gs(i=0,n=""){if(i===0&&n!==""||i>0&&n==="")throw new Error("setting status requires both code and description");return new ei(i,n)}const wf="NATS/1.0";class ei{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),d=[...o].sort();for(let m=0;m<f.length;m++)if(f[m]!==d[m])return!1}return!0}return!1}static decode(n){const s=new ei,o=an.decode(n).split(`\r
27
+ `),f=o[0];if(f!==wf){let d=f.replace(wf,"").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 n=wf;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)n=`${n}\r
28
+ ${s}: ${a[o]}`;return`${n}\r
29
+ \r
30
+ `}encode(){return Di.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new me("invalid header value - \\r and \\n are not allowed.",le.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=sn.Exact){const a=this.keys();switch(s){case sn.Exact:return a.filter(o=>o===n);case sn.CanonicalMIME:return n=M0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=sn.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=sn.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,s=sn.Exact){return this.findKeys(n,s).length>0}set(n,s,a=sn.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=sn.Exact){const o=M0(n);a===sn.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const d=ei.validHeaderValue(s);let m=this.headers.get(n);m||(m=[],this.headers.set(n,m)),m.push(d)}values(n,s=sn.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const d=this.headers.get(f);d&&a.push(...d)}),a}delete(n,s=sn.Exact){this.findKeys(n,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new ei;for(const a in n)s.headers.set(a,n[a]);return s}}function Uf(){return{encode(i){return Di.encode(i)},decode(i){return an.decode(i)}}}function qn(i){return{encode(n){try{return n===void 0&&(n=null),Di.encode(JSON.stringify(n))}catch(s){throw me.errorForCode(le.BadJson,s)}},decode(n){try{return JSON.parse(an.decode(n),i)}catch(s){throw me.errorForCode(le.BadJson,s)}}}}function $y(i){var n;return i&&i.data.length===0&&((n=i.headers)==null?void 0:n.code)===503?me.errorForCode(le.NoResponders):null}class fh{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=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 n=this._rdata.subarray(0,this._msg.hdr);this._headers=ei.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=on,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return qn(n).decode(this.data)}string(){return an.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(fh,"jc");function kr(i){return nc("durable",i)}function Ut(i){return nc("stream",i)}function nc(i,n=""){if(n==="")throw Error(`${i} name required`);return[".","*",">","/","\\"," "," ",`
31
+ `,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
32
+ `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${i} name - ${i} name cannot contain '${a}'`)}}),""}function Ha(i,n=""){if(n==="")throw Error(`${i} name required`);const s=i1(n);if(s.length)throw new Error(`invalid ${i} name - ${i} name ${s}`)}function i1(i=""){if(i==="")throw Error("name required");const n=/^[-\w]+$/g;if(i.match(n)===null){for(const a of i.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Bf(i){if(i.data.length>0)return!1;const n=i.headers;return n?n.code>=100&&n.code<200:!1}function Lf(i){var n;return Bf(i)&&((n=i.headers)==null?void 0:n.description)==="Idle Heartbeat"}function r1(i,n,s){const a=gs(i,n),o={hdr:1,sid:0,size:0},f=new fh(o,on,{});return f._headers=a,f._subject=s,f}function Nr(i){if(i.data.length!==0)return null;const n=i.headers;return n?Yy(n.code,n.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 a1(i){return i.code!==le.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 Yy(i,n=""){if(i<300)return null;switch(n=n.toLowerCase(),i){case 404:return new me(n,le.JetStream404NoMessages);case 408:return new me(n,le.JetStream408RequestTimeout);case 409:{const s=n.startsWith(Sn.IdleHeartbeatMissed)?le.JetStreamIdleHeartBeat:le.JetStream409;return new me(n,s)}case 503:return me.errorForCode(le.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=le.Unknown),new me(n,`${i}`)}}class Ot{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(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new me("unsupported iterator",le.ApiError);if(this.yielding)throw new me("already yielding",le.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=it())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class hh{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Hf;(function(i){i.Limits="limits",i.Interest="interest",i.Workqueue="workqueue"})(Hf||(Hf={}));var Ja;(function(i){i.Old="old",i.New="new"})(Ja||(Ja={}));var Pf;(function(i){i.File="file",i.Memory="memory"})(Pf||(Pf={}));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 jt;(function(i){i.None="none",i.All="all",i.Explicit="explicit",i.NotSet=""})(jt||(jt={}));var Dr;(function(i){i.Instant="instant",i.Original="original"})(Dr||(Dr={}));var ii;(function(i){i.None="none",i.S2="s2"})(ii||(ii={}));var Io;(function(i){i.CreateOrUpdate="",i.Update="update",i.Create="create"})(Io||(Io={}));function l1(i,n={}){return Object.assign({name:i,deliver_policy:dt.All,ack_policy:jt.Explicit,ack_wait:st(30*1e3),replay_policy:Dr.Instant},n)}var R0;(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"})(R0||(R0={}));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 Er;(function(i){i.Stream="Nats-Stream",i.Sequence="Nats-Sequence",i.TimeStamp="Nats-Time-Stamp",i.Subject="Nats-Subject"})(Er||(Er={}));var D0;(function(i){i.Stream="Nats-Stream",i.Subject="Nats-Subject",i.Sequence="Nats-Sequence",i.LastSequence="Nats-Last-Sequence",i.Size="Nats-Msg-Size"})(D0||(D0={}));const rn="KV_";class o1{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=l1("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?jt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return kr(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=dt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=dt.StartTime,this.config.opt_start_time=n.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(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=jt.None,this}ackAll(){return this.config.ack_policy=jt.All,this}ackExplicit(){return this.config.ack_policy=jt.Explicit,this}ackWait(n){return this.config.ack_wait=st(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Dr.Instant,this}replayOriginal(){return this.config.replay_policy=Dr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=st(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=st(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=st(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function ti(i){return new o1(i)}function q0(i){return typeof i.getOpts=="function"}class c1{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class Cr{static encode(n){return Cr.toB64URLEncoding(c1.encode(n))}static decode(n,s=!1){return Cr.decode(Cr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class qr{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),Di.encode(n)}static toAscii(n){return an.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function u1(i,n){return n.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 f1=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Da=f1.performance||{};Da.now||Da.mozNow||Da.msNow||Da.oNow||Da.webkitNow;var z0={versions:{}},h1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d1(i){if(i.__esModule)return i;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(s){var a=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return i[s]}})}),n}var Sf,sc={exports:{}},U0={},B0=d1(u1({__proto__:null,default:U0},[U0]));Sf=sc,(function(){var i="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&z0.versions&&z0.versions.node;o?s=h1:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&Sf.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(k){return Object.prototype.toString.call(k)==="[object Array]"}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var z=function(k,Z){return function(oe){return new G(Z,!0).update(oe)[k]()}},M=function(k){var Z=z("hex",k);o&&(Z=D(Z,k)),Z.create=function(){return new G(k)},Z.update=function(V){return Z.create().update(V)};for(var oe=0;oe<_.length;++oe){var F=_[oe];Z[F]=z(F,k)}return Z},D=function(k,Z){var oe,F=B0,V=B0.Buffer,K=Z?"sha224":"sha256";return oe=V.from&&!s.JS_SHA256_NO_BUFFER_FROM?V.from:function(Q){return new V(Q)},function(Q){if(typeof Q=="string")return F.createHash(K).update(Q,"utf8").digest("hex");if(Q==null)throw new Error(i);return Q.constructor===ArrayBuffer&&(Q=new Uint8Array(Q)),Array.isArray(Q)||ArrayBuffer.isView(Q)||Q.constructor===V?F.createHash(K).update(oe(Q)).digest("hex"):k(Q)}},J=function(k,Z){return function(oe,F){return new ce(oe,Z,!0).update(F)[k]()}},ie=function(k){var Z=J("hex",k);Z.create=function(V){return new ce(V,k)},Z.update=function(V,K){return Z.create(V).update(K)};for(var oe=0;oe<_.length;++oe){var F=_[oe];Z[F]=J(F,k)}return Z};function G(k,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],k?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=k}function ce(k,Z,oe){var F,V=typeof k;if(V==="string"){var K,Q=[],se=k.length,he=0;for(F=0;F<se;++F)(K=k.charCodeAt(F))<128?Q[he++]=K:K<2048?(Q[he++]=192|K>>>6,Q[he++]=128|63&K):K<55296||K>=57344?(Q[he++]=224|K>>>12,Q[he++]=128|K>>>6&63,Q[he++]=128|63&K):(K=65536+((1023&K)<<10|1023&k.charCodeAt(++F)),Q[he++]=240|K>>>18,Q[he++]=128|K>>>12&63,Q[he++]=128|K>>>6&63,Q[he++]=128|63&K);k=Q}else{if(V!=="object")throw new Error(i);if(k===null)throw new Error(i);if(d&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||d&&ArrayBuffer.isView(k)))throw new Error(i)}k.length>64&&(k=new G(Z,!0).update(k).array());var Se=[],ke=[];for(F=0;F<64;++F){var $=k[F]||0;Se[F]=92^$,ke[F]=54^$}G.call(this,Z,oe),this.update(ke),this.oKeyPad=Se,this.inner=!0,this.sharedMemory=oe}G.prototype.update=function(k){if(!this.finalized){var Z,oe=typeof k;if(oe!=="string"){if(oe!=="object")throw new Error(i);if(k===null)throw new Error(i);if(d&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||d&&ArrayBuffer.isView(k)))throw new Error(i);Z=!0}for(var F,V,K=0,Q=k.length,se=this.blocks;K<Q;){if(this.hashed&&(this.hashed=!1,se[0]=this.block,this.block=se[16]=se[1]=se[2]=se[3]=se[4]=se[5]=se[6]=se[7]=se[8]=se[9]=se[10]=se[11]=se[12]=se[13]=se[14]=se[15]=0),Z)for(V=this.start;K<Q&&V<64;++K)se[V>>>2]|=k[K]<<g[3&V++];else for(V=this.start;K<Q&&V<64;++K)(F=k.charCodeAt(K))<128?se[V>>>2]|=F<<g[3&V++]:F<2048?(se[V>>>2]|=(192|F>>>6)<<g[3&V++],se[V>>>2]|=(128|63&F)<<g[3&V++]):F<55296||F>=57344?(se[V>>>2]|=(224|F>>>12)<<g[3&V++],se[V>>>2]|=(128|F>>>6&63)<<g[3&V++],se[V>>>2]|=(128|63&F)<<g[3&V++]):(F=65536+((1023&F)<<10|1023&k.charCodeAt(++K)),se[V>>>2]|=(240|F>>>18)<<g[3&V++],se[V>>>2]|=(128|F>>>12&63)<<g[3&V++],se[V>>>2]|=(128|F>>>6&63)<<g[3&V++],se[V>>>2]|=(128|63&F)<<g[3&V++]);this.lastByteIndex=V,this.bytes+=V-this.start,V>=64?(this.block=se[16],this.start=V-64,this.hash(),this.hashed=!0):this.start=V}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},G.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,Z=this.lastByteIndex;k[16]=this.block,k[Z>>>2]|=y[3&Z],this.block=k[16],Z>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},G.prototype.hash=function(){var k,Z,oe,F,V,K,Q,se,he,Se=this.h0,ke=this.h1,$=this.h2,re=this.h3,de=this.h4,je=this.h5,P=this.h6,be=this.h7,xe=this.blocks;for(k=16;k<64;++k)Z=((V=xe[k-15])>>>7|V<<25)^(V>>>18|V<<14)^V>>>3,oe=((V=xe[k-2])>>>17|V<<15)^(V>>>19|V<<13)^V>>>10,xe[k]=xe[k-16]+Z+xe[k-7]+oe|0;for(he=ke&$,k=0;k<64;k+=4)this.first?(this.is224?(K=300032,be=(V=xe[0]-1413257819)-150054599|0,re=V+24177077|0):(K=704751109,be=(V=xe[0]-210244248)-1521486534|0,re=V+143694565|0),this.first=!1):(Z=(Se>>>2|Se<<30)^(Se>>>13|Se<<19)^(Se>>>22|Se<<10),F=(K=Se&ke)^Se&$^he,be=re+(V=be+(oe=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&je^~de&P)+E[k]+xe[k])|0,re=V+(Z+F)|0),Z=(re>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),F=(Q=re&Se)^re&ke^K,P=$+(V=P+(oe=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&de^~be&je)+E[k+1]+xe[k+1])|0,Z=(($=V+(Z+F)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),F=(se=$&re)^$&Se^Q,je=ke+(V=je+(oe=(P>>>6|P<<26)^(P>>>11|P<<21)^(P>>>25|P<<7))+(P&be^~P&de)+E[k+2]+xe[k+2])|0,Z=((ke=V+(Z+F)|0)>>>2|ke<<30)^(ke>>>13|ke<<19)^(ke>>>22|ke<<10),F=(he=ke&$)^ke&re^se,de=Se+(V=de+(oe=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&P^~je&be)+E[k+3]+xe[k+3])|0,Se=V+(Z+F)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Se|0,this.h1=this.h1+ke|0,this.h2=this.h2+$|0,this.h3=this.h3+re|0,this.h4=this.h4+de|0,this.h5=this.h5+je|0,this.h6=this.h6+P|0,this.h7=this.h7+be|0},G.prototype.hex=function(){this.finalize();var k=this.h0,Z=this.h1,oe=this.h2,F=this.h3,V=this.h4,K=this.h5,Q=this.h6,se=this.h7,he=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[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[oe>>>28&15]+m[oe>>>24&15]+m[oe>>>20&15]+m[oe>>>16&15]+m[oe>>>12&15]+m[oe>>>8&15]+m[oe>>>4&15]+m[15&oe]+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[V>>>28&15]+m[V>>>24&15]+m[V>>>20&15]+m[V>>>16&15]+m[V>>>12&15]+m[V>>>8&15]+m[V>>>4&15]+m[15&V]+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[Q>>>28&15]+m[Q>>>24&15]+m[Q>>>20&15]+m[Q>>>16&15]+m[Q>>>12&15]+m[Q>>>8&15]+m[Q>>>4&15]+m[15&Q];return this.is224||(he+=m[se>>>28&15]+m[se>>>24&15]+m[se>>>20&15]+m[se>>>16&15]+m[se>>>12&15]+m[se>>>8&15]+m[se>>>4&15]+m[15&se]),he},G.prototype.toString=G.prototype.hex,G.prototype.digest=function(){this.finalize();var k=this.h0,Z=this.h1,oe=this.h2,F=this.h3,V=this.h4,K=this.h5,Q=this.h6,se=this.h7,he=[k>>>24&255,k>>>16&255,k>>>8&255,255&k,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,oe>>>24&255,oe>>>16&255,oe>>>8&255,255&oe,F>>>24&255,F>>>16&255,F>>>8&255,255&F,V>>>24&255,V>>>16&255,V>>>8&255,255&V,K>>>24&255,K>>>16&255,K>>>8&255,255&K,Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q];return this.is224||he.push(se>>>24&255,se>>>16&255,se>>>8&255,255&se),he},G.prototype.array=G.prototype.digest,G.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),Z=new DataView(k);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),k},ce.prototype=new G,ce.prototype.finalize=function(){if(G.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();G.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),G.prototype.finalize.call(this)}};var ae=M();ae.sha256=ae,ae.sha224=M(!0),ae.sha256.hmac=ie(),ae.sha224.hmac=ie(!0),f?Sf.exports=ae:(s.sha256=ae.sha256,s.sha224=ae.sha224)})();sc.exports;sc.exports.sha224;var L0=sc.exports.sha256;function $f(i){return x1(i)}function m1(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 p1(i){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(i)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(i)}function y1(i){return m1(i)?"hex":p1(i)?"b64":""}function g1(i){if(i.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(i.length/2);for(let s=0;s<i.length;s+=2)n[s/2]=parseInt(i.substring(s,s+2),16);return n}function b1(i){i=i.replace(/-/g,"+"),i=i.replace(/_/g,"/");const n=atob(i);return Uint8Array.from(n,s=>s.charCodeAt(0))}function x1(i){switch(y1(i)){case"hex":return g1(i);case"b64":return b1(i)}return null}function v1(i,n){const s=typeof i=="string"?$f(i):i,a=typeof n=="string"?$f(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class Vy{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=si.next(),a&&(this.ctx=new Error)}}class _1 extends Vy{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 Gy extends Vy{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=it(),this.timer=Rr(o.timeout,f)}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(le.Cancelled))}}const w1="$JS.API";function S1(i){return i=i||{},i.domain&&(i.apiPrefix=`$JS.${i.domain}.API`,delete i.domain),tc({apiPrefix:w1,timeout:5e3},i)}class el{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=S1(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=qn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let o=on;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const d=ch();for(let m=0;m<f;m++)try{const y=await this.nc.request(n,o,a);return this.parseJsResponse(y)}catch(y){const g=y;if((g.code==="503"||g.code===le.Timeout)&&m+1<f)await zr(d.backoff(m));else throw y}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=Yy(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Pa{constructor(n,s,a,o){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,o;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((o=n.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Ci(i=""){const n=i.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${i}' is not a semver value`)}function Yf(i,n){return i.major<n.major?-1:i.major>n.major?1:i.minor<n.minor?-1:i.minor>n.minor?1:i.micro<n.micro?-1:i.micro>n.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 E1{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Ci(n)),this.server=n,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(n,s){this.features.set(n,{min:s,ok:Yf(this.server,Ci(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Ci(n)),Yf(this.server,n)>=0}}class Qo extends el{constructor(n,s){super(n,s)}async add(n,s,a=Io.Create){if(Ut(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&kr(o.config.durable_name);const f=this.nc;let{min:d,ok:m}=f.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{nc("name",y)}catch(T){const z=T.message,M=z.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${z.substring(M)}`):T}let g,E="";if(Array.isArray(s.filter_subjects)){const{min:T,ok:z}=f.features.get(Le.JS_MULTIPLE_CONSUMER_FILTER);if(!z)throw new Error(`consumer 'filter_subjects' requires server ${T}`);m=!1}if(s.metadata){const{min:T,ok:z}=f.features.get(Le.JS_STREAM_CONSUMER_METADATA);if(!z)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.${n}.${E}.${T}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else g=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(g,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Io.Update)}async info(n,s){return Ut(n),kr(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Ut(n),kr(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Ut(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Pa(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function vr(i,n,s=!1){if(s===!0&&!i)throw me.errorForCode(le.ApiError,new Error(`${n} is not a function`));if(i&&typeof i!="function")throw me.errorForCode(le.ApiError,new Error(`${n} is not a function`))}class A1 extends Ot{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");vr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&vr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(vr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(vr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(vr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&vr(o.cleanupFn,"cleanupFn");let f=(E,_)=>{this.callback(E,_)};if(o.callback){const E=o.callback;f=(_,T)=>{const[z,M]=this.adapter(_,T);if(z){E(z,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};D&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(z,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:d,queue:m,timeout:y}=o,g={queue:m,timeout:y,callback:f};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,f]=this.adapter(s,a);o&&this.stop(o),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let ln;function j1(i){ln=i}function Fy(){return ln!==void 0&&ln.defaultPort!==void 0?ln.defaultPort:4222}function Ef(){return ln!==void 0&&ln.urlParseFn?ln.urlParseFn:void 0}function O1(){if(!ln||typeof ln.factory!="function")throw new Error("transport fn is not set");return ln.factory()}function Vf(){return ln!==void 0&&ln.dnsResolveFn?ln.dnsResolveFn:void 0}const zo=`\r
37
+ `,Jo=qr.fromAscii(zo),T1=new Uint8Array(Jo)[0],k1=new Uint8Array(Jo)[1];function N1(i){for(let n=0;n<i.length;n++){const s=n+1;if(i.byteLength>s&&i[n]===T1&&i[s]===k1)return s+1}return 0}function C1(i){const n=N1(i);if(n>0){const a=new Uint8Array(i).slice(0,n);return an.decode(a)}return""}const M1=4,Iy=48,R1=65,D1=97;function q1(i,n,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]=n,o[14]=s,o[15]=a,o}function Gf(i){return z1(i)!==void 0}function z1(i){for(let n=0;n<i.length;n++)switch(i[n]){case".":return Qy(i);case":":return U1(i)}}function Qy(i){const n=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:f}=B1(i);if(!f||a>255)return;i=i.substring(o),n[s]=a}return q1(n[0],n[1],n[2],n[3])}function U1(i){const n=new Uint8Array(16);let s=-1;if(i.length>=2&&i[0]===":"&&i[1]===":"&&(s=0,i=i.substring(2),i.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:d}=L1(i);if(!d||o>65535)return;if(f<i.length&&i[f]==="."){if(s<0&&a!=12||a+4>16)return;const m=Qy(i);if(m===void 0)return;n[a]=m[12],n[a+1]=m[13],n[a+2]=m[14],n[a+3]=m[15],i="",a+=M1;break}if(n[a]=o>>8,n[a+1]=o,a+=2,i=i.substring(f),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 f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function B1(i){let n=0,s=0;for(n=0;n<i.length&&48<=i.charCodeAt(n)&&i.charCodeAt(n)<=57;n++)if(s=s*10+(i.charCodeAt(n)-Iy),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function L1(i){let n=0,s=0;for(s=0;s<i.length;s++){if(48<=i.charCodeAt(s)&&i.charCodeAt(s)<=57)n*=16,n+=i.charCodeAt(s)-Iy;else if(97<=i.charCodeAt(s)&&i.charCodeAt(s)<=102)n*=16,n+=i.charCodeAt(s)-D1+10;else if(65<=i.charCodeAt(s)&&i.charCodeAt(s)<=70)n*=16,n+=i.charCodeAt(s)-R1+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function H1(i){return i.indexOf("[")!==-1||i.indexOf("::")!==-1?!1:i.indexOf(".")!==-1||i.split(":").length<=2}function Ff(i){return!H1(i)}function P1(i){const n="::FFFF:",s=i.toUpperCase().indexOf(n);if(s!==-1&&i.indexOf(".")!==-1){let a=i.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return i}function $1(i){i=i.trim(),i.match(/^(.*:\/\/)(.*)/m)&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2")),i=P1(i),Ff(i)&&i.indexOf("[")===-1&&(i=`[${i}]`);const n=Ff(i)?i.match(/(]:)(\d+)/):i.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${i}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class Fa{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=$1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(Gf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",d=new URL(`${f}://${Ff(o)?"["+o+"]":o}`);d.port=`${this.port}`;const m=new Fa(d.host,!1);m.tlsName=this.hostname,s.push(m)}}return n.randomize&&Py(s),this.resolves=s,s}}class Y1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=Ef();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new Fa(o))}),this.randomize&&(this.servers=Py(this.servers))),this.servers.length===0&&this.addServer(`${zf}:${Fy()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Gf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=Ef();n=a?a(n):n;const o=new Fa(n,s);Gf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let o=[];const f=Ef(),d=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(y=>{y=f?f(y,s):y;const g=new Fa(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 V1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${ys(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=$y(s)),o.resolver(n,s))}}}close(){const n=me.errorForCode(le.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class G1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Tr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=it();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class F1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function I1(i,n="Assertion failed."){if(!i)throw new F1(n)}const H0=32*1024,Af=2**32-2;function Oo(i,n,s=0){const a=n.byteLength-s;return i.byteLength>a&&(i=i.subarray(0,a)),n.set(i,s),i.byteLength}class jf{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){I1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=Oo(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Di.encode(n))}write(n){const s=this._grow(n.byteLength);return Oo(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)Oo(this._buf.subarray(this._off),this._buf);else{if(o+n>Af)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,Af));Oo(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,Af)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(H0);for(;;){const o=this.capacity-this.length<H0,f=o?a:new Uint8Array(this._buf.buffer,this.length),d=n.read(f);if(d===null)return s;o?this.write(f.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 P0(){const i={};return i.sid=-1,i.hdr=-1,i.size=-1,i}const Q1=48;class $0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=ue.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case ue.OP_START:switch(a){case fe.M:case fe.m:this.state=ue.OP_M,this.hdr=-1,this.ma=P0();break;case fe.H:case fe.h:this.state=ue.OP_H,this.hdr=0,this.ma=P0();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(n.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(n.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(n.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(n.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(n.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():n.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 f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Bt.MSG,msg:this.ma,data:n.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(n.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(n.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(n.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(n.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(n.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(n.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=n.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(n.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(n.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(n.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(n.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(n.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(n.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(n.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(n.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(n.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=n.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(n.subarray(s))}}(this.state===ue.MSG_ARG||this.state===ue.MINUS_ERR_ARG||this.state===ue.INFO_ARG)&&!this.argBuf&&(this.argBuf=new jf(n.subarray(this.as,s-this.drop))),this.state===ue.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new jf(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new jf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${an.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-Q1)}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 n=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),f=new Uint8Array(32);f[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]),z=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function D(x,S){var 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 J(x,S){var w=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(w,A)}function ie(x,S,w){var A;for(A=0;A<4;A++)x[S+A]=w&255,w>>>=8}function G(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 ce(x,S,w,A,N){var q,ee=0;for(q=0;q<N;q++)ee|=x[S+q]^w[A+q];return(1&ee-1>>>8)-1}function ae(x,S,w,A){return ce(x,S,w,A,16)}function k(x,S,w,A){return ce(x,S,w,A,32)}function Z(x,S,w,A,N){var q=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]=D(A,4*W),ee[1+W]=D(w,4*W),ee[6+W]=D(S,4*W),ee[11+W]=D(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]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),Me=0;Me<4;Me++)q[4*pe+(pe+Me)%4]=H[Me]}for(Me=0;Me<16;Me++)ee[Me]=q[Me]}if(N){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]-D(A,4*W)|0,ee[6+W]=ee[6+W]-D(S,4*W)|0;for(W=0;W<4;W++)ie(x,4*W,ee[5*W]),ie(x,16+4*W,ee[6+W])}else for(W=0;W<16;W++)ie(x,4*W,ee[W]+ne[W]|0)}function oe(x,S,w,A){return Z(x,S,w,A,!1),0}function F(x,S,w,A){return Z(x,S,w,A,!0),0}var V=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,w,A,N,q,ee){var ne=new Uint8Array(16),H=new Uint8Array(64),W,pe;if(!N)return 0;for(pe=0;pe<16;pe++)ne[pe]=0;for(pe=0;pe<8;pe++)ne[pe]=q[pe];for(;N>=64;){for(oe(H,ne,ee,V),pe=0;pe<64;pe++)x[S+pe]=(w?w[A+pe]:0)^H[pe];for(W=1,pe=8;pe<16;pe++)W=W+(ne[pe]&255)|0,ne[pe]=W&255,W>>>=8;N-=64,S+=64,w&&(A+=64)}if(N>0)for(oe(H,ne,ee,V),pe=0;pe<N;pe++)x[S+pe]=(w?w[A+pe]:0)^H[pe];return 0}function Q(x,S,w,A,N){return K(x,S,null,0,w,A,N)}function se(x,S,w,A,N){var q=new Uint8Array(32);return F(q,A,N,V),Q(x,S,w,A.subarray(16),q)}function he(x,S,w,A,N,q,ee){var ne=new Uint8Array(32);return F(ne,q,ee,V),K(x,S,w,A,N,q.subarray(16),ne)}function Se(x,S){var w,A=0;for(w=0;w<17;w++)A=A+(x[w]+S[w]|0)|0,x[w]=A&255,A>>>=8}var ke=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,w,A,N,q){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]=q[H];for(Me[3]&=15,Me[4]&=252,Me[7]&=15,Me[8]&=252,Me[11]&=15,Me[12]&=252,Me[15]&=15;N>0;){for(H=0;H<17;H++)qt[H]=0;for(H=0;H<16&&H<N;++H)qt[H]=w[A+H];for(qt[H]=1,A+=H,N-=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,ke),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]=q[H+16];for(qt[16]=0,Se(Ze,qt),H=0;H<16;H++)x[S+H]=Ze[H];return 0}function re(x,S,w,A,N,q){var ee=new Uint8Array(16);return $(ee,0,w,A,N,q),ae(x,S,ee,0)}function de(x,S,w,A,N){var q;if(w<32)return-1;for(he(x,0,S,0,w,A,N),$(x,16,x,32,w-32,x),q=0;q<16;q++)x[q]=0;return 0}function je(x,S,w,A,N){var q,ee=new Uint8Array(32);if(w<32||(se(ee,0,32,A,N),re(S,16,S,32,w-32,ee)!==0))return-1;for(he(x,0,S,0,w,A,N),q=0;q<32;q++)x[q]=0;return 0}function P(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 A,N=~(w-1),q=0;q<16;q++)A=N&(x[q]^S[q]),x[q]^=A,S[q]^=A}function Ae(x,S){var w,A,N,q=s(),ee=s();for(w=0;w<16;w++)ee[w]=S[w];for(be(ee),be(ee),be(ee),A=0;A<2;A++){for(q[0]=ee[0]-65517,w=1;w<15;w++)q[w]=ee[w]-65535-(q[w-1]>>16&1),q[w-1]&=65535;q[15]=ee[15]-32767-(q[14]>>16&1),N=q[15]>>16&1,q[14]&=65535,xe(ee,q,1-N)}for(w=0;w<16;w++)x[2*w]=ee[w]&255,x[2*w+1]=ee[w]>>8}function He(x,S){var w=new Uint8Array(32),A=new Uint8Array(32);return Ae(w,x),Ae(A,S),k(w,0,A,0)}function vt(x){var S=new Uint8Array(32);return Ae(S,x),S[0]&1}function Et(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 A;for(A=0;A<16;A++)x[A]=S[A]+w[A]|0}function ct(x,S,w){var A;for(A=0;A<16;A++)x[A]=S[A]-w[A]|0}function Oe(x,S,w){var A,N,q=new Float64Array(31);for(A=0;A<31;A++)q[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)q[A+N]+=S[A]*w[N];for(A=0;A<15;A++)q[A]+=38*q[A+16];for(A=0;A<16;A++)x[A]=q[A];be(x),be(x)}function _t(x,S){Oe(x,S,S)}function zn(x,S){var w=s(),A;for(A=0;A<16;A++)w[A]=S[A];for(A=253;A>=0;A--)_t(w,w),A!==2&&A!==4&&Oe(w,w,S);for(A=0;A<16;A++)x[A]=w[A]}function un(x,S){var w=s(),A;for(A=0;A<16;A++)w[A]=S[A];for(A=250;A>=0;A--)_t(w,w),A!==1&&Oe(w,w,S);for(A=0;A<16;A++)x[A]=w[A]}function ai(x,S,w){var A=new Uint8Array(32),N=new Float64Array(80),q,ee,ne=s(),H=s(),W=s(),pe=s(),Me=s(),Ze=s();for(ee=0;ee<31;ee++)A[ee]=S[ee];for(A[31]=S[31]&127|64,A[0]&=248,Et(N,w),ee=0;ee<16;ee++)H[ee]=N[ee],pe[ee]=ne[ee]=W[ee]=0;for(ne[0]=pe[0]=1,ee=254;ee>=0;--ee)q=A[ee>>>3]>>>(ee&7)&1,xe(ne,H,q),xe(W,pe,q),rt(Me,ne,W),ct(ne,ne,W),rt(W,H,pe),ct(H,H,pe),_t(pe,Me),_t(Ze,ne),Oe(ne,W,ne),Oe(W,H,Me),rt(Me,ne,W),ct(ne,ne,W),_t(H,ne),ct(W,pe,Ze),Oe(ne,W,y),rt(ne,ne,pe),Oe(W,W,ne),Oe(ne,pe,Ze),Oe(pe,H,N),_t(H,Me),xe(ne,H,q),xe(W,pe,q);for(ee=0;ee<16;ee++)N[ee+16]=ne[ee],N[ee+32]=W[ee],N[ee+48]=H[ee],N[ee+64]=pe[ee];var qt=N.subarray(32),On=N.subarray(16);return zn(qt,qt),Oe(On,On,qt),Ae(x,On),0}function fn(x,S){return ai(x,S,f)}function qi(x,S){return a(S,32),fn(x,S)}function vs(x,S,w){var A=new Uint8Array(32);return ai(A,w,S),F(x,o,A,V)}var il=de,rl=je;function Lr(x,S,w,A,N,q){var ee=new Uint8Array(32);return vs(ee,N,q),il(x,S,w,A,ee)}function Hr(x,S,w,A,N,q){var ee=new Uint8Array(32);return vs(ee,N,q),rl(x,S,w,A,ee)}function Qn(){var x=0,S=0,w=0,A=0,N=65535,q,ee,ne;for(ne=0;ne<arguments.length;ne++)q=arguments[ne].lo,ee=arguments[ne].hi,x+=q&N,S+=q>>>16,w+=ee&N,A+=ee>>>16;return S+=x>>>16,w+=S>>>16,A+=w>>>16,new n(w&N|A<<16,x&N|S<<16)}function al(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function zi(){var x=0,S=0,w;for(w=0;w<arguments.length;w++)x^=arguments[w].lo,S^=arguments[w].hi;return new n(S,x)}function tt(x,S){var w,A,N=32-S;return S<32?(w=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(w=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(w,A)}function lc(x,S,w){var A=x.hi&S.hi^~x.hi&w.hi,N=x.lo&S.lo^~x.lo&w.lo;return new n(A,N)}function ll(x,S,w){var A=x.hi&S.hi^x.hi&w.hi^S.hi&w.hi,N=x.lo&S.lo^x.lo&w.lo^S.lo&w.lo;return new n(A,N)}function ol(x){return zi(tt(x,28),tt(x,34),tt(x,39))}function Ui(x){return zi(tt(x,14),tt(x,18),tt(x,41))}function oc(x){return zi(tt(x,1),tt(x,8),al(x,7))}function cl(x){return zi(tt(x,19),tt(x,61),al(x,6))}var cc=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function ul(x,S,w){var A=[],N=[],q=[],ee=[],ne,H,W;for(H=0;H<8;H++)A[H]=q[H]=J(x,8*H);for(var pe=0;w>=128;){for(H=0;H<16;H++)ee[H]=J(S,8*H+pe);for(H=0;H<80;H++){for(W=0;W<8;W++)N[W]=q[W];for(ne=Qn(q[7],Ui(q[4]),lc(q[4],q[5],q[6]),cc[H],ee[H%16]),N[7]=Qn(ne,ol(q[0]),ll(q[0],q[1],q[2])),N[3]=Qn(N[3],ne),W=0;W<8;W++)q[(W+1)%8]=N[W];if(H%16===15)for(W=0;W<16;W++)ee[W]=Qn(ee[W],ee[(W+9)%16],oc(ee[(W+1)%16]),cl(ee[(W+14)%16]))}for(H=0;H<8;H++)q[H]=Qn(q[H],A[H]),A[H]=q[H];pe+=128,w-=128}for(H=0;H<8;H++)G(x,8*H,A[H]);return w}var li=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 A=new Uint8Array(64),N=new Uint8Array(256),q,ee=w;for(q=0;q<64;q++)A[q]=li[q];for(ul(A,S,w),w%=128,q=0;q<256;q++)N[q]=0;for(q=0;q<w;q++)N[q]=S[ee-w+q];for(N[w]=128,w=256-128*(w<112?1:0),N[w-9]=0,G(N,w-8,new n(ee/536870912|0,ee<<3)),ul(A,N,w),q=0;q<64;q++)x[q]=A[q];return 0}function It(x,S){var w=s(),A=s(),N=s(),q=s(),ee=s(),ne=s(),H=s(),W=s(),pe=s();ct(w,x[1],x[0]),ct(pe,S[1],S[0]),Oe(w,w,pe),rt(A,x[0],x[1]),rt(pe,S[0],S[1]),Oe(A,A,pe),Oe(N,x[3],S[3]),Oe(N,N,E),Oe(q,x[2],S[2]),rt(q,q,q),ct(ee,A,w),ct(ne,q,N),rt(H,q,N),rt(W,A,w),Oe(x[0],ee,ne),Oe(x[1],W,H),Oe(x[2],H,ne),Oe(x[3],ee,W)}function Dt(x,S,w){var A;for(A=0;A<4;A++)xe(x[A],S[A],w)}function Pr(x,S){var w=s(),A=s(),N=s();zn(N,S[2]),Oe(w,S[0],N),Oe(A,S[1],N),Ae(x,A),x[31]^=vt(w)<<7}function $r(x,S,w){var A,N;for(P(x[0],d),P(x[1],m),P(x[2],m),P(x[3],d),N=255;N>=0;--N)A=w[N/8|0]>>(N&7)&1,Dt(x,S,A),It(S,x),It(x,x),Dt(x,S,A)}function Bi(x,S){var w=[s(),s(),s(),s()];P(w[0],_),P(w[1],T),P(w[2],m),Oe(w[3],_,T),$r(x,w,S)}function _s(x,S,w){var A=new Uint8Array(64),N=[s(),s(),s(),s()],q;for(w||a(S,32),ut(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Bi(N,A),Pr(x,N),q=0;q<32;q++)S[q+32]=x[q];return 0}var Jn=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,A,N,q;for(A=63;A>=32;--A){for(w=0,N=A-32,q=A-12;N<q;++N)S[N]+=w-16*S[A]*Jn[N-(A-32)],w=Math.floor((S[N]+128)/256),S[N]-=w*256;S[N]+=w,S[A]=0}for(w=0,N=0;N<32;N++)S[N]+=w-(S[31]>>4)*Jn[N],w=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=w*Jn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function An(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 oi(x,S,w,A){var N=new Uint8Array(64),q=new Uint8Array(64),ee=new Uint8Array(64),ne,H,W=new Float64Array(64),pe=[s(),s(),s(),s()];ut(N,A,32),N[0]&=248,N[31]&=127,N[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]=N[32+ne];for(ut(ee,x.subarray(32),w+32),An(ee),Bi(pe,ee),Pr(x,pe),ne=32;ne<64;ne++)x[ne]=A[ne];for(ut(q,x,w+64),An(q),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]+=q[ne]*N[H];return ws(x.subarray(32),W),Me}function ci(x,S){var w=s(),A=s(),N=s(),q=s(),ee=s(),ne=s(),H=s();return P(x[2],m),Et(x[1],S),_t(N,x[1]),Oe(q,N,g),ct(N,N,x[2]),rt(q,x[2],q),_t(ee,q),_t(ne,ee),Oe(H,ne,ee),Oe(w,H,N),Oe(w,w,q),un(w,w),Oe(w,w,N),Oe(w,w,q),Oe(w,w,q),Oe(x[0],w,q),_t(A,x[0]),Oe(A,A,q),He(A,N)&&Oe(x[0],x[0],z),_t(A,x[0]),Oe(A,A,q),He(A,N)?-1:(vt(x[0])===S[31]>>7&&ct(x[0],d,x[0]),Oe(x[3],x[0],x[1]),0)}function Yr(x,S,w,A){var N,q=new Uint8Array(32),ee=new Uint8Array(64),ne=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(w<64||ci(H,A))return-1;for(N=0;N<w;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ut(ee,x,w),An(ee),$r(ne,H,ee),Bi(H,S.subarray(32)),It(ne,H),Pr(q,ne),w-=64,k(S,0,q,0)){for(N=0;N<w;N++)x[N]=0;return-1}for(N=0;N<w;N++)x[N]=S[N+64];return w}var Li=32,Ss=24,jn=32,Es=16,As=32,ui=32,js=32,Kn=32,fi=32,Vr=Ss,fl=jn,Un=Es,Ke=64,at=32,Qt=64,hi=32,Gr=64;i.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:he,crypto_stream:se,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:Q,crypto_onetimeauth:$,crypto_onetimeauth_verify:re,crypto_verify_16:ae,crypto_verify_32:k,crypto_secretbox:de,crypto_secretbox_open:je,crypto_scalarmult:ai,crypto_scalarmult_base:fn,crypto_box_beforenm:vs,crypto_box_afternm:il,crypto_box:Lr,crypto_box_open:Hr,crypto_box_keypair:qi,crypto_hash:ut,crypto_sign:oi,crypto_sign_keypair:_s,crypto_sign_open:Yr,crypto_secretbox_KEYBYTES:Li,crypto_secretbox_NONCEBYTES:Ss,crypto_secretbox_ZEROBYTES:jn,crypto_secretbox_BOXZEROBYTES:Es,crypto_scalarmult_BYTES:As,crypto_scalarmult_SCALARBYTES:ui,crypto_box_PUBLICKEYBYTES:js,crypto_box_SECRETKEYBYTES:Kn,crypto_box_BEFORENMBYTES:fi,crypto_box_NONCEBYTES:Vr,crypto_box_ZEROBYTES:fl,crypto_box_BOXZEROBYTES:Un,crypto_sign_BYTES:Ke,crypto_sign_PUBLICKEYBYTES:at,crypto_sign_SECRETKEYBYTES:Qt,crypto_sign_SEEDBYTES:hi,crypto_hash_BYTES:Gr,gf:s,D:g,L:Jn,pack25519:Ae,unpack25519:Et,M:Oe,A:rt,S:_t,Z:ct,pow2523:un,add:It,set25519:P,modL:ws,scalarmult:$r,scalarbase:Bi};function hl(x,S){if(x.length!==Li)throw new Error("bad key size");if(S.length!==Ss)throw new Error("bad nonce size")}function dl(x,S){if(x.length!==js)throw new Error("bad public key size");if(S.length!==Kn)throw new Error("bad secret key size")}function wt(){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){wt(x,S,w),hl(w,S);for(var A=new Uint8Array(jn+x.length),N=new Uint8Array(A.length),q=0;q<x.length;q++)A[q+jn]=x[q];return de(N,A,A.length,S,w),N.subarray(Es)},i.secretbox.open=function(x,S,w){wt(x,S,w),hl(w,S);for(var A=new Uint8Array(Es+x.length),N=new Uint8Array(A.length),q=0;q<x.length;q++)A[q+Es]=x[q];return A.length<32||je(N,A,A.length,S,w)!==0?null:N.subarray(jn)},i.secretbox.keyLength=Li,i.secretbox.nonceLength=Ss,i.secretbox.overheadLength=Es,i.scalarMult=function(x,S){if(wt(x,S),x.length!==ui)throw new Error("bad n size");if(S.length!==As)throw new Error("bad p size");var w=new Uint8Array(As);return ai(w,x,S),w},i.scalarMult.base=function(x){if(wt(x),x.length!==ui)throw new Error("bad n size");var S=new Uint8Array(As);return fn(S,x),S},i.scalarMult.scalarLength=ui,i.scalarMult.groupElementLength=As,i.box=function(x,S,w,A){var N=i.box.before(w,A);return i.secretbox(x,S,N)},i.box.before=function(x,S){wt(x,S),dl(x,S);var w=new Uint8Array(fi);return vs(w,x,S),w},i.box.after=i.secretbox,i.box.open=function(x,S,w,A){var N=i.box.before(w,A);return i.secretbox.open(x,S,N)},i.box.open.after=i.secretbox.open,i.box.keyPair=function(){var x=new Uint8Array(js),S=new Uint8Array(Kn);return qi(x,S),{publicKey:x,secretKey:S}},i.box.keyPair.fromSecretKey=function(x){if(wt(x),x.length!==Kn)throw new Error("bad secret key size");var S=new Uint8Array(js);return fn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},i.box.publicKeyLength=js,i.box.secretKeyLength=Kn,i.box.sharedKeyLength=fi,i.box.nonceLength=Vr,i.box.overheadLength=i.secretbox.overheadLength,i.sign=function(x,S){if(wt(x,S),S.length!==Qt)throw new Error("bad secret key size");var w=new Uint8Array(Ke+x.length);return oi(w,x,x.length,S),w},i.sign.open=function(x,S){if(wt(x,S),S.length!==at)throw new Error("bad public key size");var w=new Uint8Array(x.length),A=Yr(w,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),q=0;q<N.length;q++)N[q]=w[q];return N},i.sign.detached=function(x,S){for(var w=i.sign(x,S),A=new Uint8Array(Ke),N=0;N<A.length;N++)A[N]=w[N];return A},i.sign.detached.verify=function(x,S,w){if(wt(x,S,w),S.length!==Ke)throw new Error("bad signature size");if(w.length!==at)throw new Error("bad public key size");var A=new Uint8Array(Ke+x.length),N=new Uint8Array(Ke+x.length),q;for(q=0;q<Ke;q++)A[q]=S[q];for(q=0;q<x.length;q++)A[q+Ke]=x[q];return Yr(N,A,A.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(wt(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(wt(x),x.length!==hi)throw new Error("bad seed size");for(var S=new Uint8Array(at),w=new Uint8Array(Qt),A=0;A<32;A++)w[A]=x[A];return _s(S,w,!0),{publicKey:S,secretKey:w}},i.sign.publicKeyLength=at,i.sign.secretKeyLength=Qt,i.sign.seedLength=hi,i.sign.signatureLength=Ke,i.hash=function(x){wt(x);var S=new Uint8Array(Gr);return ut(S,x,x.length),S},i.hash.hashLength=Gr,i.verify=function(x,S){return wt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:ce(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,A){var N,q=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(q.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)w[N]=q[N];Hi(q)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&i.setPRNG(function(w,A){var N,q=x.randomBytes(A);for(N=0;N<A;N++)w[N]=q[N];Hi(q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const To=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;To.sign.keyPair.fromSeed,To.sign.detached,To.sign.detached.verify,To.randomBytes;var Y0;(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"})(Y0||(Y0={}));var V0;(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"})(V0||(V0={}));function J1(i){return n=>{let s={};return i.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function K1(){return()=>{}}function X1(i,n){return()=>{const s=typeof i=="function"?i():i,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function Z1(i){return()=>({auth_token:typeof i=="function"?i():i})}const Jy=120*1e3,W1=2,Ky=2*1e3;function e_(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Jy,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Ky,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function t_(i){const n=[];return typeof i.authenticator=="function"&&n.push(i.authenticator),Array.isArray(i.authenticator)&&n.push(...i.authenticator),i.token&&n.push(Z1(i.token)),i.user&&n.push(X1(i.user,i.pass)),n.length===0?K1():J1(n)}function n_(i){const n=`${zf}:${Fy()}`;if(i=i||{servers:[n]},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",le.InvalidOption);i.servers.length===0&&i.port&&(i.servers=[`${zf}:${i.port}`]),i.servers&&i.servers.length===0&&(i.servers=[n]);const s=tc(e_(),i);if(s.authenticator=t_(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new me(`${a} option should be a function`,le.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{ys(s.inboxPrefix)}catch(a){throw new me(a.message,le.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Vf()=="function"),s.resolve&&typeof Vf()!="function")throw new me("'resolve' is not supported on this client",le.InvalidOption);return s}function s_(i,n){const{proto:s,tls_required:a,tls_available:o}=i;if((s===void 0||s<1)&&n.noEcho)throw new me("noEcho",le.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new me("tls",le.ServerOptionNotAvailable)}const i_=1024*32,r_=/^INFO\s+([^\r\n]+)\r\n/i,a_=Va(`PONG\r
38
+ `),G0=Va(`PING\r
39
+ `);class l_{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};tc(this,o)}}class Xy extends Ot{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");tc(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=it();const f=!((d=s.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=Rr(o.timeout,f),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}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,d=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(m,y)=>{const{ingest:g}=o(y);g&&f(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(le.ConnectionClosed)):this.isClosed()?Promise.reject(me.errorForCode(le.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 o_{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Ko{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=i_,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new o_,this.muxSubscriptions=new V1,this.outbound=new qr,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new E1({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new Y1(a,{randomize:!n.noRandomize}),this.closed=it(),this.parser=new $0(this),this.heartbeats=new G1(this,this.options.pingInterval||Jy,this.options.maxPingOut||W1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=me.errorForCode(le.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new $0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new Ot;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=it();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=O1(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:Tr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Tr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:ps.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:ps.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===le.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Rr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Vf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:Tr.Reconnecting,data:f.toString()}),await this.dial(f);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 n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Ky;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:me.errorForCode(le.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(d){if(n=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-f),await zr(a)}}static async connect(n,s){const a=new Ko(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new me(n,le.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new me(n,le.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new me(n,le.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new me(n,le.AccountExpired):s.indexOf("authentication timeout")!==-1?new me(n,le.AuthenticationTimeout):new me(n,le.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new fh(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=O0(n),a=Ko.toError(s),o={type:ps.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const d=this.subscriptions.getMux();f=(d==null?void 0:d.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(a_)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(O0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ci(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:d}=this.transport;try{const m=new l_({version:f,lang:d},this.options,s.nonce);s.headers&&(m.headers=!0,m.no_responders=!0);const y=JSON.stringify(m);this.transport.send(Va(`CONNECT ${y}${zo}`)),this.transport.send(G0)}catch(m){this._close(m)}}a&&this.dispatchStatus({type:ps.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:ps.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Bt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Bt.OK:break;case Bt.ERR:this.processError(n.data);break;case Bt.PING:this.processPing();break;case Bt.PONG:this.processPong();break;case Bt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=Va(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=on,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=Di.encode(s);else throw me.errorForCode(le.BadPayload);let f=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",le.ServerOptionNotAvailable);d=a.headers.encode(),m=d.length,f=o.length+m}if(this.info&&f>this.info.max_payload)throw me.errorForCode(le.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let y;a.headers?(a.reply?y=`HPUB ${n} ${a.reply} ${m} ${f}\r
40
+ `:y=`HPUB ${n} ${m} ${f}\r
41
+ `,this.sendCommand(y,d,o,Jo)):(a.reply?y=`PUB ${n} ${a.reply} ${f}\r
42
+ `:y=`PUB ${n} ${f}\r
43
+ `,this.sendCommand(y,o,Jo))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
44
+ `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
45
+ `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
46
+ `):this.sendCommand(`UNSUB ${n.sid}\r
47
+ `),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=it()),this.pongs.push(n),this.outbound.fill(G0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${zo}`):n.push(`SUB ${a.subject} ${a.sid}${zo}`)}),n.length&&this.transport.send(Va(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Xy(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const c_="$SRV";class F0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,d;return o=o||{},o.headers=o.headers||gs(),(f=o.headers)==null||f.set(Go,`${n}`),(d=o.headers)==null||d.set(Vo,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Ka{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&f_("service group",s);let o="";if(n instanceof tl)this.srv=n,o="";else if(n instanceof Ka){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;Ha("endpoint",n);let{subject:o,handler:f,metadata:d,queue:m}=a;o=o||n,m=m||this.queue,u_("endpoint subject",o),o=this.calcSubject(this.subject,o);const y={name:n,subject:o,queue:m,handler:f,metadata:d};return this.srv._addEndpoint(y)}addGroup(n="",s=""){return new Ka(this,n,s)}}function u_(i,n){if(n==="")throw new Error(`${i} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${i} cannot have internal '>': '${n}'`)})}function f_(i,n){if(n.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${i} name cannot contain internal '>': '${n}'`)})}class tl{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Ha("name",this.config.name),Ha("queue",this.config.queue),Ci(this.config.version),this._id=si.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(n,s="",a="",o){const f=o??c_;return s===""&&a===""?`${f}.${n}`:(Ha("control subject name",s),a!==""?(Ha("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=gs();if(n instanceof Fo){const a=n;s.set(Vo,a.message),s.set(Go,`${a.code}`)}else s.set(Vo,n.message),s.set(Go,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:d}=n,m=n;m.internal=s,s&&this.internal.push(m),m.stats=new h_(o,f,a),m.queue=a;const y=d?(g,E)=>{if(g){this.close(g);return}const _=Date.now();try{d(g,new F0(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(f,{callback:y,queue:a}),m.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(g=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${g.message}`);E.stack=g.stack,this.close(E).catch()}}),m}info(){return{type:Ga.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Ga.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const d={};d.name=n,d.subject=tl.controlSubject(s,o,f),d.handler=a,this.setupHandler(d,!0)}start(){const n=qn(),s=(d,m)=>d?(this.close(d),Promise.reject(d)):this.stats().then(y=>(m==null||m.respond(n.encode(y)),Promise.resolve())),a=(d,m)=>d?(this.close(d),Promise.reject(d)):(m==null||m.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(d,m)=>d?(this.close(d).then().catch(),Promise.reject(d)):(m.respond(o),Promise.resolve());return this.addInternalHandler(Ws.PING,f),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(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Ga.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new Ka(this,n,s)}addEndpoint(n,s){return new Ka(this).addEndpoint(n,s)}_addEndpoint(n){const s=new Ot;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new F0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class h_{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=st(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:d,last_error:m,data:y,queue:g}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:d,last_error:m,data:y,queue_group:g}}stats(n){const s=n;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 d_{constructor(n,s={strategy:Dn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Ws.PING,n,s)}stats(n="",s=""){return this.q(Ws.STATS,n,s)}info(n="",s=""){return this.q(Ws.INFO,n,s)}async q(n,s="",a=""){const o=new Ot,f=qn(),d=tl.controlSubject(n,s,a,this.prefix),m=await this.nc.requestMany(d,on,this.opts);return(async()=>{for await(const y of m)try{const g=f.decode(y.data);o.push(g)}catch(g){o.push(()=>{o.stop(g)})}o.push(()=>{o.stop()})})().catch(y=>{o.stop(y)}),o}}function Zy(){return{key:{encode(i){return i},decode(i){return i}},value:{encode(i){return i},decode(i){return i}}}}function m_(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Zy(),storage:Pf.File}}const Xo="KV-Operation",I0="$KV",p_=/^[-/=.\w]+$/,y_=/^[-/=.>*\w]+$/,g_=/^[-\w]+$/;function b_(i){if(i.startsWith(".")||i.endsWith(".")||!p_.test(i))throw new Error(`invalid key: ${i}`)}function x_(i){if(i.startsWith(".")||i.endsWith(".")||!y_.test(i))throw new Error(`invalid key: ${i}`)}function v_(i){if(i.startsWith(".")||i.endsWith("."))throw new Error(`invalid key: ${i}`);const n=i.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${i}`);s=!0;break}return s}function Uo(i){if(!g_.test(i))throw new Error(`invalid bucket name: ${i}`)}var Yn;(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"})(Yn||(Yn={}));class Xa{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",b_);v(this,"validateSearchKey",x_);v(this,"hasWildcards",v_);Uo(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=I0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Uo(s);const o=await n.jetstreamManager(),f=new Xa(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Uo(s);const d=new Xa(s,n,o);return f.config.name=a.streamName??d.bucketName(),Object.assign(d,f),d.stream=f.config.name,d.codec=a.codec||Zy(),d.direct=f.config.allow_direct??!1,d.initializePrefixes(f),d}async init(n={}){const s=Object.assign(m_(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Hf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const _=Object.assign({},n.mirror);_.name.startsWith(rn)||(_.name=`${rn}${_.name}`),a.mirror=_,a.mirror_direct=!0}else if(n.sources){const _=n.sources.map(T=>{const z=Object.assign({},T),M=z.name.startsWith(rn)?z.name.substring(rn.length):z.name;return z.name.startsWith(rn)||(z.name=`${rn}${z.name}`),!T.external&&M!==this.bucket&&(z.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=_,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?ii.S2:ii.None);const f=this.js.nc,d=f.getServerVersion(),m=d?Yf(d,Ci("2.7.2"))>=0:!1;a.discard=m?Ja.New:Ja.Old;const{ok:y,min:g}=f.features.get(Le.JS_ALLOW_DIRECT);if(!y&&n.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}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:y,a.allow_direct=n.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(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(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(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${I0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Lt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new q_(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new z_(this.bucket,s,n)}async create(n,s){var f;let a;try{const d=await this.put(n,s,{previousSeq:0});return Promise.resolve(d)}catch(d){if(a=d,((f=d==null?void 0:d.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(d)}let o=0;try{const d=await this.get(n);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(o=d!==null?d.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(d){return Promise.reject(d)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var d,m;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const y=gs();f.headers=y,y.set(Yn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).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(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const d=this.smToEntry(f);return d.key!==a?null:d}catch(d){if(d.code===le.JetStream404NoMessages)return null;throw d}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=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 f=Date.now()-n,d=a.map(y=>{const g=this.subjectForKey(y.key);return y.created.getTime()>=f?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(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const d of o)f.push(this._doDeleteOrPurge(d,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=gs();f.set(Xo,s),s==="PURGE"&&f.set(Lt.RollupHdr,Lt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(Yn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),on,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).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 f.length===1&&(m=f[0],f=void 0),Object.assign({deliver_policy:d,ack_policy:jt.None,filter_subjects:f,filter_subject:m,flow_control:!0,idle_heartbeat:st(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new Ot,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{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 z=this.jmToEntry(T);a.push(z),a.received++,(f&&d>0&&a.received>=d||T.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(y,g);if(f){const{info:{last:_}}=E,T=_.num_pending+_.delivered.consumer_seq;if(T===0||a.received>=T)try{f()}catch(z){a.stop(z)}finally{f=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(n={}){const s=n.key??">",a=new Ot,o={};o.headers_only=n.headers_only||!1;let f=Mn.LastValue;n.include===Mn.AllHistory?f=Mn.AllHistory:n.include===Mn.UpdatesOnly&&(f=Mn.UpdatesOnly);const d=n.ignoreDeletes===!0;let m=n.initializedFn,y=0;const g=this._buildCC(s,f,o),E=g.filter_subject,_=ti(g);this.canSetWatcherName()&&_.consumerName(si.next()),_.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&_.startSequence(n.resumeFromRevision),_.orderedConsumer(),_.callback((z,M)=>{if(z){a.stop(z);return}if(M){const D=this.jmToEntry(M);if(d&&D.operation==="DEL")return;a.push(D),a.received++,m&&(y>0&&a.received>=y||M.info.pending===0)&&(a.push(m),m=void 0)}});const T=await this.js.subscribe(E,_);if(m){const{info:{last:z}}=T,M=z.num_pending+z.delivered.consumer_seq;if(M===0||a.received>=M)try{m()}catch(D){a.stop(D)}finally{m=void 0}else y=M}return a._data=T,a.iterClosed.then(()=>{T.unsubscribe()}),T.closed.then(()=>{a.stop()}).catch(z=>{a.stop(z)}),a}async keys(n=">"){const s=new Ot,a=this._buildCC(n,Mn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=ti(a);f.bindStream(this.stream),f.orderedConsumer();const d=await this.js.subscribe(o,f);return(async()=>{var y;for await(const g of d){const E=(y=g.headers)==null?void 0:y.get(Xo);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(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Wy(o,s)}}class Wy{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,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 uh(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==ii.None:!1}}const dh="OBJ_",Q0="SHA-256=";function __(i){return Uo(i),`${dh}${i}`}function w_(i){return i.startsWith(dh)?i.substring(4):i}class If{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return w_(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!==ii.None:!1}}function ko(i){if(i===void 0)return;const{domain:n}=i;if(n===void 0)return i;const s=Object.assign({},i);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var wn;(function(i){i[i.Unset=-1]="Unset",i[i.Consume=0]="Consume",i[i.Fetch=1]="Fetch"})(wn||(wn={}));var Vn;(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"})(Vn||(Vn={}));var Mr;(function(i){i.DebugEvent="debug",i.Discard="discard",i.Reset="reset",i.Next="next"})(Mr||(Mr={}));const J0=Uint8Array.of(43,65,67,75),S_=Uint8Array.of(45,78,65,75),qa=Uint8Array.of(43,87,80,73),E_=Uint8Array.of(43,78,88,84),A_=Uint8Array.of(43,84,69,82,77),j_=Uint8Array.of(32);function Za(i,n=5e3){return new Y_(i,n)}class Of extends Ot{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=ys(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages: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,z,M;if(y){this.stop(y);return}if((_=this.monitor)==null||_.work(),g.subject===this.inbox){if(Lf(g))return;const D=(T=g.headers)==null?void 0:T.code,J=((M=(z=g.headers)==null?void 0:z.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:ie,bytesLeft:G}=this.parseDiscard(g.headers);if(ie>0||G>0)this.pending.msgs-=ie,this.pending.bytes-=G,this.pending.requests--,this.notify(Mr.Discard,{msgsLeft:ie,bytesLeft:G});else if(D===400){this.stop(new me(J,`${D}`));return}else if(D===409&&J==="consumer deleted"){if(this.notify(Vn.ConsumerDeleted,`${D} ${J}`),!this.refilling||this.abortOnMissingResource){const ce=new me(J,`${D}`);this.stop(ce);return}}else if(D===503){if(this.notify(Vn.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const ce=new me("no responders",`${D}`);this.stop(ce);return}}else this.notify(Mr.DebugEvent,`${D} ${J}`)}else this._push(Za(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<=f){const D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new hh(o,y=>(this.notify(Vn.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 ps.Disconnect:(g=this.monitor)==null||g.cancel();break;case ps.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=ch([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(d){if(d.message==="stream not found"){if(a++,this.notify(Vn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(s++,this.notify(Vn.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(f),y=zr(m);await Promise.race([y,this.consumer.api.nc.closed()]),y.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(Mr.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),f=st(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Lt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Lt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const d=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||d}return o}status(){const s=new Ot;return this.listeners.push(s),Promise.resolve(s)}}class O_ extends Ot{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 Ot;return this.listeners.push(s),Promise.resolve(s)}}class Qf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new Of(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new Of(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Rr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=it(),a=n;a.max_messages=1;const o=new Of(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const m of await o.status())if(m.type===Vn.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=Rr(f);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:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class T_{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=si.next(),typeof a.name_prefix=="string"&&(nc("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(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:dt.StartSequence,opt_start_seq:n,ack_policy:jt.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),n===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(n=0){var d,m,y,g,E;si.next();const s=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=ch([((m=this.opts)==null?void 0:m.expires)||3e4]);let f;for(let _=0;;_++)try{f=await this.api.add(this.stream,a),(y=this.iter)==null||y.notify(Vn.OrderedConsumerRecreated,f.name);break}catch(T){if(T.message==="stream not found"&&((g=this.iter)==null||g.notify(Vn.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 zr(o.backoff(_+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var 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 O_),this.consumer=new Qf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let d=null;this.type===wn.Fetch&&a?d=await this.consumer.fetch(n):this.type===wn.Consume&&(d=await this.consumer.consume(n));const m=d;m.forOrderedConsumer=!0,m.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(m)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(Mr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===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}=n;return a&&(this.userCallback=a),this.type=wn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===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}=n;return a&&(this.userCallback=a),this.type=wn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=it();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Jf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(Le.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Qf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Qf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new mh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new T_(this.api,n,s))).catch(f=>Promise.reject(f))}}class ic{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new ic(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Jf(new Qo(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Jf(new Qo(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class mh extends el{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(Le.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Le.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Le.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Le.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Le.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var m;if((((m=f==null?void 0:f.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}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Ut(n.name),n.mirror=ko(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(ko);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Ut(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var m;if(typeof n=="object"){const y=n;n=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(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=ko(o.mirror),o.sources=(m=o.sources)==null?void 0:m.map(ko);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(d),d}async info(n,s){Ut(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:d,limit:m}=f,y=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(d&&d>y){const g=[f],E=s||{};let _=0;for(;d>y;){_++,E.offset=m*_;const z=await this._request(a,E);d=z.total,g.push(z);const M=Object.getOwnPropertyNames(z.state.subjects).length;if(y+=M,M<m)break}let T={};for(let z=0;z<g.length;z++)f=g[z],f.state.subjects&&(T=Object.assign(T,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=T}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const d=f;return d.streams.forEach(m=>{this._fixInfo(m)}),d.streams},o=`${this.prefix}.STREAM.LIST`;return new Pa(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Ut(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Ut(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Ut(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new eg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var y;const f=a.streams.filter(g=>g.config.name.startsWith(rn));f.forEach(g=>{this._fixInfo(g)});let d="";return f.length&&(d=((y=this.nc.info)==null?void 0:y.cluster)??""),f.map(g=>new Wy(g,d))},s=`${this.prefix}.STREAM.LIST`;return new Pa(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(m=>m.config.name.startsWith(dh));return f.forEach(m=>{this._fixInfo(m)}),f.map(m=>new If(m))},s=`${this.prefix}.STREAM.LIST`;return new Pa(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Pa(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new ic(this,s))}}class k_ extends el{constructor(n,s){super(n,s)}async getMessage(n,s){Ut(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):on,d=this.opts.apiPrefix||"$JS.API",m=o?`${d}.DIRECT.GET.${n}.${o}`:`${d}.DIRECT.GET.${n}`,y=await this.nc.request(m,f,{timeout:this.timeout}),g=Nr(y);if(g)return Promise.reject(g);const E=new Kf(y);return Promise.resolve(E)}async getBatch(n,s){Ut(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(y,g)=>y==="up_to_time"&&g instanceof Date?g.toISOString():g),d=new Ot,m=await this.nc.requestMany(o,f,{strategy:Dn.SentinelMsg});return(async()=>{var _,T,z;let y=!1,g=!1,E;for await(const M of m){if(!y){y=!0;const D=((_=M.headers)==null?void 0:_.code)||0;if(D!==0&&D<200||D>299){E=(T=M.headers)==null?void 0:T.description.toLowerCase();break}if(((z=M.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){g=!0;break}}if(M.data.length===0)break;d.push(new Kf(M))}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 Kf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(Er.Subject)}get seq(){const n=this.header.last(Er.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Er.TimeStamp)}get stream(){return this.header.last(Er.Stream)}json(n){return qn(n).decode(this.data)}string(){return an.decode(this.data)}}v(Kf,"jc");class N_ extends el{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new mh(s,a),this.consumers=new Qo(s,a),this.direct=new k_(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Ot;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),d=f.type.split("."),m=d[d.length-1];s.push({kind:m,data:f})}catch(f){s.stop(f)}}}),s}}class eg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):on}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=ei.decode(n)}else this._header=gs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return qn(n).decode(this.data)}string(){return an.decode(this.data)}}v(eg,"jc");class C_{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new ic(this.api,s))}}class Tf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=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 n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function K0(i){const n={name:i.name,description:i.description??"",options:i.options,metadata:i.metadata};if(i.headers){const s=i.headers;n.headers=s.toRecord()}return n}function M_(){return new ReadableStream({pull(i){i.enqueue(new Uint8Array(0)),i.close()}})}class Ia{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new Tf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),m=qn().decode(f.data);return m.revision=f.seq,m}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new If(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new If(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var ae;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:d}=a,m=this.js.nc.info,y=(m==null?void 0:m.max_payload)||1024;n=n||{},n.options=n.options||{};let g=((ae=n.options)==null?void 0:ae.max_chunk_size)||128*1024;g=g>y?y:g,n.options.max_chunk_size=g;const E=await this.info(n.name),{name:_,error:T}=this._checkNotEmpty(n.name);if(T)return Promise.reject(T);const z=si.next(),M=this._chunkSubject(z),D=this._metaSubject(_),J=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},K0(n)),ie=it(),G=[],ce=new qr;try{const k=s?s.getReader():null,Z=L0.create();for(;;){const{done:oe,value:F}=k?await k.read():{done:!0,value:void 0};if(oe){if(ce.size()>0){const se=ce.drain();Z.update(se),J.chunks++,J.size+=se.length,G.push(this.js.publish(M,se,{timeout:f}))}await Promise.all(G),G.length=0,J.mtime=new Date().toISOString();const V=Cr.encode(Z.digest());J.digest=`${Q0}${V}`,J.deleted=!1;const K=gs();typeof d=="number"&&K.set(Yn.ExpectedLastSubjectSequenceHdr,`${d}`),K.set(Lt.RollupHdr,Lt.RollupValueSubject);const Q=await this.js.publish(D,qn().encode(J),{headers:K,timeout:f});if(J.revision=Q.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}ie.resolve(new Tf(J));break}if(F)for(ce.fill(F);ce.size()>g;){J.chunks++,J.size+=g;const V=ce.drain(n.options.max_chunk_size);Z.update(V),G.push(this.js.publish(M,V,{timeout:f}))}}}catch(k){await this.jsm.streams.purge(this.stream,{filter:M}),ie.reject(k)}return ie}putBlob(n,s,a){function o(f){return new ReadableStream({pull(d){d.enqueue(f),d.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const d=new qr,m=f.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(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const _=s.options.link.name||"";if(_==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Ia.create(this.js,s.options.link.bucket):this).get(_)}if(!s.digest.startsWith(Q0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=$f(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=it(),f={info:new Tf(s),error:o};if(s.size===0)return f.data=M_(),o.resolve(null),Promise.resolve(f);let d;const m=ti();m.orderedConsumer();const y=L0.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&&(v1(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(_)}),f.data=new ReadableStream({start(_){d=_},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Ia))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const d={name:o,options:{link:{bucket:a.name}}};return this._put(d,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:s.bucket,name:s.name},m={name:a,bucket:s.bucket,options:{link:d}};await this.js.publish(this._metaSubject(n),JSON.stringify(m));const y=await this.info(n);return Promise.resolve(y)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=qn(),o=gs();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(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const 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,K0(s)),m=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(m)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new Ot,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 f=qn(),d=ti();d.orderedConsumer(),n.includeHistory?d.deliverLastPerSubject():(s=!0,d.deliverNew()),d.callback((y,g)=>{var E;if(y){a.stop(y);return}if(g!==null){const _=f.decode(g.data);_.deleted&&n.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(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${Cr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=__(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ja.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?ii.S2:ii.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new Ia(s,o,n);return await f.init(a),Promise.resolve(f)}}class R_{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Le.JS_KV);return o?s.bindOnly?Xa.bind(this.js,n,s):Xa.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,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:f}=a.nc.features.get(Le.JS_OBJECTSTORE);return o?Ia.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class ph extends el{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new Qo(s,a),this.streamAPI=new mh(s,a),this.consumers=new Jf(this.consumerAPI),this.streams=new C_(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 R_(this)}async publish(s,a=on,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||gs();o&&(o.msgID&&f.set(Yn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(Yn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(Yn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(Yn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(Yn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const d=o.timeout||this.timeout,m={};d&&(m.timeout=d),o&&(m.headers=f);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(z){if(z.code==="503"&&T+1<y)await zr(g);else throw z}const _=this.parseJsResponse(E);if(_.stream==="")throw me.errorForCode(le.JetStreamInvalidAck);return _.duplicate=_.duplicate?_.duplicate:!1,_}async pull(s,a,o=0){Ut(s),kr(a);let f=this.timeout;o>f&&(f=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:f}),y=Nr(m);if(y)throw y;return Za(m,this.timeout)}fetch(s,a,o={}){Ut(s),kr(a);let f=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 G=this.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`);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 z=new Ot,M=E.batch;let D=0;z.protocolFilterFn=(G,ce=!1)=>Lf(G.msg)?(g==null||g.work(),!1):!0,z.dispatchedFn=G=>{if(G){if(d&&(m+=G.data.length),D++,f&&G.info.pending===0)return;(z.getPending()===1&&G.info.pending===0||M===D||y>0&&m>=y)&&z.stop()}};const J=ys(this.nc.options.inboxPrefix),ie=this.nc.subscribe(J,{max:o.batch,callback:(G,ce)=>{G===null&&(G=Nr(ce)),G!==null?(f&&(f.cancel(),f=null),t1(G)?z.stop(ng(G)===null?void 0:G):z.stop(G)):(g==null||g.work(),z.received++,z.push(Za(ce,this.timeout)))}});return _&&(f=Rr(_),f.catch(()=>{ie.isClosed()||(ie.drain().catch(()=>{}),f=null),g&&g.cancel()})),(async()=>{try{T&&(g=new hh(T,G=>(z.push(()=>{z.err=new me(`${Sn.IdleHeartbeatMissed}: ${G}`,le.JetStreamIdleHeartBeat)}),!0)))}catch{}await ie.closed,f!==null&&(f.cancel(),f=null),g&&g.cancel(),z.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:J}),z}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 f=o.config.ack_policy;if(f===jt.None||f===jt.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(o),m=new U_(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 f=this._buildTypedSubscriptionOpts(o),d=new tg(this,o.deliver,f);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=q0(a)?a.getOpts():a;if(o.isBind=q0(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!==jt.NotSet&&o.config.ack_policy!==jt.None)throw new me("ordered consumer: ack_policy can only be set to 'none'",le.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new me("ordered consumer: durable_name cannot be set",le.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new me("ordered consumer: deliver_subject cannot be set",le.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new me("ordered consumer: max_deliver cannot be set",le.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new me("ordered consumer: deliver_group cannot be set",le.ApiError);o.config.deliver_subject=ys(this.nc.options.inboxPrefix),o.config.ack_policy=jt.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===jt.NotSet&&(o.config.ack_policy=jt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const d=o.config.deliver_group??"";if(d===""&&f.push_bound===!0)throw new Error("duplicate subscription");const m=f.config.deliver_group??"";if(d!==m)throw m===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${m}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||ys(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=B_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=ph.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const d=o;return Bf(d.msg)?(f||d.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==jt.None&&(a.dispatchedFn=P_),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:jt.Explicit,ack_wait:st(30*1e3),replay_policy:Dr.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 f=o;if(!a)return{ingest:!1,protocol:!1};const d=a;if(Nr(d.msg)||(y=f.monitor)==null||y.work(),Lf(d.msg)){const g=s?f._checkHbOrderConsumer(d.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:g,protocol:!0}}else if(Bf(d.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class yh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=n_(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new yh(n);Ko.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const d of f.status())o.listeners.forEach(m=>{m.push(d)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw me.errorForCode(le.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw me.errorForCode(le.ConnectionDraining);if(n=n||"",n.length===0)throw me.errorForCode(le.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Xy(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=on,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!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",le.InvalidOption));const f=new Ot;function d(y){f.push(()=>{f.stop(y)})}function m(y,g){y||g===null?d(y===null?void 0:y):f.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(ys(this.options.inboxPrefix),{callback:(M,D)=>{var J,ie;if(((J=D==null?void 0:D.data)==null?void 0:J.length)===0&&((ie=D==null?void 0:D.headers)==null?void 0:ie.status)===le.NoResponders&&(M=me.errorForCode(le.NoResponders)),M){y&&(M.stack+=`
48
+
49
+ ${y}`),_(M);return}m(null,D),a.strategy===Dn.Count&&(g--,g===0&&_()),a.strategy===Dn.JitterTimer&&(z(),T=setTimeout(()=>{_()},300)),a.strategy===Dn.SentinelMsg&&D&&D.data.length===0&&_()}});E.requestSubject=n,E.closed.then(()=>{d()}).catch(M=>{f.stop(M)});const _=M=>{M&&f.push(()=>{throw M}),z(),E.drain().then(()=>{d()}).catch(D=>{d()})};f.iterClosed.then(()=>{z(),E==null||E.unsubscribe()}).catch(M=>{z(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){_(M)}let T=setTimeout(()=>{_()},a.maxWait);const z=()=>{T&&clearTimeout(T)}}else{const y=a;y.callback=m,f.iterClosed.then(()=>{g.cancel()}).catch(E=>{g.cancel(E)});const g=new _1(this.protocol.muxSubscriptions,n,y);this.protocol.request(g);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${g.token}`,headers:a.headers})}catch(E){g.cancel(E)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new me("timeout",le.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new me("reply can only be used with noMux",le.InvalidOption));if(a.noMux){const f=a.reply?a.reply:ys(this.options.inboxPrefix),d=it(),m=o?new Error:null,y=this.subscribe(f,{max:1,timeout:a.timeout,callback:(g,E)=>{g?(m&&g.code!==le.Timeout&&(g.stack+=`
50
+
51
+ ${m.stack}`),y.unsubscribe(),d.reject(g)):(g=$y(E),g?(m&&(g.stack+=`
52
+
53
+ ${m.stack}`),d.reject(g)):d.resolve(E))}});return y.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),d}else{const f=new Gy(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(m){f.cancel(m)}const d=Promise.race([f.timer,f.deferred]);return d.catch(()=>{f.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new Ot;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new N_(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===le.NoResponders&&(o.code=le.JetStreamNotEnabled),o}return s}jetstream(n={}){return new ph(this,n)}getServerVersion(){const n=this.info;return n?Ci(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw me.errorForCode(le.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new D_(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):this.protocol.reconnect()}}class D_{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new tl(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new d_(this.nc,n,s)}}class q_{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Xo)||"PUT"}get length(){const n=this.sm.header.get(Lt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class z_{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(uh(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Xo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Lt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class tg extends A1{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=ys(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=si.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=dt.StartSequence,f.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.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 ${f.stream} at seq ${s}`,le.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(uh(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,d=m=>{var E,_,T,z;const y=r1(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 M=((T=(_=this.info)==null?void 0:_.ordered_consumer_sequence)==null?void 0:T.stream_seq)||0;return this._resetOrderedConsumer(M+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new hh(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),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class U_ extends tg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,d={};if(d.batch=n.batch||1,d.no_wait=n.no_wait||!1,(n.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=n.max_bytes}let m=0;n.expires&&n.expires>0&&(m=n.expires,d.expires=st(m));let y=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(y=n.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}.${f}`,_=this.sub.subject;g.nc.publish(E,g.jc.encode(d),{reply:_})}}}function B_(i,n){return i?H_(n):L_(n)}function L_(i){return(n,s)=>n?[n,null]:(n=Nr(s),n?[n,null]:[null,Za(s,i)])}function H_(i){return(n,s)=>{if(n)return[n,null];const a=Nr(s);return a!==null?[ng(a),null]:[null,Za(s,i)]}}function ng(i){if(i!==null)switch(i.code){case le.JetStream404NoMessages:case le.JetStream408RequestTimeout:return null;case le.JetStream409:return a1(i)?i:null;default:return i}return null}function P_(i){i&&i.ack()}function $_(i){const n=i.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class Y_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=$_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===qa[0]&&n[1]===qa[1]&&n[2]===qa[2]&&n[3]===qa[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=it();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,d=!((a=f.options)!=null&&a.noAsyncTraces),m=new Gy(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},d);f.request(m);try{f.publish(this.msg.reply,J0,{reply:`${f.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(J0)}nak(n){let s=S_;n&&(s=Uf().encode(`-NAK ${JSON.stringify({delay:st(n)})}`)),this.doAck(s)}working(){this.doAck(qa)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=st(s.expires));const o=qn().encode(a),f=qr.concat(E_,j_,o),d=n?{reply:n}:void 0;this.msg.respond(f,d)}term(n=""){let s=A_;(n==null?void 0:n.length)>0&&(s=Uf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const V_="1.30.3",G_="nats.ws";class F_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=V_,this.lang=G_,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(n,s){const a=it();if(s.tls)return a.reject(new me("tls",le.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:d}=await s.wsFactory(n.src,s);this.socket=f,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=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const d=qr.concat(...this.yields),m=C1(d);if(m!==""){const y=r_.exec(m);if(!y){s.debug&&console.error("!!!",jo(d)),a.reject(new Error("unexpected response from server"));return}try{const g=JSON.parse(y[1]);s_(g,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(g){a.reject(g);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(f.wasClean||(d=new Error(f.reason)),this._closed(d))},this.socket.onerror=f=>{if(this.isDiscarded())return;const d=f,m=new me(d.message,le.Unknown,new Error(d.error));a.reject(m)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await zr(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${jo(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=it())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${jo(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${jo(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function I_(i,n){/^(.*:\/\/)(.*)/.test(i)||(typeof n=="boolean"?i=`${n===!0?"https":"http"}://${i}`:i=`https://${i}`);let a=new URL(i);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${i}`));let f,d;const m=a.hostname,y=a.pathname,g=a.search||"";switch(o){case"http:":case"ws:":case"nats:":d=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":d=a.port||"443",f="wss:";break;default:d=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${m}:${d}${y}${g}`}function Q_(i={}){return j1({defaultPort:443,urlParseFn:I_,factory:()=>new F_}),yh.connect(i)}const J_=null,K_=null,X_="lt.events";function sg(i,n){const s=i.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const nl=j.createContext({connected:!1,subscribe:()=>()=>{}});function Z_(){const{connected:i}=j.useContext(nl);return{connected:i}}function W_(i,n){const{subscribe:s}=j.useContext(nl),a=j.useRef(n);a.current=n,j.useEffect(()=>s(i,f=>a.current(f)),[s,i])}const ew=j.createContext({connected:!1,subscribe:()=>()=>{}}),tw=Uf();function nw({children:i,url:n,token:s}){const a=j.useRef(null),o=j.useRef(null),[f,d]=j.useState(!1),m=j.useRef(null),y=j.useRef(new Map),g=j.useCallback((T,z)=>{const M=y.current;return M.has(T)||M.set(T,new Set),M.get(T).add(z),()=>{const D=M.get(T);D&&(D.delete(z),D.size===0&&M.delete(T))}},[]),E=j.useCallback((T,z)=>{for(const[M,D]of y.current)if(sg(T,M))for(const J of D)try{J(z)}catch{}},[]),_=j.useCallback(async()=>{try{if(a.current)return;const T=n||J_;if(!T){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const z=await Q_({servers:T,token:s||K_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=z,d(!0);const M=z.subscribe("lt.>");o.current=M,(async()=>{for await(const D of M)try{const J=JSON.parse(tw.decode(D.data));E(D.subject,J)}catch{}})(),(async()=>{for await(const D of z.status())D.type==="disconnect"||D.type==="error"?d(!1):D.type==="reconnect"&&d(!0)})()}catch{d(!1),m.current=setTimeout(_,3e3)}},[E]);return j.useEffect(()=>(_(),()=>{m.current&&clearTimeout(m.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),d(!1)}),[_]),h.jsx(ew.Provider,{value:{connected:f,subscribe:g},children:h.jsx(nl.Provider,{value:{connected:f,subscribe:g},children:i})})}const Fn=Object.create(null);Fn.open="0";Fn.close="1";Fn.ping="2";Fn.pong="3";Fn.message="4";Fn.upgrade="5";Fn.noop="6";const Bo=Object.create(null);Object.keys(Fn).forEach(i=>{Bo[Fn[i]]=i});const Xf={type:"error",data:"parser error"},ig=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",rg=typeof ArrayBuffer=="function",ag=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,gh=({type:i,data:n},s,a)=>ig&&n instanceof Blob?s?a(n):X0(n,a):rg&&(n instanceof ArrayBuffer||ag(n))?s?a(n):X0(new Blob([n]),a):a(Fn[i]+(n||"")),X0=(i,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(i)};function Z0(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let kf;function sw(i,n){if(ig&&i.data instanceof Blob)return i.data.arrayBuffer().then(Z0).then(n);if(rg&&(i.data instanceof ArrayBuffer||ag(i.data)))return n(Z0(i.data));gh(i,!1,s=>{kf||(kf=new TextEncoder),n(kf.encode(s))})}const W0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$a=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<W0.length;i++)$a[W0.charCodeAt(i)]=i;const iw=i=>{let n=i.length*.75,s=i.length,a,o=0,f,d,m,y;i[i.length-1]==="="&&(n--,i[i.length-2]==="="&&n--);const g=new ArrayBuffer(n),E=new Uint8Array(g);for(a=0;a<s;a+=4)f=$a[i.charCodeAt(a)],d=$a[i.charCodeAt(a+1)],m=$a[i.charCodeAt(a+2)],y=$a[i.charCodeAt(a+3)],E[o++]=f<<2|d>>4,E[o++]=(d&15)<<4|m>>2,E[o++]=(m&3)<<6|y&63;return g},rw=typeof ArrayBuffer=="function",bh=(i,n)=>{if(typeof i!="string")return{type:"message",data:lg(i,n)};const s=i.charAt(0);return s==="b"?{type:"message",data:aw(i.substring(1),n)}:Bo[s]?i.length>1?{type:Bo[s],data:i.substring(1)}:{type:Bo[s]}:Xf},aw=(i,n)=>{if(rw){const s=iw(i);return lg(s,n)}else return{base64:!0,data:i}},lg=(i,n)=>{switch(n){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},og="",lw=(i,n)=>{const s=i.length,a=new Array(s);let o=0;i.forEach((f,d)=>{gh(f,!1,m=>{a[d]=m,++o===s&&n(a.join(og))})})},ow=(i,n)=>{const s=i.split(og),a=[];for(let o=0;o<s.length;o++){const f=bh(s[o],n);if(a.push(f),f.type==="error")break}return a};function cw(){return new TransformStream({transform(i,n){sw(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 f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}i.data&&typeof i.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let Nf;function No(i){return i.reduce((n,s)=>n+s.length,0)}function Co(i,n){if(i[0].length===n)return i.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;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 uw(i,n){Nf||(Nf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(d,m){for(s.push(d);;){if(a===0){if(No(s)<1)break;const y=Co(s,1);f=(y[0]&128)===128,o=y[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(No(s)<2)break;const y=Co(s,2);o=new DataView(y.buffer,y.byteOffset,y.length).getUint16(0),a=3}else if(a===2){if(No(s)<8)break;const y=Co(s,8),g=new DataView(y.buffer,y.byteOffset,y.length),E=g.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue(Xf);break}o=E*Math.pow(2,32)+g.getUint32(4),a=3}else{if(No(s)<o)break;const y=Co(s,o);m.enqueue(bh(f?y:Nf.decode(y),n)),a=0}if(o===0||o>i){m.enqueue(Xf);break}}}})}const cg=4;function bt(i){if(i)return fw(i)}function fw(i){for(var n in bt.prototype)i[n]=bt.prototype[n];return i}bt.prototype.on=bt.prototype.addEventListener=function(i,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(n),this};bt.prototype.once=function(i,n){function s(){this.off(i,s),n.apply(this,arguments)}return s.fn=n,this.on(i,s),this};bt.prototype.off=bt.prototype.removeListener=bt.prototype.removeAllListeners=bt.prototype.removeEventListener=function(i,n){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===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+i],this};bt.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+i],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};bt.prototype.emitReserved=bt.prototype.emit;bt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};bt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const rc=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),En=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),hw="arraybuffer";function ug(i,...n){return n.reduce((s,a)=>(i.hasOwnProperty(a)&&(s[a]=i[a]),s),{})}const dw=En.setTimeout,mw=En.clearTimeout;function ac(i,n){n.useNativeTimers?(i.setTimeoutFn=dw.bind(En),i.clearTimeoutFn=mw.bind(En)):(i.setTimeoutFn=En.setTimeout.bind(En),i.clearTimeoutFn=En.clearTimeout.bind(En))}const pw=1.33;function yw(i){return typeof i=="string"?gw(i):Math.ceil((i.byteLength||i.size)*pw)}function gw(i){let n=0,s=0;for(let a=0,o=i.length;a<o;a++)n=i.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function fg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function bw(i){let n="";for(let s in i)i.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(i[s]));return n}function xw(i){let n={},s=i.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class vw extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class xh extends bt{constructor(n){super(),this.writable=!1,ac(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new vw(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=bh(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=bw(n);return s.length?"?"+s:""}}class _w extends xh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};ow(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,lw(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=fg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let hg=!1;try{hg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ww=hg;function Sw(){}class Ew extends _w{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Gn extends bt{constructor(n,s,a){super(),this.createRequest=n,ac(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=ug(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Gn.requestsCount++,Gn.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Sw,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Gn.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Gn.requestsCount=0;Gn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ey);else if(typeof addEventListener=="function"){const i="onpagehide"in En?"pagehide":"unload";addEventListener(i,ey,!1)}}function ey(){for(let i in Gn.requests)Gn.requests.hasOwnProperty(i)&&Gn.requests[i].abort()}const Aw=(function(){const i=dg({xdomain:!1});return i&&i.responseType!==null})();class jw extends Ew{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=Aw&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Gn(dg,this.uri(),n)}}function dg(i){const n=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||ww))return new XMLHttpRequest}catch{}if(!n)try{return new En[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const mg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Ow extends xh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=mg?{}:ug(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;gh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&rc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=fg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const Cf=En.WebSocket||En.MozWebSocket;class Tw extends Ow{createSocket(n,s,a){return mg?new Cf(n,s,a):s?new Cf(n,s):new Cf(n)}doWrite(n,s){this.ws.send(s)}}class kw extends xh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=uw(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=cw();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:m,value:y})=>{m||(this.onPacket(y),f())}).catch(m=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&rc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const Nw={websocket:Tw,webtransport:kw,polling:jw},Cw=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Mw=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Zf(i){if(i.length>8e3)throw"URI too long";const n=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=Cw.exec(i||""),f={},d=14;for(;d--;)f[Mw[d]]=o[d]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=Rw(f,f.path),f.queryKey=Dw(f,f.query),f}function Rw(i,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function Dw(i,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Wf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Lo=[];Wf&&addEventListener("offline",()=>{Lo.forEach(i=>i())},!1);class ni extends bt{constructor(n,s){if(super(),this.binaryType=hw,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Zf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Zf(s.host).host);ac(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=xw(this.opts.query)),Wf&&(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"})},Lo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=cg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&ni.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",ni.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=yw(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,rc(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(ni.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Wf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Lo.indexOf(this._offlineEventListener);a!==-1&&Lo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}ni.protocol=cg;class qw extends ni{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;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 f(){a||(a=!0,E(),s.close(),s=null)}const d=_=>{const T=new Error("probe error: "+_);T.transport=s.name,f(),this.emitReserved("upgradeError",T)};function m(){d("transport closed")}function y(){d("socket closed")}function g(_){s&&_.name!==s.name&&f()}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&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let zw=class extends qw{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>Nw[o]).filter(o=>!!o)),super(n,a)}};function Uw(i,n="",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=Zf(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 f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const Bw=typeof ArrayBuffer=="function",Lw=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,pg=Object.prototype.toString,Hw=typeof Blob=="function"||typeof Blob<"u"&&pg.call(Blob)==="[object BlobConstructor]",Pw=typeof File=="function"||typeof File<"u"&&pg.call(File)==="[object FileConstructor]";function vh(i){return Bw&&(i instanceof ArrayBuffer||Lw(i))||Hw&&i instanceof Blob||Pw&&i instanceof File}function Ho(i,n){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let s=0,a=i.length;s<a;s++)if(Ho(i[s]))return!0;return!1}if(vh(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Ho(i.toJSON(),!0);for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&Ho(i[s]))return!0;return!1}function $w(i){const n=[],s=i.data,a=i;return a.data=eh(s,n),a.attachments=n.length,{packet:a,buffers:n}}function eh(i,n){if(!i)return i;if(vh(i)){const s={_placeholder:!0,num:n.length};return n.push(i),s}else if(Array.isArray(i)){const s=new Array(i.length);for(let a=0;a<i.length;a++)s[a]=eh(i[a],n);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]=eh(i[a],n));return s}return i}function Yw(i,n){return i.data=th(i.data,n),delete i.attachments,i}function th(i,n){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<n.length)return n[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let s=0;s<i.length;s++)i[s]=th(i[s],n);else if(typeof i=="object")for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(i[s]=th(i[s],n));return i}const Vw=["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 Gw{constructor(n){this.replacer=n}encode(n){return(n.type===Be.EVENT||n.type===Be.ACK)&&Ho(n)?this.encodeAsBinary({type:n.type===Be.EVENT?Be.BINARY_EVENT:Be.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===Be.BINARY_EVENT||n.type===Be.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=$w(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class _h extends bt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===Be.BINARY_EVENT;a||s.type===Be.BINARY_ACK?(s.type=a?Be.EVENT:Be.ACK,this.reconstructor=new Fw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(vh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(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 f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const d=n.substring(f,s);if(d!=Number(d)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(d);if(!Iw(m)||m<0)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=m}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const d=n.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(_h.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case Be.CONNECT:return ty(s);case Be.DISCONNECT:return s===void 0;case Be.CONNECT_ERROR:return typeof s=="string"||ty(s);case Be.EVENT:case Be.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Vw.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 Fw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=Yw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Iw=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function ty(i){return Object.prototype.toString.call(i)==="[object Object]"}const Qw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:_h,Encoder:Gw,get PacketType(){return Be}},Symbol.toStringTag,{value:"Module"}));function Rn(i,n,s){return i.on(n,s),function(){i.off(n,s)}}const Jw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class yg extends bt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[Rn(n,"open",this.onopen.bind(this)),Rn(n,"packet",this.onpacket.bind(this)),Rn(n,"error",this.onerror.bind(this)),Rn(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(Jw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const 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&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(y?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===n&&this.sendBuffer.splice(m,1);s.call(this,new Error("operation has timed out"))},o),d=(...m)=>{this.io.clearTimeoutFn(f),s.apply(this,m)};d.withError=!0,this.acks[n]=d}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(d,m)=>d?o(d):a(m);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case Be.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Be.EVENT:case Be.BINARY_EVENT:this.onevent(n);break;case Be.ACK:case Be.BINARY_ACK:this.onack(n);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:Be.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function Ur(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}Ur.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*i);i=(Math.floor(n*10)&1)==0?i-s:i+s}return Math.min(i,this.max)|0};Ur.prototype.reset=function(){this.attempts=0};Ur.prototype.setMin=function(i){this.ms=i};Ur.prototype.setMax=function(i){this.max=i};Ur.prototype.setJitter=function(i){this.jitter=i};class nh extends bt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,ac(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 Ur({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||Qw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new zw(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Rn(s,"open",function(){a.onopen(),n&&n()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},d=Rn(s,"error",f);if(this._timeout!==!1){const m=this._timeout,y=this.setTimeoutFn(()=>{o(),f(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(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(Rn(n,"ping",this.onping.bind(this)),Rn(n,"data",this.ondata.bind(this)),Rn(n,"error",this.onerror.bind(this)),Rn(n,"close",this.onclose.bind(this)),Rn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){rc(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new yg(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const za={};function Po(i,n){typeof i=="object"&&(n=i,i=void 0),n=n||{};const s=Uw(i,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,d=za[o]&&f in za[o].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||d;let y;return m?y=new nh(a,n):(za[o]||(za[o]=new nh(a,n)),y=za[o]),s.query&&!n.query&&(n.query=s.queryKey),y.socket(s.path,n)}Object.assign(Po,{Manager:nh,Socket:yg,io:Po,connect:Po});const Kw=j.createContext({connected:!1,subscribe:()=>()=>{}});function Xw({children:i}){const n=j.useRef(null),[s,a]=j.useState(!1),o=j.useRef(new Map),f=j.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=j.useCallback((m,y)=>{for(const[g,E]of o.current)if(sg(m,g))for(const _ of E)try{_(y)}catch{}},[]);return j.useEffect(()=>{const m=By(),y=Po({path:`${Ft}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...m?{auth:{token:m}}:{}});return n.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(),n.current=null,a(!1)}},[d]),h.jsx(Kw.Provider,{value:{connected:s,subscribe:f},children:h.jsx(nl.Provider,{value:{connected:s,subscribe:f},children:i})})}function Zw({children:i}){const[n,s]=j.useState(null),[a,o]=j.useState({url:null,token:null});return j.useEffect(()=>{let f=!1;async function d(){var m;try{console.log("[lt-transport] detecting event transport...");const y=await fetch(`${Ft}/api/settings`);if(!y.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||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),!f){if(E==="nats"){let _=g.events.natsWsUrl??null,T=null;const z=By();if(z)try{const M=await fetch(`${Ft}/api/nats-credentials`,{headers:{Authorization:`Bearer ${z}`}});if(M.ok){const D=await M.json();_=D.natsWsUrl??_,T=D.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),f||s("socketio")}}return d(),()=>{f=!0}},[]),n==="nats"?h.jsx(nw,{url:a.url,token:a.token,children:i}):n==="socketio"?h.jsx(Xw,{children:i}):h.jsx(h.Fragment,{children:i})}const wh="lt_view_as",Sh="lt_ai_override";function gg(){try{const i=localStorage.getItem(Sh);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function Ww(i){try{localStorage.setItem(Sh,String(i))}catch{}}function eS(){try{localStorage.removeItem(Sh)}catch{}}function Eh(){try{const i=localStorage.getItem(wh);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function tS(i){try{localStorage.setItem(wh,i)}catch{}window.location.reload()}function bg(){try{localStorage.removeItem(wh)}catch{}window.location.reload()}function xg(){const{isSuperAdmin:i,hasRoleType:n,hasRole:s}=In(),a=Eh(),o=i||s("engineer"),f=n("admin"),d=i||n("admin");return{isBuilder:a?!1:o,isOps:a?a==="admin"||a==="engineer":f,canBulk:a?!1:d,viewAs:a,realIsBuilder:o}}function vg(){const{isSuperAdmin:i,hasRoleType:n,hasRole:s}=In(),a=i?"superadmin":n("admin")?"admin":s("engineer")?"engineer":"operator",o=Eh(),f=o==="admin"||o==="engineer"||o==="operator"?o:null,d=f??a;return{tier:d,realTier:a,viewAs:f,canSeePaceBoard:d==="superadmin"||d==="admin",canSeeWorkflows:d==="superadmin"||d==="engineer",showTaskQueueCards:d==="operator",taskQueueSource:a==="superadmin"||a==="admin"?"manual":"membership"}}const nS="lt_ai_override";function sS(){return Te("/settings")}function iS(){try{if(localStorage.getItem(nS)==="off")return!1}catch{}return null}function Br(){var s;const i=xt({queryKey:["settings"],queryFn:sS,staleTime:1/0}),n=iS();return i.data&&n===!1&&((s=i.data.ai)!=null&&s.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}const _g=j.createContext(null),ny="lt_sidebar_collapsed";function rS({children:i}){const[n,s]=j.useState(()=>{try{return localStorage.getItem(ny)==="true"}catch{return!1}}),a=j.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(ny,String(f))}catch{}return f})},[]);return h.jsx(_g.Provider,{value:{collapsed:n,toggle:a},children:i})}function wg(){const i=j.useContext(_g);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}function Sg(i,n){var s,a,o,f,d;n.facets&&Object.keys(n.facets).length&&i.set("facets",JSON.stringify(n.facets)),(s=n.block)!=null&&s.length&&i.set("block",JSON.stringify(n.block)),(a=n.range)!=null&&a.length&&i.set("range",JSON.stringify(n.range)),(o=n.exists)!=null&&o.length&&i.set("exists",JSON.stringify(n.exists)),(f=n.roles)!=null&&f.length&&i.set("roles",JSON.stringify(n.roles)),(d=n.orderBy)!=null&&d.length&&i.set("orderBy",JSON.stringify(n.orderBy)),n.available!==void 0&&i.set("available",String(n.available)),n.jeopardy===!0&&i.set("jeopardy","1")}function KA(i,n){const s=i??"24h";return xt({queryKey:["stationMetrics",s],queryFn:()=>Te(`/escalations/station-metrics?period=${s}`),staleTime:5e3,enabled:(n==null?void 0:n.enabled)??!0})}function XA(i){const n=i?`?period=${i}`:"";return xt({queryKey:["escalationStats",i],queryFn:()=>Te(`/escalations/stats${n}`)})}function ZA(){return xt({queryKey:["escalationTypes"],queryFn:()=>Te("/escalations/types")})}function WA(i=!0){return xt({queryKey:["escalationFacetKeys"],queryFn:()=>Te("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function aS(i){const{enabled:n=!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),Sg(o,a),xt({queryKey:["escalations",a],queryFn:()=>Te(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function lS(i){const{enabled:n=!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),Sg(o,a),xt({queryKey:["escalations","available",a],queryFn:()=>Te(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function ej(i){return xt({queryKey:["escalations","by-workflow",i],queryFn:()=>Te(`/escalations/by-workflow/${i}`),enabled:!!i})}function tj(i){return xt({queryKey:["escalations",i],queryFn:()=>Te(`/escalations/${i}`),enabled:!!i})}function nj(){const i=Tt();return Rt({mutationFn:({id:n,durationMinutes:s})=>Te(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function sj(){const i=Tt();return Rt({mutationFn:n=>Te(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function ij(){const i=Tt();return Rt({mutationFn:({id:n,resolverPayload:s})=>Te(`/escalations/${n}/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 rj(){const i=Tt();return Rt({mutationFn:({id:n,targetRole:s})=>Te(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function aj(){const i=Tt();return Rt({mutationFn:({ids:n,priority:s})=>Te("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function lj(){const i=Tt();return Rt({mutationFn:({ids:n,durationMinutes:s})=>Te("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function oj(){const i=Tt();return Rt({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Te("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function cj(){const i=Tt();return Rt({mutationFn:({ids:n,targetRole:s})=>Te("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function uj(){const i=Tt();return Rt({mutationFn:({ids:n,hint:s})=>Te("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function fj(){const i=Tt();return Rt({mutationFn:n=>Te(`/escalations/${n}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function hj(){const i=Tt();return Rt({mutationFn:({ids:n})=>Te("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:n})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function oS(){const{user:i}=In(),n=i==null?void 0:i.userId,s=Tt(),a=j.useRef(null),o=j.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);W_(`${X_}.system.escalation.>`,o);const{data:f}=lS({limit:1}),{data:d}=aS({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(d==null?void 0:d.total)??0}}function Ah({size:i="sm",hideLabel:n=!1,className:s="",appName:a="LongTail"}){const o=i==="lg",f=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 ${f}`,style:{"--logo-url":`url(${Ft}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${d} ${n?"opacity-0":""}`,children:a})]})}function dj(){return xt({queryKey:["roles"],queryFn:()=>Te("/roles")})}function mj(){return xt({queryKey:["roles","escalation-chains"],queryFn:()=>Te("/roles/escalation-chains")})}function pj(i){return xt({queryKey:["roles",i,"escalation-targets"],queryFn:()=>Te(`/roles/${encodeURIComponent(i)}/escalation-targets`),enabled:!!i})}function yj(){const i=Tt();return Rt({mutationFn:n=>Te("/roles/escalation-chains",{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function gj(){const i=Tt();return Rt({mutationFn:n=>Te("/roles/escalation-chains",{method:"DELETE",body:JSON.stringify(n)}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function Eg(i){return xt({queryKey:["roles","details"],queryFn:()=>Te("/roles/details"),enabled:(i==null?void 0:i.enabled)??!0})}function bj(i,n,s=!0){return xt({queryKey:["roles",i,"schema",n??"latest"],queryFn:()=>Te(`/roles/${encodeURIComponent(i)}/schema${n!=null?`?version=${n}`:""}`),enabled:s&&!!i})}function xj(i){return xt({queryKey:["roles",i,"schema-versions"],queryFn:()=>Te(`/roles/${encodeURIComponent(i)}/schema/versions`),enabled:!!i})}function vj(i,n,s=!0){return xt({queryKey:["roles",i,"list-schema",n??"latest"],queryFn:()=>Te(`/roles/${encodeURIComponent(i)}/list-schema${n!=null?`?version=${n}`:""}`),enabled:s&&!!i})}function _j(i){return xt({queryKey:["roles",i,"list-schema-versions"],queryFn:()=>Te(`/roles/${encodeURIComponent(i)}/list-schema/versions`),enabled:!!i})}function wj(){const i=Tt();return Rt({mutationFn:n=>Te("/roles",{method:"POST",body:JSON.stringify({role:n})}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function Sj(){const i=Tt();return Rt({mutationFn:({role:n,...s})=>Te(`/roles/${encodeURIComponent(n)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:n,...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===n?{...o,...s}:o)}),{previous:a}},onError:(n,s,a)=>{a!=null&&a.previous&&i.setQueryData(["roles","details"],a.previous)},onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function Ej(){const i=Tt();return Rt({mutationFn:n=>Te(`/roles/${encodeURIComponent(n)}`,{method:"DELETE"}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}const Ag="lt:task-queues:roles",sh="lt:task-queues-changed",cS=["superadmin","admin","engineer"];function jg(i){return cS.includes(i)}function Ri(){try{const i=localStorage.getItem(Ag);if(!i)return[];const n=JSON.parse(i);return Array.isArray(n)?n.filter(s=>typeof s=="string"):[]}catch{return[]}}function Og(i){try{localStorage.setItem(Ag,JSON.stringify(i))}catch{}try{window.dispatchEvent(new CustomEvent(sh))}catch{}}function uS(i){return Ri().includes(i)}function fS(i){const n=Ri();n.includes(i)||Og([...n,i].sort((s,a)=>s.localeCompare(a)))}function hS(i){const n=Ri();n.includes(i)&&Og(n.filter(s=>s!==i))}function dS(i){return uS(i)?(hS(i),!1):(fS(i),!0)}const mS=[{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"}],pS=["operator","engineer","admin","superadmin"];function sy(i){return pS.indexOf(i)}function yS(i,n){return sy(i)>=sy(n)}function gS({onClose:i}){var F,V,K,Q,se;const{isSuperAdmin:n,hasRoleType:s,hasRole:a}=In(),{data:o}=Br(),f=Eh(),d=!!((F=o==null?void 0:o.ai)!=null&&F.enabled),m=gg(),y=m!==null?m:d,[g,E]=j.useState(y),_=n?"superadmin":s("admin")?"admin":a("engineer")?"engineer":"operator",T=((V=o==null?void 0:o.branding)==null?void 0:V.appName)??"LongTail",z=(K=o==null?void 0:o.environment)==null?void 0:K.longTailVersion,M=(Q=o==null?void 0:o.environment)==null?void 0:Q.hotmeshVersion,D=(se=o==null?void 0:o.environment)==null?void 0:se.nodeEnv;j.useEffect(()=>{const he=Se=>{Se.key==="Escape"&&i()};return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[i]);const J=mS.filter(he=>yS(_,he.minTier)),ie=J.length>1,G=_==="admin"||_==="superadmin",ce=[...ie?[{id:"viewas",label:"View As",icon:hv}]:[],{id:"ai",label:"AI",icon:dv},...G?[{id:"queues",label:"Task Queues",icon:rh}]:[]],[ae,k]=j.useState(ce[0].id),Z=he=>{he===null?bg():tS(he)},oe=()=>{const he=!g;E(he),he===d?eS():Ww(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(Mi,{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(${Ft}/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}),z&&h.jsxs("p",{className:"mt-1 text-[11px] text-text-tertiary",children:["v",z,M&&h.jsxs(h.Fragment,{children:[" · HotMesh v",M]}),D&&D!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:D})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),ce.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:ce.map(he=>{const Se=ae===he.id;return h.jsxs("button",{role:"tab","aria-selected":Se,onClick:()=>k(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)})}),ae==="viewas"&&ie&&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"}),J.map(he=>{const Se=f===he.id,ke=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:ke}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:he.description})]})]},String(he.id))})]}),ae==="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:oe,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"}`})})]})]}),ae==="queues"&&G&&h.jsx(bS,{}),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 bS(){const{data:i}=Eg(),[n,s]=j.useState(Ri),a=((i==null?void 0:i.roles)??[]).filter(f=>!jg(f.role)).sort((f,d)=>(f.title||f.role).localeCompare(d.title||d.role)),o=f=>{dS(f),s(Ri())};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(f=>{const d=n.includes(f.role);return h.jsxs("button",{onClick:()=>o(f.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:f.title||f.role}),f.title&&h.jsx("span",{className:"block text-[10px] text-text-quaternary truncate",children:f.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"}`})})]},f.role)})})]})}const Tg=["violet","red","green","blue","rose","orange"],iy="blue",xS={violet:"#7B3BE0",red:"#DC382D",green:"#059669",blue:"#2563EB",rose:"#D6246E",orange:"#E85D04"},ry={violet:"Violet",red:"Brick",green:"Emerald",blue:"Electric",rose:"Raspberry",orange:"Harvest"},kg="lt.theme";function vS(i){return Tg.includes(i)}function Ng(){try{const i=localStorage.getItem(kg);return vS(i)?i:iy}catch{return iy}}function Cg(i){document.documentElement.dataset.theme=i}function _S(i){try{localStorage.setItem(kg,i)}catch{}Cg(i)}function wS(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(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function SS(i){var n;return((n=i.title)==null?void 0:n.trim())||wS(i.role)}const Mg=800,Rg=270,Ar=40,ES=76,jh=24,AS=72,$o=Mg-Ar-ES,Dg=Rg-jh-AS,Cn=jh+Dg,ay=Ar+$o,nn="0.5s cubic-bezier(0.4, 0, 0.2, 1)",ly=9;function jS(i){return`M ${(i.x-ly).toFixed(1)} ${i.y.toFixed(1)} L ${(i.x+ly).toFixed(1)} ${i.y.toFixed(1)}`}function jr(i){if(i.length===0)return"";if(i.length===1)return jS(i[0]);const n=[];for(let s=0;s<i.length-1;s++){const a=i[Math.max(0,s-1)],o=i[s],f=i[s+1],d=i[Math.min(i.length-1,s+2)],m=(o.x+(f.x-a.x)/6).toFixed(1),y=(o.y+(f.y-a.y)/6).toFixed(1),g=(f.x-(d.x-o.x)/6).toFixed(1),E=(f.y-(d.y-o.y)/6).toFixed(1);s===0&&n.push(`M ${o.x.toFixed(1)} ${o.y.toFixed(1)}`),n.push(`C ${m} ${y}, ${g} ${E}, ${f.x.toFixed(1)} ${f.y.toFixed(1)}`)}return n.join(" ")}function OS(i,n){if(i.length<2||n.length<2)return"";const s=jr(i),a=[...n].reverse(),o=jr(a),f=o.slice(o.indexOf("C"));return`${s} L ${a[0].x.toFixed(1)} ${a[0].y.toFixed(1)} ${f} Z`}function TS(i){return i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${(i/1e3).toFixed(1)}k`:String(i)}function Mo(i){return i.length>0?i[i.length-1]:void 0}const Sr="#f97316",Ya="#0ea5e9",_r="#16a34a",Ro="#94a3b8",Aj="#DC2626",kS=13;function NS(i,n){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+kS);return a=m,{...d,labelY:m}}),f=o.length>0?o[o.length-1].labelY-n:0;if(f>0)for(const d of o)d.labelY-=f;return o}function jj({stations:i,selectedRole:n,onSelect:s,onUpstreamSelect:a,onCmdClick:o,periodHours:f}){const[d,m]=j.useState(null),y=i.length;if(y===0)return null;const g=P=>y===1?Ar+$o/2:Ar+P/(y-1)*$o,E=new Map(i.map((P,be)=>[P.role,g(be)])),_=i.map((P,be)=>{var He,vt,Et,rt;const xe=P.target_per_hour??null,Ae=xe!=null?xe*f:null;return{idx:be,x:g(be),expected:Ae,actual:((He=P.metric)==null?void 0:He.resolved)??0,active:((vt=P.metric)==null?void 0:vt.claimed)??0,pending:((Et=P.metric)==null?void 0:Et.pending)??0,priorityCount:((rt=P.metric)==null?void 0:rt.priority_count)??0}}),T=_.some(P=>P.expected!=null),M=Math.max(1,..._.map(P=>P.expected??0),..._.map(P=>P.actual),..._.map(P=>P.expected!=null?P.pending:0))*1.15,D=P=>jh+Dg*(1-Math.max(0,Math.min(P,M))/M),J=_.filter(P=>P.expected!=null),ie=J.map(P=>({...P,y:D(P.expected)})),G=J.map(P=>({...P,y:D(P.actual)})),ce=J.map(P=>({...P,y:D(P.active)})),ae=J.map(P=>({...P,y:D(P.pending)})),k=jr(ie),Z=jr(G),oe=jr(ce),F=jr(ae),V=Mo(G),K=Mo(ie),Q=Mo(ce),se=Mo(ae),he=G.length>=2&&V?`${Z} L ${V.x.toFixed(1)} ${Cn} L ${G[0].x.toFixed(1)} ${Cn} Z`:"",Se=J.some(P=>P.pending>0||P.active>0),ke=Se&&ce.length>=2&&Q?`${oe} L ${Q.x.toFixed(1)} ${Cn} L ${ce[0].x.toFixed(1)} ${Cn} Z`:"",$=Se?OS(ae,ce):"",re=J.some(P=>P.active>0),de=J.some(P=>P.pending>P.active),je=NS([K?{key:"target",text:"Target",color:Ro,y:K.y}:null,V?{key:"actual",text:"Resolved",color:_r,y:V.y}:null,re&&Q?{key:"active",text:"Claimed",color:Sr,y:Q.y}:null,de&&se?{key:"queued",text:"Pending",color:Ya,y:se.y}:null].filter(Boolean),Cn+4);return h.jsxs("svg",{viewBox:`0 0 ${Mg} ${Rg}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",style:{display:"block"},children:[i.map(P=>{if(!P.parent_role)return null;const be=E.get(P.parent_role);if(be==null)return null;const xe=g(i.findIndex(Ae=>Ae.role===P.role));return h.jsx("line",{x1:be,y1:Cn,x2:xe,y2:Cn,stroke:"#e2e8f0",strokeWidth:.75},`dep-${P.role}`)}),he&&h.jsx("path",{d:he,fill:_r,opacity:.05,style:{transition:`d ${nn}`}}),ke&&h.jsx("path",{d:ke,fill:Sr,opacity:.12,style:{transition:`d ${nn}`}}),$&&h.jsx("path",{d:$,fill:Ya,opacity:.12,style:{transition:`d ${nn}`}}),k&&h.jsx("path",{d:k,fill:"none",stroke:Ro,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.7,style:{transition:`d ${nn}`}}),ie.map(P=>h.jsxs("g",{transform:`translate(${P.x} ${P.y})`,style:{transition:`transform ${nn}`},children:[h.jsx("circle",{r:2,fill:Ro,opacity:.8}),h.jsx("text",{y:-5,textAnchor:"middle",fontSize:6.5,fill:Ro,fontFamily:"ui-monospace, monospace",fontWeight:"500",opacity:.7,children:Math.round(P.expected)})]},`tval-${P.idx}`)),Se&&F&&h.jsx("path",{d:F,fill:"none",stroke:Ya,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.55,style:{transition:`d ${nn}`}}),oe&&h.jsx("path",{d:oe,fill:"none",stroke:Sr,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.5,style:{transition:`d ${nn}`}}),Z&&h.jsx("path",{d:Z,fill:"none",stroke:_r,strokeWidth:.6,strokeLinejoin:"round",strokeLinecap:"round",opacity:.65,style:{transition:`d ${nn}`}}),ce.map((P,be)=>{if(P.pending<=0&&P.active<=0)return null;const xe=Math.max(2.5,Math.min(5,2.5+P.active/10)),Ae=P.pending>P.active,He=Math.min(ae[be].y-4,P.y-xe-4);return h.jsxs("g",{children:[P.pending>0&&h.jsx("text",{x:P.x,y:He,textAnchor:"middle",fontSize:7.5,fill:Ae?Ya:"#64748b",fontFamily:"ui-monospace, monospace",fontWeight:"600",style:{transition:`y ${nn}`},children:P.pending}),h.jsxs("g",{transform:`translate(${P.x} ${P.y})`,style:{transition:`transform ${nn}`},children:[h.jsx("circle",{r:xe,fill:Sr,opacity:.85}),P.active>0&&h.jsx("text",{y:xe+9,textAnchor:"middle",fontSize:7.5,fill:Sr,fontFamily:"ui-monospace, monospace",fontWeight:"600",children:P.active})]})]},`active-${P.idx}`)}),_.map(P=>{var zn;const be=i[P.idx],xe=P.x,Ae=P.expected!=null?D(P.actual):Cn,He=Math.max(2.25,Math.min(4,2.25+P.actual/160)),vt=be.role===n,Et=d===P.idx,rt=P.expected==null?"idle · set a target rate to plot pace":`${P.actual} resolved · target ${Math.round(P.expected)}`+(P.pending>P.active?` · ${P.pending-P.active} pending`:"")+(P.active>0?` · ${P.active} claimed`:"")+(P.priorityCount>0?` · ${P.priorityCount} in jeopardy`:""),ct=rt.length*5.5+20,Oe=Math.max(Ar+ct/2+4,Math.min(ay-ct/2-4,xe)),_t=Ae-He-10;return h.jsxs("g",{onClick:un=>{un.metaKey||un.ctrlKey?(un.stopPropagation(),o==null||o(be.role)):s(be.role)},onMouseEnter:()=>m(P.idx),onMouseLeave:()=>m(null),style:{cursor:"pointer"},children:[h.jsxs("g",{transform:`translate(${xe} ${Ae})`,style:{transition:`transform ${nn}`},children:[h.jsx("circle",{r:22,fill:"transparent"}),h.jsx("circle",{r:He,fill:_r,opacity:.9,style:{transition:`r ${nn}`}}),P.expected!=null&&h.jsx("text",{y:-He-5,textAnchor:"middle",fontSize:9.5,fill:_r,fontFamily:"ui-monospace, monospace",fontWeight:"500",children:TS(P.actual)}),Et&&!vt&&h.jsx("circle",{r:He+3,fill:"none",stroke:_r,strokeWidth:1,opacity:.4}),vt&&h.jsx("circle",{r:He+4,fill:"none",stroke:"#6366f1",strokeWidth:2})]}),(((zn=be.upstream_roles)==null?void 0:zn.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+(P.idx%2===0?14:27),textAnchor:"middle",fontSize:9.5,fill:"#475569",fontFamily:"ui-sans-serif, sans-serif",fontWeight:"500",children:SS(be)}),Et&&h.jsxs("g",{children:[h.jsx("rect",{x:Oe-ct/2,y:_t-16,width:ct,height:19,rx:3,fill:"#0f172a",opacity:.88}),h.jsx("text",{x:Oe,y:_t-3,textAnchor:"middle",fontSize:8.5,fill:"white",fontFamily:"ui-monospace, monospace",children:rt})]})]},be.role)}),!T&&h.jsx("text",{x:Ar+$o/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"}),je.map(P=>h.jsx("text",{x:ay+6,y:P.labelY,fontSize:8,fill:P.color,fontFamily:"ui-sans-serif, sans-serif",fontWeight:P.key==="actual"?700:500,opacity:P.key==="active"?.85:1,style:{transition:`y ${nn}`},children:P.text},P.key))]})}const qg="lt:bookmarks";function CS(){try{const i=localStorage.getItem(qg);if(!i)return[];const n=JSON.parse(i);return Array.isArray(n)?n:[]}catch{return[]}}function oy(i){try{localStorage.setItem(qg,JSON.stringify(i))}catch{}}function MS({onToggleEventFeed:i,onToggleDocs:n}){var K;const{user:s,logout:a}=In(),{isBuilder:o,isOps:f,viewAs:d,realIsBuilder:m}=xg(),{available:y,mine:g}=oS(),{connected:E}=Z_(),{data:_}=Br(),T=xs(),[z,M]=j.useState(!1),[D,J]=j.useState(!1),[ie,G]=j.useState(Ng),[ce,ae]=j.useState(CS),k=j.useRef(null),Z=(K=_==null?void 0:_.branding)==null?void 0:K.appName,oe=Q=>{_S(Q),G(Q)},F=()=>{const Q=window.prompt("Bookmark label:");if(!(Q!=null&&Q.trim()))return;const se=T.pathname+T.search,he=[...ce,{label:Q.trim(),url:se}].sort((Se,ke)=>Se.label.localeCompare(ke.label));ae(he),oy(he),M(!1)},V=Q=>{const se=ce.filter(he=>!(he.label===Q.label&&he.url===Q.url));ae(se),oy(se)};return j.useEffect(()=>{if(!z)return;const Q=se=>{k.current&&!k.current.contains(se.target)&&M(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[z]),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(Ni,{to:"/","aria-label":"Home",onClick:Q=>{(Q.ctrlKey||Q.metaKey)&&(Q.preventDefault(),J(!0))},children:h.jsx(Ah,{appName:Z})}),h.jsxs("div",{className:"flex items-center gap-5",children:[h.jsxs(Ni,{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:Ya}:void 0,title:"All escalations",children:[h.jsx(y0,{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(Ni,{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:Sr}:void 0,title:"My escalation queue",children:[h.jsx(y0,{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||f)&&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(Ry,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]})]}),m&&h.jsx(h.Fragment,{children:h.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[h.jsx(Dy,{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:bg,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Mi,{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:k,children:[h.jsxs("button",{onClick:()=>M(Q=>!Q),className:"btn-ghost text-xs flex items-center gap-1",children:[h.jsx(mv,{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"})})]}),z&&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(Ni,{to:"/credentials",onClick:()=>M(!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:Tg.map(Q=>h.jsx("button",{type:"button",onClick:()=>oe(Q),title:ry[Q],"aria-label":`${ry[Q]} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${ie===Q?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:xS[Q]}},Q))})]}),h.jsx("button",{onClick:()=>{M(!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:[ce.map(Q=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(Ni,{to:Q.url,onClick:()=>M(!1),title:Q.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:Q.label}),h.jsx("button",{type:"button",onClick:()=>V(Q),title:`Remove "${Q.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(Mi,{className:"w-3 h-3"})})]},`${Q.label}::${Q.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:F,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(pv,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),D&&h.jsx(gS,{onClose:()=>J(!1)})]})}function Oh({open:i,children:n}){const[s,a]=j.useState(i);return j.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?n:null})})}function ih(i){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function RS(){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 DS({group:i,collapsed:n}){const{pathname:s}=xs(),a=i.matchPaths.some(m=>s.startsWith(m)),[o,f]=j.useState(a),d=o||a;return n?h.jsx(h.Fragment,{children:i.items.map(m=>h.jsx(Yo,{to:m.to,className:ih(!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:()=>f(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(Oh,{open:d,children:i.items.map(m=>h.jsxs(Yo,{to:m.to,end:m.end,className:RS(),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 qS(i){return i.kind==="group"}function zS({entry:i,collapsed:n}){const{pathname:s,search:a}=xs(),o=i.to.includes("?"),f=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=ih(n)({isActive:y});return h.jsxs(Yo,{to:i.to,className:g,title:n?i.label:void 0,children:[f,!n&&h.jsx("span",{children:i.label})]})}return h.jsxs(Yo,{to:i.to,end:i.end,className:ih(n),title:n?i.label:void 0,children:[f,!n&&h.jsx("span",{children:i.label})]})}function ri({heading:i,entries:n}){const{collapsed:s}=wg();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}),n.map(a=>qS(a)?h.jsx(DS,{group:a,collapsed:s},a.label):h.jsx(zS,{entry:a,collapsed:s},a.to))]})}function US({aiEnabled:i=!1,isBuilder:n=!1,isOps:s=!1,viewAs:a=null,canSeePaceBoard:o=!1}){const f={to:"/operations",label:"Pace Board",icon:yv};if(!n&&(!s||a==="engineer"||a==="operator"))return null;if(!n)return h.jsx(ri,{heading:"Monitor",entries:o?[f]:[]});const d=[...o?[f]:[],{to:"/topics",label:"Event Topics",icon:Ry},{to:"/agents",label:i?"Agents":"Automations",icon:gv},{to:"/capabilities",label:"Capabilities",icon:bv}];return h.jsx(ri,{heading:"Monitor",entries:d})}function BS(){const{user:i}=In(),{taskQueueSource:n}=vg(),s=j.useMemo(()=>{const f=((i==null?void 0:i.roles)??[]).map(d=>d.role).filter(d=>!jg(d));return Array.from(new Set(f)).sort((d,m)=>d.localeCompare(m))},[i]),[a,o]=j.useState(Ri);return j.useEffect(()=>{if(n!=="manual")return;const f=()=>o(Ri());return f(),window.addEventListener(sh,f),window.addEventListener("storage",f),()=>{window.removeEventListener(sh,f),window.removeEventListener("storage",f)}},[n]),n==="manual"?a:s}function LS(){const i=BS(),{data:n}=Eg({enabled:i.length>0}),s=j.useMemo(()=>new Map(((n==null?void 0:n.roles)??[]).map(o=>[o.role,o.title])),[n]),a=j.useMemo(()=>i.map(o=>({to:`/escalations/available?role=${encodeURIComponent(o)}`,label:s.get(o)||o,icon:rh,solid:!0,iconClassName:"rotate-90"})),[i,s]);return a.length===0?null:h.jsx(ri,{heading:"Task Queues",entries:a})}function HS(){const i=[{kind:"group",label:"Procedural",icon:xv,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Registry",icon:g0},{to:"/workflows/durable/invoke",label:"Invoke",icon:b0},{to:"/workflows/executions",label:"Executions",icon:x0}]},{kind:"group",label:"Graph",icon:ah,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:g0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:b0},{to:"/mcp/executions",label:"Executions",icon:x0}]}];return h.jsx(ri,{heading:"Orchestrate",entries:i})}const PS=[{to:"/mcp/queries",label:"Designer",icon:vv},{to:"/mcp/servers",label:"Servers & Tools",icon:_v}];function $S(){return h.jsx(ri,{heading:"Design",entries:PS})}const YS=[{to:"/files",label:"Files",icon:wv},{to:"/knowledge",label:"Knowledge",icon:Sv}];function VS(){return h.jsx(ri,{heading:"Storage",entries:YS})}function GS({isBuilder:i=!1,isOps:n=!1}){var d;const{data:s}=Br(),a=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:Ev},...i||n?[{to:"/admin/roles",label:"Roles",icon:Av}]:[]],f=[{to:"/admin/controlplane",label:"Routers",icon:jv},{to:"/admin/streams",label:"Messages",icon:Ov},...a?[{to:"/admin/maintenance",label:"DB Maintenance",icon:rh}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(ri,{heading:"Identity & Access",entries:o}),i&&h.jsx(ri,{heading:"Infrastructure",entries:f})]})}const zg="lt_event_feed_patterns";function FS(i){if(i.startsWith("/topics/")){const f=decodeURIComponent(i.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=i.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[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 IS(){try{const i=localStorage.getItem(zg);return i?JSON.parse(i):[]}catch{return[]}}function Mf(i){try{localStorage.setItem(zg,JSON.stringify(i))}catch{}}function QS(){const{pathname:i}=xs(),[n,s]=j.useState(IS),a=j.useMemo(()=>FS(i),[i]),o=j.useMemo(()=>{const y=new Set([a,...n]);return Array.from(y)},[a,n]),f=j.useCallback(y=>{const g=y.startsWith("lt.events.")?y:`lt.events.${y}`;s(E=>{if(E.includes(g))return E;const _=[...E,g];return Mf(_),_})},[]),d=j.useCallback(y=>{s(g=>{const E=g.filter(_=>_!==y);return Mf(E),E})},[]),m=j.useCallback(()=>{s([]),Mf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:d,clearUserPatterns:m}}function JS({children:i,className:n=""}){return h.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:i})}const Rf=280,cy="cubic-bezier(0.4, 0, 0.2, 1)",Do=40;function KS(i){if(!i)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-Do*2,o=s-Do*2,f=i.width/a,d=i.height/o,m=i.left+i.width/2-(Do+a/2),y=i.top+i.height/2-(Do+o/2);return`translate(${m}px, ${y}px) scale(${f}, ${d})`}function Ug({open:i,onClose:n,sourceRef:s,children:a}){const[o,f]=j.useState(null),d=j.useRef(null),m=j.useRef(!1);j.useEffect(()=>{var T,z;i&&!m.current?(d.current=((T=s==null?void 0:s.current)==null?void 0:T.getBoundingClientRect())??null,f("entering")):!i&&m.current&&o==="open"&&(d.current=((z=s==null?void 0:s.current)==null?void 0:z.getBoundingClientRect())??null,f("exiting")),m.current=i},[i,s,o]),j.useEffect(()=>{if(o!=="entering")return;const T=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(T)},[o]),j.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),j.useEffect(()=>{if(!o)return;const T=z=>{z.key==="Escape"&&n()};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[o,n]);const y=j.useCallback(T=>{T.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(j.useEffect(()=>{if(o!=="exiting")return;const T=setTimeout(()=>f(null),Rf+50);return()=>clearTimeout(T)},[o]),!o)return null;const g=o==="entering"||o==="exiting",E=g?KS(d.current):"none",_=g?0:1;return Cy.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Rf}ms ${cy}, opacity ${Rf}ms ${cy}`,transform:E,opacity:_,backgroundColor:"#FFFFFF"},onTransitionEnd:y,children:a}),document.body)}function XS({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 ZS({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 WS({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 e2({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 t2({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 n2({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 s2(i){const n=i.trim().split(`
54
+ `);if(n.length<2)return i;const s=m=>m.split("|").map(y=>y.trim()).filter(Boolean),a=s(n[0]),o=n.slice(2),f=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">${f}</tr></thead><tbody>${d}</tbody></table>`}function qo(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function i2(i){const n=[];let s=i.replace(/```(\w*)\n([\s\S]*?)```/g,(y,g,E)=>{const _=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${_}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(y,g,E,_)=>s2(`${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="${qo(g)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${g}</h4>`).replace(/^### (.+)$/gm,(y,g)=>`<h3 id="${qo(g)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${g}</h3>`).replace(/^## (.+)$/gm,(y,g)=>`<h2 id="${qo(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="${qo(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,"\\$&"),f=y=>new RegExp(`(${o(y)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),y=>`<ul class="mb-3">${y}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),y=>`<ul class="mb-3">${y}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),y=>`<ol class="list-decimal mb-3">${y}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(y,g)=>n[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 z=T.index+T[0].length;E.push(_.slice(0,z)),_=_.slice(z).replace(/^<br\/>/,"").trim(),m.lastIndex=0}return _&&E.push(_),E.map(z=>{const M=z.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${d}">${M}</p>`:""}).join("")}).join(""),s}const r2=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function a2(i){return r2.test(i)}function Th({content:i,className:n,onClick:s}){const a=j.useMemo(()=>i2(i),[i]);return h.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Zo({data:i,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,d]=j.useState(o),[m,y]=j.useState(s);if(s!==void 0&&s!==m&&(y(s),d(s%2===0&&n>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:"[]"}):f?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(Zo,{data:g,depth:n+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:"{}"}):f?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(Zo,{data:_,depth:n+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 Qa({data:i,depth:n=0}){if(i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&a2(i)?h.jsx(Th,{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(Qa,{data:s,depth:n+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:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return 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," ")}),f?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Qa,{data:o,depth:n+1})}):h.jsx(Qa,{data:o,depth:n+1})]},a)})})}return h.jsx("span",{children:String(i)})}function uy({mode:i,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,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(n2,{className:g}):h.jsx(t2,{className:g})}),h.jsx("button",{onClick:()=>n(i==="json"?"tree":"json"),className:E,title:i==="json"?"Outline view":"JSON view",children:i==="json"?h.jsx(XS,{className:g}):h.jsx(ZS,{className:g})}),h.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?h.jsx(e2,{className:`${g} text-status-success`}):h.jsx(WS,{className:g})}),d&&h.jsx("button",{onClick:d,className:E,title:"Fullscreen",children:h.jsx(qy,{className:g})}),m&&h.jsx("button",{onClick:m,className:E,title:"Close (Esc)",children:h.jsx(zy,{className:g})})]})}function l2({data:i,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=j.useRef(null),[d,m]=j.useState(o??"json"),[y,g]=j.useState(!1),[E,_]=j.useState(!1),[T,z]=j.useState(a?0:1),[M,D]=j.useState(1),J=T%2===0,ie=M%2===0,G=j.useCallback(()=>z(K=>K+1),[]),ce=j.useCallback(()=>D(K=>K+1),[]);let ae=i;if(typeof i=="string")try{ae=JSON.parse(i)}catch{}const k=async()=>{const K=typeof i=="string"?i:JSON.stringify(ae,null,2);await navigator.clipboard.writeText(K),g(!0),setTimeout(()=>g(!1),2e3)},Z=j.useCallback(()=>{D(1),_(!0)},[]),oe=s==="panel",F=oe?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",V=oe?"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:F,children:[n&&h.jsx(JS,{children:n}),h.jsxs("div",{ref:f,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(uy,{mode:d,setMode:m,isCollapsed:J,onToggleCollapse:G,onCopy:k,copied:y,onFullscreen:Z})}),h.jsx("div",{className:V,children:d==="json"?h.jsx(Zo,{data:ae,generation:T}):h.jsx(Qa,{data:ae})})]}),h.jsxs(Ug,{open:E,onClose:()=>_(!1),sourceRef:f,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(uy,{mode:d,setMode:m,isCollapsed:ie,onToggleCollapse:ce,onCopy:k,copied:y,onClose:()=>_(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(Zo,{data:ae,generation:M}):h.jsx(Qa,{data:ae})})]})]})}const o2=100,fy=500;let c2=0;const Bg={"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 Lg(i){const n=i.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:i}function hy({event:i,forceExpanded:n=!1}){var T,z;const[s,a]=j.useState(n),o=Bg[Lg(i.type)]||"text-text-tertiary";j.useEffect(()=>{a(n)},[n]);const f=n,d=f?"text-xs":"text-[9px]",m=f?"text-xs":"text-[9px]",y=f?"text-xs":"text-[9px]",g=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",_=f?"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):"",(z=i.data)!=null&&z.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(Oh,{open:s,children:h.jsx("div",{className:_,children:h.jsx(l2,{data:i.data})})})]})}function u2({open:i,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=j.useState([]),[d,m]=j.useState(!1),[y,g]=j.useState(""),E=j.useRef(null),_=j.useRef(new Map),{subscribe:T}=j.useContext(nl),{patterns:z,pagePattern:M,userPatterns:D,addPattern:J,removePattern:ie}=QS(),G=j.useCallback(ae=>{const k=String(ae.type||"unknown");if(k.startsWith("mesh."))return;const Z=`${k}:${ae.timestamp||""}:${ae.escalationId||ae.workflowId||ae.taskId||""}`,oe=Date.now(),F=_.current.get(Z);if(!(F&&oe-F<fy)){if(_.current.set(Z,oe),_.current.size>200)for(const[V,K]of _.current)oe-K>fy*2&&_.current.delete(V);f(V=>[{id:++c2,type:k,timestamp:ae.timestamp||new Date().toISOString(),data:ae},...V].slice(0,o2))}},[]),ce=j.useRef(G);return ce.current=G,j.useEffect(()=>{const ae=z.map(k=>T(k,Z=>ce.current(Z)));return()=>ae.forEach(k=>k())},[T,z.join(",")]),j.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:n,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(Tv,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(kv,{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 ${Bg[Lg(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:ae=>{ae.stopPropagation(),a()},children:h.jsx(Nv,{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:ae=>{ae.stopPropagation(),m(!0)},children:h.jsx(qy,{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:ae=>{ae.stopPropagation(),f([])},children:h.jsx(Cv,{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:M.replace("lt.events.","")}),D.map(ae=>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:[ae.replace("lt.events.",""),h.jsx("button",{onClick:()=>ie(ae),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Mi,{className:"w-2 h-2"})})]},ae))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:y,onChange:ae=>g(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&y.trim()&&(J(y.trim()),g(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{y.trim()&&(J(y.trim()),g(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(Mv,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Oh,{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(ae=>h.jsx(hy,{event:ae},ae.id))})}),h.jsxs(Ug,{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(zy,{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(ae=>h.jsx(hy,{event:ae,forceExpanded:!0},ae.id))]})]})}function f2(){return xt({queryKey:["docs"],queryFn:()=>Te("/docs"),staleTime:5*6e4})}function h2(i){return xt({queryKey:["docs",i],queryFn:()=>Te(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function d2(){const[i,n]=j.useState([]),[s,a]=j.useState([]),[o,f]=j.useState(null),d=j.useRef(o),m=j.useRef(i),y=j.useRef(s);d.current=o,m.current=i,y.current=s;const g=j.useCallback((M,D)=>{var ie;const J=d.current;if(J){const G=((ie=D==null?void 0:D.current)==null?void 0:ie.scrollTop)??0;n([...m.current,{...J,scrollTop:G}])}a([]),f({path:M,scrollTop:0})},[]),E=j.useCallback(M=>{var G;const D=m.current;if(D.length===0)return;const J=D[D.length-1],ie=d.current;if(ie){const ce=((G=M==null?void 0:M.current)==null?void 0:G.scrollTop)??0;a([...y.current,{...ie,scrollTop:ce}])}n(D.slice(0,-1)),f(J),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=J.scrollTop)})},[]),_=j.useCallback(M=>{var G;const D=y.current;if(D.length===0)return;const J=D[D.length-1],ie=d.current;if(ie){const ce=((G=M==null?void 0:M.current)==null?void 0:G.scrollTop)??0;n([...m.current,{...ie,scrollTop:ce}])}a(D.slice(0,-1)),f(J),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=J.scrollTop)})},[]),T=j.useCallback(M=>{var ie,G;const D=d.current;if(!D)return;const J=((ie=M==null?void 0:M.current)==null?void 0:ie.scrollTop)??0;n([...m.current,{...D,scrollTop:J}]),a([]),f({...D,scrollTop:((G=M==null?void 0:M.current)==null?void 0:G.scrollTop)??0})},[]),z=j.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:i,forwardStack:s,navigate:g,goBack:E,goForward:_,pushScrollPosition:T,reset:z}}function m2(i,n){const[s,a]=i.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((n?n.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 p2(i){if(!i.startsWith("#docs"))return null;const n=i.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function y2(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function g2({content:i,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var g;const d=f.target,m=d.closest("[data-anchor]");if(m){f.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){f.preventDefault();const{path:E,anchor:_}=m2(y.dataset.docLink,n);s(E,_);return}};return h.jsx(Th,{content:i,className:"docs-content",onClick:o})}function b2(i){const n=[],s=new Map;for(const a of i){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let d=0;d<o.length-1;d++){const m=o[d];f.has(m)||f.set(m,{label:m,children:[],subdirs:new Map});const y=f.get(m);d===o.length-2?y.children.push(a):f=y.subdirs}}return{topLevel:n,dirs:s}}function x2({docs:i,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=b2(i),f=m=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===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(Rv,{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:f(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:f(m.path),onClick:()=>s(m.path),children:m.title},m.path)),[...o.values()].map(m=>d(m))]})}function v2({open:i,onClose:n}){var oe,F,V;const[s,a]=j.useState(!1),{data:o}=f2(),f=d2(),{data:d,isLoading:m}=h2(((oe=f.current)==null?void 0:oe.path)??null),y=j.useRef(null),[g,E]=j.useState(null);j.useEffect(()=>{g&&(d!=null&&d.content)&&y.current&&requestAnimationFrame(()=>{var Q;const K=(Q=y.current)==null?void 0:Q.querySelector(`#${CSS.escape(g)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[g,d]);const _=j.useCallback(()=>{var se;const K=p2(window.location.hash),Q=(K==null?void 0:K.path)??"README.md";((se=f.current)==null?void 0:se.path)!==Q&&f.navigate(Q,y),K!=null&&K.anchor&&E(K.anchor)},[f]),T=j.useRef(!0);j.useEffect(()=>{if(!i||!f.current)return;if(T.current){T.current=!1;return}const K=y2(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[i,(F=f.current)==null?void 0:F.path]),j.useEffect(()=>{if(!i)return;const K=()=>{window.location.hash.startsWith("#docs")&&_()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[i,_]);const z=j.useCallback((K,Q)=>{Q&&E(Q),f.navigate(K,y)},[f]),M=j.useCallback(K=>{f.navigate(K,y)},[f]),D=j.useCallback(()=>{f.goBack(y)},[f]),J=j.useCallback(()=>{f.goForward(y)},[f]),ie=j.useCallback(()=>{f.pushScrollPosition(y)},[f]);if(j.useEffect(()=>{if(i){T.current=!0,_();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[i]),!(i||s))return null;const ce=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},ae=((V=f.current)==null?void 0:V.path)??null,k=f.backStack.length>0,Z=f.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:ce}),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:D,disabled:!k,className:`p-0.5 transition-colors ${k?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(Dv,{className:"w-4 h-4"})}),h.jsx("button",{onClick:J,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(v0,{className:"w-4 h-4"})}),h.jsx(Dy,{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:ce,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Mi,{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(x2,{docs:o.docs,selected:ae,onSelect:M}):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:ae?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(g2,{content:d.content,currentPath:ae,onNavigate:z,onAnchorClick:ie}):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(v0,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function _2(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const dy=2e3;function w2(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 S2(i){const n=i.summary,s=i.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof i=="string"?i:"Query completed.")}const Hg=j.createContext(null);function E2({children:i}){const n=xs(),[s,a]=j.useState(!1),[o,f]=j.useState([]),[d,m]=j.useState(null),[y,g]=j.useState({}),E=j.useRef(null),_={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...y,suggestedTags:y.suggestedTags??_2(n.pathname)};j.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const T=j.useCallback(()=>a(ie=>!ie),[]),z=j.useCallback(ie=>{g(ie)},[]),M=j.useCallback(()=>{f([]),m(null)},[]),D=j.useCallback(async ie=>{var F;const G=new Date().toISOString(),ce={id:`user-${Date.now()}`,role:"user",content:ie,timestamp:G},ae={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:G,pending:!0};f(V=>[...V,ce,ae]);const k={..._};(F=k.entities)!=null&&F.yamlContent&&k.entities.yamlContent.length>dy&&(k.entities={...k.entities,yamlContent:k.entities.yamlContent.slice(0,dy)+`
62
+ ... (truncated)`});const oe=`${w2(o.concat(ce))}${ie}`;try{const K=(await Te("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:oe,tags:k.suggestedTags,context:k,wait:!1,direct:!0})})).workflow_id;m(K),f(Q=>Q.map(se=>se.id===ae.id?{...se,workflowId:K}:se)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var Q;try{const se=await Te(`/workflows/${K}/result`),he=(Q=se==null?void 0:se.result)==null?void 0:Q.data;if(he){E.current&&clearInterval(E.current),E.current=null,m(null);const Se=S2(he);let ke;try{ke=(await Te(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(re=>re.id===ae.id?{...re,content:Se,timestamp:new Date().toISOString(),pending:!1,durationMs:ke}:re))}}catch{}},3e3)}catch{f(V=>V.map(K=>K.id===ae.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,_]),J=j.useCallback(async ie=>{const G=o.find(k=>k.id===ie);if(!(G!=null&&G.workflowId)||G.compilationStatus==="compiling"||G.compilationStatus==="done")return;const ce=o.indexOf(G),ae=o.slice(0,ce).reverse().find(k=>k.role==="user");if(ae){f(k=>k.map(Z=>Z.id===ie?{...Z,compilationStatus:"compiling"}:Z));try{const k=await Te("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ae.content,summary:G.content})}),Z=await Te("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:G.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:k.tool_name,description:k.description,tags:k.tags,app_id:""})});await Te(`/yaml-workflows/${Z.id}/deploy`,{method:"POST"}),f(oe=>oe.map(F=>F.id===ie?{...F,compilationStatus:"done"}:F))}catch(k){const Z=k instanceof Error?k.message:"Compilation failed";f(oe=>oe.map(F=>F.id===ie?{...F,compilationStatus:"error",compilationError:Z}:F))}}},[o]);return h.jsx(Hg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:T,messages:o,sendMessage:D,pageContext:_,setPageContext:z,activeWorkflowId:d,clearMessages:M,compileMessage:J},children:i})}function Pg(){const i=j.useContext(Hg);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function A2(){const{helpOpen:i,toggleHelp:n}=Pg();return h.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":i?"Close help":"Ask for help",children:i?h.jsx(Mi,{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(${Ft}/logo512.png)`}})})}const $g=6048e5,j2=864e5,my=6e4,py=525600,yy=43200,gy=1440,by=Symbol.for("constructDateFrom");function bs(i,n){return typeof i=="function"?i(n):i&&typeof i=="object"&&by in i?i[by](n):i instanceof Date?new i.constructor(n):new Date(n)}function cn(i,n){return bs(n||i,i)}let O2={};function sl(){return O2}function Wa(i,n){var m,y,g,E;const s=sl(),a=(n==null?void 0:n.weekStartsOn)??((y=(m=n==null?void 0:n.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,n==null?void 0:n.in),f=o.getDay(),d=(f<a?7:0)+f-a;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function Wo(i,n){return Wa(i,{...n,weekStartsOn:1})}function Yg(i,n){const s=cn(i,n==null?void 0:n.in),a=s.getFullYear(),o=bs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Wo(o),d=bs(s,0);d.setFullYear(a,0,4),d.setHours(0,0,0,0);const m=Wo(d);return s.getTime()>=f.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function ec(i){const n=cn(i),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+i-+s}function Vg(i,...n){const s=bs.bind(null,i||n.find(a=>typeof a=="object"));return n.map(s)}function xy(i,n){const s=cn(i,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function T2(i,n,s){const[a,o]=Vg(s==null?void 0:s.in,i,n),f=xy(a),d=xy(o),m=+f-ec(f),y=+d-ec(d);return Math.round((m-y)/j2)}function k2(i,n){const s=Yg(i,n),a=bs(i,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Wo(a)}function N2(i,n){const s=+cn(i)-+cn(n);return s<0?-1:s>0?1:s}function C2(i){return bs(i,Date.now())}function M2(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function R2(i){return!(!M2(i)&&typeof i!="number"||isNaN(+cn(i)))}function D2(i){return n=>{const a=(i?Math[i]:Math.trunc)(n);return a===0?0:a}}function q2(i,n){const s=cn(i,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const z2={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"}},U2=(i,n,s)=>{let a;const o=z2[i];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Df(i){return(n={})=>{const s=n.width?String(n.width):i.defaultWidth;return i.formats[s]||i.formats[i.defaultWidth]}}const B2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},L2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},H2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},P2={date:Df({formats:B2,defaultWidth:"full"}),time:Df({formats:L2,defaultWidth:"full"}),dateTime:Df({formats:H2,defaultWidth:"full"})},$2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Y2=(i,n,s,a)=>$2[i];function Ua(i){return(n,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 f=i.argumentCallback?i.argumentCallback(n):n;return o[f]}}const V2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},G2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},F2={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"]},I2={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"]},Q2={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"}},J2={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"}},K2=(i,n)=>{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"},X2={ordinalNumber:K2,era:Ua({values:V2,defaultWidth:"wide"}),quarter:Ua({values:G2,defaultWidth:"wide",argumentCallback:i=>i-1}),month:Ua({values:F2,defaultWidth:"wide"}),day:Ua({values:I2,defaultWidth:"wide"}),dayPeriod:Ua({values:Q2,defaultWidth:"wide",formattingValues:J2,defaultFormattingWidth:"wide"})};function Ba(i){return(n,s={})=>{const a=s.width,o=a&&i.matchPatterns[a]||i.matchPatterns[i.defaultMatchWidth],f=n.match(o);if(!f)return null;const d=f[0],m=a&&i.parsePatterns[a]||i.parsePatterns[i.defaultParseWidth],y=Array.isArray(m)?W2(m,_=>_.test(d)):Z2(m,_=>_.test(d));let g;g=i.valueCallback?i.valueCallback(y):y,g=s.valueCallback?s.valueCallback(g):g;const E=n.slice(d.length);return{value:g,rest:E}}}function Z2(i,n){for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&n(i[s]))return s}function W2(i,n){for(let s=0;s<i.length;s++)if(n(i[s]))return s}function eE(i){return(n,s={})=>{const a=n.match(i.matchPattern);if(!a)return null;const o=a[0],f=n.match(i.parsePattern);if(!f)return null;let d=i.valueCallback?i.valueCallback(f[0]):f[0];d=s.valueCallback?s.valueCallback(d):d;const m=n.slice(o.length);return{value:d,rest:m}}}const tE=/^(\d+)(th|st|nd|rd)?/i,nE=/\d+/i,sE={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},iE={any:[/^b/i,/^(a|c)/i]},rE={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aE={any:[/1/i,/2/i,/3/i,/4/i]},lE={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},oE={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]},cE={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},uE={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]},fE={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},hE={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}},dE={ordinalNumber:eE({matchPattern:tE,parsePattern:nE,valueCallback:i=>parseInt(i,10)}),era:Ba({matchPatterns:sE,defaultMatchWidth:"wide",parsePatterns:iE,defaultParseWidth:"any"}),quarter:Ba({matchPatterns:rE,defaultMatchWidth:"wide",parsePatterns:aE,defaultParseWidth:"any",valueCallback:i=>i+1}),month:Ba({matchPatterns:lE,defaultMatchWidth:"wide",parsePatterns:oE,defaultParseWidth:"any"}),day:Ba({matchPatterns:cE,defaultMatchWidth:"wide",parsePatterns:uE,defaultParseWidth:"any"}),dayPeriod:Ba({matchPatterns:fE,defaultMatchWidth:"any",parsePatterns:hE,defaultParseWidth:"any"})},Gg={code:"en-US",formatDistance:U2,formatLong:P2,formatRelative:Y2,localize:X2,match:dE,options:{weekStartsOn:0,firstWeekContainsDate:1}};function mE(i,n){const s=cn(i,n==null?void 0:n.in);return T2(s,q2(s))+1}function pE(i,n){const s=cn(i,n==null?void 0:n.in),a=+Wo(s)-+k2(s);return Math.round(a/$g)+1}function Fg(i,n){var E,_,T,z;const s=cn(i,n==null?void 0:n.in),a=s.getFullYear(),o=sl(),f=(n==null?void 0:n.firstWeekContainsDate)??((_=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:_.firstWeekContainsDate)??o.firstWeekContainsDate??((z=(T=o.locale)==null?void 0:T.options)==null?void 0:z.firstWeekContainsDate)??1,d=bs((n==null?void 0:n.in)||i,0);d.setFullYear(a+1,0,f),d.setHours(0,0,0,0);const m=Wa(d,n),y=bs((n==null?void 0:n.in)||i,0);y.setFullYear(a,0,f),y.setHours(0,0,0,0);const g=Wa(y,n);return+s>=+m?a+1:+s>=+g?a:a-1}function yE(i,n){var m,y,g,E;const s=sl(),a=(n==null?void 0:n.firstWeekContainsDate)??((y=(m=n==null?void 0:n.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=Fg(i,n),f=bs((n==null?void 0:n.in)||i,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Wa(f,n)}function gE(i,n){const s=cn(i,n==null?void 0:n.in),a=+Wa(s,n)-+yE(s,n);return Math.round(a/$g)+1}function Fe(i,n){const s=i<0?"-":"",a=Math.abs(i).toString().padStart(n,"0");return s+a}const Xs={y(i,n){const s=i.getFullYear(),a=s>0?s:1-s;return Fe(n==="yy"?a%100:a,n.length)},M(i,n){const s=i.getMonth();return n==="M"?String(s+1):Fe(s+1,2)},d(i,n){return Fe(i.getDate(),n.length)},a(i,n){const s=i.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(i,n){return Fe(i.getHours()%12||12,n.length)},H(i,n){return Fe(i.getHours(),n.length)},m(i,n){return Fe(i.getMinutes(),n.length)},s(i,n){return Fe(i.getSeconds(),n.length)},S(i,n){const s=n.length,a=i.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Fe(o,n.length)}},wr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},vy={G:function(i,n,s){const a=i.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(i,n,s){if(n==="yo"){const a=i.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Xs.y(i,n)},Y:function(i,n,s,a){const o=Fg(i,a),f=o>0?o:1-o;if(n==="YY"){const d=f%100;return Fe(d,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Fe(f,n.length)},R:function(i,n){const s=Yg(i);return Fe(s,n.length)},u:function(i,n){const s=i.getFullYear();return Fe(s,n.length)},Q:function(i,n,s){const a=Math.ceil((i.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Fe(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,n,s){const a=Math.ceil((i.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Fe(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,n,s){const a=i.getMonth();switch(n){case"M":case"MM":return Xs.M(i,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(i,n,s){const a=i.getMonth();switch(n){case"L":return String(a+1);case"LL":return Fe(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,n,s,a){const o=gE(i,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Fe(o,n.length)},I:function(i,n,s){const a=pE(i);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Fe(a,n.length)},d:function(i,n,s){return n==="do"?s.ordinalNumber(i.getDate(),{unit:"date"}):Xs.d(i,n)},D:function(i,n,s){const a=mE(i);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Fe(a,n.length)},E:function(i,n,s){const a=i.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(i,n,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Fe(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(i,n,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Fe(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(i,n,s){const a=i.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Fe(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(i,n,s){const o=i.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(i,n,s){const a=i.getHours();let o;switch(a===12?o=wr.noon:a===0?o=wr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(i,n,s){const a=i.getHours();let o;switch(a>=17?o=wr.evening:a>=12?o=wr.afternoon:a>=4?o=wr.morning:o=wr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(i,n,s){if(n==="ho"){let a=i.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Xs.h(i,n)},H:function(i,n,s){return n==="Ho"?s.ordinalNumber(i.getHours(),{unit:"hour"}):Xs.H(i,n)},K:function(i,n,s){const a=i.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Fe(a,n.length)},k:function(i,n,s){let a=i.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Fe(a,n.length)},m:function(i,n,s){return n==="mo"?s.ordinalNumber(i.getMinutes(),{unit:"minute"}):Xs.m(i,n)},s:function(i,n,s){return n==="so"?s.ordinalNumber(i.getSeconds(),{unit:"second"}):Xs.s(i,n)},S:function(i,n){return Xs.S(i,n)},X:function(i,n,s){const a=i.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return wy(a);case"XXXX":case"XX":return ki(a);case"XXXXX":case"XXX":default:return ki(a,":")}},x:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"x":return wy(a);case"xxxx":case"xx":return ki(a);case"xxxxx":case"xxx":default:return ki(a,":")}},O:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+_y(a,":");case"OOOO":default:return"GMT"+ki(a,":")}},z:function(i,n,s){const a=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+_y(a,":");case"zzzz":default:return"GMT"+ki(a,":")}},t:function(i,n,s){const a=Math.trunc(+i/1e3);return Fe(a,n.length)},T:function(i,n,s){return Fe(+i,n.length)}};function _y(i,n=""){const s=i>0?"-":"+",a=Math.abs(i),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Fe(f,2)}function wy(i,n){return i%60===0?(i>0?"-":"+")+Fe(Math.abs(i)/60,2):ki(i,n)}function ki(i,n=""){const s=i>0?"-":"+",a=Math.abs(i),o=Fe(Math.trunc(a/60),2),f=Fe(a%60,2);return s+o+n+f}const Sy=(i,n)=>{switch(i){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},Ig=(i,n)=>{switch(i){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},bE=(i,n)=>{const s=i.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return Sy(i,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",Sy(a,n)).replace("{{time}}",Ig(o,n))},xE={p:Ig,P:bE},vE=/^D+$/,_E=/^Y+$/,wE=["D","DD","YY","YYYY"];function SE(i){return vE.test(i)}function EE(i){return _E.test(i)}function AE(i,n,s){const a=jE(i,n,s);if(console.warn(a),wE.includes(i))throw new RangeError(a)}function jE(i,n,s){const a=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const OE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,TE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,kE=/^'([^]*?)'?$/,NE=/''/g,CE=/[a-zA-Z]/;function kh(i,n,s){var E,_,T,z;const a=sl(),o=a.locale??Gg,f=a.firstWeekContainsDate??((_=(E=a.locale)==null?void 0:E.options)==null?void 0:_.firstWeekContainsDate)??1,d=a.weekStartsOn??((z=(T=a.locale)==null?void 0:T.options)==null?void 0:z.weekStartsOn)??0,m=cn(i,s==null?void 0:s.in);if(!R2(m))throw new RangeError("Invalid time value");let y=n.match(TE).map(M=>{const D=M[0];if(D==="p"||D==="P"){const J=xE[D];return J(M,o.formatLong)}return M}).join("").match(OE).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const D=M[0];if(D==="'")return{isToken:!1,value:ME(M)};if(vy[D])return{isToken:!0,value:M};if(D.match(CE))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(y=o.localize.preprocessor(m,y));const g={firstWeekContainsDate:f,weekStartsOn:d,locale:o};return y.map(M=>{if(!M.isToken)return M.value;const D=M.value;(EE(D)||SE(D))&&AE(D,n,String(i));const J=vy[D[0]];return J(m,D,o.localize,g)}).join("")}function ME(i){const n=i.match(kE);return n?n[1].replace(NE,"'"):i}function RE(i,n,s){const a=sl(),o=(s==null?void 0:s.locale)??a.locale??Gg,f=N2(i,n);if(isNaN(f))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[m,y]=Vg(s==null?void 0:s.in,...f>0?[n,i]:[i,n]),g=D2((s==null?void 0:s.roundingMethod)??"round"),E=y.getTime()-m.getTime(),_=E/my,T=ec(y)-ec(m),z=(E-T)/my,M=s==null?void 0:s.unit;let D;if(M?D=M:_<1?D="second":_<60?D="minute":_<gy?D="hour":z<yy?D="day":z<py?D="month":D="year",D==="second"){const J=g(E/1e3);return o.formatDistance("xSeconds",J,d)}else if(D==="minute"){const J=g(_);return o.formatDistance("xMinutes",J,d)}else if(D==="hour"){const J=g(_/60);return o.formatDistance("xHours",J,d)}else if(D==="day"){const J=g(z/gy);return o.formatDistance("xDays",J,d)}else if(D==="month"){const J=g(z/yy);return J===12&&M!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",J,d)}else{const J=g(z/py);return o.formatDistance("xYears",J,d)}}function DE(i,n){return RE(i,C2(i),n)}function Oj(i){return i.toLocaleString()}function Tj(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 n=new Date(i);return n.getTime()>Date.now()?"just now":DE(n,{addSuffix:!0})}function kj(i){const n=Date.now()-new Date(i).getTime();if(n<0)return"now";const s=Math.floor(n/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 f=Math.floor(o/24);return f<7?`${f}d`:f<30?`${Math.floor(f/7)}w`:f<365?`${Math.floor(f/30)}mo`:`${Math.floor(f/365)}y`}function Nj(i){return i<=0?"Expired":Nh(i)}function zE(i){return i==null?"--":Nh(i)}function Cj(i){return i?kh(new Date(i),"MMM d, yyyy h:mm a"):"--"}function Nh(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 n=Math.floor(i/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function Mj(i,n){const s=new Date(i).getTime(),a=n?new Date(n).getTime():Date.now();return Nh(a-s)}function Qg({options:i,children:n,className:s=""}){const[a,o]=j.useState(!1),[f,d]=j.useState(null),[m,y]=j.useState(null),g=j.useRef(null),E=j.useRef(void 0),_=j.useRef(void 0),T=220,z=j.useCallback(()=>{if(!g.current)return;const ie=g.current.getBoundingClientRect(),G=window.innerWidth-T-8,ce=Math.max(8,Math.min(ie.left,G));y({top:ie.bottom+4,left:ce})},[]),M=j.useCallback(async(ie,G)=>{try{await navigator.clipboard.writeText(ie),d(G),clearTimeout(E.current),E.current=setTimeout(()=>d(null),1200)}catch{}},[]),D=j.useCallback(()=>{clearTimeout(_.current),z(),o(!0)},[z]),J=j.useCallback(()=>{_.current=setTimeout(()=>o(!1),150)},[]);return j.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(_.current)},[]),h.jsxs("span",{ref:g,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:D,onMouseLeave:J,children:[n,a&&m&&Cy.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:D,onMouseLeave:J,children:i.map(ie=>h.jsxs("button",{onClick:G=>{G.stopPropagation(),M(ie.value,ie.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:ie.label}),h.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===ie.label?"✓":ie.value})]},ie.label))}),document.body)]})}function UE(i,n){const s=new Date(i);switch(n){case"relative":return qE(i);case"datetime":return kh(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function BE(i){const n=new Date(i);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:kh(n,"MMM d, yyyy h:mm:ss a")}]}function LE({date:i,format:n="relative",className:s=""}){const[,a]=j.useState(0);j.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(d=>d+1),3e4);return()=>clearInterval(f)},[n]);const o=j.useMemo(()=>BE(i),[i]);return h.jsx(Qg,{options:o,children:h.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${s}`,children:UE(i,n)})})}function HE({ms:i,className:n=""}){const s=zE(i),a=j.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 ${n}`,children:"--"}):h.jsx(Qg,{options:a,children:h.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const PE=["sm","md","lg","full"],Ey={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"},Ay={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function $E({which:i}){const n="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:n,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:n,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:n,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:n,strokeWidth:"1.5"})})}}function YE({msg:i}){const[n,s]=j.useState(0);j.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(n/60),o=n%60,f=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:f})]}),i.workflowId&&h.jsxs(Ni,{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(ah,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function VE({msg:i,compileMessage:n}){const s=i.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(LE,{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(HE,{ms:i.durationMs,className:"!text-[9px] text-text-muted/50"})]}),i.workflowId&&h.jsx(Ni,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(ah,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&i.workflowId&&!i.pending&&h.jsx("button",{onClick:()=>n(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(qv,{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 GE(){const{helpOpen:i,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:d,compileMessage:m}=Pg(),[y,g]=j.useState(""),[E,_]=j.useState("md"),[T,z]=j.useState(!0),M=j.useRef(null),D=j.useRef(null);if(j.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),j.useEffect(()=>{i&&D.current&&D.current.focus()},[i]),j.useEffect(()=>{if(!i)return;const k=Z=>{Z.key==="Escape"&&(E==="full"?_("lg"):E==="lg"?_("md"):E==="md"?_("sm"):n(!1))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i,E,n]),!i)return null;const J=()=>{const k=y.trim();!k||f||(a(k),g(""),D.current&&(D.current.style.height="auto"))},ie=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),J())},G=E==="full",ce=o.page.replace(/-/g," "),ae=G?{}:{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 ${G?Ey.full:`right-6 ${Ey[E]}`} ${T?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ae,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!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:ce})]}),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:PE.map(k=>h.jsx("button",{onClick:()=>_(k),className:`p-1 rounded transition-colors ${k===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":k===E,"aria-label":Ay[k],title:Ay[k],children:h.jsx($E,{which:k})},k))}),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(zv,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Mi,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:M,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(k=>h.jsxs("div",{className:`text-xs leading-relaxed ${k.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 ${k.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:k.pending?h.jsx(YE,{msg:k}):k.role==="assistant"?h.jsx(Th,{content:k.content}):k.content}),!k.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(VE,{msg:k,compileMessage:m})})]},k.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:D,value:y,onChange:k=>{g(k.target.value);const Z=k.target;Z.style.height="auto",Z.style.height=`${Math.min(Z.scrollHeight,120)}px`},onKeyDown:ie,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),h.jsx("button",{onClick:J,disabled:!y.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(Uv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function FE(){var ie;const{isBuilder:i,isOps:n,viewAs:s}=xg(),{canSeePaceBoard:a}=vg(),{data:o}=Br(),f=gg(),d=f!==null?f:!!((ie=o==null?void 0:o.ai)!=null&&ie.enabled),{collapsed:m,toggle:y}=wg(),[g,E]=j.useState(!1),[_,T]=j.useState(!1),[z,M]=j.useState(()=>window.location.hash.startsWith("#docs")),D=xs(),J=j.useRef(null);return j.useEffect(()=>{const G=J.current;G&&(G.classList.remove("animate-page-in"),G.offsetWidth,G.classList.add("animate-page-in"))},[D.pathname]),j.useEffect(()=>{const G=()=>{window.location.hash.startsWith("#docs")&&M(!0)};return window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)},[]),h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(MS,{onToggleEventFeed:()=>E(G=>!G),onToggleDocs:()=>M(G=>!G)}),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(US,{aiEnabled:d,isBuilder:i,isOps:n,viewAs:s,canSeePaceBoard:a}),h.jsx(LS,{}),i&&h.jsx(HS,{}),i&&d&&h.jsx($S,{}),i&&h.jsx(VS,{}),(i||n)&&h.jsx(GS,{isBuilder:i,isOps:n})]}),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(Bv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(Lv,{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:J,className:"w-full px-10 py-10 pb-16 animate-page-in h-full flex flex-col",children:h.jsx(Or,{})})})]}),h.jsx(u2,{open:g,onToggle:()=>E(G=>!G),configOpen:_,onToggleConfig:()=>T(G=>!G)}),h.jsx(v2,{open:z,onClose:()=>{M(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(A2,{}),d&&h.jsx(GE,{})]})}function IE(){const{isAuthenticated:i}=In(),n=xs();return i?h.jsx(rS,{children:h.jsx(E2,{children:h.jsx(FE,{})})}):h.jsx($n,{to:"/login",state:{from:n.pathname},replace:!0})}function Jg({provider:i,className:n="w-5 h-5"}){switch(i){case"google":return h.jsxs("svg",{className:n,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:n,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:n,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:n,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:n,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 QE(){return Te("/auth/oauth/providers")}async function JE(i,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Te(`/auth/oauth/connections/${i}${s}`,{method:"DELETE"})}function Rj(){return xt({queryKey:["oauth-connections"],queryFn:()=>Te("/auth/oauth/connections")})}function Dj(){const i=Tt();return Rt({mutationFn:({provider:n,label:s})=>JE(n,s),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function KE(){var oe;const{login:i,isAuthenticated:n}=In(),s=My(),a=xs(),o=new URLSearchParams(a.search),f=o.get("token"),d=o.get("error"),m=((oe=a.state)==null?void 0:oe.from)??o.get("returnTo")??"/",y=j.useRef(!1);f&&!y.current&&(y.current=!0,i(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[g,E]=j.useState(""),[_,T]=j.useState(""),[z,M]=j.useState(d||""),[D,J]=j.useState(!1),[ie,G]=j.useState(!!f),[ce,ae]=j.useState([]),k=j.useRef(!1);if(j.useEffect(()=>{f||k.current||(k.current=!0,(async()=>{var F,V,K,Q;try{const se=await fetch(`${Ft}/api/settings`);if(!se.ok)return;const he=await se.json();if(!((F=he.auth)!=null&&F.sso))return;const Se=await fetch(`${Ft}/api/auth/sso`,{method:"POST"});if(!Se.ok){M("Host authentication required — please log in to your organization first");return}const ke=await Se.json();ke.token&&((V=he.auth)!=null&&V.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",he.auth.ssoLogoutUrl),G(!0),i(ke.token,void 0,{displayName:(K=ke.user)==null?void 0:K.display_name,username:(Q=ke.user)==null?void 0:Q.external_id}))}catch{}})())},[]),j.useEffect(()=>{f||QE().then(ae).catch(()=>{})},[]),j.useEffect(()=>{if(!ie)return;const F=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(F)},[ie]),n&&!ie)return h.jsx($n,{to:m,replace:!0});const Z=async F=>{var V,K;if(F.preventDefault(),M(""),!g.trim()||!_){M("Username and password are required");return}J(!0);try{const Q=await fetch(`${Ft}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g.trim(),password:_})}),se=await Q.json();if(!Q.ok){M(se.error||"Login failed");return}G(!0),i(se.token,{username:g.trim(),password:_},{displayName:(V=se.user)==null?void 0:V.display_name,username:(K=se.user)==null?void 0:K.external_id})}catch{M("Unable to connect to server")}finally{J(!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 ${ie?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Ah,{size:"lg",hideLabel:ie})}),h.jsxs("form",{onSubmit:Z,className:`space-y-5 transition-opacity duration-300 ${ie?"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:F=>E(F.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ie,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:F=>T(F.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),z&&h.jsx("p",{className:"text-sm text-status-error",children:z}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:D||ie,children:D?"Signing in...":"Sign In"}),ce.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:ce.filter(F=>F.provider!=="anthropic").map(F=>h.jsxs("a",{href:`${Ft}/api/auth/oauth/${F.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(Jg,{provider:F.provider}),"Sign in with ",F.name]},F.provider))})]})]})]})})}function jy(){const{isAuthenticated:i}=In(),n=My(),s=xs(),a=new URLSearchParams(s.search),o=a.get("state")||"";j.useEffect(()=>{i||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[i]);const[f,d]=j.useState(""),[m,y]=j.useState(a.get("label")||"default"),[g,E]=j.useState(""),[_,T]=j.useState(!1),z=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),D=J=>{J.preventDefault();const ie=f.trim();if(!ie){E("A token or API key is required");return}if(!ie.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 G=`${Ft}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ie)}&state=${encodeURIComponent(o)}`;window.location.href=G};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(Ah,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(Jg,{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:D,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:f,onChange:J=>d(J.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),z&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&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:J=>y(J.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 La({roleTypes:i,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=In();return a?h.jsx(Or,{}):i&&i.some(d=>f(d))?h.jsx(Or,{}):n&&n.some(d=>o(d))?h.jsx(Or,{}):h.jsx($n,{to:s,replace:!0})}function XE({redirectTo:i="/"}){var a;const{data:n,isLoading:s}=Br();return s||!n?null:(a=n.ai)!=null&&a.enabled?h.jsx(Or,{}):h.jsx($n,{to:i,replace:!0})}function ZE({flag:i,redirectTo:n="/"}){var o;const{data:s,isLoading:a}=Br();return a||!s?null:((o=s.features)==null?void 0:o[i])===!1?h.jsx($n,{to:n,replace:!0}):h.jsx(Or,{})}const WE=j.lazy(()=>Ee(()=>import("./ProcessesListPage-CRttlU3L.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}))),eA=j.lazy(()=>Ee(()=>import("./ProcessDetailPage-txiMHbMI.js"),__vite__mapDeps([18,1,2,4,19,15,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),tA=j.lazy(()=>Ee(()=>import("./McpOverview-Cul2LFEw.js"),__vite__mapDeps([24,1,25,26,27,28,14,15,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),nA=j.lazy(()=>Ee(()=>import("./McpRunsPage-DlSrpxiv.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}))),sA=j.lazy(()=>Ee(()=>import("./McpRunDetailPage-B1RhxxlU.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}))),iA=j.lazy(()=>Ee(()=>import("./McpQueryPage-B7PmO_V-.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}))),rA=j.lazy(()=>Ee(()=>import("./McpQueryDetailPage-BVlQ0WBa.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}))),aA=j.lazy(()=>Ee(()=>import("./EscalationsOverview-DcMkbiSo.js"),__vite__mapDeps([51,1,4,14,15,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),lA=j.lazy(()=>Ee(()=>import("./AvailableEscalationsPage-AiuiLcz-.js"),__vite__mapDeps([52,1,6,53,4,54,55,56,15,20,12,5,7,8,9,10,23,57,13,58,21,17,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),oA=j.lazy(()=>Ee(()=>import("./OperatorDashboard-zviIxH-0.js"),__vite__mapDeps([59,1,4,5,6,7,8,9,10,14,15,12,33,57,13,58,21,17,53,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),cA=j.lazy(()=>Ee(()=>import("./index-B_68lp-B.js"),__vite__mapDeps([60,1,54,55,6,56,14,15,16,53,3,4,61,20,21,35,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),uA=j.lazy(()=>Ee(()=>import("./WorkflowsOverview-CkI-Pmj7.js"),__vite__mapDeps([62,1,3,4,14,15,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),fA=j.lazy(()=>Ee(()=>import("./index-DVLBkcoD.js"),__vite__mapDeps([63,1,3,14,15,13,17,64,47,48,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),hA=j.lazy(()=>Ee(()=>import("./index-DVLBkcoD.js"),__vite__mapDeps([63,1,3,14,15,13,17,64,47,48,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),dA=j.lazy(()=>Ee(()=>import("./WorkflowsDashboard-BeWjDHYW.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"})}))),mA=j.lazy(()=>Ee(()=>import("./WorkflowsDashboard-BeWjDHYW.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"})}))),pA=j.lazy(()=>Ee(()=>import("./YamlWorkflowsPage-DjmNTQ5r.js"),__vite__mapDeps([66,1,27,5,6,14,15,13,10,49,64,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),yA=j.lazy(()=>Ee(()=>import("./GraphInvokePage-CXElQqcV.js"),__vite__mapDeps([67,1,27,14,15,44,46,47,48,45,6,49,64]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),gA=j.lazy(()=>Ee(()=>import("./YamlWorkflowDetailPage-BQnO8-PQ.js"),__vite__mapDeps([68,1,27,20,64,15,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),bA=j.lazy(()=>Ee(()=>import("./TasksListPage-t9WAft9-.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}))),xA=j.lazy(()=>Ee(()=>import("./TaskDetailPage-Biikk9o_.js"),__vite__mapDeps([70,1,2,20,58,14,15,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),Oy=j.lazy(()=>Ee(()=>import("./WorkflowExecutionPage-DD1BKj5k.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}))),vA=j.lazy(()=>Ee(()=>import("./AdminDashboard-DQS74RL0.js"),__vite__mapDeps([72,1,2,4,25,19,15,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),_A=j.lazy(()=>Ee(()=>import("./index-BVZINC_p.js"),__vite__mapDeps([73,1,3,9,10,13,33,5,6,14,15,74,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),wA=j.lazy(()=>Ee(()=>import("./index-DjI2AUbn.js"),__vite__mapDeps([75,1,3,13,76,55,6,21,15,17,14,47,48,64]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),Ty=j.lazy(()=>Ee(()=>import("./index-DjI2AUbn.js"),__vite__mapDeps([75,1,3,13,76,55,6,21,15,17,14,47,48,64]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),SA=j.lazy(()=>Ee(()=>import("./index-BYEkfaUq.js"),__vite__mapDeps([77,1,25,10,76,55,6,14,15,13,12,5,78,46,47,48,49,45,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),ky=j.lazy(()=>Ee(()=>import("./index-CRBXgMsh.js"),__vite__mapDeps([79,1,25,14,15,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),EA=j.lazy(()=>Ee(()=>import("./index-BC1NxetR.js"),__vite__mapDeps([80,1,23,5,6,9,10,12,13,76,55,33,14,15,21,48,11,50]),import.meta.url).then(i=>({default:i.UsersPage}))),AA=j.lazy(()=>Ee(()=>import("./RolesPage-DzrSv6m-.js"),__vite__mapDeps([81,1,14,15,55,6]),import.meta.url).then(i=>({default:i.RolesPage}))),jA=j.lazy(()=>Ee(()=>import("./RoleDetailPage-DBIl_mhK.js"),__vite__mapDeps([82,1,76,55,6,23,15]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),OA=j.lazy(()=>Ee(()=>import("./EscalationSchemaPage-BlMx2WE6.js"),__vite__mapDeps([83,1,15,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),TA=j.lazy(()=>Ee(()=>import("./EscalationListSchemaPage-CaMydHIO.js"),__vite__mapDeps([84,1,15,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),kA=j.lazy(()=>Ee(()=>import("./index-DyS2DHqy.js"),__vite__mapDeps([85,1,14,15,55,6,56]),import.meta.url).then(i=>({default:i.MaintenancePage}))),NA=j.lazy(()=>Ee(()=>import("./OperationsPage-vm_ByX41.js").then(i=>i.O),__vite__mapDeps([86,1,4,14,15,6]),import.meta.url).then(i=>({default:i.OperationsPage}))),CA=j.lazy(()=>Ee(()=>import("./index-DJ5nhcGB.js"),__vite__mapDeps([87,1,19,15,13,5,6,31,28,55,36,74,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),MA=j.lazy(()=>Ee(()=>import("./index-Cfq3UKd8.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}))),RA=j.lazy(()=>Ee(()=>import("./CredentialsPage-BwA7k9Cb.js"),__vite__mapDeps([89,1,14,15,50,76,55,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),DA=j.lazy(()=>Ee(()=>import("./index-H6Vp-gPG.js"),__vite__mapDeps([90,1,6,14,15,13,16,8,10,91,50]),import.meta.url).then(i=>({default:i.FilesPage}))),qA=j.lazy(()=>Ee(()=>import("./index-BXbt5NHG.js"),__vite__mapDeps([92,1,14,15,13,16,12,10,91,50,93,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),zA=j.lazy(()=>Ee(()=>import("./HomePage-DcWfjZA-.js"),__vite__mapDeps([94,1,3,26,28,4,21,15,17,16,86,14,6]),import.meta.url).then(i=>({default:i.HomePage}))),UA=j.lazy(()=>Ee(()=>import("./AgentsPage-CyUXe9n4.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}))),BA=j.lazy(()=>Ee(()=>import("./AgentDetailPage-CDiopQ7D.js"),__vite__mapDeps([97,1,96,98,15,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),Ny=j.lazy(()=>Ee(()=>import("./AgentConfigPage-CSMCrFR4.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}))),LA=j.lazy(()=>Ee(()=>import("./CapabilitiesPage-nTv4STcG.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}))),HA=j.lazy(()=>Ee(()=>import("./TopicsPage-tiOEQz2m.js"),__vite__mapDeps([103,1,101,14,15,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),PA=j.lazy(()=>Ee(()=>import("./TopicDetailPage-B8pHHweA.js"),__vite__mapDeps([104,1,101,16,15,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function $A(){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(j.Suspense,{fallback:h.jsx($A,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Kg=new lv({defaultOptions:{queries:{staleTime:1e4,retry:(i,n)=>n instanceof Error&&n.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Kg.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",n=`${i}/login`;if(window.location.pathname!==n){const s=window.location.pathname+window.location.search,a=i&&s.startsWith(i)?s.slice(i.length)||"/":s;window.location.href=`${n}?returnTo=${encodeURIComponent(a)}`}});const YA=uv([{path:"/login",element:h.jsx(KE,{})},{path:"/connect/anthropic",element:h.jsx(jy,{})},{path:"/connect/:provider",element:h.jsx(jy,{})},{path:"/",element:h.jsx(IE,{}),children:[{index:!0,element:h.jsx(we,{children:h.jsx(zA,{})})},{path:"processes/all",element:h.jsx(we,{children:h.jsx(WE,{})})},{path:"processes/detail/:originId",element:h.jsx(we,{children:h.jsx(eA,{})})},{path:"credentials",element:h.jsx(we,{children:h.jsx(RA,{})})},{path:"connections",element:h.jsx($n,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(we,{children:h.jsx(aA,{})})},{path:"escalations/available",element:h.jsx(we,{children:h.jsx(lA,{})})},{path:"escalations/queue",element:h.jsx(we,{children:h.jsx(oA,{})})},{path:"escalations/detail/:id",element:h.jsx(we,{children:h.jsx(cA,{})})},{path:"capabilities",element:h.jsx(we,{children:h.jsx(LA,{})})},{path:"agents",element:h.jsx(we,{children:h.jsx(UA,{})})},{path:"agents/new",element:h.jsx(we,{children:h.jsx(Ny,{})})},{path:"agents/:id",element:h.jsx(we,{children:h.jsx(BA,{})})},{path:"agents/:id/edit",element:h.jsx(we,{children:h.jsx(Ny,{})})},{path:"topics",element:h.jsx(we,{children:h.jsx(HA,{})})},{path:"topics/:topic",element:h.jsx(we,{children:h.jsx(PA,{})})},{element:h.jsx(La,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(we,{children:h.jsx(uA,{})})},{path:"workflows/executions",element:h.jsx(we,{children:h.jsx(mA,{})})},{path:"workflows/durable/executions",element:h.jsx(we,{children:h.jsx(dA,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(we,{children:h.jsx(Oy,{})})},{path:"workflows/tasks",element:h.jsx(we,{children:h.jsx(bA,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(we,{children:h.jsx(xA,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(we,{children:h.jsx(Oy,{})})},{path:"workflows/start",element:h.jsx(we,{children:h.jsx(fA,{})})},{path:"workflows/durable/invoke",element:h.jsx(we,{children:h.jsx(hA,{})})},{path:"workflows/cron",element:h.jsx($n,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(we,{children:h.jsx(_A,{})})},{path:"workflows/registry",element:h.jsx(we,{children:h.jsx(wA,{})})},{path:"workflows/registry/new",element:h.jsx(we,{children:h.jsx(Ty,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(we,{children:h.jsx(Ty,{})})}]},{element:h.jsx(La,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(we,{children:h.jsx(pA,{})})},{path:"mcp/workflows/invoke",element:h.jsx(we,{children:h.jsx(yA,{})})},{path:"mcp/workflows/:id",element:h.jsx(we,{children:h.jsx(gA,{})})},{path:"mcp/executions",element:h.jsx(we,{children:h.jsx(nA,{})})},{path:"mcp/executions/:jobId",element:h.jsx(we,{children:h.jsx(sA,{})})},{path:"files",element:h.jsx(we,{children:h.jsx(DA,{})})},{path:"knowledge",element:h.jsx(we,{children:h.jsx(qA,{})})},{element:h.jsx(XE,{}),children:[{path:"mcp",element:h.jsx(we,{children:h.jsx(tA,{})})},{path:"mcp/queries",element:h.jsx(we,{children:h.jsx(iA,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(we,{children:h.jsx(rA,{})})},{path:"mcp/tools",element:h.jsx($n,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(we,{children:h.jsx(SA,{})})},{path:"mcp/servers/new",element:h.jsx(we,{children:h.jsx(ky,{})})},{path:"mcp/servers/:serverId",element:h.jsx(we,{children:h.jsx(ky,{})})}]}]},{element:h.jsx(La,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"operations",element:h.jsx(we,{children:h.jsx(NA,{})})}]},{element:h.jsx(La,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(we,{children:h.jsx(vA,{})})},{path:"admin/users",element:h.jsx(we,{children:h.jsx(EA,{})})},{path:"admin/escalation-chains",element:h.jsx($n,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(we,{children:h.jsx(AA,{})})},{path:"admin/roles/:role",element:h.jsx(we,{children:h.jsx(jA,{})})},{path:"admin/roles/:role/schema",element:h.jsx(we,{children:h.jsx(OA,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(we,{children:h.jsx(TA,{})})}]},{element:h.jsx(La,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx($n,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(ZE,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(we,{children:h.jsx(kA,{})})}]},{path:"admin/controlplane",element:h.jsx(we,{children:h.jsx(CA,{})})},{path:"admin/streams",element:h.jsx(we,{children:h.jsx(MA,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function VA(){return h.jsx(ov,{client:Kg,children:h.jsx(Qv,{children:h.jsx(Zw,{children:h.jsx(fv,{router:YA})})})})}Cg(Ng());Vv.createRoot(document.getElementById("root")).render(h.jsx(j.StrictMode,{children:h.jsx(VA,{})}));export{xj as $,SS as A,lS as B,Oh as C,HE as D,vj as E,Ug as F,Nh as G,sj as H,Cj as I,l2 as J,kj as K,tj as L,Th as M,X_ as N,rj as O,fj as P,pj as Q,kh as R,JS as S,Qg as T,Nj as U,wj as V,mj as W,Sj as X,Ej as Y,yj as Z,gj as _,Mj as a,bj as a0,_j as a1,Oj as a2,Ft as a3,By as a4,KA as a5,Aj as a6,jj as a7,Ro as a8,Ya as a9,Sr as aa,_r as ab,Rj as ac,Dj as ad,Jg as ae,BS as af,vg as ag,Tj as ah,LE as b,W_ as c,Te as d,ej as e,zE as f,nj as g,ij as h,XA as i,wS as j,aS as k,gg as l,In as m,WA as n,xg as o,aj as p,lj as q,oj as r,cj as s,uj as t,Br as u,hj as v,dj as w,Eg as x,ZA as y,jg as z};
63
+ //# sourceMappingURL=index-YPLTjeli.js.map