@hotmeshio/long-tail 0.18.1 → 0.19.1

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 (367) hide show
  1. package/build/api/escalations/index.d.ts +1 -1
  2. package/build/api/escalations/index.js +2 -1
  3. package/build/api/escalations/list.d.ts +11 -0
  4. package/build/api/escalations/list.js +31 -2
  5. package/build/api/users.d.ts +11 -0
  6. package/build/api/users.js +19 -0
  7. package/build/api/workflows/config.d.ts +5 -1
  8. package/build/api/workflows/config.js +9 -1
  9. package/build/api/workflows/index.d.ts +3 -0
  10. package/build/api/workflows/index.js +7 -1
  11. package/build/api/workflows/input-validation.d.ts +13 -0
  12. package/build/api/workflows/input-validation.js +38 -0
  13. package/build/api/workflows/invocable.d.ts +19 -0
  14. package/build/api/workflows/invocable.js +106 -0
  15. package/build/api/workflows/invocation.js +6 -0
  16. package/build/lib/db/schemas/034_workflow_input_schema.sql +13 -0
  17. package/build/lib/uuid.d.ts +11 -0
  18. package/build/lib/uuid.js +20 -0
  19. package/build/routes/escalations/list.js +10 -1
  20. package/build/routes/users.js +9 -0
  21. package/build/routes/workflows/config.js +2 -0
  22. package/build/routes/workflows/discovery.js +14 -0
  23. package/build/scripts/ortho-populate.d.ts +3 -1
  24. package/build/scripts/ortho-populate.js +15 -5
  25. package/build/sdk/index.d.ts +1 -0
  26. package/build/services/config/cache.js +2 -0
  27. package/build/services/config/read.js +4 -0
  28. package/build/services/config/sql.d.ts +2 -2
  29. package/build/services/config/sql.js +7 -5
  30. package/build/services/config/write.js +11 -1
  31. package/build/services/escalation/batch.js +3 -0
  32. package/build/services/escalation/bulk.js +8 -0
  33. package/build/services/escalation/crud.js +26 -0
  34. package/build/services/escalation/queries.d.ts +14 -1
  35. package/build/services/escalation/queries.js +49 -7
  36. package/build/services/escalation/sql.d.ts +4 -2
  37. package/build/services/escalation/sql.js +4 -0
  38. package/build/services/interceptor/index.js +7 -0
  39. package/build/services/invocation-access.d.ts +18 -0
  40. package/build/services/invocation-access.js +32 -0
  41. package/build/services/role/types.d.ts +1 -1
  42. package/build/services/role/types.js +1 -1
  43. package/build/services/user/auth.js +2 -2
  44. package/build/services/user/crud.d.ts +13 -0
  45. package/build/services/user/crud.js +26 -3
  46. package/build/services/user/index.d.ts +1 -1
  47. package/build/services/user/index.js +2 -1
  48. package/build/services/user/sql.d.ts +11 -5
  49. package/build/services/user/sql.js +18 -6
  50. package/build/services/workflow-invocation.js +4 -9
  51. package/build/shared/form-validation/index.d.ts +1 -0
  52. package/build/shared/form-validation/index.js +1 -0
  53. package/build/shared/form-validation/invoke-context.d.ts +7 -0
  54. package/build/shared/form-validation/invoke-context.js +11 -0
  55. package/build/shared/form-validation/validate-resolver-payload.d.ts +1 -1
  56. package/build/shared/form-validation/validate-resolver-payload.js +1 -0
  57. package/build/shared/form-validation/x-lt-help.d.ts +2 -2
  58. package/build/shared/form-validation/x-lt-help.js +2 -2
  59. package/build/shared/form-validation/x-lt-show-if.d.ts +1 -0
  60. package/build/shared/form-validation/x-lt-show-if.js +3 -0
  61. package/build/start/workers.js +2 -0
  62. package/build/system/mcp-servers/admin/workflows.js +15 -2
  63. package/build/tsconfig.tsbuildinfo +1 -1
  64. package/build/types/config.d.ts +6 -0
  65. package/build/types/index.d.ts +2 -0
  66. package/build/types/index.js +4 -1
  67. package/build/types/startup.d.ts +10 -0
  68. package/build/types/validation.d.ts +4 -2
  69. package/build/types/workflow-icons.d.ts +86 -0
  70. package/build/types/workflow-icons.js +92 -0
  71. package/dashboard/dist/assets/{AdminDashboard-DDY8bceq.js → AdminDashboard-Drs-9TRM.js} +2 -2
  72. package/dashboard/dist/assets/{AdminDashboard-DDY8bceq.js.map → AdminDashboard-Drs-9TRM.js.map} +1 -1
  73. package/dashboard/dist/assets/{AgentConfigPage-D47sHnup.js → AgentConfigPage-BDPDZ7-v.js} +3 -3
  74. package/dashboard/dist/assets/{AgentConfigPage-D47sHnup.js.map → AgentConfigPage-BDPDZ7-v.js.map} +1 -1
  75. package/dashboard/dist/assets/{AgentDetailPage-DwrfByA2.js → AgentDetailPage-CGBulM4_.js} +3 -3
  76. package/dashboard/dist/assets/{AgentDetailPage-DwrfByA2.js.map → AgentDetailPage-CGBulM4_.js.map} +1 -1
  77. package/dashboard/dist/assets/AgentsPage-D77JeViQ.js +2 -0
  78. package/dashboard/dist/assets/{AgentsPage-CLSjlyXy.js.map → AgentsPage-D77JeViQ.js.map} +1 -1
  79. package/dashboard/dist/assets/{AutoGrowTextarea-DgEQeRQw.js → AutoGrowTextarea-7X3T9La8.js} +2 -2
  80. package/dashboard/dist/assets/{AutoGrowTextarea-DgEQeRQw.js.map → AutoGrowTextarea-7X3T9La8.js.map} +1 -1
  81. package/dashboard/dist/assets/AvailableEscalationsPage-CqM_MOMy.js +2 -0
  82. package/dashboard/dist/assets/AvailableEscalationsPage-CqM_MOMy.js.map +1 -0
  83. package/dashboard/dist/assets/{BotPicker-CbL7gQFq.js → BotPicker-CC5vI_Sv.js} +2 -2
  84. package/dashboard/dist/assets/{BotPicker-CbL7gQFq.js.map → BotPicker-CC5vI_Sv.js.map} +1 -1
  85. package/dashboard/dist/assets/BulkAssignModal-BXiJnlqt.js +2 -0
  86. package/dashboard/dist/assets/BulkAssignModal-BXiJnlqt.js.map +1 -0
  87. package/dashboard/dist/assets/{CapabilitiesPage-Q9Pe0y_p.js → CapabilitiesPage-D9TC2iKy.js} +2 -2
  88. package/dashboard/dist/assets/{CapabilitiesPage-Q9Pe0y_p.js.map → CapabilitiesPage-D9TC2iKy.js.map} +1 -1
  89. package/dashboard/dist/assets/{CollapsibleSection-BZOtaWPR.js → CollapsibleSection-D10lGw_u.js} +2 -2
  90. package/dashboard/dist/assets/{CollapsibleSection-BZOtaWPR.js.map → CollapsibleSection-D10lGw_u.js.map} +1 -1
  91. package/dashboard/dist/assets/{ConfirmDeleteModal-6CidwpPx.js → ConfirmDeleteModal-BJdLN6No.js} +2 -2
  92. package/dashboard/dist/assets/{ConfirmDeleteModal-6CidwpPx.js.map → ConfirmDeleteModal-BJdLN6No.js.map} +1 -1
  93. package/dashboard/dist/assets/{CopyableId-4Lqlc5cU.js → CopyableId-Bn02zYxt.js} +2 -2
  94. package/dashboard/dist/assets/{CopyableId-4Lqlc5cU.js.map → CopyableId-Bn02zYxt.js.map} +1 -1
  95. package/dashboard/dist/assets/CountdownTimer-D9B-BjQ7.js +2 -0
  96. package/dashboard/dist/assets/CountdownTimer-D9B-BjQ7.js.map +1 -0
  97. package/dashboard/dist/assets/{CredentialsPage-dxjrUEyO.js → CredentialsPage-hniUAFBK.js} +2 -2
  98. package/dashboard/dist/assets/{CredentialsPage-dxjrUEyO.js.map → CredentialsPage-hniUAFBK.js.map} +1 -1
  99. package/dashboard/dist/assets/{CronLabel-D8oo8eaA.js → CronLabel-v9DCD2FX.js} +2 -2
  100. package/dashboard/dist/assets/{CronLabel-D8oo8eaA.js.map → CronLabel-v9DCD2FX.js.map} +1 -1
  101. package/dashboard/dist/assets/{DataTable-DFPMeqyQ.js → DataTable-7C7riavf.js} +2 -2
  102. package/dashboard/dist/assets/{DataTable-DFPMeqyQ.js.map → DataTable-7C7riavf.js.map} +1 -1
  103. package/dashboard/dist/assets/{DropZone-CWCh5ItZ.js → DropZone-XlcY8hEH.js} +2 -2
  104. package/dashboard/dist/assets/{DropZone-CWCh5ItZ.js.map → DropZone-XlcY8hEH.js.map} +1 -1
  105. package/dashboard/dist/assets/{ElapsedCell-FHHQ69G3.js → ElapsedCell-_xvVTK8N.js} +2 -2
  106. package/dashboard/dist/assets/{ElapsedCell-FHHQ69G3.js.map → ElapsedCell-_xvVTK8N.js.map} +1 -1
  107. package/dashboard/dist/assets/{EmptyState-lpUFYfun.js → EmptyState-DgC_6njU.js} +2 -2
  108. package/dashboard/dist/assets/{EmptyState-lpUFYfun.js.map → EmptyState-DgC_6njU.js.map} +1 -1
  109. package/dashboard/dist/assets/EntityTimelinePanel-1lT3jkCM.js +2 -0
  110. package/dashboard/dist/assets/EntityTimelinePanel-1lT3jkCM.js.map +1 -0
  111. package/dashboard/dist/assets/{EscalationListSchemaPage-D5L5lDNb.js → EscalationListSchemaPage-BeQUTUEO.js} +3 -3
  112. package/dashboard/dist/assets/{EscalationListSchemaPage-D5L5lDNb.js.map → EscalationListSchemaPage-BeQUTUEO.js.map} +1 -1
  113. package/dashboard/dist/assets/EscalationListView-uuZRMSLB.js +2 -0
  114. package/dashboard/dist/assets/EscalationListView-uuZRMSLB.js.map +1 -0
  115. package/dashboard/dist/assets/{EscalationSchemaPage-bYbfEpSB.js → EscalationSchemaPage-D4VlEwyS.js} +3 -3
  116. package/dashboard/dist/assets/{EscalationSchemaPage-bYbfEpSB.js.map → EscalationSchemaPage-D4VlEwyS.js.map} +1 -1
  117. package/dashboard/dist/assets/{EscalationsOverview-DjtIjL1b.js → EscalationsOverview-Bx6Zrzm-.js} +2 -2
  118. package/dashboard/dist/assets/{EscalationsOverview-DjtIjL1b.js.map → EscalationsOverview-Bx6Zrzm-.js.map} +1 -1
  119. package/dashboard/dist/assets/{EventTable-CihVTREC.js → EventTable-KEC3YWBf.js} +2 -2
  120. package/dashboard/dist/assets/{EventTable-CihVTREC.js.map → EventTable-KEC3YWBf.js.map} +1 -1
  121. package/dashboard/dist/assets/{FilterBar-Fin1IqHc.js → FilterBar-xwN_b5fj.js} +2 -2
  122. package/dashboard/dist/assets/{FilterBar-Fin1IqHc.js.map → FilterBar-xwN_b5fj.js.map} +1 -1
  123. package/dashboard/dist/assets/{GraphInvokePage-D77ILPd3.js → GraphInvokePage-DV7Y0fe2.js} +2 -2
  124. package/dashboard/dist/assets/{GraphInvokePage-D77ILPd3.js.map → GraphInvokePage-DV7Y0fe2.js.map} +1 -1
  125. package/dashboard/dist/assets/HomePage-G785SWcW.js +2 -0
  126. package/dashboard/dist/assets/HomePage-G785SWcW.js.map +1 -0
  127. package/dashboard/dist/assets/ListToolbar-zPVYPg3W.js +2 -0
  128. package/dashboard/dist/assets/{ListToolbar-DyHaJBTk.js.map → ListToolbar-zPVYPg3W.js.map} +1 -1
  129. package/dashboard/dist/assets/{McpOverview-qz7Ivf0G.js → McpOverview-CMGUq8hx.js} +2 -2
  130. package/dashboard/dist/assets/{McpOverview-qz7Ivf0G.js.map → McpOverview-CMGUq8hx.js.map} +1 -1
  131. package/dashboard/dist/assets/{McpQueryDetailPage-D6MB4CZM.js → McpQueryDetailPage-CdhLhaKn.js} +3 -3
  132. package/dashboard/dist/assets/{McpQueryDetailPage-D6MB4CZM.js.map → McpQueryDetailPage-CdhLhaKn.js.map} +1 -1
  133. package/dashboard/dist/assets/McpQueryPage-CNSNMagY.js +2 -0
  134. package/dashboard/dist/assets/{McpQueryPage-BqqRF5cQ.js.map → McpQueryPage-CNSNMagY.js.map} +1 -1
  135. package/dashboard/dist/assets/{McpRunDetailPage-DxLEhzhn.js → McpRunDetailPage-DBm8hUaW.js} +2 -2
  136. package/dashboard/dist/assets/{McpRunDetailPage-DxLEhzhn.js.map → McpRunDetailPage-DBm8hUaW.js.map} +1 -1
  137. package/dashboard/dist/assets/{McpRunsPage-BOsS4Hdf.js → McpRunsPage-B6rb5QBf.js} +2 -2
  138. package/dashboard/dist/assets/{McpRunsPage-BOsS4Hdf.js.map → McpRunsPage-B6rb5QBf.js.map} +1 -1
  139. package/dashboard/dist/assets/NamespacePill-Bb3revqD.js +2 -0
  140. package/dashboard/dist/assets/{NamespacePill-CJikgGzE.js.map → NamespacePill-Bb3revqD.js.map} +1 -1
  141. package/dashboard/dist/assets/OperationsPage-Dxk1fAMg.js +3 -0
  142. package/dashboard/dist/assets/OperationsPage-Dxk1fAMg.js.map +1 -0
  143. package/dashboard/dist/assets/OperatorDashboard-DBOscDnf.js +2 -0
  144. package/dashboard/dist/assets/{OperatorDashboard-C5rlijvh.js.map → OperatorDashboard-DBOscDnf.js.map} +1 -1
  145. package/dashboard/dist/assets/{PageHeader-DZmymFBS.js → PageHeader-Di5Sz3an.js} +2 -2
  146. package/dashboard/dist/assets/{PageHeader-DZmymFBS.js.map → PageHeader-Di5Sz3an.js.map} +1 -1
  147. package/dashboard/dist/assets/{PageHeaderWithStats-DuAm6YK2.js → PageHeaderWithStats-DutKJ-h2.js} +2 -2
  148. package/dashboard/dist/assets/{PageHeaderWithStats-DuAm6YK2.js.map → PageHeaderWithStats-DutKJ-h2.js.map} +1 -1
  149. package/dashboard/dist/assets/{PersonaDetailPage-JBdVvT5g.js → PersonaDetailPage-BGRdGpeR.js} +2 -2
  150. package/dashboard/dist/assets/{PersonaDetailPage-JBdVvT5g.js.map → PersonaDetailPage-BGRdGpeR.js.map} +1 -1
  151. package/dashboard/dist/assets/PersonasPage-DRzOZcVa.js +2 -0
  152. package/dashboard/dist/assets/PersonasPage-DRzOZcVa.js.map +1 -0
  153. package/dashboard/dist/assets/{PriorityBadge-BETdj4M-.js → PriorityBadge-r33mpDju.js} +2 -2
  154. package/dashboard/dist/assets/{PriorityBadge-BETdj4M-.js.map → PriorityBadge-r33mpDju.js.map} +1 -1
  155. package/dashboard/dist/assets/{ProcessDetailPage-CHnzOzQn.js → ProcessDetailPage-BLGjZXpM.js} +2 -2
  156. package/dashboard/dist/assets/{ProcessDetailPage-CHnzOzQn.js.map → ProcessDetailPage-BLGjZXpM.js.map} +1 -1
  157. package/dashboard/dist/assets/ProcessesListPage-5NnysKFC.js +2 -0
  158. package/dashboard/dist/assets/{ProcessesListPage-DuXTS5-v.js.map → ProcessesListPage-5NnysKFC.js.map} +1 -1
  159. package/dashboard/dist/assets/ResolverForm-Dy0yirtP.js +2 -0
  160. package/dashboard/dist/assets/ResolverForm-Dy0yirtP.js.map +1 -0
  161. package/dashboard/dist/assets/RoleDetailPage-C_LIoe1j.js +8 -0
  162. package/dashboard/dist/assets/RoleDetailPage-C_LIoe1j.js.map +1 -0
  163. package/dashboard/dist/assets/{RolePill-C9LSs1aK.js → RolePill-DhnVPK4q.js} +2 -2
  164. package/dashboard/dist/assets/{RolePill-C9LSs1aK.js.map → RolePill-DhnVPK4q.js.map} +1 -1
  165. package/dashboard/dist/assets/RolesPage-BmW1LzkU.js +2 -0
  166. package/dashboard/dist/assets/{RolesPage-h77-JOLd.js.map → RolesPage-BmW1LzkU.js.map} +1 -1
  167. package/dashboard/dist/assets/{RowActions-eYrzgQSj.js → RowActions-Bdd7z4eB.js} +2 -2
  168. package/dashboard/dist/assets/{RowActions-eYrzgQSj.js.map → RowActions-Bdd7z4eB.js.map} +1 -1
  169. package/dashboard/dist/assets/RunAsSelector-BwZTJ4Yj.js +2 -0
  170. package/dashboard/dist/assets/{RunAsSelector-DoLFJ0mZ.js.map → RunAsSelector-BwZTJ4Yj.js.map} +1 -1
  171. package/dashboard/dist/assets/ScanCodesPage-FiYIYB-m.js +2 -0
  172. package/dashboard/dist/assets/{ScanCodesPage-b5NZM_-f.js.map → ScanCodesPage-FiYIYB-m.js.map} +1 -1
  173. package/dashboard/dist/assets/{ScanSchemeDetailPage-t7X6ekaW.js → ScanSchemeDetailPage-BiAqtD-a.js} +2 -2
  174. package/dashboard/dist/assets/{ScanSchemeDetailPage-t7X6ekaW.js.map → ScanSchemeDetailPage-BiAqtD-a.js.map} +1 -1
  175. package/dashboard/dist/assets/ScanStationPage-8CdOtbCD.js +2 -0
  176. package/dashboard/dist/assets/{ScanStationPage-r02hkTAG.js.map → ScanStationPage-8CdOtbCD.js.map} +1 -1
  177. package/dashboard/dist/assets/{ScopeBadge-CjyC7iyO.js → ScopeBadge-CXUg0FHo.js} +2 -2
  178. package/dashboard/dist/assets/{ScopeBadge-CjyC7iyO.js.map → ScopeBadge-CXUg0FHo.js.map} +1 -1
  179. package/dashboard/dist/assets/{SegmentedTabs-DXNzY05q.js → SegmentedTabs-BpJh4Hwn.js} +2 -2
  180. package/dashboard/dist/assets/{SegmentedTabs-DXNzY05q.js.map → SegmentedTabs-BpJh4Hwn.js.map} +1 -1
  181. package/dashboard/dist/assets/{StatCard-BXQ8dD9Y.js → StatCard-nWY4sndl.js} +2 -2
  182. package/dashboard/dist/assets/{StatCard-BXQ8dD9Y.js.map → StatCard-nWY4sndl.js.map} +1 -1
  183. package/dashboard/dist/assets/{StatusBadge-BDeUwPtb.js → StatusBadge-DHVwxre2.js} +2 -2
  184. package/dashboard/dist/assets/{StatusBadge-BDeUwPtb.js.map → StatusBadge-DHVwxre2.js.map} +1 -1
  185. package/dashboard/dist/assets/{StickyPagination-BGHQbp0_.js → StickyPagination-DRuqKhZt.js} +2 -2
  186. package/dashboard/dist/assets/{StickyPagination-BGHQbp0_.js.map → StickyPagination-DRuqKhZt.js.map} +1 -1
  187. package/dashboard/dist/assets/{StreamMessageDetail-C-wfdbLJ.js → StreamMessageDetail-JwlbRiMn.js} +2 -2
  188. package/dashboard/dist/assets/{StreamMessageDetail-C-wfdbLJ.js.map → StreamMessageDetail-JwlbRiMn.js.map} +1 -1
  189. package/dashboard/dist/assets/{SwimlaneTimeline-Dnoz-me3.js → SwimlaneTimeline-hu3c4bCJ.js} +2 -2
  190. package/dashboard/dist/assets/{SwimlaneTimeline-Dnoz-me3.js.map → SwimlaneTimeline-hu3c4bCJ.js.map} +1 -1
  191. package/dashboard/dist/assets/{TagInput-D-vLSMQC.js → TagInput-BZ8vb2oW.js} +2 -2
  192. package/dashboard/dist/assets/{TagInput-D-vLSMQC.js.map → TagInput-BZ8vb2oW.js.map} +1 -1
  193. package/dashboard/dist/assets/{TaskDetailPage-c9IiAhVJ.js → TaskDetailPage-NqVZF3jW.js} +2 -2
  194. package/dashboard/dist/assets/{TaskDetailPage-c9IiAhVJ.js.map → TaskDetailPage-NqVZF3jW.js.map} +1 -1
  195. package/dashboard/dist/assets/{TaskQueuePill-sFRMrQ5D.js → TaskQueuePill-Bxir8WRl.js} +2 -2
  196. package/dashboard/dist/assets/{TaskQueuePill-sFRMrQ5D.js.map → TaskQueuePill-Bxir8WRl.js.map} +1 -1
  197. package/dashboard/dist/assets/TasksListPage-BQNaSzCn.js +2 -0
  198. package/dashboard/dist/assets/{TasksListPage-Dor8LSc5.js.map → TasksListPage-BQNaSzCn.js.map} +1 -1
  199. package/dashboard/dist/assets/TimeAgo-Cv35DOiI.js +2 -0
  200. package/dashboard/dist/assets/{TimeAgo-Dd8vmRnM.js.map → TimeAgo-Cv35DOiI.js.map} +1 -1
  201. package/dashboard/dist/assets/{TimestampCell-qJfC6-iT.js → TimestampCell-DHUXey9s.js} +2 -2
  202. package/dashboard/dist/assets/{TimestampCell-qJfC6-iT.js.map → TimestampCell-DHUXey9s.js.map} +1 -1
  203. package/dashboard/dist/assets/{ToolPill-OQ3mC11d.js → ToolPill-FkgTXIhq.js} +2 -2
  204. package/dashboard/dist/assets/{ToolPill-OQ3mC11d.js.map → ToolPill-FkgTXIhq.js.map} +1 -1
  205. package/dashboard/dist/assets/ToolTestPanel-DvuLFWqQ.js +2 -0
  206. package/dashboard/dist/assets/{ToolTestPanel-CEGY5jss.js.map → ToolTestPanel-DvuLFWqQ.js.map} +1 -1
  207. package/dashboard/dist/assets/{TopicDetailPage-SI80ZTVv.js → TopicDetailPage-TXX3QNSo.js} +3 -3
  208. package/dashboard/dist/assets/{TopicDetailPage-SI80ZTVv.js.map → TopicDetailPage-TXX3QNSo.js.map} +1 -1
  209. package/dashboard/dist/assets/{TopicsPage-DiVB8tNr.js → TopicsPage-h-oyTeEJ.js} +2 -2
  210. package/dashboard/dist/assets/{TopicsPage-DiVB8tNr.js.map → TopicsPage-h-oyTeEJ.js.map} +1 -1
  211. package/dashboard/dist/assets/UserName-BceRCeDF.js +2 -0
  212. package/dashboard/dist/assets/UserName-BceRCeDF.js.map +1 -0
  213. package/dashboard/dist/assets/WorkflowExecutionPage-CmHGcaN9.js +2 -0
  214. package/dashboard/dist/assets/{WorkflowExecutionPage-e-Q57yiJ.js.map → WorkflowExecutionPage-CmHGcaN9.js.map} +1 -1
  215. package/dashboard/dist/assets/{WorkflowPill-Dh3hIW1l.js → WorkflowPill--AYMW7u_.js} +2 -2
  216. package/dashboard/dist/assets/WorkflowPill--AYMW7u_.js.map +1 -0
  217. package/dashboard/dist/assets/WorkflowsDashboard-B0r2lQXk.js +2 -0
  218. package/dashboard/dist/assets/{WorkflowsDashboard-DLKzN80h.js.map → WorkflowsDashboard-B0r2lQXk.js.map} +1 -1
  219. package/dashboard/dist/assets/WorkflowsOverview-BTMc2PJ_.js +2 -0
  220. package/dashboard/dist/assets/{WorkflowsOverview-J-ITQiO5.js.map → WorkflowsOverview-BTMc2PJ_.js.map} +1 -1
  221. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B_-ahhf1.js → YamlWorkflowDetailPage-DUiCVnZp.js} +2 -2
  222. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B_-ahhf1.js.map → YamlWorkflowDetailPage-DUiCVnZp.js.map} +1 -1
  223. package/dashboard/dist/assets/YamlWorkflowsPage-BAuXfwi0.js +2 -0
  224. package/dashboard/dist/assets/{YamlWorkflowsPage-DQNeERXU.js.map → YamlWorkflowsPage-BAuXfwi0.js.map} +1 -1
  225. package/dashboard/dist/assets/{agents-BsJ-MizQ.js → agents-BvmLCk4h.js} +2 -2
  226. package/dashboard/dist/assets/{agents-BsJ-MizQ.js.map → agents-BvmLCk4h.js.map} +1 -1
  227. package/dashboard/dist/assets/{bots-q1UYqaIh.js → bots-f_tyhl4I.js} +2 -2
  228. package/dashboard/dist/assets/{bots-q1UYqaIh.js.map → bots-f_tyhl4I.js.map} +1 -1
  229. package/dashboard/dist/assets/capabilities-DNo5bqLx.js +2 -0
  230. package/dashboard/dist/assets/{capabilities-BvjPXUcJ.js.map → capabilities-DNo5bqLx.js.map} +1 -1
  231. package/dashboard/dist/assets/{controlplane-BwlNpoJ_.js → controlplane-Dyyj2Irb.js} +2 -2
  232. package/dashboard/dist/assets/{controlplane-BwlNpoJ_.js.map → controlplane-Dyyj2Irb.js.map} +1 -1
  233. package/dashboard/dist/assets/escalation-columns-DIigeTOK.js +2 -0
  234. package/dashboard/dist/assets/escalation-columns-DIigeTOK.js.map +1 -0
  235. package/dashboard/dist/assets/index-BMlQYOE1.js +67 -0
  236. package/dashboard/dist/assets/index-BMlQYOE1.js.map +1 -0
  237. package/dashboard/dist/assets/index-BNZknxFY.js +2 -0
  238. package/dashboard/dist/assets/{index-cvmt1plS.js.map → index-BNZknxFY.js.map} +1 -1
  239. package/dashboard/dist/assets/index-Bpvfr4OW.css +1 -0
  240. package/dashboard/dist/assets/{index-CldVY0UQ.js → index-C-Xr2V3F.js} +2 -2
  241. package/dashboard/dist/assets/{index-CldVY0UQ.js.map → index-C-Xr2V3F.js.map} +1 -1
  242. package/dashboard/dist/assets/index-CegPUKpc.js +3 -0
  243. package/dashboard/dist/assets/index-CegPUKpc.js.map +1 -0
  244. package/dashboard/dist/assets/{index-O9uuK2yO.js → index-CsKiRyhy.js} +2 -2
  245. package/dashboard/dist/assets/{index-O9uuK2yO.js.map → index-CsKiRyhy.js.map} +1 -1
  246. package/dashboard/dist/assets/index-D7ESqn22.js +2 -0
  247. package/dashboard/dist/assets/{index-BhzsR_gZ.js.map → index-D7ESqn22.js.map} +1 -1
  248. package/dashboard/dist/assets/{index-Hbbox1A4.js → index-DL83W7Gu.js} +2 -2
  249. package/dashboard/dist/assets/{index-Hbbox1A4.js.map → index-DL83W7Gu.js.map} +1 -1
  250. package/dashboard/dist/assets/index-DPLssnMW.js +6 -0
  251. package/dashboard/dist/assets/index-DPLssnMW.js.map +1 -0
  252. package/dashboard/dist/assets/{index-DsKqDMs4.js → index-DWse7ERF.js} +2 -2
  253. package/dashboard/dist/assets/{index-DsKqDMs4.js.map → index-DWse7ERF.js.map} +1 -1
  254. package/dashboard/dist/assets/index-DoETPlJP.js +11 -0
  255. package/dashboard/dist/assets/index-DoETPlJP.js.map +1 -0
  256. package/dashboard/dist/assets/{index-8Gmtvd8e.js → index-DvxxrFBo.js} +2 -2
  257. package/dashboard/dist/assets/{index-8Gmtvd8e.js.map → index-DvxxrFBo.js.map} +1 -1
  258. package/dashboard/dist/assets/{index-DDHoDZRg.js → index-PcyGjmBm.js} +2 -2
  259. package/dashboard/dist/assets/{index-DDHoDZRg.js.map → index-PcyGjmBm.js.map} +1 -1
  260. package/dashboard/dist/assets/{index-BvGIyZUt.js → index-e2X-s0EQ.js} +2 -2
  261. package/dashboard/dist/assets/{index-BvGIyZUt.js.map → index-e2X-s0EQ.js.map} +1 -1
  262. package/dashboard/dist/assets/{knowledge-DM0tNphj.js → knowledge-Coo6CKzo.js} +2 -2
  263. package/dashboard/dist/assets/{knowledge-DM0tNphj.js.map → knowledge-Coo6CKzo.js.map} +1 -1
  264. package/dashboard/dist/assets/{mcp-CQ_TD2P9.js → mcp-Cz5eFnP_.js} +2 -2
  265. package/dashboard/dist/assets/{mcp-CQ_TD2P9.js.map → mcp-Cz5eFnP_.js.map} +1 -1
  266. package/dashboard/dist/assets/{mcp-query-BP7KSGhc.js → mcp-query-BtnuO4LF.js} +2 -2
  267. package/dashboard/dist/assets/{mcp-query-BP7KSGhc.js.map → mcp-query-BtnuO4LF.js.map} +1 -1
  268. package/dashboard/dist/assets/{personas-DclHdHKK.js → personas-C2-LgpHQ.js} +2 -2
  269. package/dashboard/dist/assets/{personas-DclHdHKK.js.map → personas-C2-LgpHQ.js.map} +1 -1
  270. package/dashboard/dist/assets/{pipelines-LwuKJfj-.js → pipelines-TuXQvUA-.js} +2 -2
  271. package/dashboard/dist/assets/{pipelines-LwuKJfj-.js.map → pipelines-TuXQvUA-.js.map} +1 -1
  272. package/dashboard/dist/assets/resolver-payload-C1dXB3n6.js +2 -0
  273. package/dashboard/dist/assets/resolver-payload-C1dXB3n6.js.map +1 -0
  274. package/dashboard/dist/assets/seed-form-json-DvPsISxD.js +2 -0
  275. package/dashboard/dist/assets/seed-form-json-DvPsISxD.js.map +1 -0
  276. package/dashboard/dist/assets/{tasks-CDs-Li2v.js → tasks-OUzpu__z.js} +2 -2
  277. package/dashboard/dist/assets/{tasks-CDs-Li2v.js.map → tasks-OUzpu__z.js.map} +1 -1
  278. package/dashboard/dist/assets/{topics-BeOSelBX.js → topics-B8bdrBaW.js} +2 -2
  279. package/dashboard/dist/assets/{topics-BeOSelBX.js.map → topics-B8bdrBaW.js.map} +1 -1
  280. package/dashboard/dist/assets/useDebouncedValue-Cp5ZOtVE.js +2 -0
  281. package/dashboard/dist/assets/{useDebouncedValue-DhhAKjDC.js.map → useDebouncedValue-Cp5ZOtVE.js.map} +1 -1
  282. package/dashboard/dist/assets/{useFilterParams-crmlBw_l.js → useFilterParams-DBRw1Hcv.js} +2 -2
  283. package/dashboard/dist/assets/{useFilterParams-crmlBw_l.js.map → useFilterParams-DBRw1Hcv.js.map} +1 -1
  284. package/dashboard/dist/assets/{useNamespace-C-E2gNEK.js → useNamespace-DtQe3wZ5.js} +2 -2
  285. package/dashboard/dist/assets/{useNamespace-C-E2gNEK.js.map → useNamespace-DtQe3wZ5.js.map} +1 -1
  286. package/dashboard/dist/assets/{useYamlActivityEvents-CmLzX3YU.js → useYamlActivityEvents-CS22c15X.js} +2 -2
  287. package/dashboard/dist/assets/{useYamlActivityEvents-CmLzX3YU.js.map → useYamlActivityEvents-CS22c15X.js.map} +1 -1
  288. package/dashboard/dist/assets/{vendor-icons-R9b9gQ04.js → vendor-icons-DeBdvyKJ.js} +368 -143
  289. package/dashboard/dist/assets/vendor-icons-DeBdvyKJ.js.map +1 -0
  290. package/dashboard/dist/assets/vendor-query-DvWWuNIB.js +18 -0
  291. package/dashboard/dist/assets/vendor-query-DvWWuNIB.js.map +1 -0
  292. package/dashboard/dist/assets/{vendor-react-CdqEC2zv.js → vendor-react-_9U4mKFr.js} +2 -2
  293. package/dashboard/dist/assets/{vendor-react-CdqEC2zv.js.map → vendor-react-_9U4mKFr.js.map} +1 -1
  294. package/dashboard/dist/assets/{yaml-workflows-BgAsc6-I.js → yaml-workflows-HQIki3hI.js} +2 -2
  295. package/dashboard/dist/assets/{yaml-workflows-BgAsc6-I.js.map → yaml-workflows-HQIki3hI.js.map} +1 -1
  296. package/dashboard/dist/index.html +5 -5
  297. package/docs/api/http/workflows.md +25 -1
  298. package/docs/code-owned-configuration.md +1 -1
  299. package/docs/dashboard.md +179 -80
  300. package/docs/events.md +3 -1
  301. package/docs/faceted-routing.md +5 -1
  302. package/docs/hitl/iframe.md +35 -6
  303. package/docs/hitl/invoke-form.md +98 -0
  304. package/docs/hitl/x-lt-list-schema.md +3 -0
  305. package/docs/hitl/x-lt-show-if.md +11 -0
  306. package/docs/hitl-guide.md +4 -2
  307. package/docs/iam.md +1 -1
  308. package/docs/operations.md +61 -60
  309. package/docs/scan-codes.md +30 -3
  310. package/docs/workflows.md +1 -1
  311. package/package.json +1 -1
  312. package/dashboard/dist/assets/AgentsPage-CLSjlyXy.js +0 -2
  313. package/dashboard/dist/assets/AvailableEscalationsPage-D2ukvuQh.js +0 -2
  314. package/dashboard/dist/assets/AvailableEscalationsPage-D2ukvuQh.js.map +0 -1
  315. package/dashboard/dist/assets/BulkAssignModal-CMSgvHIs.js +0 -2
  316. package/dashboard/dist/assets/BulkAssignModal-CMSgvHIs.js.map +0 -1
  317. package/dashboard/dist/assets/CountdownTimer-B5lM7PfE.js +0 -2
  318. package/dashboard/dist/assets/CountdownTimer-B5lM7PfE.js.map +0 -1
  319. package/dashboard/dist/assets/EntityTimelinePanel-B5NuHnPF.js +0 -2
  320. package/dashboard/dist/assets/EntityTimelinePanel-B5NuHnPF.js.map +0 -1
  321. package/dashboard/dist/assets/HomePage-8XsQFqKL.js +0 -2
  322. package/dashboard/dist/assets/HomePage-8XsQFqKL.js.map +0 -1
  323. package/dashboard/dist/assets/ListToolbar-DyHaJBTk.js +0 -2
  324. package/dashboard/dist/assets/McpQueryPage-BqqRF5cQ.js +0 -2
  325. package/dashboard/dist/assets/NamespacePill-CJikgGzE.js +0 -2
  326. package/dashboard/dist/assets/OperationsPage-Cj1mJLMC.js +0 -3
  327. package/dashboard/dist/assets/OperationsPage-Cj1mJLMC.js.map +0 -1
  328. package/dashboard/dist/assets/OperatorDashboard-C5rlijvh.js +0 -2
  329. package/dashboard/dist/assets/PersonasPage-Xp_Gt6El.js +0 -2
  330. package/dashboard/dist/assets/PersonasPage-Xp_Gt6El.js.map +0 -1
  331. package/dashboard/dist/assets/ProcessesListPage-DuXTS5-v.js +0 -2
  332. package/dashboard/dist/assets/RoleDetailPage-C9GGHNf4.js +0 -8
  333. package/dashboard/dist/assets/RoleDetailPage-C9GGHNf4.js.map +0 -1
  334. package/dashboard/dist/assets/RolesPage-h77-JOLd.js +0 -2
  335. package/dashboard/dist/assets/RunAsSelector-DoLFJ0mZ.js +0 -2
  336. package/dashboard/dist/assets/ScanCodesPage-b5NZM_-f.js +0 -2
  337. package/dashboard/dist/assets/ScanStationPage-r02hkTAG.js +0 -2
  338. package/dashboard/dist/assets/TasksListPage-Dor8LSc5.js +0 -2
  339. package/dashboard/dist/assets/TimeAgo-Dd8vmRnM.js +0 -2
  340. package/dashboard/dist/assets/ToolTestPanel-CEGY5jss.js +0 -2
  341. package/dashboard/dist/assets/UserName-Dmm456xT.js +0 -2
  342. package/dashboard/dist/assets/UserName-Dmm456xT.js.map +0 -1
  343. package/dashboard/dist/assets/WorkflowExecutionPage-e-Q57yiJ.js +0 -2
  344. package/dashboard/dist/assets/WorkflowPill-Dh3hIW1l.js.map +0 -1
  345. package/dashboard/dist/assets/WorkflowsDashboard-DLKzN80h.js +0 -2
  346. package/dashboard/dist/assets/WorkflowsOverview-J-ITQiO5.js +0 -2
  347. package/dashboard/dist/assets/YamlWorkflowsPage-DQNeERXU.js +0 -2
  348. package/dashboard/dist/assets/capabilities-BvjPXUcJ.js +0 -2
  349. package/dashboard/dist/assets/escalation-columns-Bo3PfIZj.js +0 -2
  350. package/dashboard/dist/assets/escalation-columns-Bo3PfIZj.js.map +0 -1
  351. package/dashboard/dist/assets/index-B8JfGtQB.js +0 -3
  352. package/dashboard/dist/assets/index-B8JfGtQB.js.map +0 -1
  353. package/dashboard/dist/assets/index-Bb9ZZUyB.js +0 -5
  354. package/dashboard/dist/assets/index-Bb9ZZUyB.js.map +0 -1
  355. package/dashboard/dist/assets/index-BhzsR_gZ.js +0 -2
  356. package/dashboard/dist/assets/index-D88VWEVp.js +0 -67
  357. package/dashboard/dist/assets/index-D88VWEVp.js.map +0 -1
  358. package/dashboard/dist/assets/index-DBvkaa-B.js +0 -6
  359. package/dashboard/dist/assets/index-DBvkaa-B.js.map +0 -1
  360. package/dashboard/dist/assets/index-cvmt1plS.js +0 -2
  361. package/dashboard/dist/assets/index-qU_dXqP4.css +0 -1
  362. package/dashboard/dist/assets/useDebouncedValue-DhhAKjDC.js +0 -2
  363. package/dashboard/dist/assets/vendor-icons-R9b9gQ04.js.map +0 -1
  364. package/dashboard/dist/assets/vendor-query-RUZdMvN6.js +0 -18
  365. package/dashboard/dist/assets/vendor-query-RUZdMvN6.js.map +0 -1
  366. package/dashboard/dist/assets/workflows-CYv1CTU0.js +0 -2
  367. package/dashboard/dist/assets/workflows-CYv1CTU0.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-5NnysKFC.js","./vendor-query-DvWWuNIB.js","./tasks-OUzpu__z.js","./useFilterParams-DBRw1Hcv.js","./vendor-react-_9U4mKFr.js","./useDebouncedValue-Cp5ZOtVE.js","./api-path-u2Jf9QXS.js","./DataTable-7C7riavf.js","./EmptyState-DgC_6njU.js","./TimestampCell-DHUXey9s.js","./StickyPagination-DRuqKhZt.js","./FilterBar-xwN_b5fj.js","./vendor-icons-DeBdvyKJ.js","./PageHeader-Di5Sz3an.js","./ListToolbar-zPVYPg3W.js","./WorkflowPill--AYMW7u_.js","./ProcessDetailPage-BLGjZXpM.js","./PageHeaderWithStats-DutKJ-h2.js","./StatusBadge-DHVwxre2.js","./RolePill-DhnVPK4q.js","./UserName-BceRCeDF.js","./McpOverview-CMGUq8hx.js","./mcp-Cz5eFnP_.js","./pipelines-TuXQvUA-.js","./yaml-workflows-HQIki3hI.js","./controlplane-Dyyj2Irb.js","./StatCard-nWY4sndl.js","./McpRunsPage-B6rb5QBf.js","./useNamespace-DtQe3wZ5.js","./ElapsedCell-_xvVTK8N.js","./RowActions-Bdd7z4eB.js","./McpRunDetailPage-DBm8hUaW.js","./SegmentedTabs-BpJh4Hwn.js","./EventTable-KEC3YWBf.js","./SwimlaneTimeline-hu3c4bCJ.js","./StreamMessageDetail-JwlbRiMn.js","./CopyableId-Bn02zYxt.js","./McpQueryPage-CNSNMagY.js","./mcp-query-BtnuO4LF.js","./McpQueryDetailPage-CdhLhaKn.js","./TagInput-BZ8vb2oW.js","./CollapsibleSection-D10lGw_u.js","./useYamlActivityEvents-CS22c15X.js","./helpers-DzO-OGPe.js","./RunAsSelector-BwZTJ4Yj.js","./BotPicker-CC5vI_Sv.js","./bots-f_tyhl4I.js","./ToolPill-FkgTXIhq.js","./TimeAgo-Cv35DOiI.js","./EscalationsOverview-Bx6Zrzm-.js","./AvailableEscalationsPage-CqM_MOMy.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-BXiJnlqt.js","./constants-BHkpVaqx.js","./escalation-columns-DIigeTOK.js","./EntityTimelinePanel-1lT3jkCM.js","./PriorityBadge-r33mpDju.js","./CountdownTimer-D9B-BjQ7.js","./EscalationListView-uuZRMSLB.js","./OperatorDashboard-DBOscDnf.js","./index-CegPUKpc.js","./resolver-payload-C1dXB3n6.js","./ResolverForm-Dy0yirtP.js","./metadata-display--TzK0REC.js","./WorkflowsOverview-BTMc2PJ_.js","./index-DPLssnMW.js","./seed-form-json-DvPsISxD.js","./NamespacePill-Bb3revqD.js","./WorkflowsDashboard-B0r2lQXk.js","./YamlWorkflowsPage-BAuXfwi0.js","./GraphInvokePage-DV7Y0fe2.js","./YamlWorkflowDetailPage-DUiCVnZp.js","./TasksListPage-BQNaSzCn.js","./TaskDetailPage-NqVZF3jW.js","./WorkflowExecutionPage-CmHGcaN9.js","./AdminDashboard-Drs-9TRM.js","./index-D7ESqn22.js","./TaskQueuePill-Bxir8WRl.js","./index-DoETPlJP.js","./ConfirmDeleteModal-BJdLN6No.js","./index-DWse7ERF.js","./ToolTestPanel-DvuLFWqQ.js","./index-e2X-s0EQ.js","./index-DL83W7Gu.js","./personas-C2-LgpHQ.js","./ScopeBadge-CXUg0FHo.js","./RolesPage-BmW1LzkU.js","./RoleDetailPage-C_LIoe1j.js","./AutoGrowTextarea-7X3T9La8.js","./PersonasPage-DRzOZcVa.js","./PersonaDetailPage-BGRdGpeR.js","./EscalationSchemaPage-D4VlEwyS.js","./EscalationListSchemaPage-BeQUTUEO.js","./ScanCodesPage-FiYIYB-m.js","./ScanSchemeDetailPage-BiAqtD-a.js","./ScanStationPage-8CdOtbCD.js","./index-CsKiRyhy.js","./OperationsPage-Dxk1fAMg.js","./index-BNZknxFY.js","./index-DvxxrFBo.js","./CredentialsPage-hniUAFBK.js","./index-C-Xr2V3F.js","./DropZone-XlcY8hEH.js","./index-PcyGjmBm.js","./knowledge-Coo6CKzo.js","./HomePage-G785SWcW.js","./AgentsPage-D77JeViQ.js","./agents-BvmLCk4h.js","./AgentDetailPage-CGBulM4_.js","./CronLabel-v9DCD2FX.js","./AgentConfigPage-BDPDZ7-v.js","./capabilities-DNo5bqLx.js","./topics-B8bdrBaW.js","./CapabilitiesPage-D9TC2iKy.js","./TopicsPage-h-oyTeEJ.js","./TopicDetailPage-TXX3QNSo.js"])))=>i.map(i=>d[i]);
2
+ var Uw=Object.defineProperty;var Pw=(n,t,s)=>t in n?Uw(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var j=(n,t,s)=>Pw(n,typeof t!="symbol"?t+"":t,s);import{r as zw,u as ze,a as O,j as h,b as Ie,c as Ve,g as $w,d as Iw,Q as Hw,e as Fw}from"./vendor-query-DvWWuNIB.js";import{r as Gw,u as Zi,a as En,b as Hd,L as Nr,N as Ji,c as bn,O as Ks,d as Vw,R as Yw}from"./vendor-react-_9U4mKFr.js";import{X as Qt,E as Kw,S as Jw,M as Qw,a as Oo,C as Fd,b as Xw,c as Ww,d as Pb,e as id,I as ad,U as Zw,B as eS,G as tS,T as nS,R as zb,f as rS,Z as sS,P as dg,g as $b,h as iS,i as mg,j as od,L as pg,k as aS,W as Gd,l as oS,m as lS,F as cS,n as Ib,o as uS,D as fS,N as hS,p as dS,q as Hb,r as Fb,s as Gb,t as mS,u as pS,v as yS,w as gS,x as bS,y as xS,z as vS,A as _S,H as wS}from"./vendor-icons-DeBdvyKJ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var zh={exports:{}},Xa={},$h={exports:{}},Ih={};/**
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 yg;function SS(){return yg||(yg=1,(function(n){function t(Y,Z){var ce=Y.length;Y.push(Z);e:for(;0<ce;){var _e=ce-1>>>1,we=Y[_e];if(0<o(we,Z))Y[_e]=Z,Y[ce]=we,ce=_e;else break e}}function s(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var Z=Y[0],ce=Y.pop();if(ce!==Z){Y[0]=ce;e:for(var _e=0,we=Y.length,Ne=we>>>1;_e<Ne;){var je=2*(_e+1)-1,Te=Y[je],nt=je+1,Nt=Y[nt];if(0>o(Te,ce))nt<we&&0>o(Nt,Te)?(Y[_e]=Nt,Y[nt]=ce,_e=nt):(Y[_e]=Te,Y[je]=ce,_e=je);else if(nt<we&&0>o(Nt,ce))Y[_e]=Nt,Y[nt]=ce,_e=nt;else break e}}return Z}function o(Y,Z){var ce=Y.sortIndex-Z.sortIndex;return ce!==0?ce:Y.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var d=Date,y=d.now();n.unstable_now=function(){return d.now()-y}}var g=[],u=[],m=1,b=null,x=3,v=!1,_=!1,S=!1,C=!1,L=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,re=typeof setImmediate<"u"?setImmediate:null;function le(Y){for(var Z=s(u);Z!==null;){if(Z.callback===null)i(u);else if(Z.startTime<=Y)i(u),Z.sortIndex=Z.expirationTime,t(g,Z);else break;Z=s(u)}}function D(Y){if(S=!1,le(Y),!_)if(s(g)!==null)_=!0,z||(z=!0,Q());else{var Z=s(u);Z!==null&&ke(D,Z.startTime-Y)}}var z=!1,ae=-1,K=5,M=-1;function $(){return C?!0:!(n.unstable_now()-M<K)}function W(){if(C=!1,z){var Y=n.unstable_now();M=Y;var Z=!0;try{e:{_=!1,S&&(S=!1,U(ae),ae=-1),v=!0;var ce=x;try{t:{for(le(Y),b=s(g);b!==null&&!(b.expirationTime>Y&&$());){var _e=b.callback;if(typeof _e=="function"){b.callback=null,x=b.priorityLevel;var we=_e(b.expirationTime<=Y);if(Y=n.unstable_now(),typeof we=="function"){b.callback=we,le(Y),Z=!0;break t}b===s(g)&&i(g),le(Y)}else i(g);b=s(g)}if(b!==null)Z=!0;else{var Ne=s(u);Ne!==null&&ke(D,Ne.startTime-Y),Z=!1}}break e}finally{b=null,x=ce,v=!1}Z=void 0}}finally{Z?Q():z=!1}}}var Q;if(typeof re=="function")Q=function(){re(W)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,ve=oe.port2;oe.port1.onmessage=W,Q=function(){ve.postMessage(null)}}else Q=function(){L(W,0)};function ke(Y,Z){ae=L(function(){Y(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Y){Y.callback=null},n.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<Y?Math.floor(1e3/Y):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(Y){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var ce=x;x=Z;try{return Y()}finally{x=ce}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(Y,Z){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var ce=x;x=Y;try{return Z()}finally{x=ce}},n.unstable_scheduleCallback=function(Y,Z,ce){var _e=n.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?_e+ce:_e):ce=_e,Y){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=ce+we,Y={id:m++,callback:Z,priorityLevel:Y,startTime:ce,expirationTime:we,sortIndex:-1},ce>_e?(Y.sortIndex=ce,t(u,Y),s(g)===null&&Y===s(u)&&(S?(U(ae),ae=-1):S=!0,ke(D,ce-_e))):(Y.sortIndex=we,t(g,Y),_||v||(_=!0,z||(z=!0,Q()))),Y},n.unstable_shouldYield=$,n.unstable_wrapCallback=function(Y){var Z=x;return function(){var ce=x;x=Z;try{return Y.apply(this,arguments)}finally{x=ce}}}})(Ih)),Ih}var gg;function ES(){return gg||(gg=1,$h.exports=SS()),$h.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 bg;function OS(){if(bg)return Xa;bg=1;var n=ES(),t=zw(),s=Gw();function i(e){var r="https://react.dev/errors/"+e;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+r+" 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 c(e){var r=e,a=e;if(e.alternate)for(;r.return;)r=r.return;else{e=r;do r=e,(r.flags&4098)!==0&&(a=r.return),e=r.return;while(e)}return r.tag===3?a:null}function d(e){if(e.tag===13){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function y(e){if(e.tag===31){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(i(188))}function u(e){var r=e.alternate;if(!r){if(r=c(e),r===null)throw Error(i(188));return r!==e?null:e}for(var a=e,l=r;;){var f=a.return;if(f===null)break;var p=f.alternate;if(p===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===a)return g(f),e;if(p===l)return g(f),r;p=p.sibling}throw Error(i(188))}if(a.return!==l.return)a=f,l=p;else{for(var w=!1,E=f.child;E;){if(E===a){w=!0,a=f,l=p;break}if(E===l){w=!0,l=f,a=p;break}E=E.sibling}if(!w){for(E=p.child;E;){if(E===a){w=!0,a=p,l=f;break}if(E===l){w=!0,l=p,a=f;break}E=E.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:r}function m(e){var r=e.tag;if(r===5||r===26||r===27||r===6)return e;for(e=e.child;e!==null;){if(r=m(e),r!==null)return r;e=e.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),re=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var oe=Symbol.for("react.client.reference");function ve(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case L:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case z:return"SuspenseList";case M:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _:return"Portal";case re:return e.displayName||"Context";case U:return(e._context.displayName||"Context")+".Consumer";case le:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return r=e.displayName||null,r!==null?r:ve(e.type)||"Memo";case K:r=e._payload,e=e._init;try{return ve(e(r))}catch{}}return null}var ke=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},_e=[],we=-1;function Ne(e){return{current:e}}function je(e){0>we||(e.current=_e[we],_e[we]=null,we--)}function Te(e,r){we++,_e[we]=e.current,e.current=r}var nt=Ne(null),Nt=Ne(null),Dt=Ne(null),ut=Ne(null);function ft(e,r){switch(Te(Dt,r),Te(Nt,e),Te(nt,null),r.nodeType){case 9:case 11:e=(e=r.documentElement)&&(e=e.namespaceURI)?Ly(e):0;break;default:if(e=r.tagName,r=r.namespaceURI)r=Ly(r),e=By(r,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je(nt),Te(nt,e)}function fe(){je(nt),je(Nt),je(Dt)}function pe(e){e.memoizedState!==null&&Te(ut,e);var r=nt.current,a=By(r,e.type);r!==a&&(Te(Nt,e),Te(nt,a))}function ht(e){Nt.current===e&&(je(nt),je(Nt)),ut.current===e&&(je(ut),Ya._currentValue=ce)}var Ht,An;function zt(e){if(Ht===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);Ht=r&&r[1]||"",An=-1<a.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+Ht+e+An}var Ws=!1;function Lr(e,r){if(!e||Ws)return"";Ws=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(J){var G=J}Reflect.construct(e,[],se)}else{try{se.call()}catch(J){G=J}e.call(se.prototype)}}else{try{throw Error()}catch(J){G=J}(se=e())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(J){if(J&&G&&typeof J.stack=="string")return[J.stack,G.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=l.DetermineComponentFrameRoot(),w=p[0],E=p[1];if(w&&E){var R=w.split(`
21
+ `),F=E.split(`
22
+ `);for(f=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;f<F.length&&!F[f].includes("DetermineComponentFrameRoot");)f++;if(l===R.length||f===F.length)for(l=R.length-1,f=F.length-1;1<=l&&0<=f&&R[l]!==F[f];)f--;for(;1<=l&&0<=f;l--,f--)if(R[l]!==F[f]){if(l!==1||f!==1)do if(l--,f--,0>f||R[l]!==F[f]){var X=`
23
+ `+R[l].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=l&&0<=f);break}}}finally{Ws=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?zt(a):""}function Ro(e,r){switch(e.tag){case 26:case 27:case 5:return zt(e.type);case 16:return zt("Lazy");case 13:return e.child!==r&&r!==null?zt("Suspense Fallback"):zt("Suspense");case 19:return zt("SuspenseList");case 0:case 15:return Lr(e.type,!1);case 11:return Lr(e.type.render,!1);case 1:return Lr(e.type,!0);case 31:return zt("Activity");default:return""}}function Do(e){try{var r="",a=null;do r+=Ro(e,a),a=e,e=e.return;while(e);return r}catch(l){return`
24
+ Error generating stack: `+l.message+`
25
+ `+l.stack}}var ra=Object.prototype.hasOwnProperty,sa=n.unstable_scheduleCallback,or=n.unstable_cancelCallback,qo=n.unstable_shouldYield,Zs=n.unstable_requestPaint,at=n.unstable_now,Nu=n.unstable_getCurrentPriorityLevel,Lo=n.unstable_ImmediatePriority,Bo=n.unstable_UserBlockingPriority,ei=n.unstable_NormalPriority,Tu=n.unstable_LowPriority,Uo=n.unstable_IdlePriority,Cu=n.log,Po=n.unstable_setDisableYieldValue,ws=null,gt=null;function sn(e){if(typeof Cu=="function"&&Po(e),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(ws,e)}catch{}}var $t=Math.clz32?Math.clz32:ti,ia=Math.log,aa=Math.LN2;function ti(e){return e>>>=0,e===0?32:31-(ia(e)/aa|0)|0}var Br=256,lr=262144,Ur=4194304;function zn(e){var r=e&42;if(r!==0)return r;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 Ss(e,r,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,p=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var E=l&134217727;return E!==0?(l=E&~p,l!==0?f=zn(l):(w&=E,w!==0?f=zn(w):a||(a=E&~e,a!==0&&(f=zn(a))))):(E=l&~p,E!==0?f=zn(E):w!==0?f=zn(w):a||(a=l&~e,a!==0&&(f=zn(a)))),f===0?0:r!==0&&r!==f&&(r&p)===0&&(p=f&-f,a=r&-r,p>=a||p===32&&(a&4194048)!==0)?r:f}function Es(e,r){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&r)===0}function oa(e,r){switch(e){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 ni(){var e=Ur;return Ur<<=1,(Ur&62914560)===0&&(Ur=4194304),e}function Pr(e){for(var r=[],a=0;31>a;a++)r.push(e);return r}function $n(e,r){e.pendingLanes|=r,r!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function zr(e,r,a,l,f,p){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var E=e.entanglements,R=e.expirationTimes,F=e.hiddenUpdates;for(a=w&~a;0<a;){var X=31-$t(a),se=1<<X;E[X]=0,R[X]=-1;var G=F[X];if(G!==null)for(F[X]=null,X=0;X<G.length;X++){var J=G[X];J!==null&&(J.lane&=-536870913)}a&=~se}l!==0&&$r(e,l,0),p!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~r))}function $r(e,r,a){e.pendingLanes|=r,e.suspendedLanes&=~r;var l=31-$t(r);e.entangledLanes|=r,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Os(e,r){var a=e.entangledLanes|=r;for(e=e.entanglements;a;){var l=31-$t(a),f=1<<l;f&r|e[l]&r&&(e[l]|=r),a&=~f}}function Ir(e,r){var a=r&-r;return a=(a&42)!==0?1:cr(a),(a&(e.suspendedLanes|r))!==0?0:a}function cr(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 As(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function la(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:ag(e.type))}function zo(e,r){var a=Z.p;try{return Z.p=e,r()}finally{Z.p=a}}var Wn=Math.random().toString(36).slice(2),et="__reactFiber$"+Wn,dt="__reactProps$"+Wn,an="__reactContainer$"+Wn,js="__reactEvents$"+Wn,ca="__reactListeners$"+Wn,$o="__reactHandles$"+Wn,Io="__reactResources$"+Wn,At="__reactMarker$"+Wn;function ri(e){delete e[et],delete e[dt],delete e[js],delete e[ca],delete e[$o]}function A(e){var r=e[et];if(r)return r;for(var a=e.parentNode;a;){if(r=a[an]||a[et]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(e=Fy(e);e!==null;){if(a=e[et])return a;e=Fy(e)}return r}e=a,a=e.parentNode}return null}function N(e){if(e=e[et]||e[an]){var r=e.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return e}return null}function k(e){var r=e.tag;if(r===5||r===26||r===27||r===6)return e.stateNode;throw Error(i(33))}function T(e){var r=e[Io];return r||(r=e[Io]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function q(e){e[At]=!0}var I=new Set,ne={};function ie(e,r){V(e,r),V(e+"Capture",r)}function V(e,r){for(ne[e]=r,e=0;e<r.length;e++)I.add(r[e])}var te=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]*$"),ge={},Re={};function rt(e){return ra.call(Re,e)?!0:ra.call(ge,e)?!1:te.test(e)?Re[e]=!0:(ge[e]=!0,!1)}function It(e,r,a){if(rt(r))if(a===null)e.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(r);return}}e.setAttribute(r,""+a)}}function In(e,r,a){if(a===null)e.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttribute(r,""+a)}}function ur(e,r,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(r,a,""+l)}}function jn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function km(e){var r=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Cv(e,r,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,r);if(!e.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,p=l.set;return Object.defineProperty(e,r,{configurable:!0,get:function(){return f.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[r]}}}}function Mu(e){if(!e._valueTracker){var r=km(e)?"checked":"value";e._valueTracker=Cv(e,r,""+e[r])}}function Nm(e){if(!e)return!1;var r=e._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return e&&(l=km(e)?e.checked?"true":"false":e.value),e=l,e!==a?(r.setValue(e),!0):!1}function Ho(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 Mv=/[\n"\\]/g;function kn(e){return e.replace(Mv,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Ru(e,r,a,l,f,p,w,E){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),r!=null?w==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+jn(r)):e.value!==""+jn(r)&&(e.value=""+jn(r)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),r!=null?Du(e,w,jn(r)):a!=null?Du(e,w,jn(a)):l!=null&&e.removeAttribute("value"),f==null&&p!=null&&(e.defaultChecked=!!p),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+jn(E):e.removeAttribute("name")}function Tm(e,r,a,l,f,p,w,E){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),r!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||r!=null)){Mu(e);return}a=a!=null?""+jn(a):"",r=r!=null?""+jn(r):a,E||r===e.value||(e.value=r),e.defaultValue=r}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=E?e.checked:!!l,e.defaultChecked=!!l,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),Mu(e)}function Du(e,r,a){r==="number"&&Ho(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function si(e,r,a,l){if(e=e.options,r){r={};for(var f=0;f<a.length;f++)r["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=r.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+jn(a),r=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}r!==null||e[f].disabled||(r=e[f])}r!==null&&(r.selected=!0)}}function Cm(e,r,a){if(r!=null&&(r=""+jn(r),r!==e.value&&(e.value=r),a==null)){e.defaultValue!==r&&(e.defaultValue=r);return}e.defaultValue=a!=null?""+jn(a):""}function Mm(e,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(i(92));if(ke(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=jn(r),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Mu(e)}function ii(e,r){if(r){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=r;return}}e.textContent=r}var Rv=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 Rm(e,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="":l?e.setProperty(r,a):typeof a!="number"||a===0||Rv.has(r)?r==="float"?e.cssFloat=a:e[r]=(""+a).trim():e[r]=a+"px"}function Dm(e,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in r)l=r[f],r.hasOwnProperty(f)&&a[f]!==l&&Rm(e,f,l)}else for(var p in r)r.hasOwnProperty(p)&&Rm(e,p,r[p])}function qu(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 Dv=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"]]),qv=/^[\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 Fo(e){return qv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function fr(){}var Lu=null;function Bu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ai=null,oi=null;function qm(e){var r=N(e);if(r&&(e=r.stateNode)){var a=e[dt]||null;e:switch(e=r.stateNode,r.type){case"input":if(Ru(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+kn(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==e&&l.form===e.form){var f=l[dt]||null;if(!f)throw Error(i(90));Ru(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===e.form&&Nm(l)}break e;case"textarea":Cm(e,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&si(e,!!a.multiple,r,!1)}}}var Uu=!1;function Lm(e,r,a){if(Uu)return e(r,a);Uu=!0;try{var l=e(r);return l}finally{if(Uu=!1,(ai!==null||oi!==null)&&(Cl(),ai&&(r=ai,e=oi,oi=ai=null,qm(r),e)))for(r=0;r<e.length;r++)qm(e[r])}}function ua(e,r){var a=e.stateNode;if(a===null)return null;var l=a[dt]||null;if(l===null)return null;a=l[r];e:switch(r){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(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var hr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pu=!1;if(hr)try{var fa={};Object.defineProperty(fa,"passive",{get:function(){Pu=!0}}),window.addEventListener("test",fa,fa),window.removeEventListener("test",fa,fa)}catch{Pu=!1}var Hr=null,zu=null,Go=null;function Bm(){if(Go)return Go;var e,r=zu,a=r.length,l,f="value"in Hr?Hr.value:Hr.textContent,p=f.length;for(e=0;e<a&&r[e]===f[e];e++);var w=a-e;for(l=1;l<=w&&r[a-l]===f[p-l];l++);return Go=f.slice(e,1<l?1-l:void 0)}function Vo(e){var r=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&r===13&&(e=13)):e=r,e===10&&(e=13),32<=e||e===13?e:0}function Yo(){return!0}function Um(){return!1}function Xt(e){function r(a,l,f,p,w){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(p):p[E]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Yo:Um,this.isPropagationStopped=Um,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Yo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Yo)},persist:function(){},isPersistent:Yo}),r}var ks={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ko=Xt(ks),ha=b({},ks,{view:0,detail:0}),Lv=Xt(ha),$u,Iu,da,Jo=b({},ha,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fu,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!==da&&(da&&e.type==="mousemove"?($u=e.screenX-da.screenX,Iu=e.screenY-da.screenY):Iu=$u=0,da=e),$u)},movementY:function(e){return"movementY"in e?e.movementY:Iu}}),Pm=Xt(Jo),Bv=b({},Jo,{dataTransfer:0}),Uv=Xt(Bv),Pv=b({},ha,{relatedTarget:0}),Hu=Xt(Pv),zv=b({},ks,{animationName:0,elapsedTime:0,pseudoElement:0}),$v=Xt(zv),Iv=b({},ks,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Hv=Xt(Iv),Fv=b({},ks,{data:0}),zm=Xt(Fv),Gv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vv={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"},Yv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kv(e){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(e):(e=Yv[e])?!!r[e]:!1}function Fu(){return Kv}var Jv=b({},ha,{key:function(e){if(e.key){var r=Gv[e.key]||e.key;if(r!=="Unidentified")return r}return e.type==="keypress"?(e=Vo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fu,charCode:function(e){return e.type==="keypress"?Vo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Vo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qv=Xt(Jv),Xv=b({},Jo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$m=Xt(Xv),Wv=b({},ha,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fu}),Zv=Xt(Wv),e_=b({},ks,{propertyName:0,elapsedTime:0,pseudoElement:0}),t_=Xt(e_),n_=b({},Jo,{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}),r_=Xt(n_),s_=b({},ks,{newState:0,oldState:0}),i_=Xt(s_),a_=[9,13,27,32],Gu=hr&&"CompositionEvent"in window,ma=null;hr&&"documentMode"in document&&(ma=document.documentMode);var o_=hr&&"TextEvent"in window&&!ma,Im=hr&&(!Gu||ma&&8<ma&&11>=ma),Hm=" ",Fm=!1;function Gm(e,r){switch(e){case"keyup":return a_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var li=!1;function l_(e,r){switch(e){case"compositionend":return Vm(r);case"keypress":return r.which!==32?null:(Fm=!0,Hm);case"textInput":return e=r.data,e===Hm&&Fm?null:e;default:return null}}function c_(e,r){if(li)return e==="compositionend"||!Gu&&Gm(e,r)?(e=Bm(),Go=zu=Hr=null,li=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Im&&r.locale!=="ko"?null:r.data;default:return null}}var u_={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 Ym(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r==="input"?!!u_[e.type]:r==="textarea"}function Km(e,r,a,l){ai?oi?oi.push(l):oi=[l]:ai=l,r=Ul(r,"onChange"),0<r.length&&(a=new Ko("onChange","change",null,a,l),e.push({event:a,listeners:r}))}var pa=null,ya=null;function f_(e){Ty(e,0)}function Qo(e){var r=k(e);if(Nm(r))return e}function Jm(e,r){if(e==="change")return r}var Qm=!1;if(hr){var Vu;if(hr){var Yu="oninput"in document;if(!Yu){var Xm=document.createElement("div");Xm.setAttribute("oninput","return;"),Yu=typeof Xm.oninput=="function"}Vu=Yu}else Vu=!1;Qm=Vu&&(!document.documentMode||9<document.documentMode)}function Wm(){pa&&(pa.detachEvent("onpropertychange",Zm),ya=pa=null)}function Zm(e){if(e.propertyName==="value"&&Qo(ya)){var r=[];Km(r,ya,e,Bu(e)),Lm(f_,r)}}function h_(e,r,a){e==="focusin"?(Wm(),pa=r,ya=a,pa.attachEvent("onpropertychange",Zm)):e==="focusout"&&Wm()}function d_(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qo(ya)}function m_(e,r){if(e==="click")return Qo(r)}function p_(e,r){if(e==="input"||e==="change")return Qo(r)}function y_(e,r){return e===r&&(e!==0||1/e===1/r)||e!==e&&r!==r}var on=typeof Object.is=="function"?Object.is:y_;function ga(e,r){if(on(e,r))return!0;if(typeof e!="object"||e===null||typeof r!="object"||r===null)return!1;var a=Object.keys(e),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!ra.call(r,f)||!on(e[f],r[f]))return!1}return!0}function e0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function t0(e,r){var a=e0(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=r&&l>=r)return{node:a,offset:r-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=e0(a)}}function n0(e,r){return e&&r?e===r?!0:e&&e.nodeType===3?!1:r&&r.nodeType===3?n0(e,r.parentNode):"contains"in e?e.contains(r):e.compareDocumentPosition?!!(e.compareDocumentPosition(r)&16):!1:!1}function r0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var r=Ho(e.document);r instanceof e.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)e=r.contentWindow;else break;r=Ho(e.document)}return r}function Ku(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r&&(r==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||r==="textarea"||e.contentEditable==="true")}var g_=hr&&"documentMode"in document&&11>=document.documentMode,ci=null,Ju=null,ba=null,Qu=!1;function s0(e,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Qu||ci==null||ci!==Ho(l)||(l=ci,"selectionStart"in l&&Ku(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}),ba&&ga(ba,l)||(ba=l,l=Ul(Ju,"onSelect"),0<l.length&&(r=new Ko("onSelect","select",null,r,a),e.push({event:r,listeners:l}),r.target=ci)))}function Ns(e,r){var a={};return a[e.toLowerCase()]=r.toLowerCase(),a["Webkit"+e]="webkit"+r,a["Moz"+e]="moz"+r,a}var ui={animationend:Ns("Animation","AnimationEnd"),animationiteration:Ns("Animation","AnimationIteration"),animationstart:Ns("Animation","AnimationStart"),transitionrun:Ns("Transition","TransitionRun"),transitionstart:Ns("Transition","TransitionStart"),transitioncancel:Ns("Transition","TransitionCancel"),transitionend:Ns("Transition","TransitionEnd")},Xu={},i0={};hr&&(i0=document.createElement("div").style,"AnimationEvent"in window||(delete ui.animationend.animation,delete ui.animationiteration.animation,delete ui.animationstart.animation),"TransitionEvent"in window||delete ui.transitionend.transition);function Ts(e){if(Xu[e])return Xu[e];if(!ui[e])return e;var r=ui[e],a;for(a in r)if(r.hasOwnProperty(a)&&a in i0)return Xu[e]=r[a];return e}var a0=Ts("animationend"),o0=Ts("animationiteration"),l0=Ts("animationstart"),b_=Ts("transitionrun"),x_=Ts("transitionstart"),v_=Ts("transitioncancel"),c0=Ts("transitionend"),u0=new Map,Wu="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(" ");Wu.push("scrollEnd");function Hn(e,r){u0.set(e,r),ie(r,[e])}var Xo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Nn=[],fi=0,Zu=0;function Wo(){for(var e=fi,r=Zu=fi=0;r<e;){var a=Nn[r];Nn[r++]=null;var l=Nn[r];Nn[r++]=null;var f=Nn[r];Nn[r++]=null;var p=Nn[r];if(Nn[r++]=null,l!==null&&f!==null){var w=l.pending;w===null?f.next=f:(f.next=w.next,w.next=f),l.pending=f}p!==0&&f0(a,f,p)}}function Zo(e,r,a,l){Nn[fi++]=e,Nn[fi++]=r,Nn[fi++]=a,Nn[fi++]=l,Zu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function ef(e,r,a,l){return Zo(e,r,a,l),el(e)}function Cs(e,r){return Zo(e,null,null,r),el(e)}function f0(e,r,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,p=e.return;p!==null;)p.childLanes|=a,l=p.alternate,l!==null&&(l.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(f=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,f&&r!==null&&(f=31-$t(a),e=p.hiddenUpdates,l=e[f],l===null?e[f]=[r]:l.push(r),r.lane=a|536870912),p):null}function el(e){if(50<za)throw za=0,uh=null,Error(i(185));for(var r=e.return;r!==null;)e=r,r=e.return;return e.tag===3?e.stateNode:null}var hi={};function __(e,r,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,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 ln(e,r,a,l){return new __(e,r,a,l)}function tf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dr(e,r){var a=e.alternate;return a===null?(a=ln(e.tag,r,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=r,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,r=e.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function h0(e,r){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=r,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,r=a.dependencies,e.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),e}function tl(e,r,a,l,f,p){var w=0;if(l=e,typeof e=="function")tf(e)&&(w=1);else if(typeof e=="string")w=Aw(e,a,nt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case M:return e=ln(31,a,r,f),e.elementType=M,e.lanes=p,e;case S:return Ms(a.children,f,p,r);case C:w=8,f|=24;break;case L:return e=ln(12,a,r,f|2),e.elementType=L,e.lanes=p,e;case D:return e=ln(13,a,r,f),e.elementType=D,e.lanes=p,e;case z:return e=ln(19,a,r,f),e.elementType=z,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case re:w=10;break e;case U:w=9;break e;case le:w=11;break e;case ae:w=14;break e;case K:w=16,l=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),l=null}return r=ln(w,a,r,f),r.elementType=e,r.type=l,r.lanes=p,r}function Ms(e,r,a,l){return e=ln(7,e,l,r),e.lanes=a,e}function nf(e,r,a){return e=ln(6,e,null,r),e.lanes=a,e}function d0(e){var r=ln(18,null,null,0);return r.stateNode=e,r}function rf(e,r,a){return r=ln(4,e.children!==null?e.children:[],e.key,r),r.lanes=a,r.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},r}var m0=new WeakMap;function Tn(e,r){if(typeof e=="object"&&e!==null){var a=m0.get(e);return a!==void 0?a:(r={value:e,source:r,stack:Do(r)},m0.set(e,r),r)}return{value:e,source:r,stack:Do(r)}}var di=[],mi=0,nl=null,xa=0,Cn=[],Mn=0,Fr=null,Zn=1,er="";function mr(e,r){di[mi++]=xa,di[mi++]=nl,nl=e,xa=r}function p0(e,r,a){Cn[Mn++]=Zn,Cn[Mn++]=er,Cn[Mn++]=Fr,Fr=e;var l=Zn;e=er;var f=32-$t(l)-1;l&=~(1<<f),a+=1;var p=32-$t(r)+f;if(30<p){var w=f-f%5;p=(l&(1<<w)-1).toString(32),l>>=w,f-=w,Zn=1<<32-$t(r)+f|a<<f|l,er=p+e}else Zn=1<<p|a<<f|l,er=e}function sf(e){e.return!==null&&(mr(e,1),p0(e,1,0))}function af(e){for(;e===nl;)nl=di[--mi],di[mi]=null,xa=di[--mi],di[mi]=null;for(;e===Fr;)Fr=Cn[--Mn],Cn[Mn]=null,er=Cn[--Mn],Cn[Mn]=null,Zn=Cn[--Mn],Cn[Mn]=null}function y0(e,r){Cn[Mn++]=Zn,Cn[Mn++]=er,Cn[Mn++]=Fr,Zn=r.id,er=r.overflow,Fr=e}var qt=null,st=null,Ue=!1,Gr=null,Rn=!1,of=Error(i(519));function Vr(e){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw va(Tn(r,e)),of}function g0(e){var r=e.stateNode,a=e.type,l=e.memoizedProps;switch(r[et]=e,r[dt]=l,a){case"dialog":qe("cancel",r),qe("close",r);break;case"iframe":case"object":case"embed":qe("load",r);break;case"video":case"audio":for(a=0;a<Ia.length;a++)qe(Ia[a],r);break;case"source":qe("error",r);break;case"img":case"image":case"link":qe("error",r),qe("load",r);break;case"details":qe("toggle",r);break;case"input":qe("invalid",r),Tm(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":qe("invalid",r);break;case"textarea":qe("invalid",r),Mm(r,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||l.suppressHydrationWarning===!0||Dy(r.textContent,a)?(l.popover!=null&&(qe("beforetoggle",r),qe("toggle",r)),l.onScroll!=null&&qe("scroll",r),l.onScrollEnd!=null&&qe("scrollend",r),l.onClick!=null&&(r.onclick=fr),r=!0):r=!1,r||Vr(e,!0)}function b0(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 31:case 13:Rn=!1;return;case 27:case 3:Rn=!0;return;default:qt=qt.return}}function pi(e){if(e!==qt)return!1;if(!Ue)return b0(e),Ue=!0,!1;var r=e.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Oh(e.type,e.memoizedProps)),a=!a),a&&st&&Vr(e),b0(e),r===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));st=Hy(e)}else if(r===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));st=Hy(e)}else r===27?(r=st,as(e.type)?(e=Th,Th=null,st=e):st=r):st=qt?qn(e.stateNode.nextSibling):null;return!0}function Rs(){st=qt=null,Ue=!1}function lf(){var e=Gr;return e!==null&&(tn===null?tn=e:tn.push.apply(tn,e),Gr=null),e}function va(e){Gr===null?Gr=[e]:Gr.push(e)}var cf=Ne(null),Ds=null,pr=null;function Yr(e,r,a){Te(cf,r._currentValue),r._currentValue=a}function yr(e){e._currentValue=cf.current,je(cf)}function uf(e,r,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&r)!==r?(e.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),e===a)break;e=e.return}}function ff(e,r,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var p=f.dependencies;if(p!==null){var w=f.child;p=p.firstContext;e:for(;p!==null;){var E=p;p=f;for(var R=0;R<r.length;R++)if(E.context===r[R]){p.lanes|=a,E=p.alternate,E!==null&&(E.lanes|=a),uf(p.return,a,e),l||(w=null);break e}p=E.next}}else if(f.tag===18){if(w=f.return,w===null)throw Error(i(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),uf(w,a,e),w=null}else w=f.child;if(w!==null)w.return=f;else for(w=f;w!==null;){if(w===e){w=null;break}if(f=w.sibling,f!==null){f.return=w.return,w=f;break}w=w.return}f=w}}function yi(e,r,a,l){e=null;for(var f=r,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var w=f.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var E=f.type;on(f.pendingProps.value,w.value)||(e!==null?e.push(E):e=[E])}}else if(f===ut.current){if(w=f.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Ya):e=[Ya])}f=f.return}e!==null&&ff(r,e,a,l),r.flags|=262144}function rl(e){for(e=e.firstContext;e!==null;){if(!on(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qs(e){Ds=e,pr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Lt(e){return x0(Ds,e)}function sl(e,r){return Ds===null&&qs(e),x0(e,r)}function x0(e,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},pr===null){if(e===null)throw Error(i(308));pr=r,e.dependencies={lanes:0,firstContext:r},e.flags|=524288}else pr=pr.next=r;return a}var w_=typeof AbortController<"u"?AbortController:function(){var e=[],r=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){r.aborted=!0,e.forEach(function(a){return a()})}},S_=n.unstable_scheduleCallback,E_=n.unstable_NormalPriority,_t={$$typeof:re,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hf(){return{controller:new w_,data:new Map,refCount:0}}function _a(e){e.refCount--,e.refCount===0&&S_(E_,function(){e.controller.abort()})}var wa=null,df=0,gi=0,bi=null;function O_(e,r){if(wa===null){var a=wa=[];df=0,gi=yh(),bi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return df++,r.then(v0,v0),r}function v0(){if(--df===0&&wa!==null){bi!==null&&(bi.status="fulfilled");var e=wa;wa=null,gi=0,bi=null;for(var r=0;r<e.length;r++)(0,e[r])()}}function A_(e,r){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=r;for(var f=0;f<a.length;f++)(0,a[f])(r)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var _0=Y.S;Y.S=function(e,r){sy=at(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&O_(e,r),_0!==null&&_0(e,r)};var Ls=Ne(null);function mf(){var e=Ls.current;return e!==null?e:tt.pooledCache}function il(e,r){r===null?Te(Ls,Ls.current):Te(Ls,r.pool)}function w0(){var e=mf();return e===null?null:{parent:_t._currentValue,pool:e}}var xi=Error(i(460)),pf=Error(i(474)),al=Error(i(542)),ol={then:function(){}};function S0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function E0(e,r,a){switch(a=e[a],a===void 0?e.push(r):a!==r&&(r.then(fr,fr),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw e=r.reason,A0(e),e;default:if(typeof r.status=="string")r.then(fr,fr);else{if(e=tt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=r,e.status="pending",e.then(function(l){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=l}},function(l){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw e=r.reason,A0(e),e}throw Us=r,xi}}function Bs(e){try{var r=e._init;return r(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Us=a,xi):a}}var Us=null;function O0(){if(Us===null)throw Error(i(459));var e=Us;return Us=null,e}function A0(e){if(e===xi||e===al)throw Error(i(483))}var vi=null,Sa=0;function ll(e){var r=Sa;return Sa+=1,vi===null&&(vi=[]),E0(vi,e,r)}function Ea(e,r){r=r.props.ref,e.ref=r!==void 0?r:null}function cl(e,r){throw r.$$typeof===x?Error(i(525)):(e=Object.prototype.toString.call(r),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)))}function j0(e){function r(P,B){if(e){var H=P.deletions;H===null?(P.deletions=[B],P.flags|=16):H.push(B)}}function a(P,B){if(!e)return null;for(;B!==null;)r(P,B),B=B.sibling;return null}function l(P){for(var B=new Map;P!==null;)P.key!==null?B.set(P.key,P):B.set(P.index,P),P=P.sibling;return B}function f(P,B){return P=dr(P,B),P.index=0,P.sibling=null,P}function p(P,B,H){return P.index=H,e?(H=P.alternate,H!==null?(H=H.index,H<B?(P.flags|=67108866,B):H):(P.flags|=67108866,B)):(P.flags|=1048576,B)}function w(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function E(P,B,H,ee){return B===null||B.tag!==6?(B=nf(H,P.mode,ee),B.return=P,B):(B=f(B,H),B.return=P,B)}function R(P,B,H,ee){var Ee=H.type;return Ee===S?X(P,B,H.props.children,ee,H.key):B!==null&&(B.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===K&&Bs(Ee)===B.type)?(B=f(B,H.props),Ea(B,H),B.return=P,B):(B=tl(H.type,H.key,H.props,null,P.mode,ee),Ea(B,H),B.return=P,B)}function F(P,B,H,ee){return B===null||B.tag!==4||B.stateNode.containerInfo!==H.containerInfo||B.stateNode.implementation!==H.implementation?(B=rf(H,P.mode,ee),B.return=P,B):(B=f(B,H.children||[]),B.return=P,B)}function X(P,B,H,ee,Ee){return B===null||B.tag!==7?(B=Ms(H,P.mode,ee,Ee),B.return=P,B):(B=f(B,H),B.return=P,B)}function se(P,B,H){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=nf(""+B,P.mode,H),B.return=P,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case v:return H=tl(B.type,B.key,B.props,null,P.mode,H),Ea(H,B),H.return=P,H;case _:return B=rf(B,P.mode,H),B.return=P,B;case K:return B=Bs(B),se(P,B,H)}if(ke(B)||Q(B))return B=Ms(B,P.mode,H,null),B.return=P,B;if(typeof B.then=="function")return se(P,ll(B),H);if(B.$$typeof===re)return se(P,sl(P,B),H);cl(P,B)}return null}function G(P,B,H,ee){var Ee=B!==null?B.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return Ee!==null?null:E(P,B,""+H,ee);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case v:return H.key===Ee?R(P,B,H,ee):null;case _:return H.key===Ee?F(P,B,H,ee):null;case K:return H=Bs(H),G(P,B,H,ee)}if(ke(H)||Q(H))return Ee!==null?null:X(P,B,H,ee,null);if(typeof H.then=="function")return G(P,B,ll(H),ee);if(H.$$typeof===re)return G(P,B,sl(P,H),ee);cl(P,H)}return null}function J(P,B,H,ee,Ee){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return P=P.get(H)||null,E(B,P,""+ee,Ee);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return P=P.get(ee.key===null?H:ee.key)||null,R(B,P,ee,Ee);case _:return P=P.get(ee.key===null?H:ee.key)||null,F(B,P,ee,Ee);case K:return ee=Bs(ee),J(P,B,H,ee,Ee)}if(ke(ee)||Q(ee))return P=P.get(H)||null,X(B,P,ee,Ee,null);if(typeof ee.then=="function")return J(P,B,H,ll(ee),Ee);if(ee.$$typeof===re)return J(P,B,H,sl(B,ee),Ee);cl(B,ee)}return null}function be(P,B,H,ee){for(var Ee=null,Fe=null,xe=B,Me=B=0,Be=null;xe!==null&&Me<H.length;Me++){xe.index>Me?(Be=xe,xe=null):Be=xe.sibling;var Ge=G(P,xe,H[Me],ee);if(Ge===null){xe===null&&(xe=Be);break}e&&xe&&Ge.alternate===null&&r(P,xe),B=p(Ge,B,Me),Fe===null?Ee=Ge:Fe.sibling=Ge,Fe=Ge,xe=Be}if(Me===H.length)return a(P,xe),Ue&&mr(P,Me),Ee;if(xe===null){for(;Me<H.length;Me++)xe=se(P,H[Me],ee),xe!==null&&(B=p(xe,B,Me),Fe===null?Ee=xe:Fe.sibling=xe,Fe=xe);return Ue&&mr(P,Me),Ee}for(xe=l(xe);Me<H.length;Me++)Be=J(xe,P,Me,H[Me],ee),Be!==null&&(e&&Be.alternate!==null&&xe.delete(Be.key===null?Me:Be.key),B=p(Be,B,Me),Fe===null?Ee=Be:Fe.sibling=Be,Fe=Be);return e&&xe.forEach(function(fs){return r(P,fs)}),Ue&&mr(P,Me),Ee}function Ae(P,B,H,ee){if(H==null)throw Error(i(151));for(var Ee=null,Fe=null,xe=B,Me=B=0,Be=null,Ge=H.next();xe!==null&&!Ge.done;Me++,Ge=H.next()){xe.index>Me?(Be=xe,xe=null):Be=xe.sibling;var fs=G(P,xe,Ge.value,ee);if(fs===null){xe===null&&(xe=Be);break}e&&xe&&fs.alternate===null&&r(P,xe),B=p(fs,B,Me),Fe===null?Ee=fs:Fe.sibling=fs,Fe=fs,xe=Be}if(Ge.done)return a(P,xe),Ue&&mr(P,Me),Ee;if(xe===null){for(;!Ge.done;Me++,Ge=H.next())Ge=se(P,Ge.value,ee),Ge!==null&&(B=p(Ge,B,Me),Fe===null?Ee=Ge:Fe.sibling=Ge,Fe=Ge);return Ue&&mr(P,Me),Ee}for(xe=l(xe);!Ge.done;Me++,Ge=H.next())Ge=J(xe,P,Me,Ge.value,ee),Ge!==null&&(e&&Ge.alternate!==null&&xe.delete(Ge.key===null?Me:Ge.key),B=p(Ge,B,Me),Fe===null?Ee=Ge:Fe.sibling=Ge,Fe=Ge);return e&&xe.forEach(function(Bw){return r(P,Bw)}),Ue&&mr(P,Me),Ee}function Ze(P,B,H,ee){if(typeof H=="object"&&H!==null&&H.type===S&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case v:e:{for(var Ee=H.key;B!==null;){if(B.key===Ee){if(Ee=H.type,Ee===S){if(B.tag===7){a(P,B.sibling),ee=f(B,H.props.children),ee.return=P,P=ee;break e}}else if(B.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===K&&Bs(Ee)===B.type){a(P,B.sibling),ee=f(B,H.props),Ea(ee,H),ee.return=P,P=ee;break e}a(P,B);break}else r(P,B);B=B.sibling}H.type===S?(ee=Ms(H.props.children,P.mode,ee,H.key),ee.return=P,P=ee):(ee=tl(H.type,H.key,H.props,null,P.mode,ee),Ea(ee,H),ee.return=P,P=ee)}return w(P);case _:e:{for(Ee=H.key;B!==null;){if(B.key===Ee)if(B.tag===4&&B.stateNode.containerInfo===H.containerInfo&&B.stateNode.implementation===H.implementation){a(P,B.sibling),ee=f(B,H.children||[]),ee.return=P,P=ee;break e}else{a(P,B);break}else r(P,B);B=B.sibling}ee=rf(H,P.mode,ee),ee.return=P,P=ee}return w(P);case K:return H=Bs(H),Ze(P,B,H,ee)}if(ke(H))return be(P,B,H,ee);if(Q(H)){if(Ee=Q(H),typeof Ee!="function")throw Error(i(150));return H=Ee.call(H),Ae(P,B,H,ee)}if(typeof H.then=="function")return Ze(P,B,ll(H),ee);if(H.$$typeof===re)return Ze(P,B,sl(P,H),ee);cl(P,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,B!==null&&B.tag===6?(a(P,B.sibling),ee=f(B,H),ee.return=P,P=ee):(a(P,B),ee=nf(H,P.mode,ee),ee.return=P,P=ee),w(P)):a(P,B)}return function(P,B,H,ee){try{Sa=0;var Ee=Ze(P,B,H,ee);return vi=null,Ee}catch(xe){if(xe===xi||xe===al)throw xe;var Fe=ln(29,xe,null,P.mode);return Fe.lanes=ee,Fe.return=P,Fe}finally{}}}var Ps=j0(!0),k0=j0(!1),Kr=!1;function yf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gf(e,r){e=e.updateQueue,r.updateQueue===e&&(r.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Jr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Qr(e,r,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ye&2)!==0){var f=l.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),l.pending=r,r=el(e),f0(e,null,a),r}return Zo(e,l,r,a),el(e)}function Oa(e,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=e.pendingLanes,a|=l,r.lanes=a,Os(e,a)}}function bf(e,r){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?f=p=r:p=p.next=r}else f=p=r;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=r:e.next=r,a.lastBaseUpdate=r}var xf=!1;function Aa(){if(xf){var e=bi;if(e!==null)throw e}}function ja(e,r,a,l){xf=!1;var f=e.updateQueue;Kr=!1;var p=f.firstBaseUpdate,w=f.lastBaseUpdate,E=f.shared.pending;if(E!==null){f.shared.pending=null;var R=E,F=R.next;R.next=null,w===null?p=F:w.next=F,w=R;var X=e.alternate;X!==null&&(X=X.updateQueue,E=X.lastBaseUpdate,E!==w&&(E===null?X.firstBaseUpdate=F:E.next=F,X.lastBaseUpdate=R))}if(p!==null){var se=f.baseState;w=0,X=F=R=null,E=p;do{var G=E.lane&-536870913,J=G!==E.lane;if(J?(Le&G)===G:(l&G)===G){G!==0&&G===gi&&(xf=!0),X!==null&&(X=X.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var be=e,Ae=E;G=r;var Ze=a;switch(Ae.tag){case 1:if(be=Ae.payload,typeof be=="function"){se=be.call(Ze,se,G);break e}se=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ae.payload,G=typeof be=="function"?be.call(Ze,se,G):be,G==null)break e;se=b({},se,G);break e;case 2:Kr=!0}}G=E.callback,G!==null&&(e.flags|=64,J&&(e.flags|=8192),J=f.callbacks,J===null?f.callbacks=[G]:J.push(G))}else J={lane:G,tag:E.tag,payload:E.payload,callback:E.callback,next:null},X===null?(F=X=J,R=se):X=X.next=J,w|=G;if(E=E.next,E===null){if(E=f.shared.pending,E===null)break;J=E,E=J.next,J.next=null,f.lastBaseUpdate=J,f.shared.pending=null}}while(!0);X===null&&(R=se),f.baseState=R,f.firstBaseUpdate=F,f.lastBaseUpdate=X,p===null&&(f.shared.lanes=0),ts|=w,e.lanes=w,e.memoizedState=se}}function N0(e,r){if(typeof e!="function")throw Error(i(191,e));e.call(r)}function T0(e,r){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)N0(a[e],r)}var _i=Ne(null),ul=Ne(0);function C0(e,r){e=Or,Te(ul,e),Te(_i,r),Or=e|r.baseLanes}function vf(){Te(ul,Or),Te(_i,_i.current)}function _f(){Or=ul.current,je(_i),je(ul)}var cn=Ne(null),Dn=null;function Xr(e){var r=e.alternate;Te(bt,bt.current&1),Te(cn,e),Dn===null&&(r===null||_i.current!==null||r.memoizedState!==null)&&(Dn=e)}function wf(e){Te(bt,bt.current),Te(cn,e),Dn===null&&(Dn=e)}function M0(e){e.tag===22?(Te(bt,bt.current),Te(cn,e),Dn===null&&(Dn=e)):Wr()}function Wr(){Te(bt,bt.current),Te(cn,cn.current)}function un(e){je(cn),Dn===e&&(Dn=null),je(bt)}var bt=Ne(0);function fl(e){for(var r=e;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||kh(a)||Nh(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var gr=0,Ce=null,Xe=null,wt=null,hl=!1,wi=!1,zs=!1,dl=0,ka=0,Si=null,j_=0;function mt(){throw Error(i(321))}function Sf(e,r){if(r===null)return!1;for(var a=0;a<r.length&&a<e.length;a++)if(!on(e[a],r[a]))return!1;return!0}function Ef(e,r,a,l,f,p){return gr=p,Ce=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Y.H=e===null||e.memoizedState===null?pp:Pf,zs=!1,p=a(l,f),zs=!1,wi&&(p=D0(r,a,l,f)),R0(e),p}function R0(e){Y.H=Ca;var r=Xe!==null&&Xe.next!==null;if(gr=0,wt=Xe=Ce=null,hl=!1,ka=0,Si=null,r)throw Error(i(300));e===null||St||(e=e.dependencies,e!==null&&rl(e)&&(St=!0))}function D0(e,r,a,l){Ce=e;var f=0;do{if(wi&&(Si=null),ka=0,wi=!1,25<=f)throw Error(i(301));if(f+=1,wt=Xe=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}Y.H=yp,p=r(a,l)}while(wi);return p}function k_(){var e=Y.H,r=e.useState()[0];return r=typeof r.then=="function"?Na(r):r,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Ce.flags|=1024),r}function Of(){var e=dl!==0;return dl=0,e}function Af(e,r,a){r.updateQueue=e.updateQueue,r.flags&=-2053,e.lanes&=~a}function jf(e){if(hl){for(e=e.memoizedState;e!==null;){var r=e.queue;r!==null&&(r.pending=null),e=e.next}hl=!1}gr=0,wt=Xe=Ce=null,wi=!1,ka=dl=0,Si=null}function Ft(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?Ce.memoizedState=wt=e:wt=wt.next=e,wt}function xt(){if(Xe===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var r=wt===null?Ce.memoizedState:wt.next;if(r!==null)wt=r,Xe=e;else{if(e===null)throw Ce.alternate===null?Error(i(467)):Error(i(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},wt===null?Ce.memoizedState=wt=e:wt=wt.next=e}return wt}function ml(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Na(e){var r=ka;return ka+=1,Si===null&&(Si=[]),e=E0(Si,e,r),r=Ce,(wt===null?r.memoizedState:wt.next)===null&&(r=r.alternate,Y.H=r===null||r.memoizedState===null?pp:Pf),e}function pl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Na(e);if(e.$$typeof===re)return Lt(e)}throw Error(i(438,String(e)))}function kf(e){var r=null,a=Ce.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=Ce.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=ml(),Ce.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(e),l=0;l<e;l++)a[l]=$;return r.index++,a}function br(e,r){return typeof r=="function"?r(e):r}function yl(e){var r=xt();return Nf(r,Xe,e)}function Nf(e,r,a){var l=e.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var f=e.baseQueue,p=l.pending;if(p!==null){if(f!==null){var w=f.next;f.next=p.next,p.next=w}r.baseQueue=f=p,l.pending=null}if(p=e.baseState,f===null)e.memoizedState=p;else{r=f.next;var E=w=null,R=null,F=r,X=!1;do{var se=F.lane&-536870913;if(se!==F.lane?(Le&se)===se:(gr&se)===se){var G=F.revertLane;if(G===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),se===gi&&(X=!0);else if((gr&G)===G){F=F.next,G===gi&&(X=!0);continue}else se={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},R===null?(E=R=se,w=p):R=R.next=se,Ce.lanes|=G,ts|=G;se=F.action,zs&&a(p,se),p=F.hasEagerState?F.eagerState:a(p,se)}else G={lane:se,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},R===null?(E=R=G,w=p):R=R.next=G,Ce.lanes|=se,ts|=se;F=F.next}while(F!==null&&F!==r);if(R===null?w=p:R.next=E,!on(p,e.memoizedState)&&(St=!0,X&&(a=bi,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=R,l.lastRenderedState=p}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Tf(e){var r=xt(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,p=r.memoizedState;if(f!==null){a.pending=null;var w=f=f.next;do p=e(p,w.action),w=w.next;while(w!==f);on(p,r.memoizedState)||(St=!0),r.memoizedState=p,r.baseQueue===null&&(r.baseState=p),a.lastRenderedState=p}return[p,l]}function q0(e,r,a){var l=Ce,f=xt(),p=Ue;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=r();var w=!on((Xe||f).memoizedState,a);if(w&&(f.memoizedState=a,St=!0),f=f.queue,Rf(U0.bind(null,l,f,e),[e]),f.getSnapshot!==r||w||wt!==null&&wt.memoizedState.tag&1){if(l.flags|=2048,Ei(9,{destroy:void 0},B0.bind(null,l,f,a,r),null),tt===null)throw Error(i(349));p||(gr&127)!==0||L0(l,r,a)}return a}function L0(e,r,a){e.flags|=16384,e={getSnapshot:r,value:a},r=Ce.updateQueue,r===null?(r=ml(),Ce.updateQueue=r,r.stores=[e]):(a=r.stores,a===null?r.stores=[e]:a.push(e))}function B0(e,r,a,l){r.value=a,r.getSnapshot=l,P0(r)&&z0(e)}function U0(e,r,a){return a(function(){P0(r)&&z0(e)})}function P0(e){var r=e.getSnapshot;e=e.value;try{var a=r();return!on(e,a)}catch{return!0}}function z0(e){var r=Cs(e,2);r!==null&&nn(r,e,2)}function Cf(e){var r=Ft();if(typeof e=="function"){var a=e;if(e=a(),zs){sn(!0);try{a()}finally{sn(!1)}}}return r.memoizedState=r.baseState=e,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:e},r}function $0(e,r,a,l){return e.baseState=a,Nf(e,Xe,typeof l=="function"?l:br)}function N_(e,r,a,l,f){if(xl(e))throw Error(i(485));if(e=r.action,e!==null){var p={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};Y.T!==null?a(!0):p.isTransition=!1,l(p),a=r.pending,a===null?(p.next=r.pending=p,I0(r,p)):(p.next=a.next,r.pending=a.next=p)}}function I0(e,r){var a=r.action,l=r.payload,f=e.state;if(r.isTransition){var p=Y.T,w={};Y.T=w;try{var E=a(f,l),R=Y.S;R!==null&&R(w,E),H0(e,r,E)}catch(F){Mf(e,r,F)}finally{p!==null&&w.types!==null&&(p.types=w.types),Y.T=p}}else try{p=a(f,l),H0(e,r,p)}catch(F){Mf(e,r,F)}}function H0(e,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){F0(e,r,l)},function(l){return Mf(e,r,l)}):F0(e,r,a)}function F0(e,r,a){r.status="fulfilled",r.value=a,G0(r),e.state=a,r=e.pending,r!==null&&(a=r.next,a===r?e.pending=null:(a=a.next,r.next=a,I0(e,a)))}function Mf(e,r,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,G0(r),r=r.next;while(r!==l)}e.action=null}function G0(e){e=e.listeners;for(var r=0;r<e.length;r++)(0,e[r])()}function V0(e,r){return r}function Y0(e,r){if(Ue){var a=tt.formState;if(a!==null){e:{var l=Ce;if(Ue){if(st){t:{for(var f=st,p=Rn;f.nodeType!==8;){if(!p){f=null;break t}if(f=qn(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){st=qn(f.nextSibling),l=f.data==="F!";break e}}Vr(l)}l=!1}l&&(r=a[0])}}return a=Ft(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:V0,lastRenderedState:r},a.queue=l,a=hp.bind(null,Ce,l),l.dispatch=a,l=Cf(!1),p=Uf.bind(null,Ce,!1,l.queue),l=Ft(),f={state:r,dispatch:null,action:e,pending:null},l.queue=f,a=N_.bind(null,Ce,f,p,a),f.dispatch=a,l.memoizedState=e,[r,a,!1]}function K0(e){var r=xt();return J0(r,Xe,e)}function J0(e,r,a){if(r=Nf(e,r,V0)[0],e=yl(br)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Na(r)}catch(w){throw w===xi?al:w}else l=r;r=xt();var f=r.queue,p=f.dispatch;return a!==r.memoizedState&&(Ce.flags|=2048,Ei(9,{destroy:void 0},T_.bind(null,f,a),null)),[l,p,e]}function T_(e,r){e.action=r}function Q0(e){var r=xt(),a=Xe;if(a!==null)return J0(r,a,e);xt(),r=r.memoizedState,a=xt();var l=a.queue.dispatch;return a.memoizedState=e,[r,l,!1]}function Ei(e,r,a,l){return e={tag:e,create:a,deps:l,inst:r,next:null},r=Ce.updateQueue,r===null&&(r=ml(),Ce.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,r.lastEffect=e),e}function X0(){return xt().memoizedState}function gl(e,r,a,l){var f=Ft();Ce.flags|=e,f.memoizedState=Ei(1|r,{destroy:void 0},a,l===void 0?null:l)}function bl(e,r,a,l){var f=xt();l=l===void 0?null:l;var p=f.memoizedState.inst;Xe!==null&&l!==null&&Sf(l,Xe.memoizedState.deps)?f.memoizedState=Ei(r,p,a,l):(Ce.flags|=e,f.memoizedState=Ei(1|r,p,a,l))}function W0(e,r){gl(8390656,8,e,r)}function Rf(e,r){bl(2048,8,e,r)}function C_(e){Ce.flags|=4;var r=Ce.updateQueue;if(r===null)r=ml(),Ce.updateQueue=r,r.events=[e];else{var a=r.events;a===null?r.events=[e]:a.push(e)}}function Z0(e){var r=xt().memoizedState;return C_({ref:r,nextImpl:e}),function(){if((Ye&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function ep(e,r){return bl(4,2,e,r)}function tp(e,r){return bl(4,4,e,r)}function np(e,r){if(typeof r=="function"){e=e();var a=r(e);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return e=e(),r.current=e,function(){r.current=null}}function rp(e,r,a){a=a!=null?a.concat([e]):null,bl(4,4,np.bind(null,r,e),a)}function Df(){}function sp(e,r){var a=xt();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Sf(r,l[1])?l[0]:(a.memoizedState=[e,r],e)}function ip(e,r){var a=xt();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Sf(r,l[1]))return l[0];if(l=e(),zs){sn(!0);try{e()}finally{sn(!1)}}return a.memoizedState=[l,r],l}function qf(e,r,a){return a===void 0||(gr&1073741824)!==0&&(Le&261930)===0?e.memoizedState=r:(e.memoizedState=a,e=ay(),Ce.lanes|=e,ts|=e,a)}function ap(e,r,a,l){return on(a,r)?a:_i.current!==null?(e=qf(e,a,l),on(e,r)||(St=!0),e):(gr&42)===0||(gr&1073741824)!==0&&(Le&261930)===0?(St=!0,e.memoizedState=a):(e=ay(),Ce.lanes|=e,ts|=e,r)}function op(e,r,a,l,f){var p=Z.p;Z.p=p!==0&&8>p?p:8;var w=Y.T,E={};Y.T=E,Uf(e,!1,r,a);try{var R=f(),F=Y.S;if(F!==null&&F(E,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var X=A_(R,l);Ta(e,r,X,dn(e))}else Ta(e,r,l,dn(e))}catch(se){Ta(e,r,{then:function(){},status:"rejected",reason:se},dn())}finally{Z.p=p,w!==null&&E.types!==null&&(w.types=E.types),Y.T=w}}function M_(){}function Lf(e,r,a,l){if(e.tag!==5)throw Error(i(476));var f=lp(e).queue;op(e,f,r,ce,a===null?M_:function(){return cp(e),a(l)})}function lp(e){var r=e.memoizedState;if(r!==null)return r;r={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:ce},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:a},next:null},e.memoizedState=r,e=e.alternate,e!==null&&(e.memoizedState=r),r}function cp(e){var r=lp(e);r.next===null&&(r=e.alternate.memoizedState),Ta(e,r.next.queue,{},dn())}function Bf(){return Lt(Ya)}function up(){return xt().memoizedState}function fp(){return xt().memoizedState}function R_(e){for(var r=e.return;r!==null;){switch(r.tag){case 24:case 3:var a=dn();e=Jr(a);var l=Qr(r,e,a);l!==null&&(nn(l,r,a),Oa(l,r,a)),r={cache:hf()},e.payload=r;return}r=r.return}}function D_(e,r,a){var l=dn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},xl(e)?dp(r,a):(a=ef(e,r,a,l),a!==null&&(nn(a,e,l),mp(a,r,l)))}function hp(e,r,a){var l=dn();Ta(e,r,a,l)}function Ta(e,r,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(xl(e))dp(r,f);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=r.lastRenderedReducer,p!==null))try{var w=r.lastRenderedState,E=p(w,a);if(f.hasEagerState=!0,f.eagerState=E,on(E,w))return Zo(e,r,f,0),tt===null&&Wo(),!1}catch{}finally{}if(a=ef(e,r,f,l),a!==null)return nn(a,e,l),mp(a,r,l),!0}return!1}function Uf(e,r,a,l){if(l={lane:2,revertLane:yh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},xl(e)){if(r)throw Error(i(479))}else r=ef(e,a,l,2),r!==null&&nn(r,e,2)}function xl(e){var r=e.alternate;return e===Ce||r!==null&&r===Ce}function dp(e,r){wi=hl=!0;var a=e.pending;a===null?r.next=r:(r.next=a.next,a.next=r),e.pending=r}function mp(e,r,a){if((a&4194048)!==0){var l=r.lanes;l&=e.pendingLanes,a|=l,r.lanes=a,Os(e,a)}}var Ca={readContext:Lt,use:pl,useCallback:mt,useContext:mt,useEffect:mt,useImperativeHandle:mt,useLayoutEffect:mt,useInsertionEffect:mt,useMemo:mt,useReducer:mt,useRef:mt,useState:mt,useDebugValue:mt,useDeferredValue:mt,useTransition:mt,useSyncExternalStore:mt,useId:mt,useHostTransitionStatus:mt,useFormState:mt,useActionState:mt,useOptimistic:mt,useMemoCache:mt,useCacheRefresh:mt};Ca.useEffectEvent=mt;var pp={readContext:Lt,use:pl,useCallback:function(e,r){return Ft().memoizedState=[e,r===void 0?null:r],e},useContext:Lt,useEffect:W0,useImperativeHandle:function(e,r,a){a=a!=null?a.concat([e]):null,gl(4194308,4,np.bind(null,r,e),a)},useLayoutEffect:function(e,r){return gl(4194308,4,e,r)},useInsertionEffect:function(e,r){gl(4,2,e,r)},useMemo:function(e,r){var a=Ft();r=r===void 0?null:r;var l=e();if(zs){sn(!0);try{e()}finally{sn(!1)}}return a.memoizedState=[l,r],l},useReducer:function(e,r,a){var l=Ft();if(a!==void 0){var f=a(r);if(zs){sn(!0);try{a(r)}finally{sn(!1)}}}else f=r;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=D_.bind(null,Ce,e),[l.memoizedState,e]},useRef:function(e){var r=Ft();return e={current:e},r.memoizedState=e},useState:function(e){e=Cf(e);var r=e.queue,a=hp.bind(null,Ce,r);return r.dispatch=a,[e.memoizedState,a]},useDebugValue:Df,useDeferredValue:function(e,r){var a=Ft();return qf(a,e,r)},useTransition:function(){var e=Cf(!1);return e=op.bind(null,Ce,e.queue,!0,!1),Ft().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,r,a){var l=Ce,f=Ft();if(Ue){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),tt===null)throw Error(i(349));(Le&127)!==0||L0(l,r,a)}f.memoizedState=a;var p={value:a,getSnapshot:r};return f.queue=p,W0(U0.bind(null,l,p,e),[e]),l.flags|=2048,Ei(9,{destroy:void 0},B0.bind(null,l,p,a,r),null),a},useId:function(){var e=Ft(),r=tt.identifierPrefix;if(Ue){var a=er,l=Zn;a=(l&~(1<<32-$t(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=dl++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=j_++,r="_"+r+"r_"+a.toString(32)+"_";return e.memoizedState=r},useHostTransitionStatus:Bf,useFormState:Y0,useActionState:Y0,useOptimistic:function(e){var r=Ft();r.memoizedState=r.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Uf.bind(null,Ce,!0,a),a.dispatch=r,[e,r]},useMemoCache:kf,useCacheRefresh:function(){return Ft().memoizedState=R_.bind(null,Ce)},useEffectEvent:function(e){var r=Ft(),a={impl:e};return r.memoizedState=a,function(){if((Ye&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Pf={readContext:Lt,use:pl,useCallback:sp,useContext:Lt,useEffect:Rf,useImperativeHandle:rp,useInsertionEffect:ep,useLayoutEffect:tp,useMemo:ip,useReducer:yl,useRef:X0,useState:function(){return yl(br)},useDebugValue:Df,useDeferredValue:function(e,r){var a=xt();return ap(a,Xe.memoizedState,e,r)},useTransition:function(){var e=yl(br)[0],r=xt().memoizedState;return[typeof e=="boolean"?e:Na(e),r]},useSyncExternalStore:q0,useId:up,useHostTransitionStatus:Bf,useFormState:K0,useActionState:K0,useOptimistic:function(e,r){var a=xt();return $0(a,Xe,e,r)},useMemoCache:kf,useCacheRefresh:fp};Pf.useEffectEvent=Z0;var yp={readContext:Lt,use:pl,useCallback:sp,useContext:Lt,useEffect:Rf,useImperativeHandle:rp,useInsertionEffect:ep,useLayoutEffect:tp,useMemo:ip,useReducer:Tf,useRef:X0,useState:function(){return Tf(br)},useDebugValue:Df,useDeferredValue:function(e,r){var a=xt();return Xe===null?qf(a,e,r):ap(a,Xe.memoizedState,e,r)},useTransition:function(){var e=Tf(br)[0],r=xt().memoizedState;return[typeof e=="boolean"?e:Na(e),r]},useSyncExternalStore:q0,useId:up,useHostTransitionStatus:Bf,useFormState:Q0,useActionState:Q0,useOptimistic:function(e,r){var a=xt();return Xe!==null?$0(a,Xe,e,r):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:kf,useCacheRefresh:fp};yp.useEffectEvent=Z0;function zf(e,r,a,l){r=e.memoizedState,a=a(l,r),a=a==null?r:b({},r,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var $f={enqueueSetState:function(e,r,a){e=e._reactInternals;var l=dn(),f=Jr(l);f.payload=r,a!=null&&(f.callback=a),r=Qr(e,f,l),r!==null&&(nn(r,e,l),Oa(r,e,l))},enqueueReplaceState:function(e,r,a){e=e._reactInternals;var l=dn(),f=Jr(l);f.tag=1,f.payload=r,a!=null&&(f.callback=a),r=Qr(e,f,l),r!==null&&(nn(r,e,l),Oa(r,e,l))},enqueueForceUpdate:function(e,r){e=e._reactInternals;var a=dn(),l=Jr(a);l.tag=2,r!=null&&(l.callback=r),r=Qr(e,l,a),r!==null&&(nn(r,e,a),Oa(r,e,a))}};function gp(e,r,a,l,f,p,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,p,w):r.prototype&&r.prototype.isPureReactComponent?!ga(a,l)||!ga(f,p):!0}function bp(e,r,a,l){e=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==e&&$f.enqueueReplaceState(r,r.state,null)}function $s(e,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(e=e.defaultProps){a===r&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function xp(e){Xo(e)}function vp(e){console.error(e)}function _p(e){Xo(e)}function vl(e,r){try{var a=e.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function wp(e,r,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function If(e,r,a){return a=Jr(a),a.tag=3,a.payload={element:null},a.callback=function(){vl(e,r)},a}function Sp(e){return e=Jr(e),e.tag=3,e}function Ep(e,r,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var p=l.value;e.payload=function(){return f(p)},e.callback=function(){wp(r,a,l)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){wp(r,a,l),typeof f!="function"&&(ns===null?ns=new Set([this]):ns.add(this));var E=l.stack;this.componentDidCatch(l.value,{componentStack:E!==null?E:""})})}function q_(e,r,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&yi(r,a,f,!0),a=cn.current,a!==null){switch(a.tag){case 31:case 13:return Dn===null?Ml():a.alternate===null&&pt===0&&(pt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===ol?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),dh(e,l,f)),!1;case 22:return a.flags|=65536,l===ol?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([l]):a.add(l)),dh(e,l,f)),!1}throw Error(i(435,a.tag))}return dh(e,l,f),Ml(),!1}if(Ue)return r=cn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,l!==of&&(e=Error(i(422),{cause:l}),va(Tn(e,a)))):(l!==of&&(r=Error(i(423),{cause:l}),va(Tn(r,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Tn(l,a),f=If(e.stateNode,l,f),bf(e,f),pt!==4&&(pt=2)),!1;var p=Error(i(520),{cause:l});if(p=Tn(p,a),Pa===null?Pa=[p]:Pa.push(p),pt!==4&&(pt=2),r===null)return!0;l=Tn(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=If(a.stateNode,l,e),bf(a,e),!1;case 1:if(r=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(ns===null||!ns.has(p))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Sp(f),Ep(f,e,a,l),bf(a,f),!1}a=a.return}while(a!==null);return!1}var Hf=Error(i(461)),St=!1;function Bt(e,r,a,l){r.child=e===null?k0(r,null,a,l):Ps(r,e.child,a,l)}function Op(e,r,a,l,f){a=a.render;var p=r.ref;if("ref"in l){var w={};for(var E in l)E!=="ref"&&(w[E]=l[E])}else w=l;return qs(r),l=Ef(e,r,a,w,p,f),E=Of(),e!==null&&!St?(Af(e,r,f),xr(e,r,f)):(Ue&&E&&sf(r),r.flags|=1,Bt(e,r,l,f),r.child)}function Ap(e,r,a,l,f){if(e===null){var p=a.type;return typeof p=="function"&&!tf(p)&&p.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=p,jp(e,r,p,l,f)):(e=tl(a.type,null,l,r,r.mode,f),e.ref=r.ref,e.return=r,r.child=e)}if(p=e.child,!Xf(e,f)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:ga,a(w,l)&&e.ref===r.ref)return xr(e,r,f)}return r.flags|=1,e=dr(p,l),e.ref=r.ref,e.return=r,r.child=e}function jp(e,r,a,l,f){if(e!==null){var p=e.memoizedProps;if(ga(p,l)&&e.ref===r.ref)if(St=!1,r.pendingProps=l=p,Xf(e,f))(e.flags&131072)!==0&&(St=!0);else return r.lanes=e.lanes,xr(e,r,f)}return Ff(e,r,a,l,f)}function kp(e,r,a,l){var f=l.children,p=e!==null?e.memoizedState:null;if(e===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(l=r.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~p}else l=0,r.child=null;return Np(e,r,p,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},e!==null&&il(r,p!==null?p.cachePool:null),p!==null?C0(r,p):vf(),M0(r);else return l=r.lanes=536870912,Np(e,r,p!==null?p.baseLanes|a:a,a,l)}else p!==null?(il(r,p.cachePool),C0(r,p),Wr(),r.memoizedState=null):(e!==null&&il(r,null),vf(),Wr());return Bt(e,r,f,a),r.child}function Ma(e,r){return e!==null&&e.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Np(e,r,a,l,f){var p=mf();return p=p===null?null:{parent:_t._currentValue,pool:p},r.memoizedState={baseLanes:a,cachePool:p},e!==null&&il(r,null),vf(),M0(r),e!==null&&yi(e,r,l,!0),r.childLanes=f,null}function _l(e,r){return r=Sl({mode:r.mode,children:r.children},e.mode),r.ref=e.ref,e.child=r,r.return=e,r}function Tp(e,r,a){return Ps(r,e.child,null,a),e=_l(r,r.pendingProps),e.flags|=2,un(r),r.memoizedState=null,e}function L_(e,r,a){var l=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,e===null){if(Ue){if(l.mode==="hidden")return e=_l(r,l),r.lanes=536870912,Ma(null,e);if(wf(r),(e=st)?(e=Iy(e,Rn),e=e!==null&&e.data==="&"?e:null,e!==null&&(r.memoizedState={dehydrated:e,treeContext:Fr!==null?{id:Zn,overflow:er}:null,retryLane:536870912,hydrationErrors:null},a=d0(e),a.return=r,r.child=a,qt=r,st=null)):e=null,e===null)throw Vr(r);return r.lanes=536870912,null}return _l(r,l)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(wf(r),f)if(r.flags&256)r.flags&=-257,r=Tp(e,r,a);else if(r.memoizedState!==null)r.child=e.child,r.flags|=128,r=null;else throw Error(i(558));else if(St||yi(e,r,a,!1),f=(a&e.childLanes)!==0,St||f){if(l=tt,l!==null&&(w=Ir(l,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,Cs(e,w),nn(l,e,w),Hf;Ml(),r=Tp(e,r,a)}else e=p.treeContext,st=qn(w.nextSibling),qt=r,Ue=!0,Gr=null,Rn=!1,e!==null&&y0(r,e),r=_l(r,l),r.flags|=4096;return r}return e=dr(e.child,{mode:l.mode,children:l.children}),e.ref=r.ref,r.child=e,e.return=r,e}function wl(e,r){var a=r.ref;if(a===null)e!==null&&e.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(r.flags|=4194816)}}function Ff(e,r,a,l,f){return qs(r),a=Ef(e,r,a,l,void 0,f),l=Of(),e!==null&&!St?(Af(e,r,f),xr(e,r,f)):(Ue&&l&&sf(r),r.flags|=1,Bt(e,r,a,f),r.child)}function Cp(e,r,a,l,f,p){return qs(r),r.updateQueue=null,a=D0(r,l,a,f),R0(e),l=Of(),e!==null&&!St?(Af(e,r,p),xr(e,r,p)):(Ue&&l&&sf(r),r.flags|=1,Bt(e,r,a,p),r.child)}function Mp(e,r,a,l,f){if(qs(r),r.stateNode===null){var p=hi,w=a.contextType;typeof w=="object"&&w!==null&&(p=Lt(w)),p=new a(l,p),r.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=$f,r.stateNode=p,p._reactInternals=r,p=r.stateNode,p.props=l,p.state=r.memoizedState,p.refs={},yf(r),w=a.contextType,p.context=typeof w=="object"&&w!==null?Lt(w):hi,p.state=r.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(zf(r,a,w,l),p.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&$f.enqueueReplaceState(p,p.state,null),ja(r,l,p,f),Aa(),p.state=r.memoizedState),typeof p.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(e===null){p=r.stateNode;var E=r.memoizedProps,R=$s(a,E);p.props=R;var F=p.context,X=a.contextType;w=hi,typeof X=="object"&&X!==null&&(w=Lt(X));var se=a.getDerivedStateFromProps;X=typeof se=="function"||typeof p.getSnapshotBeforeUpdate=="function",E=r.pendingProps!==E,X||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(E||F!==w)&&bp(r,p,l,w),Kr=!1;var G=r.memoizedState;p.state=G,ja(r,l,p,f),Aa(),F=r.memoizedState,E||G!==F||Kr?(typeof se=="function"&&(zf(r,a,se,l),F=r.memoizedState),(R=Kr||gp(r,a,R,l,G,F,w))?(X||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(r.flags|=4194308)):(typeof p.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=F),p.props=l,p.state=F,p.context=w,l=R):(typeof p.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{p=r.stateNode,gf(e,r),w=r.memoizedProps,X=$s(a,w),p.props=X,se=r.pendingProps,G=p.context,F=a.contextType,R=hi,typeof F=="object"&&F!==null&&(R=Lt(F)),E=a.getDerivedStateFromProps,(F=typeof E=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==se||G!==R)&&bp(r,p,l,R),Kr=!1,G=r.memoizedState,p.state=G,ja(r,l,p,f),Aa();var J=r.memoizedState;w!==se||G!==J||Kr||e!==null&&e.dependencies!==null&&rl(e.dependencies)?(typeof E=="function"&&(zf(r,a,E,l),J=r.memoizedState),(X=Kr||gp(r,a,X,l,G,J,R)||e!==null&&e.dependencies!==null&&rl(e.dependencies))?(F||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,J,R),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,J,R)),typeof p.componentDidUpdate=="function"&&(r.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&G===e.memoizedState||(r.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&G===e.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=J),p.props=l,p.state=J,p.context=R,l=X):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&G===e.memoizedState||(r.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&G===e.memoizedState||(r.flags|=1024),l=!1)}return p=l,wl(e,r),l=(r.flags&128)!==0,p||l?(p=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:p.render(),r.flags|=1,e!==null&&l?(r.child=Ps(r,e.child,null,f),r.child=Ps(r,null,a,f)):Bt(e,r,a,f),r.memoizedState=p.state,e=r.child):e=xr(e,r,f),e}function Rp(e,r,a,l){return Rs(),r.flags|=256,Bt(e,r,a,l),r.child}var Gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vf(e){return{baseLanes:e,cachePool:w0()}}function Yf(e,r,a){return e=e!==null?e.childLanes&~a:0,r&&(e|=hn),e}function Dp(e,r,a){var l=r.pendingProps,f=!1,p=(r.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(bt.current&2)!==0),w&&(f=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,e===null){if(Ue){if(f?Xr(r):Wr(),(e=st)?(e=Iy(e,Rn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(r.memoizedState={dehydrated:e,treeContext:Fr!==null?{id:Zn,overflow:er}:null,retryLane:536870912,hydrationErrors:null},a=d0(e),a.return=r,r.child=a,qt=r,st=null)):e=null,e===null)throw Vr(r);return Nh(e)?r.lanes=32:r.lanes=536870912,null}var E=l.children;return l=l.fallback,f?(Wr(),f=r.mode,E=Sl({mode:"hidden",children:E},f),l=Ms(l,f,a,null),E.return=r,l.return=r,E.sibling=l,r.child=E,l=r.child,l.memoizedState=Vf(a),l.childLanes=Yf(e,w,a),r.memoizedState=Gf,Ma(null,l)):(Xr(r),Kf(r,E))}var R=e.memoizedState;if(R!==null&&(E=R.dehydrated,E!==null)){if(p)r.flags&256?(Xr(r),r.flags&=-257,r=Jf(e,r,a)):r.memoizedState!==null?(Wr(),r.child=e.child,r.flags|=128,r=null):(Wr(),E=l.fallback,f=r.mode,l=Sl({mode:"visible",children:l.children},f),E=Ms(E,f,a,null),E.flags|=2,l.return=r,E.return=r,l.sibling=E,r.child=l,Ps(r,e.child,null,a),l=r.child,l.memoizedState=Vf(a),l.childLanes=Yf(e,w,a),r.memoizedState=Gf,r=Ma(null,l));else if(Xr(r),Nh(E)){if(w=E.nextSibling&&E.nextSibling.dataset,w)var F=w.dgst;w=F,l=Error(i(419)),l.stack="",l.digest=w,va({value:l,source:null,stack:null}),r=Jf(e,r,a)}else if(St||yi(e,r,a,!1),w=(a&e.childLanes)!==0,St||w){if(w=tt,w!==null&&(l=Ir(w,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,Cs(e,l),nn(w,e,l),Hf;kh(E)||Ml(),r=Jf(e,r,a)}else kh(E)?(r.flags|=192,r.child=e.child,r=null):(e=R.treeContext,st=qn(E.nextSibling),qt=r,Ue=!0,Gr=null,Rn=!1,e!==null&&y0(r,e),r=Kf(r,l.children),r.flags|=4096);return r}return f?(Wr(),E=l.fallback,f=r.mode,R=e.child,F=R.sibling,l=dr(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,F!==null?E=dr(F,E):(E=Ms(E,f,a,null),E.flags|=2),E.return=r,l.return=r,l.sibling=E,r.child=l,Ma(null,l),l=r.child,E=e.child.memoizedState,E===null?E=Vf(a):(f=E.cachePool,f!==null?(R=_t._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=w0(),E={baseLanes:E.baseLanes|a,cachePool:f}),l.memoizedState=E,l.childLanes=Yf(e,w,a),r.memoizedState=Gf,Ma(e.child,l)):(Xr(r),a=e.child,e=a.sibling,a=dr(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,e!==null&&(w=r.deletions,w===null?(r.deletions=[e],r.flags|=16):w.push(e)),r.child=a,r.memoizedState=null,a)}function Kf(e,r){return r=Sl({mode:"visible",children:r},e.mode),r.return=e,e.child=r}function Sl(e,r){return e=ln(22,e,null,r),e.lanes=0,e}function Jf(e,r,a){return Ps(r,e.child,null,a),e=Kf(r,r.pendingProps.children),e.flags|=2,r.memoizedState=null,e}function qp(e,r,a){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r),uf(e.return,r,a)}function Qf(e,r,a,l,f,p){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:p}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=l,w.tail=a,w.tailMode=f,w.treeForkCount=p)}function Lp(e,r,a){var l=r.pendingProps,f=l.revealOrder,p=l.tail;l=l.children;var w=bt.current,E=(w&2)!==0;if(E?(w=w&1|2,r.flags|=128):w&=1,Te(bt,w),Bt(e,r,l,a),l=Ue?xa:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=r.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&qp(e,a,r);else if(e.tag===19)qp(e,a,r);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===r)break e;for(;e.sibling===null;){if(e.return===null||e.return===r)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=r.child,f=null;a!==null;)e=a.alternate,e!==null&&fl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=r.child,r.child=null):(f=a.sibling,a.sibling=null),Qf(r,!1,f,a,p,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=r.child,r.child=null;f!==null;){if(e=f.alternate,e!==null&&fl(e)===null){r.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Qf(r,!0,a,null,p,l);break;case"together":Qf(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function xr(e,r,a){if(e!==null&&(r.dependencies=e.dependencies),ts|=r.lanes,(a&r.childLanes)===0)if(e!==null){if(yi(e,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(e!==null&&r.child!==e.child)throw Error(i(153));if(r.child!==null){for(e=r.child,a=dr(e,e.pendingProps),r.child=a,a.return=r;e.sibling!==null;)e=e.sibling,a=a.sibling=dr(e,e.pendingProps),a.return=r;a.sibling=null}return r.child}function Xf(e,r){return(e.lanes&r)!==0?!0:(e=e.dependencies,!!(e!==null&&rl(e)))}function B_(e,r,a){switch(r.tag){case 3:ft(r,r.stateNode.containerInfo),Yr(r,_t,e.memoizedState.cache),Rs();break;case 27:case 5:pe(r);break;case 4:ft(r,r.stateNode.containerInfo);break;case 10:Yr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,wf(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(Xr(r),r.flags|=128,null):(a&r.child.childLanes)!==0?Dp(e,r,a):(Xr(r),e=xr(e,r,a),e!==null?e.sibling:null);Xr(r);break;case 19:var f=(e.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(yi(e,r,a,!1),l=(a&r.childLanes)!==0),f){if(l)return Lp(e,r,a);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Te(bt,bt.current),l)break;return null;case 22:return r.lanes=0,kp(e,r,a,r.pendingProps);case 24:Yr(r,_t,e.memoizedState.cache)}return xr(e,r,a)}function Bp(e,r,a){if(e!==null)if(e.memoizedProps!==r.pendingProps)St=!0;else{if(!Xf(e,a)&&(r.flags&128)===0)return St=!1,B_(e,r,a);St=(e.flags&131072)!==0}else St=!1,Ue&&(r.flags&1048576)!==0&&p0(r,xa,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(e=Bs(r.elementType),r.type=e,typeof e=="function")tf(e)?(l=$s(e,l),r.tag=1,r=Mp(null,r,e,l,a)):(r.tag=0,r=Ff(null,r,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===le){r.tag=11,r=Op(null,r,e,l,a);break e}else if(f===ae){r.tag=14,r=Ap(null,r,e,l,a);break e}}throw r=ve(e)||e,Error(i(306,r,""))}}return r;case 0:return Ff(e,r,r.type,r.pendingProps,a);case 1:return l=r.type,f=$s(l,r.pendingProps),Mp(e,r,l,f,a);case 3:e:{if(ft(r,r.stateNode.containerInfo),e===null)throw Error(i(387));l=r.pendingProps;var p=r.memoizedState;f=p.element,gf(e,r),ja(r,l,null,a);var w=r.memoizedState;if(l=w.cache,Yr(r,_t,l),l!==p.cache&&ff(r,[_t],a,!0),Aa(),l=w.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=p,r.memoizedState=p,r.flags&256){r=Rp(e,r,l,a);break e}else if(l!==f){f=Tn(Error(i(424)),r),va(f),r=Rp(e,r,l,a);break e}else{switch(e=r.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(st=qn(e.firstChild),qt=r,Ue=!0,Gr=null,Rn=!0,a=k0(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Rs(),l===f){r=xr(e,r,a);break e}Bt(e,r,l,a)}r=r.child}return r;case 26:return wl(e,r),e===null?(a=Ky(r.type,null,r.pendingProps,null))?r.memoizedState=a:Ue||(a=r.type,e=r.pendingProps,l=Pl(Dt.current).createElement(a),l[et]=r,l[dt]=e,Ut(l,a,e),q(l),r.stateNode=l):r.memoizedState=Ky(r.type,e.memoizedProps,r.pendingProps,e.memoizedState),null;case 27:return pe(r),e===null&&Ue&&(l=r.stateNode=Gy(r.type,r.pendingProps,Dt.current),qt=r,Rn=!0,f=st,as(r.type)?(Th=f,st=qn(l.firstChild)):st=f),Bt(e,r,r.pendingProps.children,a),wl(e,r),e===null&&(r.flags|=4194304),r.child;case 5:return e===null&&Ue&&((f=l=st)&&(l=dw(l,r.type,r.pendingProps,Rn),l!==null?(r.stateNode=l,qt=r,st=qn(l.firstChild),Rn=!1,f=!0):f=!1),f||Vr(r)),pe(r),f=r.type,p=r.pendingProps,w=e!==null?e.memoizedProps:null,l=p.children,Oh(f,p)?l=null:w!==null&&Oh(f,w)&&(r.flags|=32),r.memoizedState!==null&&(f=Ef(e,r,k_,null,null,a),Ya._currentValue=f),wl(e,r),Bt(e,r,l,a),r.child;case 6:return e===null&&Ue&&((e=a=st)&&(a=mw(a,r.pendingProps,Rn),a!==null?(r.stateNode=a,qt=r,st=null,e=!0):e=!1),e||Vr(r)),null;case 13:return Dp(e,r,a);case 4:return ft(r,r.stateNode.containerInfo),l=r.pendingProps,e===null?r.child=Ps(r,null,l,a):Bt(e,r,l,a),r.child;case 11:return Op(e,r,r.type,r.pendingProps,a);case 7:return Bt(e,r,r.pendingProps,a),r.child;case 8:return Bt(e,r,r.pendingProps.children,a),r.child;case 12:return Bt(e,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Yr(r,r.type,l.value),Bt(e,r,l.children,a),r.child;case 9:return f=r.type._context,l=r.pendingProps.children,qs(r),f=Lt(f),l=l(f),r.flags|=1,Bt(e,r,l,a),r.child;case 14:return Ap(e,r,r.type,r.pendingProps,a);case 15:return jp(e,r,r.type,r.pendingProps,a);case 19:return Lp(e,r,a);case 31:return L_(e,r,a);case 22:return kp(e,r,a,r.pendingProps);case 24:return qs(r),l=Lt(_t),e===null?(f=mf(),f===null&&(f=tt,p=hf(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=a),f=p),r.memoizedState={parent:l,cache:f},yf(r),Yr(r,_t,f)):((e.lanes&a)!==0&&(gf(e,r),ja(r,null,null,a),Aa()),f=e.memoizedState,p=r.memoizedState,f.parent!==l?(f={parent:l,cache:l},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Yr(r,_t,l)):(l=p.cache,Yr(r,_t,l),l!==f.cache&&ff(r,[_t],a,!0))),Bt(e,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function vr(e){e.flags|=4}function Wf(e,r,a,l,f){if((r=(e.mode&32)!==0)&&(r=!1),r){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(uy())e.flags|=8192;else throw Us=ol,pf}else e.flags&=-16777217}function Up(e,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Zy(r))if(uy())e.flags|=8192;else throw Us=ol,pf}function El(e,r){r!==null&&(e.flags|=4),e.flags&16384&&(r=e.tag!==22?ni():536870912,e.lanes|=r,ki|=r)}function Ra(e,r){if(!Ue)switch(e.tailMode){case"hidden":r=e.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function it(e){var r=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(r)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,r}function U_(e,r,a){var l=r.pendingProps;switch(af(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return it(r),null;case 1:return it(r),null;case 3:return a=r.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),yr(_t),fe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(pi(r)?vr(r):e===null||e.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,lf())),it(r),null;case 26:var f=r.type,p=r.memoizedState;return e===null?(vr(r),p!==null?(it(r),Up(r,p)):(it(r),Wf(r,f,null,l,a))):p?p!==e.memoizedState?(vr(r),it(r),Up(r,p)):(it(r),r.flags&=-16777217):(e=e.memoizedProps,e!==l&&vr(r),it(r),Wf(r,f,e,l,a)),null;case 27:if(ht(r),a=Dt.current,f=r.type,e!==null&&r.stateNode!=null)e.memoizedProps!==l&&vr(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return it(r),null}e=nt.current,pi(r)?g0(r):(e=Gy(f,l,a),r.stateNode=e,vr(r))}return it(r),null;case 5:if(ht(r),f=r.type,e!==null&&r.stateNode!=null)e.memoizedProps!==l&&vr(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return it(r),null}if(p=nt.current,pi(r))g0(r);else{var w=Pl(Dt.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?w.createElement("select",{is:l.is}):w.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?w.createElement(f,{is:l.is}):w.createElement(f)}}p[et]=r,p[dt]=l;e:for(w=r.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===r)break e;for(;w.sibling===null;){if(w.return===null||w.return===r)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}r.stateNode=p;e:switch(Ut(p,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&vr(r)}}return it(r),Wf(r,r.type,e===null?null:e.memoizedProps,r.pendingProps,a),null;case 6:if(e&&r.stateNode!=null)e.memoizedProps!==l&&vr(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(i(166));if(e=Dt.current,pi(r)){if(e=r.stateNode,a=r.memoizedProps,l=null,f=qt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[et]=r,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Dy(e.nodeValue,a)),e||Vr(r,!0)}else e=Pl(e).createTextNode(l),e[et]=r,r.stateNode=e}return it(r),null;case 31:if(a=r.memoizedState,e===null||e.memoizedState!==null){if(l=pi(r),a!==null){if(e===null){if(!l)throw Error(i(318));if(e=r.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[et]=r}else Rs(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;it(r),e=!1}else a=lf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return r.flags&256?(un(r),r):(un(r),null);if((r.flags&128)!==0)throw Error(i(558))}return it(r),null;case 13:if(l=r.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=pi(r),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(i(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[et]=r}else Rs(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;it(r),f=!1}else f=lf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(un(r),r):(un(r),null)}return un(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=r.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==f&&(l.flags|=2048)),a!==e&&a&&(r.child.flags|=8192),El(r,r.updateQueue),it(r),null);case 4:return fe(),e===null&&vh(r.stateNode.containerInfo),it(r),null;case 10:return yr(r.type),it(r),null;case 19:if(je(bt),l=r.memoizedState,l===null)return it(r),null;if(f=(r.flags&128)!==0,p=l.rendering,p===null)if(f)Ra(l,!1);else{if(pt!==0||e!==null&&(e.flags&128)!==0)for(e=r.child;e!==null;){if(p=fl(e),p!==null){for(r.flags|=128,Ra(l,!1),e=p.updateQueue,r.updateQueue=e,El(r,e),r.subtreeFlags=0,e=a,a=r.child;a!==null;)h0(a,e),a=a.sibling;return Te(bt,bt.current&1|2),Ue&&mr(r,l.treeForkCount),r.child}e=e.sibling}l.tail!==null&&at()>Nl&&(r.flags|=128,f=!0,Ra(l,!1),r.lanes=4194304)}else{if(!f)if(e=fl(p),e!==null){if(r.flags|=128,f=!0,e=e.updateQueue,r.updateQueue=e,El(r,e),Ra(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!Ue)return it(r),null}else 2*at()-l.renderingStartTime>Nl&&a!==536870912&&(r.flags|=128,f=!0,Ra(l,!1),r.lanes=4194304);l.isBackwards?(p.sibling=r.child,r.child=p):(e=l.last,e!==null?e.sibling=p:r.child=p,l.last=p)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=at(),e.sibling=null,a=bt.current,Te(bt,f?a&1|2:a&1),Ue&&mr(r,l.treeForkCount),e):(it(r),null);case 22:case 23:return un(r),_f(),l=r.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(it(r),r.subtreeFlags&6&&(r.flags|=8192)):it(r),a=r.updateQueue,a!==null&&El(r,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),e!==null&&je(Ls),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),yr(_t),it(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function P_(e,r){switch(af(r),r.tag){case 1:return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 3:return yr(_t),fe(),e=r.flags,(e&65536)!==0&&(e&128)===0?(r.flags=e&-65537|128,r):null;case 26:case 27:case 5:return ht(r),null;case 31:if(r.memoizedState!==null){if(un(r),r.alternate===null)throw Error(i(340));Rs()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 13:if(un(r),e=r.memoizedState,e!==null&&e.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Rs()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 19:return je(bt),null;case 4:return fe(),null;case 10:return yr(r.type),null;case 22:case 23:return un(r),_f(),e!==null&&je(Ls),e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 24:return yr(_t),null;case 25:return null;default:return null}}function Pp(e,r){switch(af(r),r.tag){case 3:yr(_t),fe();break;case 26:case 27:case 5:ht(r);break;case 4:fe();break;case 31:r.memoizedState!==null&&un(r);break;case 13:un(r);break;case 19:je(bt);break;case 10:yr(r.type);break;case 22:case 23:un(r),_f(),e!==null&&je(Ls);break;case 24:yr(_t)}}function Da(e,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var p=a.create,w=a.inst;l=p(),w.destroy=l}a=a.next}while(a!==f)}}catch(E){Je(r,r.return,E)}}function Zr(e,r,a){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var p=f.next;l=p;do{if((l.tag&e)===e){var w=l.inst,E=w.destroy;if(E!==void 0){w.destroy=void 0,f=r;var R=a,F=E;try{F()}catch(X){Je(f,R,X)}}}l=l.next}while(l!==p)}}catch(X){Je(r,r.return,X)}}function zp(e){var r=e.updateQueue;if(r!==null){var a=e.stateNode;try{T0(r,a)}catch(l){Je(e,e.return,l)}}}function $p(e,r,a){a.props=$s(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Je(e,r,l)}}function qa(e,r){try{var a=e.ref;if(a!==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 a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){Je(e,r,f)}}function tr(e,r){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){Je(e,r,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){Je(e,r,f)}else a.current=null}function Ip(e){var r=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){Je(e,e.return,f)}}function Zf(e,r,a){try{var l=e.stateNode;ow(l,e.type,a,r),l[dt]=r}catch(f){Je(e,e.return,f)}}function Hp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&as(e.type)||e.tag===4}function eh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Hp(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&&as(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 th(e,r,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(e),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=fr));else if(l!==4&&(l===27&&as(e.type)&&(a=e.stateNode,r=null),e=e.child,e!==null))for(th(e,r,a),e=e.sibling;e!==null;)th(e,r,a),e=e.sibling}function Ol(e,r,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,r?a.insertBefore(e,r):a.appendChild(e);else if(l!==4&&(l===27&&as(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Ol(e,r,a),e=e.sibling;e!==null;)Ol(e,r,a),e=e.sibling}function Fp(e){var r=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Ut(r,l,a),r[et]=e,r[dt]=a}catch(p){Je(e,e.return,p)}}var _r=!1,Et=!1,nh=!1,Gp=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function z_(e,r){if(e=e.containerInfo,Sh=Vl,e=r0(e),Ku(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,E=-1,R=-1,F=0,X=0,se=e,G=null;t:for(;;){for(var J;se!==a||f!==0&&se.nodeType!==3||(E=w+f),se!==p||l!==0&&se.nodeType!==3||(R=w+l),se.nodeType===3&&(w+=se.nodeValue.length),(J=se.firstChild)!==null;)G=se,se=J;for(;;){if(se===e)break t;if(G===a&&++F===f&&(E=w),G===p&&++X===l&&(R=w),(J=se.nextSibling)!==null)break;se=G,G=se.parentNode}se=J}a=E===-1||R===-1?null:{start:E,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Eh={focusedElem:e,selectionRange:a},Vl=!1,Tt=r;Tt!==null;)if(r=Tt,e=r.child,(r.subtreeFlags&1028)!==0&&e!==null)e.return=r,Tt=e;else for(;Tt!==null;){switch(r=Tt,p=r.alternate,e=r.flags,r.tag){case 0:if((e&4)!==0&&(e=r.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=r,f=p.memoizedProps,p=p.memoizedState,l=a.stateNode;try{var be=$s(a.type,f);e=l.getSnapshotBeforeUpdate(be,p),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ae){Je(a,a.return,Ae)}}break;case 3:if((e&1024)!==0){if(e=r.stateNode.containerInfo,a=e.nodeType,a===9)jh(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":jh(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(i(163))}if(e=r.sibling,e!==null){e.return=r.return,Tt=e;break}Tt=r.return}}function Vp(e,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Sr(e,a),l&4&&Da(5,a);break;case 1:if(Sr(e,a),l&4)if(e=a.stateNode,r===null)try{e.componentDidMount()}catch(w){Je(a,a.return,w)}else{var f=$s(a.type,r.memoizedProps);r=r.memoizedState;try{e.componentDidUpdate(f,r,e.__reactInternalSnapshotBeforeUpdate)}catch(w){Je(a,a.return,w)}}l&64&&zp(a),l&512&&qa(a,a.return);break;case 3:if(Sr(e,a),l&64&&(e=a.updateQueue,e!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{T0(e,r)}catch(w){Je(a,a.return,w)}}break;case 27:r===null&&l&4&&Fp(a);case 26:case 5:Sr(e,a),r===null&&l&4&&Ip(a),l&512&&qa(a,a.return);break;case 12:Sr(e,a);break;case 31:Sr(e,a),l&4&&Jp(e,a);break;case 13:Sr(e,a),l&4&&Qp(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=J_.bind(null,a),pw(e,a))));break;case 22:if(l=a.memoizedState!==null||_r,!l){r=r!==null&&r.memoizedState!==null||Et,f=_r;var p=Et;_r=l,(Et=r)&&!p?Er(e,a,(a.subtreeFlags&8772)!==0):Sr(e,a),_r=f,Et=p}break;case 30:break;default:Sr(e,a)}}function Yp(e){var r=e.alternate;r!==null&&(e.alternate=null,Yp(r)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(r=e.stateNode,r!==null&&ri(r)),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 ot=null,Wt=!1;function wr(e,r,a){for(a=a.child;a!==null;)Kp(e,r,a),a=a.sibling}function Kp(e,r,a){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(ws,a)}catch{}switch(a.tag){case 26:Et||tr(a,r),wr(e,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Et||tr(a,r);var l=ot,f=Wt;as(a.type)&&(ot=a.stateNode,Wt=!1),wr(e,r,a),Fa(a.stateNode),ot=l,Wt=f;break;case 5:Et||tr(a,r);case 6:if(l=ot,f=Wt,ot=null,wr(e,r,a),ot=l,Wt=f,ot!==null)if(Wt)try{(ot.nodeType===9?ot.body:ot.nodeName==="HTML"?ot.ownerDocument.body:ot).removeChild(a.stateNode)}catch(p){Je(a,r,p)}else try{ot.removeChild(a.stateNode)}catch(p){Je(a,r,p)}break;case 18:ot!==null&&(Wt?(e=ot,zy(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Li(e)):zy(ot,a.stateNode));break;case 4:l=ot,f=Wt,ot=a.stateNode.containerInfo,Wt=!0,wr(e,r,a),ot=l,Wt=f;break;case 0:case 11:case 14:case 15:Zr(2,a,r),Et||Zr(4,a,r),wr(e,r,a);break;case 1:Et||(tr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&$p(a,r,l)),wr(e,r,a);break;case 21:wr(e,r,a);break;case 22:Et=(l=Et)||a.memoizedState!==null,wr(e,r,a),Et=l;break;default:wr(e,r,a)}}function Jp(e,r){if(r.memoizedState===null&&(e=r.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Li(e)}catch(a){Je(r,r.return,a)}}}function Qp(e,r){if(r.memoizedState===null&&(e=r.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Li(e)}catch(a){Je(r,r.return,a)}}function $_(e){switch(e.tag){case 31:case 13:case 19:var r=e.stateNode;return r===null&&(r=e.stateNode=new Gp),r;case 22:return e=e.stateNode,r=e._retryCache,r===null&&(r=e._retryCache=new Gp),r;default:throw Error(i(435,e.tag))}}function Al(e,r){var a=$_(e);r.forEach(function(l){if(!a.has(l)){a.add(l);var f=Q_.bind(null,e,l);l.then(f,f)}})}function Zt(e,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],p=e,w=r,E=w;e:for(;E!==null;){switch(E.tag){case 27:if(as(E.type)){ot=E.stateNode,Wt=!1;break e}break;case 5:ot=E.stateNode,Wt=!1;break e;case 3:case 4:ot=E.stateNode.containerInfo,Wt=!0;break e}E=E.return}if(ot===null)throw Error(i(160));Kp(p,w,f),ot=null,Wt=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Xp(r,e),r=r.sibling}var Fn=null;function Xp(e,r){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Zt(r,e),en(e),l&4&&(Zr(3,e,e.return),Da(3,e),Zr(5,e,e.return));break;case 1:Zt(r,e),en(e),l&512&&(Et||a===null||tr(a,a.return)),l&64&&_r&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Fn;if(Zt(r,e),en(e),l&512&&(Et||a===null||tr(a,a.return)),l&4){var p=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":p=f.getElementsByTagName("title")[0],(!p||p[At]||p[et]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(l),f.head.insertBefore(p,f.querySelector("head > title"))),Ut(p,l,a),p[et]=e,q(p),l=p;break e;case"link":var w=Xy("link","href",f).get(l+(a.href||""));if(w){for(var E=0;E<w.length;E++)if(p=w[E],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(E,1);break t}}p=f.createElement(l),Ut(p,l,a),f.head.appendChild(p);break;case"meta":if(w=Xy("meta","content",f).get(l+(a.content||""))){for(E=0;E<w.length;E++)if(p=w[E],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(E,1);break t}}p=f.createElement(l),Ut(p,l,a),f.head.appendChild(p);break;default:throw Error(i(468,l))}p[et]=e,q(p),l=p}e.stateNode=l}else Wy(f,e.type,e.stateNode);else e.stateNode=Qy(f,l,e.memoizedProps);else p!==l?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,l===null?Wy(f,e.type,e.stateNode):Qy(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Zf(e,e.memoizedProps,a.memoizedProps)}break;case 27:Zt(r,e),en(e),l&512&&(Et||a===null||tr(a,a.return)),a!==null&&l&4&&Zf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Zt(r,e),en(e),l&512&&(Et||a===null||tr(a,a.return)),e.flags&32){f=e.stateNode;try{ii(f,"")}catch(be){Je(e,e.return,be)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Zf(e,f,a!==null?a.memoizedProps:f)),l&1024&&(nh=!0);break;case 6:if(Zt(r,e),en(e),l&4){if(e.stateNode===null)throw Error(i(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(be){Je(e,e.return,be)}}break;case 3:if(Il=null,f=Fn,Fn=zl(r.containerInfo),Zt(r,e),Fn=f,en(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Li(r.containerInfo)}catch(be){Je(e,e.return,be)}nh&&(nh=!1,Wp(e));break;case 4:l=Fn,Fn=zl(e.stateNode.containerInfo),Zt(r,e),en(e),Fn=l;break;case 12:Zt(r,e),en(e);break;case 31:Zt(r,e),en(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Al(e,l)));break;case 13:Zt(r,e),en(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(kl=at()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Al(e,l)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,F=_r,X=Et;if(_r=F||f,Et=X||R,Zt(r,e),Et=X,_r=F,en(e),l&8192)e:for(r=e.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(a===null||R||_r||Et||Is(e)),a=null,r=e;;){if(r.tag===5||r.tag===26){if(a===null){R=a=r;try{if(p=R.stateNode,f)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{E=R.stateNode;var se=R.memoizedProps.style,G=se!=null&&se.hasOwnProperty("display")?se.display:null;E.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(be){Je(R,R.return,be)}}}else if(r.tag===6){if(a===null){R=r;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(be){Je(R,R.return,be)}}}else if(r.tag===18){if(a===null){R=r;try{var J=R.stateNode;f?$y(J,!0):$y(R.stateNode,!1)}catch(be){Je(R,R.return,be)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===e)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break e;for(;r.sibling===null;){if(r.return===null||r.return===e)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Al(e,a))));break;case 19:Zt(r,e),en(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Al(e,l)));break;case 30:break;case 21:break;default:Zt(r,e),en(e)}}function en(e){var r=e.flags;if(r&2){try{for(var a,l=e.return;l!==null;){if(Hp(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var f=a.stateNode,p=eh(e);Ol(e,p,f);break;case 5:var w=a.stateNode;a.flags&32&&(ii(w,""),a.flags&=-33);var E=eh(e);Ol(e,E,w);break;case 3:case 4:var R=a.stateNode.containerInfo,F=eh(e);th(e,F,R);break;default:throw Error(i(161))}}catch(X){Je(e,e.return,X)}e.flags&=-3}r&4096&&(e.flags&=-4097)}function Wp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var r=e;Wp(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),e=e.sibling}}function Sr(e,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Vp(e,r.alternate,r),r=r.sibling}function Is(e){for(e=e.child;e!==null;){var r=e;switch(r.tag){case 0:case 11:case 14:case 15:Zr(4,r,r.return),Is(r);break;case 1:tr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&$p(r,r.return,a),Is(r);break;case 27:Fa(r.stateNode);case 26:case 5:tr(r,r.return),Is(r);break;case 22:r.memoizedState===null&&Is(r);break;case 30:Is(r);break;default:Is(r)}e=e.sibling}}function Er(e,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,f=e,p=r,w=p.flags;switch(p.tag){case 0:case 11:case 15:Er(f,p,a),Da(4,p);break;case 1:if(Er(f,p,a),l=p,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(F){Je(l,l.return,F)}if(l=p,f=l.updateQueue,f!==null){var E=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)N0(R[f],E)}catch(F){Je(l,l.return,F)}}a&&w&64&&zp(p),qa(p,p.return);break;case 27:Fp(p);case 26:case 5:Er(f,p,a),a&&l===null&&w&4&&Ip(p),qa(p,p.return);break;case 12:Er(f,p,a);break;case 31:Er(f,p,a),a&&w&4&&Jp(f,p);break;case 13:Er(f,p,a),a&&w&4&&Qp(f,p);break;case 22:p.memoizedState===null&&Er(f,p,a),qa(p,p.return);break;case 30:break;default:Er(f,p,a)}r=r.sibling}}function rh(e,r){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(e=r.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&_a(a))}function sh(e,r){e=null,r.alternate!==null&&(e=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==e&&(r.refCount++,e!=null&&_a(e))}function Gn(e,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Zp(e,r,a,l),r=r.sibling}function Zp(e,r,a,l){var f=r.flags;switch(r.tag){case 0:case 11:case 15:Gn(e,r,a,l),f&2048&&Da(9,r);break;case 1:Gn(e,r,a,l);break;case 3:Gn(e,r,a,l),f&2048&&(e=null,r.alternate!==null&&(e=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==e&&(r.refCount++,e!=null&&_a(e)));break;case 12:if(f&2048){Gn(e,r,a,l),e=r.stateNode;try{var p=r.memoizedProps,w=p.id,E=p.onPostCommit;typeof E=="function"&&E(w,r.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Je(r,r.return,R)}}else Gn(e,r,a,l);break;case 31:Gn(e,r,a,l);break;case 13:Gn(e,r,a,l);break;case 23:break;case 22:p=r.stateNode,w=r.alternate,r.memoizedState!==null?p._visibility&2?Gn(e,r,a,l):La(e,r):p._visibility&2?Gn(e,r,a,l):(p._visibility|=2,Oi(e,r,a,l,(r.subtreeFlags&10256)!==0||!1)),f&2048&&rh(w,r);break;case 24:Gn(e,r,a,l),f&2048&&sh(r.alternate,r);break;default:Gn(e,r,a,l)}}function Oi(e,r,a,l,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var p=e,w=r,E=a,R=l,F=w.flags;switch(w.tag){case 0:case 11:case 15:Oi(p,w,E,R,f),Da(8,w);break;case 23:break;case 22:var X=w.stateNode;w.memoizedState!==null?X._visibility&2?Oi(p,w,E,R,f):La(p,w):(X._visibility|=2,Oi(p,w,E,R,f)),f&&F&2048&&rh(w.alternate,w);break;case 24:Oi(p,w,E,R,f),f&&F&2048&&sh(w.alternate,w);break;default:Oi(p,w,E,R,f)}r=r.sibling}}function La(e,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=e,l=r,f=l.flags;switch(l.tag){case 22:La(a,l),f&2048&&rh(l.alternate,l);break;case 24:La(a,l),f&2048&&sh(l.alternate,l);break;default:La(a,l)}r=r.sibling}}var Ba=8192;function Ai(e,r,a){if(e.subtreeFlags&Ba)for(e=e.child;e!==null;)ey(e,r,a),e=e.sibling}function ey(e,r,a){switch(e.tag){case 26:Ai(e,r,a),e.flags&Ba&&e.memoizedState!==null&&jw(a,Fn,e.memoizedState,e.memoizedProps);break;case 5:Ai(e,r,a);break;case 3:case 4:var l=Fn;Fn=zl(e.stateNode.containerInfo),Ai(e,r,a),Fn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Ba,Ba=16777216,Ai(e,r,a),Ba=l):Ai(e,r,a));break;default:Ai(e,r,a)}}function ty(e){var r=e.alternate;if(r!==null&&(e=r.child,e!==null)){r.child=null;do r=e.sibling,e.sibling=null,e=r;while(e!==null)}}function Ua(e){var r=e.deletions;if((e.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Tt=l,ry(l,e)}ty(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ny(e),e=e.sibling}function ny(e){switch(e.tag){case 0:case 11:case 15:Ua(e),e.flags&2048&&Zr(9,e,e.return);break;case 3:Ua(e);break;case 12:Ua(e);break;case 22:var r=e.stateNode;e.memoizedState!==null&&r._visibility&2&&(e.return===null||e.return.tag!==13)?(r._visibility&=-3,jl(e)):Ua(e);break;default:Ua(e)}}function jl(e){var r=e.deletions;if((e.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Tt=l,ry(l,e)}ty(e)}for(e=e.child;e!==null;){switch(r=e,r.tag){case 0:case 11:case 15:Zr(8,r,r.return),jl(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,jl(r));break;default:jl(r)}e=e.sibling}}function ry(e,r){for(;Tt!==null;){var a=Tt;switch(a.tag){case 0:case 11:case 15:Zr(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:_a(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Tt=l;else e:for(a=e;Tt!==null;){l=Tt;var f=l.sibling,p=l.return;if(Yp(l),l===a){Tt=null;break e}if(f!==null){f.return=p,Tt=f;break e}Tt=p}}}var I_={getCacheForType:function(e){var r=Lt(_t),a=r.data.get(e);return a===void 0&&(a=e(),r.data.set(e,a)),a},cacheSignal:function(){return Lt(_t).controller.signal}},H_=typeof WeakMap=="function"?WeakMap:Map,Ye=0,tt=null,De=null,Le=0,Ke=0,fn=null,es=!1,ji=!1,ih=!1,Or=0,pt=0,ts=0,Hs=0,ah=0,hn=0,ki=0,Pa=null,tn=null,oh=!1,kl=0,sy=0,Nl=1/0,Tl=null,ns=null,jt=0,rs=null,Ni=null,Ar=0,lh=0,ch=null,iy=null,za=0,uh=null;function dn(){return(Ye&2)!==0&&Le!==0?Le&-Le:Y.T!==null?yh():la()}function ay(){if(hn===0)if((Le&536870912)===0||Ue){var e=lr;lr<<=1,(lr&3932160)===0&&(lr=262144),hn=e}else hn=536870912;return e=cn.current,e!==null&&(e.flags|=32),hn}function nn(e,r,a){(e===tt&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(Ti(e,0),ss(e,Le,hn,!1)),$n(e,a),((Ye&2)===0||e!==tt)&&(e===tt&&((Ye&2)===0&&(Hs|=a),pt===4&&ss(e,Le,hn,!1)),nr(e))}function oy(e,r,a){if((Ye&6)!==0)throw Error(i(327));var l=!a&&(r&127)===0&&(r&e.expiredLanes)===0||Es(e,r),f=l?V_(e,r):hh(e,r,!0),p=l;do{if(f===0){ji&&!l&&ss(e,r,0,!1);break}else{if(a=e.current.alternate,p&&!F_(a)){f=hh(e,r,!1),p=!1;continue}if(f===2){if(p=r,e.errorRecoveryDisabledLanes&p)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var E=e;f=Pa;var R=E.current.memoizedState.isDehydrated;if(R&&(Ti(E,w).flags|=256),w=hh(E,w,!1),w!==2){if(ih&&!R){E.errorRecoveryDisabledLanes|=p,Hs|=p,f=4;break e}p=tn,tn=f,p!==null&&(tn===null?tn=p:tn.push.apply(tn,p))}f=w}if(p=!1,f!==2)continue}}if(f===1){Ti(e,0),ss(e,r,0,!0);break}e:{switch(l=e,p=f,p){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:ss(l,r,hn,!es);break e;case 2:tn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(f=kl+300-at(),10<f)){if(ss(l,r,hn,!es),Ss(l,0,!0)!==0)break e;Ar=r,l.timeoutHandle=Uy(ly.bind(null,l,a,tn,Tl,oh,r,hn,Hs,ki,es,p,"Throttled",-0,0),f);break e}ly(l,a,tn,Tl,oh,r,hn,Hs,ki,es,p,null,-0,0)}}break}while(!0);nr(e)}function ly(e,r,a,l,f,p,w,E,R,F,X,se,G,J){if(e.timeoutHandle=-1,se=r.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:fr},ey(r,p,se);var be=(p&62914560)===p?kl-at():(p&4194048)===p?sy-at():0;if(be=kw(se,be),be!==null){Ar=p,e.cancelPendingCommit=be(yy.bind(null,e,r,p,a,l,f,w,E,R,X,se,null,G,J)),ss(e,p,w,!F);return}}yy(e,r,p,a,l,f,w,E,R)}function F_(e){for(var r=e;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],p=f.getSnapshot;f=f.value;try{if(!on(p(),f))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function ss(e,r,a,l){r&=~ah,r&=~Hs,e.suspendedLanes|=r,e.pingedLanes&=~r,l&&(e.warmLanes|=r),l=e.expirationTimes;for(var f=r;0<f;){var p=31-$t(f),w=1<<p;l[p]=-1,f&=~w}a!==0&&$r(e,a,r)}function Cl(){return(Ye&6)===0?($a(0),!1):!0}function fh(){if(De!==null){if(Ke===0)var e=De.return;else e=De,pr=Ds=null,jf(e),vi=null,Sa=0,e=De;for(;e!==null;)Pp(e.alternate,e),e=e.return;De=null}}function Ti(e,r){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,uw(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Ar=0,fh(),tt=e,De=a=dr(e.current,null),Le=r,Ke=0,fn=null,es=!1,ji=Es(e,r),ih=!1,ki=hn=ah=Hs=ts=pt=0,tn=Pa=null,oh=!1,(r&8)!==0&&(r|=r&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=r;0<l;){var f=31-$t(l),p=1<<f;r|=e[f],l&=~p}return Or=r,Wo(),a}function cy(e,r){Ce=null,Y.H=Ca,r===xi||r===al?(r=O0(),Ke=3):r===pf?(r=O0(),Ke=4):Ke=r===Hf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,fn=r,De===null&&(pt=1,vl(e,Tn(r,e.current)))}function uy(){var e=cn.current;return e===null?!0:(Le&4194048)===Le?Dn===null:(Le&62914560)===Le||(Le&536870912)!==0?e===Dn:!1}function fy(){var e=Y.H;return Y.H=Ca,e===null?Ca:e}function hy(){var e=Y.A;return Y.A=I_,e}function Ml(){pt=4,es||(Le&4194048)!==Le&&cn.current!==null||(ji=!0),(ts&134217727)===0&&(Hs&134217727)===0||tt===null||ss(tt,Le,hn,!1)}function hh(e,r,a){var l=Ye;Ye|=2;var f=fy(),p=hy();(tt!==e||Le!==r)&&(Tl=null,Ti(e,r)),r=!1;var w=pt;e:do try{if(Ke!==0&&De!==null){var E=De,R=fn;switch(Ke){case 8:fh(),w=6;break e;case 3:case 2:case 9:case 6:cn.current===null&&(r=!0);var F=Ke;if(Ke=0,fn=null,Ci(e,E,R,F),a&&ji){w=0;break e}break;default:F=Ke,Ke=0,fn=null,Ci(e,E,R,F)}}G_(),w=pt;break}catch(X){cy(e,X)}while(!0);return r&&e.shellSuspendCounter++,pr=Ds=null,Ye=l,Y.H=f,Y.A=p,De===null&&(tt=null,Le=0,Wo()),w}function G_(){for(;De!==null;)dy(De)}function V_(e,r){var a=Ye;Ye|=2;var l=fy(),f=hy();tt!==e||Le!==r?(Tl=null,Nl=at()+500,Ti(e,r)):ji=Es(e,r);e:do try{if(Ke!==0&&De!==null){r=De;var p=fn;t:switch(Ke){case 1:Ke=0,fn=null,Ci(e,r,p,1);break;case 2:case 9:if(S0(p)){Ke=0,fn=null,my(r);break}r=function(){Ke!==2&&Ke!==9||tt!==e||(Ke=7),nr(e)},p.then(r,r);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:S0(p)?(Ke=0,fn=null,my(r)):(Ke=0,fn=null,Ci(e,r,p,7));break;case 5:var w=null;switch(De.tag){case 26:w=De.memoizedState;case 5:case 27:var E=De;if(w?Zy(w):E.stateNode.complete){Ke=0,fn=null;var R=E.sibling;if(R!==null)De=R;else{var F=E.return;F!==null?(De=F,Rl(F)):De=null}break t}}Ke=0,fn=null,Ci(e,r,p,5);break;case 6:Ke=0,fn=null,Ci(e,r,p,6);break;case 8:fh(),pt=6;break e;default:throw Error(i(462))}}Y_();break}catch(X){cy(e,X)}while(!0);return pr=Ds=null,Y.H=l,Y.A=f,Ye=a,De!==null?0:(tt=null,Le=0,Wo(),pt)}function Y_(){for(;De!==null&&!qo();)dy(De)}function dy(e){var r=Bp(e.alternate,e,Or);e.memoizedProps=e.pendingProps,r===null?Rl(e):De=r}function my(e){var r=e,a=r.alternate;switch(r.tag){case 15:case 0:r=Cp(a,r,r.pendingProps,r.type,void 0,Le);break;case 11:r=Cp(a,r,r.pendingProps,r.type.render,r.ref,Le);break;case 5:jf(r);default:Pp(a,r),r=De=h0(r,Or),r=Bp(a,r,Or)}e.memoizedProps=e.pendingProps,r===null?Rl(e):De=r}function Ci(e,r,a,l){pr=Ds=null,jf(r),vi=null,Sa=0;var f=r.return;try{if(q_(e,f,r,a,Le)){pt=1,vl(e,Tn(a,e.current)),De=null;return}}catch(p){if(f!==null)throw De=f,p;pt=1,vl(e,Tn(a,e.current)),De=null;return}r.flags&32768?(Ue||l===1?e=!0:ji||(Le&536870912)!==0?e=!1:(es=e=!0,(l===2||l===9||l===3||l===6)&&(l=cn.current,l!==null&&l.tag===13&&(l.flags|=16384))),py(r,e)):Rl(r)}function Rl(e){var r=e;do{if((r.flags&32768)!==0){py(r,es);return}e=r.return;var a=U_(r.alternate,r,Or);if(a!==null){De=a;return}if(r=r.sibling,r!==null){De=r;return}De=r=e}while(r!==null);pt===0&&(pt=5)}function py(e,r){do{var a=P_(e.alternate,e);if(a!==null){a.flags&=32767,De=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(e=e.sibling,e!==null)){De=e;return}De=e=a}while(e!==null);pt=6,De=null}function yy(e,r,a,l,f,p,w,E,R){e.cancelPendingCommit=null;do Dl();while(jt!==0);if((Ye&6)!==0)throw Error(i(327));if(r!==null){if(r===e.current)throw Error(i(177));if(p=r.lanes|r.childLanes,p|=Zu,zr(e,a,p,w,E,R),e===tt&&(De=tt=null,Le=0),Ni=r,rs=e,Ar=a,lh=p,ch=f,iy=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,X_(ei,function(){return _y(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=Y.T,Y.T=null,f=Z.p,Z.p=2,w=Ye,Ye|=4;try{z_(e,r,a)}finally{Ye=w,Z.p=f,Y.T=l}}jt=1,gy(),by(),xy()}}function gy(){if(jt===1){jt=0;var e=rs,r=Ni,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var l=Z.p;Z.p=2;var f=Ye;Ye|=4;try{Xp(r,e);var p=Eh,w=r0(e.containerInfo),E=p.focusedElem,R=p.selectionRange;if(w!==E&&E&&E.ownerDocument&&n0(E.ownerDocument.documentElement,E)){if(R!==null&&Ku(E)){var F=R.start,X=R.end;if(X===void 0&&(X=F),"selectionStart"in E)E.selectionStart=F,E.selectionEnd=Math.min(X,E.value.length);else{var se=E.ownerDocument||document,G=se&&se.defaultView||window;if(G.getSelection){var J=G.getSelection(),be=E.textContent.length,Ae=Math.min(R.start,be),Ze=R.end===void 0?Ae:Math.min(R.end,be);!J.extend&&Ae>Ze&&(w=Ze,Ze=Ae,Ae=w);var P=t0(E,Ae),B=t0(E,Ze);if(P&&B&&(J.rangeCount!==1||J.anchorNode!==P.node||J.anchorOffset!==P.offset||J.focusNode!==B.node||J.focusOffset!==B.offset)){var H=se.createRange();H.setStart(P.node,P.offset),J.removeAllRanges(),Ae>Ze?(J.addRange(H),J.extend(B.node,B.offset)):(H.setEnd(B.node,B.offset),J.addRange(H))}}}}for(se=[],J=E;J=J.parentNode;)J.nodeType===1&&se.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<se.length;E++){var ee=se[E];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Vl=!!Sh,Eh=Sh=null}finally{Ye=f,Z.p=l,Y.T=a}}e.current=r,jt=2}}function by(){if(jt===2){jt=0;var e=rs,r=Ni,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var l=Z.p;Z.p=2;var f=Ye;Ye|=4;try{Vp(e,r.alternate,r)}finally{Ye=f,Z.p=l,Y.T=a}}jt=3}}function xy(){if(jt===4||jt===3){jt=0,Zs();var e=rs,r=Ni,a=Ar,l=iy;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?jt=5:(jt=0,Ni=rs=null,vy(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(ns=null),As(a),r=r.stateNode,gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(ws,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=Y.T,f=Z.p,Z.p=2,Y.T=null;try{for(var p=e.onRecoverableError,w=0;w<l.length;w++){var E=l[w];p(E.value,{componentStack:E.stack})}}finally{Y.T=r,Z.p=f}}(Ar&3)!==0&&Dl(),nr(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===uh?za++:(za=0,uh=e):za=0,$a(0)}}function vy(e,r){(e.pooledCacheLanes&=r)===0&&(r=e.pooledCache,r!=null&&(e.pooledCache=null,_a(r)))}function Dl(){return gy(),by(),xy(),_y()}function _y(){if(jt!==5)return!1;var e=rs,r=lh;lh=0;var a=As(Ar),l=Y.T,f=Z.p;try{Z.p=32>a?32:a,Y.T=null,a=ch,ch=null;var p=rs,w=Ar;if(jt=0,Ni=rs=null,Ar=0,(Ye&6)!==0)throw Error(i(331));var E=Ye;if(Ye|=4,ny(p.current),Zp(p,p.current,w,a),Ye=E,$a(0,!1),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(ws,p)}catch{}return!0}finally{Z.p=f,Y.T=l,vy(e,r)}}function wy(e,r,a){r=Tn(a,r),r=If(e.stateNode,r,2),e=Qr(e,r,2),e!==null&&($n(e,2),nr(e))}function Je(e,r,a){if(e.tag===3)wy(e,e,a);else for(;r!==null;){if(r.tag===3){wy(r,e,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ns===null||!ns.has(l))){e=Tn(a,e),a=Sp(2),l=Qr(r,a,2),l!==null&&(Ep(a,l,r,e),$n(l,2),nr(l));break}}r=r.return}}function dh(e,r,a){var l=e.pingCache;if(l===null){l=e.pingCache=new H_;var f=new Set;l.set(r,f)}else f=l.get(r),f===void 0&&(f=new Set,l.set(r,f));f.has(a)||(ih=!0,f.add(a),e=K_.bind(null,e,r,a),r.then(e,e))}function K_(e,r,a){var l=e.pingCache;l!==null&&l.delete(r),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,tt===e&&(Le&a)===a&&(pt===4||pt===3&&(Le&62914560)===Le&&300>at()-kl?(Ye&2)===0&&Ti(e,0):ah|=a,ki===Le&&(ki=0)),nr(e)}function Sy(e,r){r===0&&(r=ni()),e=Cs(e,r),e!==null&&($n(e,r),nr(e))}function J_(e){var r=e.memoizedState,a=0;r!==null&&(a=r.retryLane),Sy(e,a)}function Q_(e,r){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(r),Sy(e,a)}function X_(e,r){return sa(e,r)}var ql=null,Mi=null,mh=!1,Ll=!1,ph=!1,is=0;function nr(e){e!==Mi&&e.next===null&&(Mi===null?ql=Mi=e:Mi=Mi.next=e),Ll=!0,mh||(mh=!0,Z_())}function $a(e,r){if(!ph&&Ll){ph=!0;do for(var a=!1,l=ql;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var p=0;else{var w=l.suspendedLanes,E=l.pingedLanes;p=(1<<31-$t(42|e)+1)-1,p&=f&~(w&~E),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,jy(l,p))}else p=Le,p=Ss(l,l===tt?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||Es(l,p)||(a=!0,jy(l,p));l=l.next}while(a);ph=!1}}function W_(){Ey()}function Ey(){Ll=mh=!1;var e=0;is!==0&&cw()&&(e=is);for(var r=at(),a=null,l=ql;l!==null;){var f=l.next,p=Oy(l,r);p===0?(l.next=null,a===null?ql=f:a.next=f,f===null&&(Mi=a)):(a=l,(e!==0||(p&3)!==0)&&(Ll=!0)),l=f}jt!==0&&jt!==5||$a(e),is!==0&&(is=0)}function Oy(e,r){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-$t(p),E=1<<w,R=f[w];R===-1?((E&a)===0||(E&l)!==0)&&(f[w]=oa(E,r)):R<=r&&(e.expiredLanes|=E),p&=~E}if(r=tt,a=Le,a=Ss(e,e===r?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===r&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&or(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Es(e,a)){if(r=a&-a,r===e.callbackPriority)return r;switch(l!==null&&or(l),As(a)){case 2:case 8:a=Bo;break;case 32:a=ei;break;case 268435456:a=Uo;break;default:a=ei}return l=Ay.bind(null,e),a=sa(a,l),e.callbackPriority=r,e.callbackNode=a,r}return l!==null&&l!==null&&or(l),e.callbackPriority=2,e.callbackNode=null,2}function Ay(e,r){if(jt!==0&&jt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Dl()&&e.callbackNode!==a)return null;var l=Le;return l=Ss(e,e===tt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(oy(e,l,r),Oy(e,at()),e.callbackNode!=null&&e.callbackNode===a?Ay.bind(null,e):null)}function jy(e,r){if(Dl())return null;oy(e,r,!0)}function Z_(){fw(function(){(Ye&6)!==0?sa(Lo,W_):Ey()})}function yh(){if(is===0){var e=gi;e===0&&(e=Br,Br<<=1,(Br&261888)===0&&(Br=256)),is=e}return is}function ky(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Fo(""+e)}function Ny(e,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,e.id&&a.setAttribute("form",e.id),r.parentNode.insertBefore(a,r),e=new FormData(e),a.parentNode.removeChild(a),e}function ew(e,r,a,l,f){if(r==="submit"&&a&&a.stateNode===f){var p=ky((f[dt]||null).action),w=l.submitter;w&&(r=(r=w[dt]||null)?ky(r.formAction):w.getAttribute("formAction"),r!==null&&(p=r,w=null));var E=new Ko("action","action",null,l,f);e.push({event:E,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(is!==0){var R=w?Ny(f,w):new FormData(f);Lf(a,{pending:!0,data:R,method:f.method,action:p},null,R)}}else typeof p=="function"&&(E.preventDefault(),R=w?Ny(f,w):new FormData(f),Lf(a,{pending:!0,data:R,method:f.method,action:p},p,R))},currentTarget:f}]})}}for(var gh=0;gh<Wu.length;gh++){var bh=Wu[gh],tw=bh.toLowerCase(),nw=bh[0].toUpperCase()+bh.slice(1);Hn(tw,"on"+nw)}Hn(a0,"onAnimationEnd"),Hn(o0,"onAnimationIteration"),Hn(l0,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(b_,"onTransitionRun"),Hn(x_,"onTransitionStart"),Hn(v_,"onTransitionCancel"),Hn(c0,"onTransitionEnd"),V("onMouseEnter",["mouseout","mouseover"]),V("onMouseLeave",["mouseout","mouseover"]),V("onPointerEnter",["pointerout","pointerover"]),V("onPointerLeave",["pointerout","pointerover"]),ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ia="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(" "),rw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ia));function Ty(e,r){r=(r&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var p=void 0;if(r)for(var w=l.length-1;0<=w;w--){var E=l[w],R=E.instance,F=E.currentTarget;if(E=E.listener,R!==p&&f.isPropagationStopped())break e;p=E,f.currentTarget=F;try{p(f)}catch(X){Xo(X)}f.currentTarget=null,p=R}else for(w=0;w<l.length;w++){if(E=l[w],R=E.instance,F=E.currentTarget,E=E.listener,R!==p&&f.isPropagationStopped())break e;p=E,f.currentTarget=F;try{p(f)}catch(X){Xo(X)}f.currentTarget=null,p=R}}}}function qe(e,r){var a=r[js];a===void 0&&(a=r[js]=new Set);var l=e+"__bubble";a.has(l)||(Cy(r,e,2,!1),a.add(l))}function xh(e,r,a){var l=0;r&&(l|=4),Cy(a,e,l,r)}var Bl="_reactListening"+Math.random().toString(36).slice(2);function vh(e){if(!e[Bl]){e[Bl]=!0,I.forEach(function(a){a!=="selectionchange"&&(rw.has(a)||xh(a,!1,e),xh(a,!0,e))});var r=e.nodeType===9?e:e.ownerDocument;r===null||r[Bl]||(r[Bl]=!0,xh("selectionchange",!1,r))}}function Cy(e,r,a,l){switch(ag(r)){case 2:var f=Cw;break;case 8:f=Mw;break;default:f=qh}a=f.bind(null,r,a,e),f=void 0,!Pu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(r,a,{capture:!0,passive:f}):e.addEventListener(r,a,!0):f!==void 0?e.addEventListener(r,a,{passive:f}):e.addEventListener(r,a,!1)}function _h(e,r,a,l,f){var p=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var w=l.tag;if(w===3||w===4){var E=l.stateNode.containerInfo;if(E===f)break;if(w===4)for(w=l.return;w!==null;){var R=w.tag;if((R===3||R===4)&&w.stateNode.containerInfo===f)return;w=w.return}for(;E!==null;){if(w=A(E),w===null)return;if(R=w.tag,R===5||R===6||R===26||R===27){l=p=w;continue e}E=E.parentNode}}l=l.return}Lm(function(){var F=p,X=Bu(a),se=[];e:{var G=u0.get(e);if(G!==void 0){var J=Ko,be=e;switch(e){case"keypress":if(Vo(a)===0)break e;case"keydown":case"keyup":J=Qv;break;case"focusin":be="focus",J=Hu;break;case"focusout":be="blur",J=Hu;break;case"beforeblur":case"afterblur":J=Hu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=Pm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=Uv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Zv;break;case a0:case o0:case l0:J=$v;break;case c0:J=t_;break;case"scroll":case"scrollend":J=Lv;break;case"wheel":J=r_;break;case"copy":case"cut":case"paste":J=Hv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=$m;break;case"toggle":case"beforetoggle":J=i_}var Ae=(r&4)!==0,Ze=!Ae&&(e==="scroll"||e==="scrollend"),P=Ae?G!==null?G+"Capture":null:G;Ae=[];for(var B=F,H;B!==null;){var ee=B;if(H=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||H===null||P===null||(ee=ua(B,P),ee!=null&&Ae.push(Ha(B,ee,H))),Ze)break;B=B.return}0<Ae.length&&(G=new J(G,be,null,a,X),se.push({event:G,listeners:Ae}))}}if((r&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",G&&a!==Lu&&(be=a.relatedTarget||a.fromElement)&&(A(be)||be[an]))break e;if((J||G)&&(G=X.window===X?X:(G=X.ownerDocument)?G.defaultView||G.parentWindow:window,J?(be=a.relatedTarget||a.toElement,J=F,be=be?A(be):null,be!==null&&(Ze=c(be),Ae=be.tag,be!==Ze||Ae!==5&&Ae!==27&&Ae!==6)&&(be=null)):(J=null,be=F),J!==be)){if(Ae=Pm,ee="onMouseLeave",P="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Ae=$m,ee="onPointerLeave",P="onPointerEnter",B="pointer"),Ze=J==null?G:k(J),H=be==null?G:k(be),G=new Ae(ee,B+"leave",J,a,X),G.target=Ze,G.relatedTarget=H,ee=null,A(X)===F&&(Ae=new Ae(P,B+"enter",be,a,X),Ae.target=H,Ae.relatedTarget=Ze,ee=Ae),Ze=ee,J&&be)t:{for(Ae=sw,P=J,B=be,H=0,ee=P;ee;ee=Ae(ee))H++;ee=0;for(var Ee=B;Ee;Ee=Ae(Ee))ee++;for(;0<H-ee;)P=Ae(P),H--;for(;0<ee-H;)B=Ae(B),ee--;for(;H--;){if(P===B||B!==null&&P===B.alternate){Ae=P;break t}P=Ae(P),B=Ae(B)}Ae=null}else Ae=null;J!==null&&My(se,G,J,Ae,!1),be!==null&&Ze!==null&&My(se,Ze,be,Ae,!0)}}e:{if(G=F?k(F):window,J=G.nodeName&&G.nodeName.toLowerCase(),J==="select"||J==="input"&&G.type==="file")var Fe=Jm;else if(Ym(G))if(Qm)Fe=p_;else{Fe=d_;var xe=h_}else J=G.nodeName,!J||J.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?F&&qu(F.elementType)&&(Fe=Jm):Fe=m_;if(Fe&&(Fe=Fe(e,F))){Km(se,Fe,a,X);break e}xe&&xe(e,G,F),e==="focusout"&&F&&G.type==="number"&&F.memoizedProps.value!=null&&Du(G,"number",G.value)}switch(xe=F?k(F):window,e){case"focusin":(Ym(xe)||xe.contentEditable==="true")&&(ci=xe,Ju=F,ba=null);break;case"focusout":ba=Ju=ci=null;break;case"mousedown":Qu=!0;break;case"contextmenu":case"mouseup":case"dragend":Qu=!1,s0(se,a,X);break;case"selectionchange":if(g_)break;case"keydown":case"keyup":s0(se,a,X)}var Me;if(Gu)e:{switch(e){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else li?Gm(e,a)&&(Be="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Be="onCompositionStart");Be&&(Im&&a.locale!=="ko"&&(li||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&li&&(Me=Bm()):(Hr=X,zu="value"in Hr?Hr.value:Hr.textContent,li=!0)),xe=Ul(F,Be),0<xe.length&&(Be=new zm(Be,e,null,a,X),se.push({event:Be,listeners:xe}),Me?Be.data=Me:(Me=Vm(a),Me!==null&&(Be.data=Me)))),(Me=o_?l_(e,a):c_(e,a))&&(Be=Ul(F,"onBeforeInput"),0<Be.length&&(xe=new zm("onBeforeInput","beforeinput",null,a,X),se.push({event:xe,listeners:Be}),xe.data=Me)),ew(se,e,F,a,X)}Ty(se,r)})}function Ha(e,r,a){return{instance:e,listener:r,currentTarget:a}}function Ul(e,r){for(var a=r+"Capture",l=[];e!==null;){var f=e,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=ua(e,a),f!=null&&l.unshift(Ha(e,f,p)),f=ua(e,r),f!=null&&l.push(Ha(e,f,p))),e.tag===3)return l;e=e.return}return[]}function sw(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function My(e,r,a,l,f){for(var p=r._reactName,w=[];a!==null&&a!==l;){var E=a,R=E.alternate,F=E.stateNode;if(E=E.tag,R!==null&&R===l)break;E!==5&&E!==26&&E!==27||F===null||(R=F,f?(F=ua(a,p),F!=null&&w.unshift(Ha(a,F,R))):f||(F=ua(a,p),F!=null&&w.push(Ha(a,F,R)))),a=a.return}w.length!==0&&e.push({event:r,listeners:w})}var iw=/\r\n?/g,aw=/\u0000|\uFFFD/g;function Ry(e){return(typeof e=="string"?e:""+e).replace(iw,`
26
+ `).replace(aw,"")}function Dy(e,r){return r=Ry(r),Ry(e)===r}function We(e,r,a,l,f,p){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||ii(e,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&ii(e,""+l);break;case"className":In(e,"class",l);break;case"tabIndex":In(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":In(e,a,l);break;case"style":Dm(e,l,p);break;case"data":if(r!=="object"){In(e,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Fo(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"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 p=="function"&&(a==="formAction"?(r!=="input"&&We(e,r,"name",f.name,f,null),We(e,r,"formEncType",f.formEncType,f,null),We(e,r,"formMethod",f.formMethod,f,null),We(e,r,"formTarget",f.formTarget,f,null)):(We(e,r,"encType",f.encType,f,null),We(e,r,"method",f.method,f,null),We(e,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Fo(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=fr);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));e.innerHTML=a}}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}a=Fo(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+l):e.removeAttribute(a);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(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":qe("beforetoggle",e),qe("toggle",e),It(e,"popover",l);break;case"xlinkActuate":ur(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ur(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ur(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ur(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ur(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ur(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ur(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ur(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ur(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":It(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Dv.get(a)||a,It(e,a,l))}}function wh(e,r,a,l,f,p){switch(a){case"style":Dm(e,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof l=="string"?ii(e,l):(typeof l=="number"||typeof l=="bigint")&&ii(e,""+l);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=fr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ne.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),p=e[dt]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(r,p,f),typeof l=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(r,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):It(e,a,l)}}}function Ut(e,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var l=!1,f=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:We(e,r,p,w,a,null)}}f&&We(e,r,"srcSet",a.srcSet,a,null),l&&We(e,r,"src",a.src,a,null);return;case"input":qe("invalid",e);var E=p=w=f=null,R=null,F=null;for(l in a)if(a.hasOwnProperty(l)){var X=a[l];if(X!=null)switch(l){case"name":f=X;break;case"type":w=X;break;case"checked":R=X;break;case"defaultChecked":F=X;break;case"value":p=X;break;case"defaultValue":E=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(i(137,r));break;default:We(e,r,l,X,a,null)}}Tm(e,p,E,R,F,w,f,!1);return;case"select":qe("invalid",e),l=w=p=null;for(f in a)if(a.hasOwnProperty(f)&&(E=a[f],E!=null))switch(f){case"value":p=E;break;case"defaultValue":w=E;break;case"multiple":l=E;default:We(e,r,f,E,a,null)}r=p,a=w,e.multiple=!!l,r!=null?si(e,!!l,r,!1):a!=null&&si(e,!!l,a,!0);return;case"textarea":qe("invalid",e),p=f=l=null;for(w in a)if(a.hasOwnProperty(w)&&(E=a[w],E!=null))switch(w){case"value":l=E;break;case"defaultValue":f=E;break;case"children":p=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:We(e,r,w,E,a,null)}Mm(e,l,f,p);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:We(e,r,R,l,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(l=0;l<Ia.length;l++)qe(Ia[l],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("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(F in a)if(a.hasOwnProperty(F)&&(l=a[F],l!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:We(e,r,F,l,a,null)}return;default:if(qu(r)){for(X in a)a.hasOwnProperty(X)&&(l=a[X],l!==void 0&&wh(e,r,X,l,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(l=a[E],l!=null&&We(e,r,E,l,a,null))}function ow(e,r,a,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,w=null,E=null,R=null,F=null,X=null;for(J in a){var se=a[J];if(a.hasOwnProperty(J)&&se!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":R=se;default:l.hasOwnProperty(J)||We(e,r,J,null,l,se)}}for(var G in l){var J=l[G];if(se=a[G],l.hasOwnProperty(G)&&(J!=null||se!=null))switch(G){case"type":p=J;break;case"name":f=J;break;case"checked":F=J;break;case"defaultChecked":X=J;break;case"value":w=J;break;case"defaultValue":E=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(i(137,r));break;default:J!==se&&We(e,r,G,J,l,se)}}Ru(e,w,E,R,F,X,p,f);return;case"select":J=w=E=G=null;for(p in a)if(R=a[p],a.hasOwnProperty(p)&&R!=null)switch(p){case"value":break;case"multiple":J=R;default:l.hasOwnProperty(p)||We(e,r,p,null,l,R)}for(f in l)if(p=l[f],R=a[f],l.hasOwnProperty(f)&&(p!=null||R!=null))switch(f){case"value":G=p;break;case"defaultValue":E=p;break;case"multiple":w=p;default:p!==R&&We(e,r,f,p,l,R)}r=E,a=w,l=J,G!=null?si(e,!!a,G,!1):!!l!=!!a&&(r!=null?si(e,!!a,r,!0):si(e,!!a,a?[]:"",!1));return;case"textarea":J=G=null;for(E in a)if(f=a[E],a.hasOwnProperty(E)&&f!=null&&!l.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:We(e,r,E,null,l,f)}for(w in l)if(f=l[w],p=a[w],l.hasOwnProperty(w)&&(f!=null||p!=null))switch(w){case"value":G=f;break;case"defaultValue":J=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==p&&We(e,r,w,f,l,p)}Cm(e,G,J);return;case"option":for(var be in a)if(G=a[be],a.hasOwnProperty(be)&&G!=null&&!l.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:We(e,r,be,null,l,G)}for(R in l)if(G=l[R],J=a[R],l.hasOwnProperty(R)&&G!==J&&(G!=null||J!=null))switch(R){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:We(e,r,R,G,l,J)}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 Ae in a)G=a[Ae],a.hasOwnProperty(Ae)&&G!=null&&!l.hasOwnProperty(Ae)&&We(e,r,Ae,null,l,G);for(F in l)if(G=l[F],J=a[F],l.hasOwnProperty(F)&&G!==J&&(G!=null||J!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(i(137,r));break;default:We(e,r,F,G,l,J)}return;default:if(qu(r)){for(var Ze in a)G=a[Ze],a.hasOwnProperty(Ze)&&G!==void 0&&!l.hasOwnProperty(Ze)&&wh(e,r,Ze,void 0,l,G);for(X in l)G=l[X],J=a[X],!l.hasOwnProperty(X)||G===J||G===void 0&&J===void 0||wh(e,r,X,G,l,J);return}}for(var P in a)G=a[P],a.hasOwnProperty(P)&&G!=null&&!l.hasOwnProperty(P)&&We(e,r,P,null,l,G);for(se in l)G=l[se],J=a[se],!l.hasOwnProperty(se)||G===J||G==null&&J==null||We(e,r,se,G,l,J)}function qy(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lw(){if(typeof performance.getEntriesByType=="function"){for(var e=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],p=f.transferSize,w=f.initiatorType,E=f.duration;if(p&&E&&qy(w)){for(w=0,E=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],F=R.startTime;if(F>E)break;var X=R.transferSize,se=R.initiatorType;X&&qy(se)&&(R=R.responseEnd,w+=X*(R<E?1:(E-F)/(R-F)))}if(--l,r+=8*(p+w)/(f.duration/1e3),e++,10<e)break}}if(0<e)return r/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Sh=null,Eh=null;function Pl(e){return e.nodeType===9?e:e.ownerDocument}function Ly(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 By(e,r){if(e===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&r==="foreignObject"?0:e}function Oh(e,r){return e==="textarea"||e==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Ah=null;function cw(){var e=window.event;return e&&e.type==="popstate"?e===Ah?!1:(Ah=e,!0):(Ah=null,!1)}var Uy=typeof setTimeout=="function"?setTimeout:void 0,uw=typeof clearTimeout=="function"?clearTimeout:void 0,Py=typeof Promise=="function"?Promise:void 0,fw=typeof queueMicrotask=="function"?queueMicrotask:typeof Py<"u"?function(e){return Py.resolve(null).then(e).catch(hw)}:Uy;function hw(e){setTimeout(function(){throw e})}function as(e){return e==="head"}function zy(e,r){var a=r,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),Li(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Fa(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Fa(a);for(var p=a.firstChild;p;){var w=p.nextSibling,E=p.nodeName;p[At]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&Fa(e.ownerDocument.body);a=f}while(a);Li(r)}function $y(e,r){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function jh(e){var r=e.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":jh(a),ri(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function dw(e,r,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[At])switch(r){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(r==="input"&&e.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=qn(e.nextSibling),e===null)break}return null}function mw(e,r,a){if(r==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=qn(e.nextSibling),e===null))return null;return e}function Iy(e,r){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=qn(e.nextSibling),e===null))return null;return e}function kh(e){return e.data==="$?"||e.data==="$~"}function Nh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function pw(e,r){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=r;else if(e.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function qn(e){for(;e!=null;e=e.nextSibling){var r=e.nodeType;if(r===1||r===3)break;if(r===8){if(r=e.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return e}var Th=null;function Hy(e){e=e.nextSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(r===0)return qn(e.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}e=e.nextSibling}return null}function Fy(e){e=e.previousSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return e;r--}else a!=="/$"&&a!=="/&"||r++}e=e.previousSibling}return null}function Gy(e,r,a){switch(r=Pl(a),e){case"html":if(e=r.documentElement,!e)throw Error(i(452));return e;case"head":if(e=r.head,!e)throw Error(i(453));return e;case"body":if(e=r.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Fa(e){for(var r=e.attributes;r.length;)e.removeAttributeNode(r[0]);ri(e)}var Ln=new Map,Vy=new Set;function zl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var jr=Z.d;Z.d={f:yw,r:gw,D:bw,C:xw,L:vw,m:_w,X:Sw,S:ww,M:Ew};function yw(){var e=jr.f(),r=Cl();return e||r}function gw(e){var r=N(e);r!==null&&r.tag===5&&r.type==="form"?cp(r):jr.r(e)}var Ri=typeof document>"u"?null:document;function Yy(e,r,a){var l=Ri;if(l&&typeof r=="string"&&r){var f=kn(r);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),Vy.has(f)||(Vy.add(f),e={rel:e,crossOrigin:a,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),Ut(r,"link",e),q(r),l.head.appendChild(r)))}}function bw(e){jr.D(e),Yy("dns-prefetch",e,null)}function xw(e,r){jr.C(e,r),Yy("preconnect",e,r)}function vw(e,r,a){jr.L(e,r,a);var l=Ri;if(l&&e&&r){var f='link[rel="preload"][as="'+kn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+kn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+kn(a.imageSizes)+'"]')):f+='[href="'+kn(e)+'"]';var p=f;switch(r){case"style":p=Di(e);break;case"script":p=qi(e)}Ln.has(p)||(e=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:e,as:r},a),Ln.set(p,e),l.querySelector(f)!==null||r==="style"&&l.querySelector(Ga(p))||r==="script"&&l.querySelector(Va(p))||(r=l.createElement("link"),Ut(r,"link",e),q(r),l.head.appendChild(r)))}}function _w(e,r){jr.m(e,r);var a=Ri;if(a&&e){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+kn(l)+'"][href="'+kn(e)+'"]',p=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=qi(e)}if(!Ln.has(p)&&(e=b({rel:"modulepreload",href:e},r),Ln.set(p,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Va(p)))return}l=a.createElement("link"),Ut(l,"link",e),q(l),a.head.appendChild(l)}}}function ww(e,r,a){jr.S(e,r,a);var l=Ri;if(l&&e){var f=T(l).hoistableStyles,p=Di(e);r=r||"default";var w=f.get(p);if(!w){var E={loading:0,preload:null};if(w=l.querySelector(Ga(p)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":r},a),(a=Ln.get(p))&&Ch(e,a);var R=w=l.createElement("link");q(R),Ut(R,"link",e),R._p=new Promise(function(F,X){R.onload=F,R.onerror=X}),R.addEventListener("load",function(){E.loading|=1}),R.addEventListener("error",function(){E.loading|=2}),E.loading|=4,$l(w,r,l)}w={type:"stylesheet",instance:w,count:1,state:E},f.set(p,w)}}}function Sw(e,r){jr.X(e,r);var a=Ri;if(a&&e){var l=T(a).hoistableScripts,f=qi(e),p=l.get(f);p||(p=a.querySelector(Va(f)),p||(e=b({src:e,async:!0},r),(r=Ln.get(f))&&Mh(e,r),p=a.createElement("script"),q(p),Ut(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(f,p))}}function Ew(e,r){jr.M(e,r);var a=Ri;if(a&&e){var l=T(a).hoistableScripts,f=qi(e),p=l.get(f);p||(p=a.querySelector(Va(f)),p||(e=b({src:e,async:!0,type:"module"},r),(r=Ln.get(f))&&Mh(e,r),p=a.createElement("script"),q(p),Ut(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(f,p))}}function Ky(e,r,a,l){var f=(f=Dt.current)?zl(f):null;if(!f)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=Di(a.href),a=T(f).hoistableStyles,l=a.get(r),l||(l={type:"style",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Di(a.href);var p=T(f).hoistableStyles,w=p.get(e);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=f.querySelector(Ga(e)))&&!p._p&&(w.instance=p,w.state.loading=5),Ln.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Ln.set(e,a),p||Ow(f,e,a,w.state))),r&&l===null)throw Error(i(528,""));return w}if(r&&l!==null)throw Error(i(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=qi(a),a=T(f).hoistableScripts,l=a.get(r),l||(l={type:"script",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Di(e){return'href="'+kn(e)+'"'}function Ga(e){return'link[rel="stylesheet"]['+e+"]"}function Jy(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Ow(e,r,a,l){e.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=e.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),Ut(r,"link",a),q(r),e.head.appendChild(r))}function qi(e){return'[src="'+kn(e)+'"]'}function Va(e){return"script[async]"+e}function Qy(e,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=e.querySelector('style[data-href~="'+kn(a.href)+'"]');if(l)return r.instance=l,q(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),q(l),Ut(l,"style",f),$l(l,a.precedence,e),r.instance=l;case"stylesheet":f=Di(a.href);var p=e.querySelector(Ga(f));if(p)return r.state.loading|=4,r.instance=p,q(p),p;l=Jy(a),(f=Ln.get(f))&&Ch(l,f),p=(e.ownerDocument||e).createElement("link"),q(p);var w=p;return w._p=new Promise(function(E,R){w.onload=E,w.onerror=R}),Ut(p,"link",l),r.state.loading|=4,$l(p,a.precedence,e),r.instance=p;case"script":return p=qi(a.src),(f=e.querySelector(Va(p)))?(r.instance=f,q(f),f):(l=a,(f=Ln.get(p))&&(l=b({},a),Mh(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),q(f),Ut(f,"link",l),e.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,$l(l,a.precedence,e));return r.instance}function $l(e,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,p=f,w=0;w<l.length;w++){var E=l[w];if(E.dataset.precedence===r)p=E;else if(p!==f)break}p?p.parentNode.insertBefore(e,p.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(e,r.firstChild))}function Ch(e,r){e.crossOrigin==null&&(e.crossOrigin=r.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=r.referrerPolicy),e.title==null&&(e.title=r.title)}function Mh(e,r){e.crossOrigin==null&&(e.crossOrigin=r.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=r.referrerPolicy),e.integrity==null&&(e.integrity=r.integrity)}var Il=null;function Xy(e,r,a){if(Il===null){var l=new Map,f=Il=new Map;f.set(a,l)}else f=Il,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var p=a[f];if(!(p[At]||p[et]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(r)||"";w=e+w;var E=l.get(w);E?E.push(p):l.set(w,[p])}}return l}function Wy(e,r,a){e=e.ownerDocument||e,e.head.insertBefore(a,r==="title"?e.querySelector("head > title"):null)}function Aw(e,r,a){if(a===1||r.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return e=r.disabled,typeof r.precedence=="string"&&e==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Zy(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function jw(e,r,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=Di(l.href),p=r.querySelector(Ga(f));if(p){r=p._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(e.count++,e=Hl.bind(e),r.then(e,e)),a.state.loading|=4,a.instance=p,q(p);return}p=r.ownerDocument||r,l=Jy(l),(f=Ln.get(f))&&Ch(l,f),p=p.createElement("link"),q(p);var w=p;w._p=new Promise(function(E,R){w.onload=E,w.onerror=R}),Ut(p,"link",l),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Hl.bind(e),r.addEventListener("load",a),r.addEventListener("error",a))}}var Rh=0;function kw(e,r){return e.stylesheets&&e.count===0&&Gl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Gl(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+r);0<e.imgBytes&&Rh===0&&(Rh=62500*lw());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Gl(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Rh?50:800)+r);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Hl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Fl=null;function Gl(e,r){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Fl=new Map,r.forEach(Nw,e),Fl=null,Hl.call(e))}function Nw(e,r){if(!(r.state.loading&4)){var a=Fl.get(e);if(a)var l=a.get(null);else{a=new Map,Fl.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var w=f[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),l=w)}l&&a.set(null,l)}f=r.instance,w=f.getAttribute("data-precedence"),p=a.get(w)||l,p===l&&a.set(null,f),a.set(w,f),this.count++,l=Hl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),p?p.parentNode.insertBefore(f,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),r.state.loading|=4}}var Ya={$$typeof:re,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Tw(e,r,a,l,f,p,w,E,R){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=Pr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pr(0),this.hiddenUpdates=Pr(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function eg(e,r,a,l,f,p,w,E,R,F,X,se){return e=new Tw(e,r,a,w,R,F,X,se,E),r=1,p===!0&&(r|=24),p=ln(3,null,null,r),e.current=p,p.stateNode=e,r=hf(),r.refCount++,e.pooledCache=r,r.refCount++,p.memoizedState={element:l,isDehydrated:a,cache:r},yf(p),e}function tg(e){return e?(e=hi,e):hi}function ng(e,r,a,l,f,p){f=tg(f),l.context===null?l.context=f:l.pendingContext=f,l=Jr(r),l.payload={element:a},p=p===void 0?null:p,p!==null&&(l.callback=p),a=Qr(e,l,r),a!==null&&(nn(a,e,r),Oa(a,e,r))}function rg(e,r){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<r?a:r}}function Dh(e,r){rg(e,r),(e=e.alternate)&&rg(e,r)}function sg(e){if(e.tag===13||e.tag===31){var r=Cs(e,67108864);r!==null&&nn(r,e,67108864),Dh(e,67108864)}}function ig(e){if(e.tag===13||e.tag===31){var r=dn();r=cr(r);var a=Cs(e,r);a!==null&&nn(a,e,r),Dh(e,r)}}var Vl=!0;function Cw(e,r,a,l){var f=Y.T;Y.T=null;var p=Z.p;try{Z.p=2,qh(e,r,a,l)}finally{Z.p=p,Y.T=f}}function Mw(e,r,a,l){var f=Y.T;Y.T=null;var p=Z.p;try{Z.p=8,qh(e,r,a,l)}finally{Z.p=p,Y.T=f}}function qh(e,r,a,l){if(Vl){var f=Lh(l);if(f===null)_h(e,r,l,Yl,a),og(e,l);else if(Dw(f,e,r,a,l))l.stopPropagation();else if(og(e,l),r&4&&-1<Rw.indexOf(e)){for(;f!==null;){var p=N(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=zn(p.pendingLanes);if(w!==0){var E=p;for(E.pendingLanes|=2,E.entangledLanes|=2;w;){var R=1<<31-$t(w);E.entanglements[1]|=R,w&=~R}nr(p),(Ye&6)===0&&(Nl=at()+500,$a(0))}}break;case 31:case 13:E=Cs(p,2),E!==null&&nn(E,p,2),Cl(),Dh(p,2)}if(p=Lh(l),p===null&&_h(e,r,l,Yl,a),p===f)break;f=p}f!==null&&l.stopPropagation()}else _h(e,r,l,null,a)}}function Lh(e){return e=Bu(e),Bh(e)}var Yl=null;function Bh(e){if(Yl=null,e=A(e),e!==null){var r=c(e);if(r===null)e=null;else{var a=r.tag;if(a===13){if(e=d(r),e!==null)return e;e=null}else if(a===31){if(e=y(r),e!==null)return e;e=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;e=null}else r!==e&&(e=null)}}return Yl=e,null}function ag(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(Nu()){case Lo:return 2;case Bo:return 8;case ei:case Tu:return 32;case Uo:return 268435456;default:return 32}default:return 32}}var Uh=!1,os=null,ls=null,cs=null,Ka=new Map,Ja=new Map,us=[],Rw="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 og(e,r){switch(e){case"focusin":case"focusout":os=null;break;case"dragenter":case"dragleave":ls=null;break;case"mouseover":case"mouseout":cs=null;break;case"pointerover":case"pointerout":Ka.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ja.delete(r.pointerId)}}function Qa(e,r,a,l,f,p){return e===null||e.nativeEvent!==p?(e={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:p,targetContainers:[f]},r!==null&&(r=N(r),r!==null&&sg(r)),e):(e.eventSystemFlags|=l,r=e.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),e)}function Dw(e,r,a,l,f){switch(r){case"focusin":return os=Qa(os,e,r,a,l,f),!0;case"dragenter":return ls=Qa(ls,e,r,a,l,f),!0;case"mouseover":return cs=Qa(cs,e,r,a,l,f),!0;case"pointerover":var p=f.pointerId;return Ka.set(p,Qa(Ka.get(p)||null,e,r,a,l,f)),!0;case"gotpointercapture":return p=f.pointerId,Ja.set(p,Qa(Ja.get(p)||null,e,r,a,l,f)),!0}return!1}function lg(e){var r=A(e.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=d(a),r!==null){e.blockedOn=r,zo(e.priority,function(){ig(a)});return}}else if(r===31){if(r=y(a),r!==null){e.blockedOn=r,zo(e.priority,function(){ig(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Kl(e){if(e.blockedOn!==null)return!1;for(var r=e.targetContainers;0<r.length;){var a=Lh(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Lu=l,a.target.dispatchEvent(l),Lu=null}else return r=N(a),r!==null&&sg(r),e.blockedOn=a,!1;r.shift()}return!0}function cg(e,r,a){Kl(e)&&a.delete(r)}function qw(){Uh=!1,os!==null&&Kl(os)&&(os=null),ls!==null&&Kl(ls)&&(ls=null),cs!==null&&Kl(cs)&&(cs=null),Ka.forEach(cg),Ja.forEach(cg)}function Jl(e,r){e.blockedOn===r&&(e.blockedOn=null,Uh||(Uh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,qw)))}var Ql=null;function ug(e){Ql!==e&&(Ql=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Ql===e&&(Ql=null);for(var r=0;r<e.length;r+=3){var a=e[r],l=e[r+1],f=e[r+2];if(typeof l!="function"){if(Bh(l||a)===null)continue;break}var p=N(a);p!==null&&(e.splice(r,3),r-=3,Lf(p,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Li(e){function r(R){return Jl(R,e)}os!==null&&Jl(os,e),ls!==null&&Jl(ls,e),cs!==null&&Jl(cs,e),Ka.forEach(r),Ja.forEach(r);for(var a=0;a<us.length;a++){var l=us[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<us.length&&(a=us[0],a.blockedOn===null);)lg(a),a.blockedOn===null&&us.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],p=a[l+1],w=f[dt]||null;if(typeof p=="function")w||ug(a);else if(w){var E=null;if(p&&p.hasAttribute("formAction")){if(f=p,w=p[dt]||null)E=w.formAction;else if(Bh(f)!==null)continue}else E=w.action;typeof E=="function"?a[l+1]=E:(a.splice(l,3),l-=3),ug(a)}}}function fg(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return f=w})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Ph(e){this._internalRoot=e}Xl.prototype.render=Ph.prototype.render=function(e){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=dn();ng(a,l,e,r,null,null)},Xl.prototype.unmount=Ph.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var r=e.containerInfo;ng(e.current,2,null,e,null,null),Cl(),r[an]=null}};function Xl(e){this._internalRoot=e}Xl.prototype.unstable_scheduleHydration=function(e){if(e){var r=la();e={blockedOn:null,target:e,priority:r};for(var a=0;a<us.length&&r!==0&&r<us[a].priority;a++);us.splice(a,0,e),a===0&&lg(e)}};var hg=t.version;if(hg!=="19.2.4")throw Error(i(527,hg,"19.2.4"));Z.findDOMNode=function(e){var r=e._reactInternals;if(r===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=u(r),e=e!==null?m(e):null,e=e===null?null:e.stateNode,e};var Lw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wl.isDisabled&&Wl.supportsFiber)try{ws=Wl.inject(Lw),gt=Wl}catch{}}return Xa.createRoot=function(e,r){if(!o(e))throw Error(i(299));var a=!1,l="",f=xp,p=vp,w=_p;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(p=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=eg(e,1,!1,null,null,a,l,null,f,p,w,fg),e[an]=r.current,vh(e),new Ph(r)},Xa.hydrateRoot=function(e,r,a){if(!o(e))throw Error(i(299));var l=!1,f="",p=xp,w=vp,E=_p,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),r=eg(e,1,!0,r,a??null,l,f,R,p,w,E,fg),r.context=tg(null),a=r.current,l=dn(),l=cr(l),f=Jr(l),f.callback=null,Qr(a,f,l),a=l,r.current.lanes=a,$n(r,a),nr(r),e[an]=r.current,vh(e),new Xl(r)},Xa.version="19.2.4",Xa}var xg;function AS(){if(xg)return zh.exports;xg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),zh.exports=OS(),zh.exports}var jS=AS();const kS="modulepreload",NS=function(n,t){return new URL(n,t).href},vg={},Oe=function(t,s,i){let o=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const y=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),u=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=d(s.map(m=>{if(m=NS(m,i),m in vg)return;vg[m]=!0;const b=m.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=y.length-1;S>=0;S--){const C=y[S];if(C.href===m&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${x}`))return;const _=document.createElement("link");if(_.rel=b?"stylesheet":kS,b||(_.as="script"),_.crossOrigin="",_.href=m,u&&_.setAttribute("nonce",u),document.head.appendChild(_),b)return new Promise((S,C)=>{_.addEventListener("load",S),_.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=d,window.dispatchEvent(y),!y.defaultPrevented)throw d}return o.then(d=>{for(const y of d||[])y.status==="rejected"&&c(y.reason);return t().catch(c)})};function gu(n){try{const t=n.split(".");if(t.length!==3)return null;const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function Vb(n){const t=gu(n);return!t||typeof t.exp!="number"?null:t.exp}function Vd(n,t=0){const s=Vb(n);return s===null?!0:Date.now()/1e3>=s-t}const Pt=window.__LT_BASE__??"",ld=`${Pt}/api`;class _g extends Error{constructor(t,s,i){super(t),this.status=s,this.body=i,this.name="ApiError"}}let ps=null;function Zl(n){ps=n}function Yb(){return ps}const TS="X-LT-Acting-Token";let Qc=null,Xc=null;function wg(n){Qc=n}function Sg(n){Xc=n}function CS(n){const t=n==null?void 0:n.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function Eg(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:t,password:s}=JSON.parse(n),i=await fetch(`${ld}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:s})});if(!i.ok)return null;const o=await i.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 hs=null;async function he(n,t={}){const s={"Content-Type":"application/json",...t.headers};if(ps){if(Vd(ps)){hs||(hs=Eg().finally(()=>{hs=null}));const c=await hs;if(c)ps=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${ps}`}const i=(Qc==null?void 0:Qc())??null;i&&(s[TS]=i);let o=await fetch(`${ld}${n}`,{...t,headers:s});if(o.status===401&&i){const c=await o.clone().json().catch(()=>null);if(CS(c))throw Xc==null||Xc(),new _g(c.error,401,c)}if(o.status===401&&ps){hs||(hs=Eg().finally(()=>{hs=null}));const c=await hs;if(c&&(ps=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),s.Authorization=`Bearer ${c}`,o=await fetch(`${ld}${n}`,{...t,headers:s})),o.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(o.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!o.ok){const c=await o.json().catch(()=>({error:o.statusText}));throw new _g(c.message||c.error||o.statusText,o.status,c)}return o.json()}const MS="lt_ai_override";let ec=null;function Yd(){return ec||(ec=fetch(`${Pt}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw ec=null,n})),ec}function RS(){try{if(localStorage.getItem(MS)==="off")return!1}catch{}return null}function Xn(){var s;const n=ze({queryKey:["settings"],queryFn:Yd,staleTime:1/0}),t=RS();return n.data&&t===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function DS(n){var u,m,b;const{data:t}=Xn(),s=((u=t==null?void 0:t.auth)==null?void 0:u.ssoKeepaliveSeconds)??0,i=((m=t==null?void 0:t.auth)==null?void 0:m.ssoKeepaliveIdleTimeoutSeconds)??0,o=O.useRef(Date.now()),c=O.useRef(Date.now()),d=O.useRef(!1),g=!!n&&((b=gu(n))==null?void 0:b.sso)===!0&&s>0;O.useEffect(()=>{if(!g)return;const x=()=>{o.current=Date.now()};window.addEventListener("pointerdown",x,{passive:!0}),window.addEventListener("keydown",x,{passive:!0}),window.addEventListener("wheel",x,{passive:!0});const v=async()=>{if(!d.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-o.current>i*1e3)){d.current=!0;try{const C=await fetch(`${Pt}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const L=await C.json().catch(()=>null);L!=null&&L.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:L.token}})))}catch{}finally{d.current=!1}}},_=setInterval(v,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&v()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(_),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),window.removeEventListener("wheel",x)}},[g,s,i])}const Kb=O.createContext(null),qS=300;function Hh(n,t){if(Vd(n))return null;const s=gu(n);if(!s)return null;const i=t??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(i==null?void 0:i.displayName)??null,username:(i==null?void 0:i.username)??null,roles:s.roles??[]}}function LS({children:n}){const[t,s]=O.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Vd(b)?(sessionStorage.removeItem("lt_token"),null):(Zl(b),Hh(b)):null}),i=O.useRef(void 0),o=O.useCallback(b=>{clearTimeout(i.current);const x=Vb(b);if(!x)return;const v=(x-qS)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const _=gu(b);if(_!=null&&_.sso){const le=await fetch(`${Pt}/api/auth/sso`,{method:"POST"});if(!le.ok)return;const D=await le.json();D.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:D.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:L}=JSON.parse(S),U=await fetch(`${Pt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:L})});if(!U.ok)return;const re=await U.json();re.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:re.token}}))}catch{}},v))},[]),c=O.useCallback((b,x,v)=>{const _={displayName:(v==null?void 0:v.displayName)??null,username:(v==null?void 0:v.username)??(x==null?void 0:x.username)??null},S=Hh(b,_);S&&(Zl(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(_)),x&&sessionStorage.setItem("lt_credentials",JSON.stringify(x)),s(S),o(b))},[o]),d=O.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");Zl(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),b&&(window.location.href=b)},[]);O.useEffect(()=>{const b=()=>d(),x=v=>{var C;const _=(C=v.detail)==null?void 0:C.token;if(!_)return;const S=Hh(_);S&&(Zl(_),sessionStorage.setItem("lt_token",_),s(S),o(_))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",x),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",x)}},[d,o]),O.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&o(b),()=>clearTimeout(i.current)},[]);const y=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=O.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.role===b))??!1,[t]),u=O.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.type===b))??!1,[t]),m=(t==null?void 0:t.roles.map(b=>b.role))??[];return h.jsxs(Kb.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:y,login:c,logout:d,hasRole:g,hasRoleType:u,userRoleNames:m},children:[h.jsx(BS,{authenticated:t!==null}),n]})}function BS({authenticated:n}){return DS(n?sessionStorage.getItem("lt_token"):null),null}function Rt(){const n=O.useContext(Kb);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}const wn=new Uint8Array(0),Qs=new TextEncoder,xn=new TextDecoder;function US(...n){let t=0;for(let o=0;o<n.length;o++)t+=n[o].length;const s=new Uint8Array(t);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function ho(...n){const t=[];for(let s=0;s<n.length;s++)t.push(Qs.encode(n[s]));return t.length===0?wn:t.length===1?t[0]:US(...t)}function Og(n){return!n||n.length===0?"":xn.decode(n)}const Ag="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",jg=36,PS=0xcfd41b9100000,kg=33,zS=333,Ng=22;function $S(n){for(let t=0;t<n.length;t++)n[t]=Math.floor(Math.random()*255)}function IS(n){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(n):$S(n)}class HS{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(Ng),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*PS),this.inc=Math.floor(Math.random()*(zS-kg)+kg)}setPre(){const t=new Uint8Array(12);IS(t);for(let s=0;s<12;s++){const i=t[s]%36;this.buf[s]=Ag.charCodeAt(i)}}fillSeq(){let t=this.seq;for(let s=Ng-1;s>=12;s--)this.buf[s]=Ag.charCodeAt(t%jg),t=Math.floor(t/jg)}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 vs=new HS;var Tr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Tr||(Tr={}));var Fi;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Fi||(Fi={}));var ue;(function(n){n.ApiError="BAD API",n.BadAuthentication="BAD_AUTHENTICATION",n.BadCreds="BAD_CREDS",n.BadHeader="BAD_HEADER",n.BadJson="BAD_JSON",n.BadPayload="BAD_PAYLOAD",n.BadSubject="BAD_SUBJECT",n.Cancelled="CANCELLED",n.ConnectionClosed="CONNECTION_CLOSED",n.ConnectionDraining="CONNECTION_DRAINING",n.ConnectionRefused="CONNECTION_REFUSED",n.ConnectionTimeout="CONNECTION_TIMEOUT",n.Disconnect="DISCONNECT",n.InvalidOption="INVALID_OPTION",n.InvalidPayload="INVALID_PAYLOAD",n.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",n.NoResponders="503",n.NotFunction="NOT_FUNC",n.RequestError="REQUEST_ERROR",n.ServerOptionNotAvailable="SERVER_OPT_NA",n.SubClosed="SUB_CLOSED",n.SubDraining="SUB_DRAINING",n.Timeout="TIMEOUT",n.Tls="TLS",n.Unknown="UNKNOWN_ERROR",n.WssRequired="WSS_REQUIRED",n.JetStreamInvalidAck="JESTREAM_INVALID_ACK",n.JetStream404NoMessages="404",n.JetStream408RequestTimeout="408",n.JetStream409MaxAckPendingExceeded="409",n.JetStream409="409",n.JetStreamNotEnabled="503",n.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",n.AuthorizationViolation="AUTHORIZATION_VIOLATION",n.AuthenticationExpired="AUTHENTICATION_EXPIRED",n.ProtocolError="NATS_PROTOCOL_ERR",n.PermissionsViolation="PERMISSIONS_VIOLATION",n.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",n.AccountExpired="ACCOUNT_EXPIRED"})(ue||(ue={}));function FS(n){return typeof n.code=="string"}class Jb{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(ue.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ue.BadJson,"Bad JSON"),this.messages.set(ue.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return GS.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const GS=new Jb;class ye extends Error{constructor(s,i,o){super(s);j(this,"name");j(this,"message");j(this,"code");j(this,"permissionContext");j(this,"chainedError");j(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=o}static errorForCode(s,i){const o=Jb.getMessage(s);return new ye(o,s,i)}isAuthError(){return this.code===ue.AuthenticationExpired||this.code===ue.AuthorizationViolation||this.code===ue.AccountExpired}isAuthTimeout(){return this.code===ue.AuthenticationTimeout}isPermissionError(){return this.code===ue.PermissionsViolation}isProtocolError(){return this.code===ue.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var yn;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(yn||(yn={}));var Jn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Jn||(Jn={}));var mo;(function(n){n.STATS="io.nats.micro.v1.stats_response",n.INFO="io.nats.micro.v1.info_response",n.PING="io.nats.micro.v1.ping_response"})(mo||(mo={}));const iu="Nats-Service-Error",au="Nats-Service-Error-Code";class ou extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return ou.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(au))||"";if(i!==""){const d=parseInt(i)||400,y=((c=s==null?void 0:s.headers)==null?void 0:c.get(iu))||"";return new ou(d,y.length?y:i)}return null}}function Cr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${vs.next()}`}const cd="127.0.0.1";var ys;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(ys||(ys={}));function bu(n,...t){for(let s=0;s<t.length;s++){const i=t[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function tc(n){return xn.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Qi(n,t=!0){const s=t?ye.errorForCode(ue.Timeout):null;let i,o;const c=new Promise((d,y)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{y(s===null?ye.errorForCode(ue.Timeout):s)},n)});return Object.assign(c,i)}function ea(n=0){let t;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);t={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,t)}function ct(){let n={};const t=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(t,n)}function Qb(n){for(let t=n.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[n[t],n[s]]=[n[s],n[t]]}return n}function VS(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function Kd(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const t=n.length-1;return{backoff(s){return VS(s>t?n[t]:n[s])}}}function lt(n){return n*1e6}function Jd(n){return Math.floor(n/1e6)}function Tg(n){let i=!0;const o=new Array(n.length);for(let c=0;c<n.length;c++){let d=n.charCodeAt(c);if(d===58||d<33||d>126)throw new ye(`'${n[c]}' is not a valid character for a header key`,ue.BadHeader);i&&97<=d&&d<=122?d-=32:!i&&65<=d&&d<=90&&(d+=32),o[c]=d,i=d==45}return String.fromCharCode(...o)}function Rr(n=0,t=""){if(n===0&&t!==""||n>0&&t==="")throw new Error("setting status requires both code and description");return new gs(n,t)}const Fh="NATS/1.0";class gs{constructor(t=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=t,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[s,i]of this.headers){const o=t.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),d=[...o].sort();for(let y=0;y<c.length;y++)if(c[y]!==d[y])return!1}return!0}return!1}static decode(t){const s=new gs,o=xn.decode(t).split(`\r
27
+ `),c=o[0];if(c!==Fh){let d=c.replace(Fh,"").trim();if(d.length>0){s._code=parseInt(d,10),isNaN(s._code)&&(s._code=0);const y=s._code.toString();d=d.replace(y,""),s._description=d.trim()}}return o.length>=1&&o.slice(1).map(d=>{if(d){const y=d.indexOf(":");if(y>-1){const g=d.slice(0,y),u=d.slice(y+1).trim();s.append(g,u)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Fh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let o=0;o<i.length;o++)t=`${t}\r
28
+ ${s}: ${i[o]}`;return`${t}\r
29
+ \r
30
+ `}encode(){return Qs.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new ye("invalid header value - \\r and \\n are not allowed.",ue.BadHeader);return t.trim()}keys(){const t=[];for(const s of this.headers.keys())t.push(s);return t}findKeys(t,s=yn.Exact){const i=this.keys();switch(s){case yn.Exact:return i.filter(o=>o===t);case yn.CanonicalMIME:return t=Tg(t),i.filter(o=>o===t);default:{const o=t.toLowerCase();return i.filter(c=>o===c.toLowerCase())}}}get(t,s=yn.Exact){const i=this.findKeys(t,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(t,s=yn.Exact){const i=this.findKeys(t,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(t,s=yn.Exact){return this.findKeys(t,s).length>0}set(t,s,i=yn.Exact){this.delete(t,i),this.append(t,s,i)}append(t,s,i=yn.Exact){const o=Tg(t);i===yn.CanonicalMIME&&(t=o);const c=this.findKeys(t,i);t=c.length>0?c[0]:t;const d=gs.validHeaderValue(s);let y=this.headers.get(t);y||(y=[],this.headers.set(t,y)),y.push(d)}values(t,s=yn.Exact){const i=[];return this.findKeys(t,s).forEach(c=>{const d=this.headers.get(c);d&&i.push(...d)}),i}delete(t,s=yn.Exact){this.findKeys(t,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(s=>{t[s]=this.values(s)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const s=new gs;for(const i in t)s.headers.set(i,t[i]);return s}}function ud(){return{encode(n){return Qs.encode(n)},decode(n){return xn.decode(n)}}}function Qn(n){return{encode(t){try{return t===void 0&&(t=null),Qs.encode(JSON.stringify(t))}catch(s){throw ye.errorForCode(ue.BadJson,s)}},decode(t){try{return JSON.parse(xn.decode(t),n)}catch(s){throw ye.errorForCode(ue.BadJson,s)}}}}function Xb(n){var t;return n&&n.data.length===0&&((t=n.headers)==null?void 0:t.code)===503?ye.errorForCode(ue.NoResponders):null}class Qd{constructor(t,s,i){j(this,"_headers");j(this,"_msg");j(this,"_rdata");j(this,"_reply");j(this,"_subject");j(this,"publisher");this._msg=t,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=xn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=xn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=gs.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=wn,s){return this.reply?(this.publisher.publish(this.reply,t,s),!0):!1}size(){var o;const t=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,i=this._msg.size===-1?0:this._msg.size;return t+s+i}json(t){return Qn(t).decode(this.data)}string(){return xn.decode(this.data)}requestInfo(){var s;const t=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return t?JSON.parse(t,function(i,o){return(i==="start"||i==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}j(Qd,"jc");function Gi(n){return xu("durable",n)}function Vt(n){return xu("stream",n)}function xu(n,t=""){if(t==="")throw Error(`${n} name required`);return[".","*",">","/","\\"," "," ",`
31
+ `,"\r"].forEach(i=>{if(t.indexOf(i)!==-1){switch(i){case`
32
+ `:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${n} name - ${n} name cannot contain '${i}'`)}}),""}function co(n,t=""){if(t==="")throw Error(`${n} name required`);const s=YS(t);if(s.length)throw new Error(`invalid ${n} name - ${n} name ${s}`)}function YS(n=""){if(n==="")throw Error("name required");const t=/^[-\w]+$/g;if(n.match(t)===null){for(const i of n.split(""))if(i.match(t)===null)return`cannot contain '${i}'`}return""}function fd(n){if(n.data.length>0)return!1;const t=n.headers;return t?t.code>=100&&t.code<200:!1}function hd(n){var t;return fd(n)&&((t=n.headers)==null?void 0:t.description)==="Idle Heartbeat"}function KS(n,t,s){const i=Rr(n,t),o={hdr:1,sid:0,size:0},c=new Qd(o,wn,{});return c._headers=i,c._subject=s,c}function Vi(n){if(n.data.length!==0)return null;const t=n.headers;return t?Wb(t.code,t.description):null}var Un;(function(n){n.MaxBatchExceeded="exceeded maxrequestbatch of",n.MaxExpiresExceeded="exceeded maxrequestexpires of",n.MaxBytesExceeded="exceeded maxrequestmaxbytes of",n.MaxMessageSizeExceeded="message size exceeds maxbytes",n.PushConsumer="consumer is push based",n.MaxWaitingExceeded="exceeded maxwaiting",n.IdleHeartbeatMissed="idle heartbeats missed",n.ConsumerDeleted="consumer deleted"})(Un||(Un={}));function JS(n){return n.code!==ue.JetStream409?!1:[Un.MaxBatchExceeded,Un.MaxExpiresExceeded,Un.MaxBytesExceeded,Un.MaxMessageSizeExceeded,Un.PushConsumer,Un.IdleHeartbeatMissed,Un.ConsumerDeleted].find(s=>n.message.indexOf(s)!==-1)!==void 0}function Wb(n,t=""){if(n<300)return null;switch(t=t.toLowerCase(),n){case 404:return new ye(t,ue.JetStream404NoMessages);case 408:return new ye(t,ue.JetStream408RequestTimeout);case 409:{const s=t.startsWith(Un.IdleHeartbeatMissed)?ue.JetStreamIdleHeartBeat:ue.JetStream409;return new ye(t,s)}case 503:return ye.errorForCode(ue.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ue.Unknown),new ye(t,`${n}`)}}class Mt{constructor(){j(this,"inflight");j(this,"processed");j(this,"received");j(this,"noIterator");j(this,"iterClosed");j(this,"done");j(this,"signal");j(this,"yields");j(this,"filtered");j(this,"pendingFiltered");j(this,"ingestionFilterFn");j(this,"protocolFilterFn");j(this,"dispatchedFn");j(this,"ctx");j(this,"_data");j(this,"err");j(this,"time");j(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=ct(),this.yields=[],this.iterClosed=ct(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ye("unsupported iterator",ue.ApiError);if(this.yielding)throw new ye("already yielding",ue.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let s=0;s<t.length;s++){if(typeof t[s]=="function"){const o=t[s];try{o()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[s]):!0){this.processed++;const o=Date.now();yield t[s],this.time=Date.now()-o,this.dispatchedFn&&t[s]&&this.dispatchedFn(t[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=ct())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Xd{constructor(t,s,i={maxOut:2}){j(this,"interval");j(this,"maxOut");j(this,"cancelAfter");j(this,"timer");j(this,"autoCancelTimer");j(this,"last");j(this,"missed");j(this,"count");j(this,"callback");this.interval=t,this.maxOut=(i==null?void 0:i.maxOut)||2,this.cancelAfter=(i==null?void 0:i.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,s=0,i=2){this.interval=t,this.maxOut=i,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var dd;(function(n){n.Limits="limits",n.Interest="interest",n.Workqueue="workqueue"})(dd||(dd={}));var bo;(function(n){n.Old="old",n.New="new"})(bo||(bo={}));var md;(function(n){n.File="file",n.Memory="memory"})(md||(md={}));var vt;(function(n){n.All="all",n.Last="last",n.New="new",n.StartSequence="by_start_sequence",n.StartTime="by_start_time",n.LastPerSubject="last_per_subject"})(vt||(vt={}));var Ct;(function(n){n.None="none",n.All="all",n.Explicit="explicit",n.NotSet=""})(Ct||(Ct={}));var Xi;(function(n){n.Instant="instant",n.Original="original"})(Xi||(Xi={}));var _s;(function(n){n.None="none",n.S2="s2"})(_s||(_s={}));var lu;(function(n){n.CreateOrUpdate="",n.Update="update",n.Create="create"})(lu||(lu={}));function QS(n,t={}){return Object.assign({name:n,deliver_policy:vt.All,ack_policy:Ct.Explicit,ack_wait:lt(30*1e3),replay_policy:Xi.Instant},t)}var Cg;(function(n){n.API="api_audit",n.StreamAction="stream_action",n.ConsumerAction="consumer_action",n.SnapshotCreate="snapshot_create",n.SnapshotComplete="snapshot_complete",n.RestoreCreate="restore_create",n.RestoreComplete="restore_complete",n.MaxDeliver="max_deliver",n.Terminated="terminated",n.Ack="consumer_ack",n.StreamLeaderElected="stream_leader_elected",n.StreamQuorumLost="stream_quorum_lost",n.ConsumerLeaderElected="consumer_leader_elected",n.ConsumerQuorumLost="consumer_quorum_lost"})(Cg||(Cg={}));var Jt;(function(n){n.StreamSourceHdr="Nats-Stream-Source",n.LastConsumerSeqHdr="Nats-Last-Consumer",n.LastStreamSeqHdr="Nats-Last-Stream",n.ConsumerStalledHdr="Nats-Consumer-Stalled",n.MessageSizeHdr="Nats-Msg-Size",n.RollupHdr="Nats-Rollup",n.RollupValueSubject="sub",n.RollupValueAll="all",n.PendingMessagesHdr="Nats-Pending-Messages",n.PendingBytesHdr="Nats-Pending-Bytes"})(Jt||(Jt={}));var Yn;(function(n){n.LastValue="",n.AllHistory="history",n.UpdatesOnly="updates"})(Yn||(Yn={}));var Hi;(function(n){n.Stream="Nats-Stream",n.Sequence="Nats-Sequence",n.TimeStamp="Nats-Time-Stamp",n.Subject="Nats-Subject"})(Hi||(Hi={}));var Mg;(function(n){n.Stream="Nats-Stream",n.Subject="Nats-Subject",n.Sequence="Nats-Sequence",n.LastSequence="Nats-Last-Sequence",n.Size="Nats-Msg-Size"})(Mg||(Mg={}));const gn="KV_";class XS{constructor(t){j(this,"config");j(this,"ordered");j(this,"mack");j(this,"stream");j(this,"callbackFn");j(this,"max");j(this,"qname");j(this,"isBind");j(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=QS("",t||{})}getOpts(){var s;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((s=t.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?Ct.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Gi(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=vt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=vt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=vt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=vt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=vt.Last,this}deliverNew(){return this.config.deliver_policy=vt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Ct.None,this}ackAll(){return this.config.ack_policy=Ct.All,this}ackExplicit(){return this.config.ack_policy=Ct.Explicit,this}ackWait(t){return this.config.ack_wait=lt(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=Xi.Instant,this}replayOriginal(){return this.config.replay_policy=Xi.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=lt(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,s){return this.stream=t,this.config.durable_name=s,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=lt(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=lt(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function bs(n){return new XS(n)}function Rg(n){return typeof n.getOpts=="function"}class WS{static encode(t){if(typeof t=="string")return btoa(t);const s=Array.from(t);return btoa(String.fromCharCode(...s))}static decode(t,s=!1){const i=atob(t);return s?Uint8Array.from(i,o=>o.charCodeAt(0)):i}}class Yi{static encode(t){return Yi.toB64URLEncoding(WS.encode(t))}static decode(t,s=!1){return Yi.decode(Yi.fromB64URLEncoding(t),s)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Wi{constructor(){j(this,"buffers");j(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let s=0;for(let c=0;c<t.length;c++)s+=t[c].length;const i=new Uint8Array(s);let o=0;for(let c=0;c<t.length;c++)i.set(t[c],o),o+=t[c].length;return i}static fromAscii(t){return t||(t=""),Qs.encode(t)}static toAscii(t){return xn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)t.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(t===void 0||t>i)&&(t=i);const o=s.subarray(0,t);return i>t&&this.buffers.push(s.subarray(t)),this.byteLength=i-t,o}}return new Uint8Array(0)}fill(t,...s){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let i=0;i<s.length;i++)s[i]&&s[i].length&&(this.buffers.push(s[i]),this.byteLength+=s[i].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function ZS(n,t){return t.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in n)){var o=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(n)}var eE=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Wa=eE.performance||{};Wa.now||Wa.mozNow||Wa.msNow||Wa.oNow||Wa.webkitNow;var Dg={versions:{}},tE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nE(n){if(n.__esModule)return n;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),t}var Gh,vu={exports:{}},qg={},Lg=nE(ZS({__proto__:null,default:qg},[qg]));Gh=vu,(function(){var n="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&Dg.versions&&Dg.versions.node;o?s=tE:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&Gh.exports,d=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",y="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],u=[24,16,8,0],m=[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],b=["hex","array","digest","arrayBuffer"],x=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(D){return Object.prototype.toString.call(D)==="[object Array]"}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(D){return typeof D=="object"&&D.buffer&&D.buffer.constructor===ArrayBuffer});var v=function(D,z){return function(ae){return new U(z,!0).update(ae)[D]()}},_=function(D){var z=v("hex",D);o&&(z=S(z,D)),z.create=function(){return new U(D)},z.update=function(M){return z.create().update(M)};for(var ae=0;ae<b.length;++ae){var K=b[ae];z[K]=v(K,D)}return z},S=function(D,z){var ae,K=Lg,M=Lg.Buffer,$=z?"sha224":"sha256";return ae=M.from&&!s.JS_SHA256_NO_BUFFER_FROM?M.from:function(W){return new M(W)},function(W){if(typeof W=="string")return K.createHash($).update(W,"utf8").digest("hex");if(W==null)throw new Error(n);return W.constructor===ArrayBuffer&&(W=new Uint8Array(W)),Array.isArray(W)||ArrayBuffer.isView(W)||W.constructor===M?K.createHash($).update(ae(W)).digest("hex"):D(W)}},C=function(D,z){return function(ae,K){return new re(ae,z,!0).update(K)[D]()}},L=function(D){var z=C("hex",D);z.create=function(M){return new re(M,D)},z.update=function(M,$){return z.create(M).update($)};for(var ae=0;ae<b.length;++ae){var K=b[ae];z[K]=C(K,D)}return z};function U(D,z){z?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],D?(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=D}function re(D,z,ae){var K,M=typeof D;if(M==="string"){var $,W=[],Q=D.length,oe=0;for(K=0;K<Q;++K)($=D.charCodeAt(K))<128?W[oe++]=$:$<2048?(W[oe++]=192|$>>>6,W[oe++]=128|63&$):$<55296||$>=57344?(W[oe++]=224|$>>>12,W[oe++]=128|$>>>6&63,W[oe++]=128|63&$):($=65536+((1023&$)<<10|1023&D.charCodeAt(++K)),W[oe++]=240|$>>>18,W[oe++]=128|$>>>12&63,W[oe++]=128|$>>>6&63,W[oe++]=128|63&$);D=W}else{if(M!=="object")throw new Error(n);if(D===null)throw new Error(n);if(d&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!(Array.isArray(D)||d&&ArrayBuffer.isView(D)))throw new Error(n)}D.length>64&&(D=new U(z,!0).update(D).array());var ve=[],ke=[];for(K=0;K<64;++K){var Y=D[K]||0;ve[K]=92^Y,ke[K]=54^Y}U.call(this,z,ae),this.update(ke),this.oKeyPad=ve,this.inner=!0,this.sharedMemory=ae}U.prototype.update=function(D){if(!this.finalized){var z,ae=typeof D;if(ae!=="string"){if(ae!=="object")throw new Error(n);if(D===null)throw new Error(n);if(d&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!(Array.isArray(D)||d&&ArrayBuffer.isView(D)))throw new Error(n);z=!0}for(var K,M,$=0,W=D.length,Q=this.blocks;$<W;){if(this.hashed&&(this.hashed=!1,Q[0]=this.block,this.block=Q[16]=Q[1]=Q[2]=Q[3]=Q[4]=Q[5]=Q[6]=Q[7]=Q[8]=Q[9]=Q[10]=Q[11]=Q[12]=Q[13]=Q[14]=Q[15]=0),z)for(M=this.start;$<W&&M<64;++$)Q[M>>>2]|=D[$]<<u[3&M++];else for(M=this.start;$<W&&M<64;++$)(K=D.charCodeAt($))<128?Q[M>>>2]|=K<<u[3&M++]:K<2048?(Q[M>>>2]|=(192|K>>>6)<<u[3&M++],Q[M>>>2]|=(128|63&K)<<u[3&M++]):K<55296||K>=57344?(Q[M>>>2]|=(224|K>>>12)<<u[3&M++],Q[M>>>2]|=(128|K>>>6&63)<<u[3&M++],Q[M>>>2]|=(128|63&K)<<u[3&M++]):(K=65536+((1023&K)<<10|1023&D.charCodeAt(++$)),Q[M>>>2]|=(240|K>>>18)<<u[3&M++],Q[M>>>2]|=(128|K>>>12&63)<<u[3&M++],Q[M>>>2]|=(128|K>>>6&63)<<u[3&M++],Q[M>>>2]|=(128|63&K)<<u[3&M++]);this.lastByteIndex=M,this.bytes+=M-this.start,M>=64?(this.block=Q[16],this.start=M-64,this.hash(),this.hashed=!0):this.start=M}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},U.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var D=this.blocks,z=this.lastByteIndex;D[16]=this.block,D[z>>>2]|=g[3&z],this.block=D[16],z>=56&&(this.hashed||this.hash(),D[0]=this.block,D[16]=D[1]=D[2]=D[3]=D[4]=D[5]=D[6]=D[7]=D[8]=D[9]=D[10]=D[11]=D[12]=D[13]=D[14]=D[15]=0),D[14]=this.hBytes<<3|this.bytes>>>29,D[15]=this.bytes<<3,this.hash()}},U.prototype.hash=function(){var D,z,ae,K,M,$,W,Q,oe,ve=this.h0,ke=this.h1,Y=this.h2,Z=this.h3,ce=this.h4,_e=this.h5,we=this.h6,Ne=this.h7,je=this.blocks;for(D=16;D<64;++D)z=((M=je[D-15])>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,ae=((M=je[D-2])>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,je[D]=je[D-16]+z+je[D-7]+ae|0;for(oe=ke&Y,D=0;D<64;D+=4)this.first?(this.is224?($=300032,Ne=(M=je[0]-1413257819)-150054599|0,Z=M+24177077|0):($=704751109,Ne=(M=je[0]-210244248)-1521486534|0,Z=M+143694565|0),this.first=!1):(z=(ve>>>2|ve<<30)^(ve>>>13|ve<<19)^(ve>>>22|ve<<10),K=($=ve&ke)^ve&Y^oe,Ne=Z+(M=Ne+(ae=(ce>>>6|ce<<26)^(ce>>>11|ce<<21)^(ce>>>25|ce<<7))+(ce&_e^~ce&we)+m[D]+je[D])|0,Z=M+(z+K)|0),z=(Z>>>2|Z<<30)^(Z>>>13|Z<<19)^(Z>>>22|Z<<10),K=(W=Z&ve)^Z&ke^$,we=Y+(M=we+(ae=(Ne>>>6|Ne<<26)^(Ne>>>11|Ne<<21)^(Ne>>>25|Ne<<7))+(Ne&ce^~Ne&_e)+m[D+1]+je[D+1])|0,z=((Y=M+(z+K)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),K=(Q=Y&Z)^Y&ve^W,_e=ke+(M=_e+(ae=(we>>>6|we<<26)^(we>>>11|we<<21)^(we>>>25|we<<7))+(we&Ne^~we&ce)+m[D+2]+je[D+2])|0,z=((ke=M+(z+K)|0)>>>2|ke<<30)^(ke>>>13|ke<<19)^(ke>>>22|ke<<10),K=(oe=ke&Y)^ke&Z^Q,ce=ve+(M=ce+(ae=(_e>>>6|_e<<26)^(_e>>>11|_e<<21)^(_e>>>25|_e<<7))+(_e&we^~_e&Ne)+m[D+3]+je[D+3])|0,ve=M+(z+K)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+ve|0,this.h1=this.h1+ke|0,this.h2=this.h2+Y|0,this.h3=this.h3+Z|0,this.h4=this.h4+ce|0,this.h5=this.h5+_e|0,this.h6=this.h6+we|0,this.h7=this.h7+Ne|0},U.prototype.hex=function(){this.finalize();var D=this.h0,z=this.h1,ae=this.h2,K=this.h3,M=this.h4,$=this.h5,W=this.h6,Q=this.h7,oe=y[D>>>28&15]+y[D>>>24&15]+y[D>>>20&15]+y[D>>>16&15]+y[D>>>12&15]+y[D>>>8&15]+y[D>>>4&15]+y[15&D]+y[z>>>28&15]+y[z>>>24&15]+y[z>>>20&15]+y[z>>>16&15]+y[z>>>12&15]+y[z>>>8&15]+y[z>>>4&15]+y[15&z]+y[ae>>>28&15]+y[ae>>>24&15]+y[ae>>>20&15]+y[ae>>>16&15]+y[ae>>>12&15]+y[ae>>>8&15]+y[ae>>>4&15]+y[15&ae]+y[K>>>28&15]+y[K>>>24&15]+y[K>>>20&15]+y[K>>>16&15]+y[K>>>12&15]+y[K>>>8&15]+y[K>>>4&15]+y[15&K]+y[M>>>28&15]+y[M>>>24&15]+y[M>>>20&15]+y[M>>>16&15]+y[M>>>12&15]+y[M>>>8&15]+y[M>>>4&15]+y[15&M]+y[$>>>28&15]+y[$>>>24&15]+y[$>>>20&15]+y[$>>>16&15]+y[$>>>12&15]+y[$>>>8&15]+y[$>>>4&15]+y[15&$]+y[W>>>28&15]+y[W>>>24&15]+y[W>>>20&15]+y[W>>>16&15]+y[W>>>12&15]+y[W>>>8&15]+y[W>>>4&15]+y[15&W];return this.is224||(oe+=y[Q>>>28&15]+y[Q>>>24&15]+y[Q>>>20&15]+y[Q>>>16&15]+y[Q>>>12&15]+y[Q>>>8&15]+y[Q>>>4&15]+y[15&Q]),oe},U.prototype.toString=U.prototype.hex,U.prototype.digest=function(){this.finalize();var D=this.h0,z=this.h1,ae=this.h2,K=this.h3,M=this.h4,$=this.h5,W=this.h6,Q=this.h7,oe=[D>>>24&255,D>>>16&255,D>>>8&255,255&D,z>>>24&255,z>>>16&255,z>>>8&255,255&z,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,K>>>24&255,K>>>16&255,K>>>8&255,255&K,M>>>24&255,M>>>16&255,M>>>8&255,255&M,$>>>24&255,$>>>16&255,$>>>8&255,255&$,W>>>24&255,W>>>16&255,W>>>8&255,255&W];return this.is224||oe.push(Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q),oe},U.prototype.array=U.prototype.digest,U.prototype.arrayBuffer=function(){this.finalize();var D=new ArrayBuffer(this.is224?28:32),z=new DataView(D);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),D},re.prototype=new U,re.prototype.finalize=function(){if(U.prototype.finalize.call(this),this.inner){this.inner=!1;var D=this.array();U.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(D),U.prototype.finalize.call(this)}};var le=_();le.sha256=le,le.sha224=_(!0),le.sha256.hmac=L(),le.sha224.hmac=L(!0),c?Gh.exports=le:(s.sha256=le.sha256,s.sha224=le.sha224)})();vu.exports;vu.exports.sha224;var Bg=vu.exports.sha256;function pd(n){return lE(n)}function rE(n){if(!/^[0-9A-Fa-f]+$/.test(n))return!1;const s=/^[0-9A-F]+$/.test(n),i=/^[0-9a-f]+$/.test(n);return s||i?n.length%2===0:!1}function sE(n){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(n)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(n)}function iE(n){return rE(n)?"hex":sE(n)?"b64":""}function aE(n){if(n.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(n.length/2);for(let s=0;s<n.length;s+=2)t[s/2]=parseInt(n.substring(s,s+2),16);return t}function oE(n){n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/");const t=atob(n);return Uint8Array.from(t,s=>s.charCodeAt(0))}function lE(n){switch(iE(n)){case"hex":return aE(n);case"b64":return oE(n)}return null}function cE(n,t){const s=typeof n=="string"?pd(n):n,i=typeof t=="string"?pd(t):t;if(s===null||i===null||s.length!==i.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==i[o])return!1;return!0}class Zb{constructor(t,s,i=!0){j(this,"token");j(this,"received");j(this,"ctx");j(this,"requestSubject");j(this,"mux");this.mux=t,this.requestSubject=s,this.received=0,this.token=vs.next(),i&&(this.ctx=new Error)}}class uE extends Zb{constructor(s,i,o={maxWait:1e3}){super(s,i);j(this,"callback");j(this,"done");j(this,"timer");j(this,"max");j(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=ct(),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,i){s?(this.ctx&&(s.stack+=`
33
+
34
+ ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Jn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Jn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Jn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class ex extends Zb{constructor(s,i,o={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=ct(),this.timer=Qi(o.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
+
36
+ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ye.errorForCode(ue.Cancelled))}}const fE="$JS.API";function hE(n){return n=n||{},n.domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),bu({apiPrefix:fE,timeout:5e3},n)}class Ao{constructor(t,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=t,this.opts=hE(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Qn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,s=null,i){i=i||{},i.timeout=this.timeout;let o=wn;s&&(o=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const d=Kd();for(let y=0;y<c;y++)try{const g=await this.nc.request(t,o,i);return this.parseJsResponse(g)}catch(g){const u=g;if((u.code==="503"||u.code===ue.Timeout)&&y+1<c)await ea(d.backoff(y));else throw g}}async findStream(t){const s={subject:t},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const s=this.jc.decode(t.data),i=s;if(i.error){const o=Wb(i.error.code,i.error.description);if(o!==null)throw o.api_error=i.error,o}return s}}class uo{constructor(t,s,i,o){j(this,"err");j(this,"offset");j(this,"pageInfo");j(this,"subject");j(this,"jsm");j(this,"filter");j(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const s=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=s;const i=this.countResponse(s);return i===0?[]:(this.offset+=i,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(t){var s,i,o;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=t.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=t.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((o=t.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const s of t)yield s;t=await this.next()}}}function Js(n=""){const t=n.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${n}' is not a semver value`)}function yd(n,t){return n.major<t.major?-1:n.major>t.major?1:n.minor<t.minor?-1:n.minor>t.minor?1:n.micro<t.micro?-1:n.micro>t.micro?1:0}var He;(function(n){n.JS_KV="js_kv",n.JS_OBJECTSTORE="js_objectstore",n.JS_PULL_MAX_BYTES="js_pull_max_bytes",n.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",n.JS_ALLOW_DIRECT="js_allow_direct",n.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",n.JS_SIMPLIFICATION="js_simplification",n.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",n.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",n.JS_STREAM_FIRST_SEQ="js_stream_first_seq",n.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",n.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",n.JS_STREAM_COMPRESSION="js_stream_compression",n.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",n.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(He||(He={}));class dE{constructor(t){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=Js(t)),this.server=t,this.set(He.JS_KV,"2.6.2"),this.set(He.JS_OBJECTSTORE,"2.6.3"),this.set(He.JS_PULL_MAX_BYTES,"2.8.3"),this.set(He.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(He.JS_ALLOW_DIRECT,"2.9.0"),this.set(He.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(He.JS_SIMPLIFICATION,"2.9.4"),this.set(He.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(He.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(He.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(He.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(He.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(He.JS_STREAM_COMPRESSION,"2.10.0"),this.set(He.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(He.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(t,s){this.features.set(t,{min:s,ok:yd(this.server,Js(s))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var s;return((s=this.get(t))==null?void 0:s.ok)||!1}require(t){return typeof t=="string"&&(t=Js(t)),yd(this.server,t)>=0}}class cu extends Ao{constructor(t,s){super(t,s)}async add(t,s,i=lu.Create){if(Vt(t),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=t,o.action=i,o.config.durable_name&&Gi(o.config.durable_name);const c=this.nc;let{min:d,ok:y}=c.features.get(He.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!y)throw new Error(`consumer 'name' requires server ${d}`);if(g)try{xu("name",g)}catch(x){const v=x.message,_=v.indexOf("cannot contain");throw _!==-1?new Error(`consumer 'name' ${v.substring(_)}`):x}let u,m="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get(He.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);y=!1}if(s.metadata){const{min:x,ok:v}=c.features.get(He.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(y&&(m=s.name??s.durable_name??""),m!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),u=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${m}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${m}`}else u=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(u,o)}async update(t,s,i){const o=await this.info(t,s),c=i;return this.add(t,Object.assign(o.config,c),lu.Update)}async info(t,s){return Vt(t),Gi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${s}`)}async delete(t,s){return Vt(t),Gi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${s}`)).success}list(t){Vt(t);const s=o=>o.consumers,i=`${this.prefix}.CONSUMER.LIST.${t}`;return new uo(i,s,this)}pause(t,s,i){const o=`${this.prefix}.CONSUMER.PAUSE.${t}.${s}`,c={pause_until:i.toISOString()};return this._request(o,c)}resume(t,s){return this.pause(t,s,new Date(0))}}function Bi(n,t,s=!1){if(s===!0&&!n)throw ye.errorForCode(ue.ApiError,new Error(`${t} is not a function`));if(n&&typeof n!="function")throw ye.errorForCode(ue.ApiError,new Error(`${t} is not a function`))}class mE extends Mt{constructor(s,i,o){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");Bi(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&Bi(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(Bi(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(Bi(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(Bi(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&Bi(o.cleanupFn,"cleanupFn");let c=(m,b)=>{this.callback(m,b)};if(o.callback){const m=o.callback;c=(b,x)=>{const[v,_]=this.adapter(b,x);if(v){m(v,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(_,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(_))&&(m(v,_),this.dispatchedFn&&_&&this.dispatchedFn(_))}}const{max:d,queue:y,timeout:g}=o,u={queue:y,timeout:g,callback:c};d&&d>0&&(u.max=d),this.sub=s.subscribe(i,u),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=ct(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async m=>{await m.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,i){this.sub.cancelTimeout();const[o,c]=this.adapter(s,i);o&&this.stop(o),c&&this.push(c)}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 vn;function pE(n){vn=n}function tx(){return vn!==void 0&&vn.defaultPort!==void 0?vn.defaultPort:4222}function Vh(){return vn!==void 0&&vn.urlParseFn?vn.urlParseFn:void 0}function yE(){if(!vn||typeof vn.factory!="function")throw new Error("transport fn is not set");return vn.factory()}function gd(){return vn!==void 0&&vn.dnsResolveFn?vn.dnsResolveFn:void 0}const Wc=`\r
37
+ `,uu=Wi.fromAscii(Wc),gE=new Uint8Array(uu)[0],bE=new Uint8Array(uu)[1];function xE(n){for(let t=0;t<n.length;t++){const s=t+1;if(n.byteLength>s&&n[t]===gE&&n[s]===bE)return s+1}return 0}function vE(n){const t=xE(n);if(t>0){const i=new Uint8Array(n).slice(0,t);return xn.decode(i)}return""}const _E=4,nx=48,wE=65,SE=97;function EE(n,t,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,y)=>{o[y]=d}),o[12]=n,o[13]=t,o[14]=s,o[15]=i,o}function bd(n){return OE(n)!==void 0}function OE(n){for(let t=0;t<n.length;t++)switch(n[t]){case".":return rx(n);case":":return AE(n)}}function rx(n){const t=new Uint8Array(4);for(let s=0;s<4;s++){if(n.length===0)return;if(s>0){if(n[0]!==".")return;n=n.substring(1)}const{n:i,c:o,ok:c}=jE(n);if(!c||i>255)return;n=n.substring(o),t[s]=i}return EE(t[0],t[1],t[2],t[3])}function AE(n){const t=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return t;let i=0;for(;i<16;){const{n:o,c,ok:d}=kE(n);if(!d||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const y=rx(n);if(y===void 0)return;t[i]=y[12],t[i+1]=y[13],t[i+2]=y[14],t[i+3]=y[15],n="",i+=_E;break}if(t[i]=o>>8,t[i+1]=o,i+=2,n=n.substring(c),n.length===0)break;if(n[0]!==":"||n.length==1)return;if(n=n.substring(1),n[0]===":"){if(s>=0)return;if(s=i,n=n.substring(1),n.length===0)break}}if(n.length===0){if(i<16){if(s<0)return;const o=16-i;for(let c=i-1;c>=s;c--)t[c+o]=t[c];for(let c=s+o-1;c>=s;c--)t[c]=0}else if(s>=0)return;return t}}function jE(n){let t=0,s=0;for(t=0;t<n.length&&48<=n.charCodeAt(t)&&n.charCodeAt(t)<=57;t++)if(s=s*10+(n.charCodeAt(t)-nx),s>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:s,c:t,ok:!0}}function kE(n){let t=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)t*=16,t+=n.charCodeAt(s)-nx;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)t*=16,t+=n.charCodeAt(s)-SE+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)t*=16,t+=n.charCodeAt(s)-wE+10;else break;if(t>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:t,c:s,ok:!0}}function NE(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function xd(n){return!NE(n)}function TE(n){const t="::FFFF:",s=n.toUpperCase().indexOf(t);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+t.length);return i=i.replace("[",""),i.replace("]","")}return n}function CE(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=TE(n),xd(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const t=xd(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,i=s===80?"https":"http",o=new URL(`${i}://${n}`);o.port=`${s}`;let c=o.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:o.host,hostname:c,port:s}}class po{constructor(t,s=!1){j(this,"src");j(this,"listen");j(this,"hostname");j(this,"port");j(this,"didConnect");j(this,"reconnects");j(this,"lastConnect");j(this,"gossiped");j(this,"tlsName");j(this,"resolves");this.src=t,this.tlsName="";const i=CE(t);this.listen=i.listen,this.hostname=i.hostname,this.port=i.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const s=[];if(bd(this.hostname))return[this];{const i=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",d=new URL(`${c}://${xd(o)?"["+o+"]":o}`);d.port=`${this.port}`;const y=new po(d.host,!1);y.tlsName=this.hostname,s.push(y)}}return t.randomize&&Qb(s),this.resolves=s,s}}class ME{constructor(t=[],s={}){j(this,"firstSelect");j(this,"servers");j(this,"currentServer");j(this,"tlsName");j(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=Vh();t&&(t.forEach(o=>{o=i?i(o):o,this.servers.push(new po(o))}),this.randomize&&(this.servers=Qb(this.servers))),this.servers.length===0&&this.addServer(`${cd}:${tx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();bd(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,s=!1){const i=Vh();t=i?i(t):t;const o=new po(t,s);bd(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const s=this.servers.indexOf(t);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,s){const i=[];let o=[];const c=Vh(),d=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,s):g;const u=new po(g,!0);d.set(g,u)});const y=[];return this.servers.forEach((g,u)=>{const m=g.listen;g.gossiped&&this.currentServer.listen!==m&&d.get(m)===void 0&&y.push(u),d.delete(m)}),y.reverse(),y.forEach(g=>{const u=this.servers.splice(g,1);o=o.concat(u[0].listen)}),d.forEach((g,u)=>{this.servers.push(g),i.push(u)}),{added:i,deleted:o}}}class RE{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Cr(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const s=t.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,s){if(s&&s.permissionContext){if(t)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const o=this.all().find(c=>c.requestSubject===i.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(t,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(t===null&&s.headers&&(t=Xb(s)),o.resolver(t,s))}}}close(){const t=ye.errorForCode(ue.Timeout);this.reqs.forEach(s=>{s.resolver(t,{})})}}class DE{constructor(t,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=t,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Fi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=ct();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class qE extends Error{constructor(t){super(t),this.name="AssertionError"}}function LE(n,t="Assertion failed."){if(!n)throw new qE(t)}const Ug=32*1024,Yh=2**32-2;function nc(n,t,s=0){const i=t.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),t.set(n,s),n.byteLength}class Kh{constructor(t){j(this,"_buf");j(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const s=this._buf.byteLength;return t<=this.capacity-s?(this._reslice(s+t),s):-1}_reslice(t){LE(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const s=nc(this._buf.subarray(this._off),t);return this._off+=s,s}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Qs.encode(t))}write(t){const s=this._grow(t.byteLength);return nc(t,this._buf,s)}_grow(t){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(t);if(i>=0)return i;const o=this.capacity;if(t<=Math.floor(o/2)-s)nc(this._buf.subarray(this._off),this._buf);else{if(o+t>Yh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+t,Yh));nc(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+t,Yh)),s}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const s=this._grow(t);this._reslice(s)}readFrom(t){let s=0;const i=new Uint8Array(Ug);for(;;){const o=this.capacity-this.length<Ug,c=o?i:new Uint8Array(this._buf.buffer,this.length),d=t.read(c);if(d===null)return s;o?this.write(c.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var Yt;(function(n){n[n.OK=0]="OK",n[n.ERR=1]="ERR",n[n.MSG=2]="MSG",n[n.INFO=3]="INFO",n[n.PING=4]="PING",n[n.PONG=5]="PONG"})(Yt||(Yt={}));function Pg(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const BE=48;class zg{constructor(t){j(this,"dispatcher");j(this,"state");j(this,"as");j(this,"drop");j(this,"hdr");j(this,"ma");j(this,"argBuf");j(this,"msgBuf");this.dispatcher=t,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let s;for(s=0;s<t.length;s++){const i=t[s];switch(this.state){case de.OP_START:switch(i){case me.M:case me.m:this.state=de.OP_M,this.hdr=-1,this.ma=Pg();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=Pg();break;case me.P:case me.p:this.state=de.OP_P;break;case me.PLUS:this.state=de.OP_PLUS;break;case me.MINUS:this.state=de.OP_MINUS;break;case me.I:case me.i:this.state=de.OP_I;break;default:throw this.fail(t.subarray(s))}break;case de.OP_H:switch(i){case me.M:case me.m:this.state=de.OP_M;break;default:throw this.fail(t.subarray(s))}break;case de.OP_M:switch(i){case me.S:case me.s:this.state=de.OP_MS;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MS:switch(i){case me.G:case me.g:this.state=de.OP_MSG;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MSG:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MSG_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MSG_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MSG_ARG,this.as=s}break;case de.MSG_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{const o=this.argBuf?this.argBuf.bytes():t.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=de.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case de.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Yt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const c=t.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(t.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Yt.MSG,msg:this.ma,data:t.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END);break;case de.MSG_END:switch(i){case me.NL:this.drop=0,this.as=s+1,this.state=de.OP_START;break;default:continue}break;case de.OP_PLUS:switch(i){case me.O:case me.o:this.state=de.OP_PLUS_O;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PLUS_O:switch(i){case me.K:case me.k:this.state=de.OP_PLUS_OK;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Yt.OK}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_MINUS:switch(i){case me.E:case me.e:this.state=de.OP_MINUS_E;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_E:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ER;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ER:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ERR:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ERR_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MINUS_ERR_ARG,this.as=s}break;case de.MINUS_ERR_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Yt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case de.OP_P:switch(i){case me.I:case me.i:this.state=de.OP_PI;break;case me.O:case me.o:this.state=de.OP_PO;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PO:switch(i){case me.N:case me.n:this.state=de.OP_PON;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PON:switch(i){case me.G:case me.g:this.state=de.OP_PONG;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Yt.PONG}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_PI:switch(i){case me.N:case me.n:this.state=de.OP_PIN;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PIN:switch(i){case me.G:case me.g:this.state=de.OP_PING;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Yt.PING}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_I:switch(i){case me.N:case me.n:this.state=de.OP_IN;break;default:throw this.fail(t.subarray(s))}break;case de.OP_IN:switch(i){case me.F:case me.f:this.state=de.OP_INF;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INF:switch(i){case me.O:case me.o:this.state=de.OP_INFO;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INFO:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_INFO_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INFO_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.INFO_ARG,this.as=s}break;case de.INFO_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Yt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(t.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Kh(t.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Kh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(t+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,t),this.argBuf=new Kh(i),this.ma.subject=i.subarray(0,t),this.ma.reply&&(this.ma.reply=i.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const s=[];let i=-1;for(let o=0;o<t.length;o++)switch(t[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(t.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${xn.decode(t)}`)}processHeaderMsgArgs(t){const s=[];let i=-1;for(let o=0;o<t.length;o++)switch(t[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(t.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let s=0;for(let i=0;i<t.length;i++){if(t[i]<48||t[i]>57)return-1;s=s*10+(t[i]-BE)}return s}}var de;(function(n){n[n.OP_START=0]="OP_START",n[n.OP_PLUS=1]="OP_PLUS",n[n.OP_PLUS_O=2]="OP_PLUS_O",n[n.OP_PLUS_OK=3]="OP_PLUS_OK",n[n.OP_MINUS=4]="OP_MINUS",n[n.OP_MINUS_E=5]="OP_MINUS_E",n[n.OP_MINUS_ER=6]="OP_MINUS_ER",n[n.OP_MINUS_ERR=7]="OP_MINUS_ERR",n[n.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",n[n.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",n[n.OP_M=10]="OP_M",n[n.OP_MS=11]="OP_MS",n[n.OP_MSG=12]="OP_MSG",n[n.OP_MSG_SPC=13]="OP_MSG_SPC",n[n.MSG_ARG=14]="MSG_ARG",n[n.MSG_PAYLOAD=15]="MSG_PAYLOAD",n[n.MSG_END=16]="MSG_END",n[n.OP_H=17]="OP_H",n[n.OP_P=18]="OP_P",n[n.OP_PI=19]="OP_PI",n[n.OP_PIN=20]="OP_PIN",n[n.OP_PING=21]="OP_PING",n[n.OP_PO=22]="OP_PO",n[n.OP_PON=23]="OP_PON",n[n.OP_PONG=24]="OP_PONG",n[n.OP_I=25]="OP_I",n[n.OP_IN=26]="OP_IN",n[n.OP_INF=27]="OP_INF",n[n.OP_INFO=28]="OP_INFO",n[n.OP_INFO_SPC=29]="OP_INFO_SPC",n[n.INFO_ARG=30]="INFO_ARG"})(de||(de={}));var me;(function(n){n[n.CR=13]="CR",n[n.E=69]="E",n[n.e=101]="e",n[n.F=70]="F",n[n.f=102]="f",n[n.G=71]="G",n[n.g=103]="g",n[n.H=72]="H",n[n.h=104]="h",n[n.I=73]="I",n[n.i=105]="i",n[n.K=75]="K",n[n.k=107]="k",n[n.M=77]="M",n[n.m=109]="m",n[n.MINUS=45]="MINUS",n[n.N=78]="N",n[n.n=110]="n",n[n.NL=10]="NL",n[n.O=79]="O",n[n.o=111]="o",n[n.P=80]="P",n[n.p=112]="p",n[n.PLUS=43]="PLUS",n[n.R=82]="R",n[n.r=114]="r",n[n.S=83]="S",n[n.s=115]="s",n[n.SPACE=32]="SPACE",n[n.TAB=9]="TAB"})(me||(me={}));(function(n){var t=function(A,N){this.hi=A|0,this.lo=N|0},s=function(A){var N,k=new Float64Array(16);if(A)for(N=0;N<A.length;N++)k[N]=A[N];return k},i=function(){throw new Error("no PRNG")},o=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var d=s(),y=s([1]),g=s([56129,1]),u=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),m=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(A,N){return A<<N|A>>>32-N}function S(A,N){var k=A[N+3]&255;return k=k<<8|A[N+2]&255,k=k<<8|A[N+1]&255,k<<8|A[N+0]&255}function C(A,N){var k=A[N]<<24|A[N+1]<<16|A[N+2]<<8|A[N+3],T=A[N+4]<<24|A[N+5]<<16|A[N+6]<<8|A[N+7];return new t(k,T)}function L(A,N,k){var T;for(T=0;T<4;T++)A[N+T]=k&255,k>>>=8}function U(A,N,k){A[N]=k.hi>>24&255,A[N+1]=k.hi>>16&255,A[N+2]=k.hi>>8&255,A[N+3]=k.hi&255,A[N+4]=k.lo>>24&255,A[N+5]=k.lo>>16&255,A[N+6]=k.lo>>8&255,A[N+7]=k.lo&255}function re(A,N,k,T,q){var I,ne=0;for(I=0;I<q;I++)ne|=A[N+I]^k[T+I];return(1&ne-1>>>8)-1}function le(A,N,k,T){return re(A,N,k,T,16)}function D(A,N,k,T){return re(A,N,k,T,32)}function z(A,N,k,T,q){var I=new Uint32Array(16),ne=new Uint32Array(16),ie=new Uint32Array(16),V=new Uint32Array(4),te,ge,Re;for(te=0;te<4;te++)ne[5*te]=S(T,4*te),ne[1+te]=S(k,4*te),ne[6+te]=S(N,4*te),ne[11+te]=S(k,16+4*te);for(te=0;te<16;te++)ie[te]=ne[te];for(te=0;te<20;te++){for(ge=0;ge<4;ge++){for(Re=0;Re<4;Re++)V[Re]=ne[(5*ge+4*Re)%16];for(V[1]^=_(V[0]+V[3]|0,7),V[2]^=_(V[1]+V[0]|0,9),V[3]^=_(V[2]+V[1]|0,13),V[0]^=_(V[3]+V[2]|0,18),Re=0;Re<4;Re++)I[4*ge+(ge+Re)%4]=V[Re]}for(Re=0;Re<16;Re++)ne[Re]=I[Re]}if(q){for(te=0;te<16;te++)ne[te]=ne[te]+ie[te]|0;for(te=0;te<4;te++)ne[5*te]=ne[5*te]-S(T,4*te)|0,ne[6+te]=ne[6+te]-S(N,4*te)|0;for(te=0;te<4;te++)L(A,4*te,ne[5*te]),L(A,16+4*te,ne[6+te])}else for(te=0;te<16;te++)L(A,4*te,ne[te]+ie[te]|0)}function ae(A,N,k,T){return z(A,N,k,T,!1),0}function K(A,N,k,T){return z(A,N,k,T,!0),0}var M=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function $(A,N,k,T,q,I,ne){var ie=new Uint8Array(16),V=new Uint8Array(64),te,ge;if(!q)return 0;for(ge=0;ge<16;ge++)ie[ge]=0;for(ge=0;ge<8;ge++)ie[ge]=I[ge];for(;q>=64;){for(ae(V,ie,ne,M),ge=0;ge<64;ge++)A[N+ge]=(k?k[T+ge]:0)^V[ge];for(te=1,ge=8;ge<16;ge++)te=te+(ie[ge]&255)|0,ie[ge]=te&255,te>>>=8;q-=64,N+=64,k&&(T+=64)}if(q>0)for(ae(V,ie,ne,M),ge=0;ge<q;ge++)A[N+ge]=(k?k[T+ge]:0)^V[ge];return 0}function W(A,N,k,T,q){return $(A,N,null,0,k,T,q)}function Q(A,N,k,T,q){var I=new Uint8Array(32);return K(I,T,q,M),W(A,N,k,T.subarray(16),I)}function oe(A,N,k,T,q,I,ne){var ie=new Uint8Array(32);return K(ie,I,ne,M),$(A,N,k,T,q,I.subarray(16),ie)}function ve(A,N){var k,T=0;for(k=0;k<17;k++)T=T+(A[k]+N[k]|0)|0,A[k]=T&255,T>>>=8}var ke=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(A,N,k,T,q,I){var ne,ie,V,te,ge=new Uint32Array(17),Re=new Uint32Array(17),rt=new Uint32Array(17),It=new Uint32Array(17),In=new Uint32Array(17);for(V=0;V<17;V++)Re[V]=rt[V]=0;for(V=0;V<16;V++)Re[V]=I[V];for(Re[3]&=15,Re[4]&=252,Re[7]&=15,Re[8]&=252,Re[11]&=15,Re[12]&=252,Re[15]&=15;q>0;){for(V=0;V<17;V++)It[V]=0;for(V=0;V<16&&V<q;++V)It[V]=k[T+V];for(It[V]=1,T+=V,q-=V,ve(rt,It),ie=0;ie<17;ie++)for(ge[ie]=0,V=0;V<17;V++)ge[ie]=ge[ie]+rt[V]*(V<=ie?Re[ie-V]:320*Re[ie+17-V]|0)|0|0;for(ie=0;ie<17;ie++)rt[ie]=ge[ie];for(te=0,V=0;V<16;V++)te=te+rt[V]|0,rt[V]=te&255,te>>>=8;for(te=te+rt[16]|0,rt[16]=te&3,te=5*(te>>>2)|0,V=0;V<16;V++)te=te+rt[V]|0,rt[V]=te&255,te>>>=8;te=te+rt[16]|0,rt[16]=te}for(V=0;V<17;V++)In[V]=rt[V];for(ve(rt,ke),ne=-(rt[16]>>>7)|0,V=0;V<17;V++)rt[V]^=ne&(In[V]^rt[V]);for(V=0;V<16;V++)It[V]=I[V+16];for(It[16]=0,ve(rt,It),V=0;V<16;V++)A[N+V]=rt[V];return 0}function Z(A,N,k,T,q,I){var ne=new Uint8Array(16);return Y(ne,0,k,T,q,I),le(A,N,ne,0)}function ce(A,N,k,T,q){var I;if(k<32)return-1;for(oe(A,0,N,0,k,T,q),Y(A,16,A,32,k-32,A),I=0;I<16;I++)A[I]=0;return 0}function _e(A,N,k,T,q){var I,ne=new Uint8Array(32);if(k<32||(Q(ne,0,32,T,q),Z(N,16,N,32,k-32,ne)!==0))return-1;for(oe(A,0,N,0,k,T,q),I=0;I<32;I++)A[I]=0;return 0}function we(A,N){var k;for(k=0;k<16;k++)A[k]=N[k]|0}function Ne(A){var N,k;for(k=0;k<16;k++)A[k]+=65536,N=Math.floor(A[k]/65536),A[(k+1)*(k<15?1:0)]+=N-1+37*(N-1)*(k===15?1:0),A[k]-=N*65536}function je(A,N,k){for(var T,q=~(k-1),I=0;I<16;I++)T=q&(A[I]^N[I]),A[I]^=T,N[I]^=T}function Te(A,N){var k,T,q,I=s(),ne=s();for(k=0;k<16;k++)ne[k]=N[k];for(Ne(ne),Ne(ne),Ne(ne),T=0;T<2;T++){for(I[0]=ne[0]-65517,k=1;k<15;k++)I[k]=ne[k]-65535-(I[k-1]>>16&1),I[k-1]&=65535;I[15]=ne[15]-32767-(I[14]>>16&1),q=I[15]>>16&1,I[14]&=65535,je(ne,I,1-q)}for(k=0;k<16;k++)A[2*k]=ne[k]&255,A[2*k+1]=ne[k]>>8}function nt(A,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Te(k,A),Te(T,N),D(k,0,T,0)}function Nt(A){var N=new Uint8Array(32);return Te(N,A),N[0]&1}function Dt(A,N){var k;for(k=0;k<16;k++)A[k]=N[2*k]+(N[2*k+1]<<8);A[15]&=32767}function ut(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]+k[T]|0}function ft(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]-k[T]|0}function fe(A,N,k){var T,q,I=new Float64Array(31);for(T=0;T<31;T++)I[T]=0;for(T=0;T<16;T++)for(q=0;q<16;q++)I[T+q]+=N[T]*k[q];for(T=0;T<15;T++)I[T]+=38*I[T+16];for(T=0;T<16;T++)A[T]=I[T];Ne(A),Ne(A)}function pe(A,N){fe(A,N,N)}function ht(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)pe(k,k),T!==2&&T!==4&&fe(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function Ht(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)pe(k,k),T!==1&&fe(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function An(A,N,k){var T=new Uint8Array(32),q=new Float64Array(80),I,ne,ie=s(),V=s(),te=s(),ge=s(),Re=s(),rt=s();for(ne=0;ne<31;ne++)T[ne]=N[ne];for(T[31]=N[31]&127|64,T[0]&=248,Dt(q,k),ne=0;ne<16;ne++)V[ne]=q[ne],ge[ne]=ie[ne]=te[ne]=0;for(ie[0]=ge[0]=1,ne=254;ne>=0;--ne)I=T[ne>>>3]>>>(ne&7)&1,je(ie,V,I),je(te,ge,I),ut(Re,ie,te),ft(ie,ie,te),ut(te,V,ge),ft(V,V,ge),pe(ge,Re),pe(rt,ie),fe(ie,te,ie),fe(te,V,Re),ut(Re,ie,te),ft(ie,ie,te),pe(V,ie),ft(te,ge,rt),fe(ie,te,g),ut(ie,ie,ge),fe(te,te,ie),fe(ie,ge,rt),fe(ge,V,q),pe(V,Re),je(ie,V,I),je(te,ge,I);for(ne=0;ne<16;ne++)q[ne+16]=ie[ne],q[ne+32]=te[ne],q[ne+48]=V[ne],q[ne+64]=ge[ne];var It=q.subarray(32),In=q.subarray(16);return ht(It,It),fe(In,In,It),Te(A,In),0}function zt(A,N){return An(A,N,c)}function Ws(A,N){return i(N,32),zt(A,N)}function Lr(A,N,k){var T=new Uint8Array(32);return An(T,k,N),K(A,o,T,M)}var Ro=ce,Do=_e;function ra(A,N,k,T,q,I){var ne=new Uint8Array(32);return Lr(ne,q,I),Ro(A,N,k,T,ne)}function sa(A,N,k,T,q,I){var ne=new Uint8Array(32);return Lr(ne,q,I),Do(A,N,k,T,ne)}function or(){var A=0,N=0,k=0,T=0,q=65535,I,ne,ie;for(ie=0;ie<arguments.length;ie++)I=arguments[ie].lo,ne=arguments[ie].hi,A+=I&q,N+=I>>>16,k+=ne&q,T+=ne>>>16;return N+=A>>>16,k+=N>>>16,T+=k>>>16,new t(k&q|T<<16,A&q|N<<16)}function qo(A,N){return new t(A.hi>>>N,A.lo>>>N|A.hi<<32-N)}function Zs(){var A=0,N=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,N^=arguments[k].hi;return new t(N,A)}function at(A,N){var k,T,q=32-N;return N<32?(k=A.hi>>>N|A.lo<<q,T=A.lo>>>N|A.hi<<q):N<64&&(k=A.lo>>>N|A.hi<<q,T=A.hi>>>N|A.lo<<q),new t(k,T)}function Nu(A,N,k){var T=A.hi&N.hi^~A.hi&k.hi,q=A.lo&N.lo^~A.lo&k.lo;return new t(T,q)}function Lo(A,N,k){var T=A.hi&N.hi^A.hi&k.hi^N.hi&k.hi,q=A.lo&N.lo^A.lo&k.lo^N.lo&k.lo;return new t(T,q)}function Bo(A){return Zs(at(A,28),at(A,34),at(A,39))}function ei(A){return Zs(at(A,14),at(A,18),at(A,41))}function Tu(A){return Zs(at(A,1),at(A,8),qo(A,7))}function Uo(A){return Zs(at(A,19),at(A,61),qo(A,6))}var Cu=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function Po(A,N,k){var T=[],q=[],I=[],ne=[],ie,V,te;for(V=0;V<8;V++)T[V]=I[V]=C(A,8*V);for(var ge=0;k>=128;){for(V=0;V<16;V++)ne[V]=C(N,8*V+ge);for(V=0;V<80;V++){for(te=0;te<8;te++)q[te]=I[te];for(ie=or(I[7],ei(I[4]),Nu(I[4],I[5],I[6]),Cu[V],ne[V%16]),q[7]=or(ie,Bo(I[0]),Lo(I[0],I[1],I[2])),q[3]=or(q[3],ie),te=0;te<8;te++)I[(te+1)%8]=q[te];if(V%16===15)for(te=0;te<16;te++)ne[te]=or(ne[te],ne[(te+9)%16],Tu(ne[(te+1)%16]),Uo(ne[(te+14)%16]))}for(V=0;V<8;V++)I[V]=or(I[V],T[V]),T[V]=I[V];ge+=128,k-=128}for(V=0;V<8;V++)U(A,8*V,T[V]);return k}var ws=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 gt(A,N,k){var T=new Uint8Array(64),q=new Uint8Array(256),I,ne=k;for(I=0;I<64;I++)T[I]=ws[I];for(Po(T,N,k),k%=128,I=0;I<256;I++)q[I]=0;for(I=0;I<k;I++)q[I]=N[ne-k+I];for(q[k]=128,k=256-128*(k<112?1:0),q[k-9]=0,U(q,k-8,new t(ne/536870912|0,ne<<3)),Po(T,q,k),I=0;I<64;I++)A[I]=T[I];return 0}function sn(A,N){var k=s(),T=s(),q=s(),I=s(),ne=s(),ie=s(),V=s(),te=s(),ge=s();ft(k,A[1],A[0]),ft(ge,N[1],N[0]),fe(k,k,ge),ut(T,A[0],A[1]),ut(ge,N[0],N[1]),fe(T,T,ge),fe(q,A[3],N[3]),fe(q,q,m),fe(I,A[2],N[2]),ut(I,I,I),ft(ne,T,k),ft(ie,I,q),ut(V,I,q),ut(te,T,k),fe(A[0],ne,ie),fe(A[1],te,V),fe(A[2],V,ie),fe(A[3],ne,te)}function $t(A,N,k){var T;for(T=0;T<4;T++)je(A[T],N[T],k)}function ia(A,N){var k=s(),T=s(),q=s();ht(q,N[2]),fe(k,N[0],q),fe(T,N[1],q),Te(A,T),A[31]^=Nt(k)<<7}function aa(A,N,k){var T,q;for(we(A[0],d),we(A[1],y),we(A[2],y),we(A[3],d),q=255;q>=0;--q)T=k[q/8|0]>>(q&7)&1,$t(A,N,T),sn(N,A),sn(A,A),$t(A,N,T)}function ti(A,N){var k=[s(),s(),s(),s()];we(k[0],b),we(k[1],x),we(k[2],y),fe(k[3],b,x),aa(A,k,N)}function Br(A,N,k){var T=new Uint8Array(64),q=[s(),s(),s(),s()],I;for(k||i(N,32),gt(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,ti(q,T),ia(A,q),I=0;I<32;I++)N[I+32]=A[I];return 0}var lr=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 Ur(A,N){var k,T,q,I;for(T=63;T>=32;--T){for(k=0,q=T-32,I=T-12;q<I;++q)N[q]+=k-16*N[T]*lr[q-(T-32)],k=Math.floor((N[q]+128)/256),N[q]-=k*256;N[q]+=k,N[T]=0}for(k=0,q=0;q<32;q++)N[q]+=k-(N[31]>>4)*lr[q],k=N[q]>>8,N[q]&=255;for(q=0;q<32;q++)N[q]-=k*lr[q];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,A[T]=N[T]&255}function zn(A){var N=new Float64Array(64),k;for(k=0;k<64;k++)N[k]=A[k];for(k=0;k<64;k++)A[k]=0;Ur(A,N)}function Ss(A,N,k,T){var q=new Uint8Array(64),I=new Uint8Array(64),ne=new Uint8Array(64),ie,V,te=new Float64Array(64),ge=[s(),s(),s(),s()];gt(q,T,32),q[0]&=248,q[31]&=127,q[31]|=64;var Re=k+64;for(ie=0;ie<k;ie++)A[64+ie]=N[ie];for(ie=0;ie<32;ie++)A[32+ie]=q[32+ie];for(gt(ne,A.subarray(32),k+32),zn(ne),ti(ge,ne),ia(A,ge),ie=32;ie<64;ie++)A[ie]=T[ie];for(gt(I,A,k+64),zn(I),ie=0;ie<64;ie++)te[ie]=0;for(ie=0;ie<32;ie++)te[ie]=ne[ie];for(ie=0;ie<32;ie++)for(V=0;V<32;V++)te[ie+V]+=I[ie]*q[V];return Ur(A.subarray(32),te),Re}function Es(A,N){var k=s(),T=s(),q=s(),I=s(),ne=s(),ie=s(),V=s();return we(A[2],y),Dt(A[1],N),pe(q,A[1]),fe(I,q,u),ft(q,q,A[2]),ut(I,A[2],I),pe(ne,I),pe(ie,ne),fe(V,ie,ne),fe(k,V,q),fe(k,k,I),Ht(k,k),fe(k,k,q),fe(k,k,I),fe(k,k,I),fe(A[0],k,I),pe(T,A[0]),fe(T,T,I),nt(T,q)&&fe(A[0],A[0],v),pe(T,A[0]),fe(T,T,I),nt(T,q)?-1:(Nt(A[0])===N[31]>>7&&ft(A[0],d,A[0]),fe(A[3],A[0],A[1]),0)}function oa(A,N,k,T){var q,I=new Uint8Array(32),ne=new Uint8Array(64),ie=[s(),s(),s(),s()],V=[s(),s(),s(),s()];if(k<64||Es(V,T))return-1;for(q=0;q<k;q++)A[q]=N[q];for(q=0;q<32;q++)A[q+32]=T[q];if(gt(ne,A,k),zn(ne),aa(ie,V,ne),ti(V,N.subarray(32)),sn(ie,V),ia(I,ie),k-=64,D(N,0,I,0)){for(q=0;q<k;q++)A[q]=0;return-1}for(q=0;q<k;q++)A[q]=N[q+64];return k}var ni=32,Pr=24,$n=32,zr=16,$r=32,Os=32,Ir=32,cr=32,As=32,la=Pr,zo=$n,Wn=zr,et=64,dt=32,an=64,js=32,ca=64;n.lowlevel={crypto_core_hsalsa20:K,crypto_stream_xor:oe,crypto_stream:Q,crypto_stream_salsa20_xor:$,crypto_stream_salsa20:W,crypto_onetimeauth:Y,crypto_onetimeauth_verify:Z,crypto_verify_16:le,crypto_verify_32:D,crypto_secretbox:ce,crypto_secretbox_open:_e,crypto_scalarmult:An,crypto_scalarmult_base:zt,crypto_box_beforenm:Lr,crypto_box_afternm:Ro,crypto_box:ra,crypto_box_open:sa,crypto_box_keypair:Ws,crypto_hash:gt,crypto_sign:Ss,crypto_sign_keypair:Br,crypto_sign_open:oa,crypto_secretbox_KEYBYTES:ni,crypto_secretbox_NONCEBYTES:Pr,crypto_secretbox_ZEROBYTES:$n,crypto_secretbox_BOXZEROBYTES:zr,crypto_scalarmult_BYTES:$r,crypto_scalarmult_SCALARBYTES:Os,crypto_box_PUBLICKEYBYTES:Ir,crypto_box_SECRETKEYBYTES:cr,crypto_box_BEFORENMBYTES:As,crypto_box_NONCEBYTES:la,crypto_box_ZEROBYTES:zo,crypto_box_BOXZEROBYTES:Wn,crypto_sign_BYTES:et,crypto_sign_PUBLICKEYBYTES:dt,crypto_sign_SECRETKEYBYTES:an,crypto_sign_SEEDBYTES:js,crypto_hash_BYTES:ca,gf:s,D:u,L:lr,pack25519:Te,unpack25519:Dt,M:fe,A:ut,S:pe,Z:ft,pow2523:Ht,add:sn,set25519:we,modL:Ur,scalarmult:aa,scalarbase:ti};function $o(A,N){if(A.length!==ni)throw new Error("bad key size");if(N.length!==Pr)throw new Error("bad nonce size")}function Io(A,N){if(A.length!==Ir)throw new Error("bad public key size");if(N.length!==cr)throw new Error("bad secret key size")}function At(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ri(A){for(var N=0;N<A.length;N++)A[N]=0}n.randomBytes=function(A){var N=new Uint8Array(A);return i(N,A),N},n.secretbox=function(A,N,k){At(A,N,k),$o(k,N);for(var T=new Uint8Array($n+A.length),q=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+$n]=A[I];return ce(q,T,T.length,N,k),q.subarray(zr)},n.secretbox.open=function(A,N,k){At(A,N,k),$o(k,N);for(var T=new Uint8Array(zr+A.length),q=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+zr]=A[I];return T.length<32||_e(q,T,T.length,N,k)!==0?null:q.subarray($n)},n.secretbox.keyLength=ni,n.secretbox.nonceLength=Pr,n.secretbox.overheadLength=zr,n.scalarMult=function(A,N){if(At(A,N),A.length!==Os)throw new Error("bad n size");if(N.length!==$r)throw new Error("bad p size");var k=new Uint8Array($r);return An(k,A,N),k},n.scalarMult.base=function(A){if(At(A),A.length!==Os)throw new Error("bad n size");var N=new Uint8Array($r);return zt(N,A),N},n.scalarMult.scalarLength=Os,n.scalarMult.groupElementLength=$r,n.box=function(A,N,k,T){var q=n.box.before(k,T);return n.secretbox(A,N,q)},n.box.before=function(A,N){At(A,N),Io(A,N);var k=new Uint8Array(As);return Lr(k,A,N),k},n.box.after=n.secretbox,n.box.open=function(A,N,k,T){var q=n.box.before(k,T);return n.secretbox.open(A,N,q)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Ir),N=new Uint8Array(cr);return Ws(A,N),{publicKey:A,secretKey:N}},n.box.keyPair.fromSecretKey=function(A){if(At(A),A.length!==cr)throw new Error("bad secret key size");var N=new Uint8Array(Ir);return zt(N,A),{publicKey:N,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Ir,n.box.secretKeyLength=cr,n.box.sharedKeyLength=As,n.box.nonceLength=la,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,N){if(At(A,N),N.length!==an)throw new Error("bad secret key size");var k=new Uint8Array(et+A.length);return Ss(k,A,A.length,N),k},n.sign.open=function(A,N){if(At(A,N),N.length!==dt)throw new Error("bad public key size");var k=new Uint8Array(A.length),T=oa(k,A,A.length,N);if(T<0)return null;for(var q=new Uint8Array(T),I=0;I<q.length;I++)q[I]=k[I];return q},n.sign.detached=function(A,N){for(var k=n.sign(A,N),T=new Uint8Array(et),q=0;q<T.length;q++)T[q]=k[q];return T},n.sign.detached.verify=function(A,N,k){if(At(A,N,k),N.length!==et)throw new Error("bad signature size");if(k.length!==dt)throw new Error("bad public key size");var T=new Uint8Array(et+A.length),q=new Uint8Array(et+A.length),I;for(I=0;I<et;I++)T[I]=N[I];for(I=0;I<A.length;I++)T[I+et]=A[I];return oa(q,T,T.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(dt),N=new Uint8Array(an);return Br(A,N),{publicKey:A,secretKey:N}},n.sign.keyPair.fromSecretKey=function(A){if(At(A),A.length!==an)throw new Error("bad secret key size");for(var N=new Uint8Array(dt),k=0;k<N.length;k++)N[k]=A[32+k];return{publicKey:N,secretKey:new Uint8Array(A)}},n.sign.keyPair.fromSeed=function(A){if(At(A),A.length!==js)throw new Error("bad seed size");for(var N=new Uint8Array(dt),k=new Uint8Array(an),T=0;T<32;T++)k[T]=A[T];return Br(N,k,!0),{publicKey:N,secretKey:k}},n.sign.publicKeyLength=dt,n.sign.secretKeyLength=an,n.sign.seedLength=js,n.sign.signatureLength=et,n.hash=function(A){At(A);var N=new Uint8Array(ca);return gt(N,A,A.length),N},n.hash.hashLength=ca,n.verify=function(A,N){return At(A,N),A.length===0||N.length===0||A.length!==N.length?!1:re(A,0,N,0,A.length)===0},n.setPRNG=function(A){i=A},(function(){var A=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(A&&A.getRandomValues){var N=65536;n.setPRNG(function(k,T){var q,I=new Uint8Array(T);for(q=0;q<T;q+=N)A.getRandomValues(I.subarray(q,q+Math.min(T-q,N)));for(q=0;q<T;q++)k[q]=I[q];ri(I)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,T){var q,I=A.randomBytes(T);for(q=0;q<T;q++)k[q]=I[q];ri(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const rc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;rc.sign.keyPair.fromSeed,rc.sign.detached,rc.sign.detached.verify,rc.randomBytes;var $g;(function(n){n.InvalidPrefixByte="nkeys: invalid prefix byte",n.InvalidKey="nkeys: invalid key",n.InvalidPublicKey="nkeys: invalid public key",n.InvalidSeedLen="nkeys: invalid seed length",n.InvalidSeed="nkeys: invalid seed",n.InvalidEncoding="nkeys: invalid encoded key",n.InvalidSignature="nkeys: signature verification failed",n.CannotSign="nkeys: cannot sign, no private key available",n.PublicKeyOnly="nkeys: no seed or private key available",n.InvalidChecksum="nkeys: invalid checksum",n.SerializationError="nkeys: serialization error",n.ApiError="nkeys: api error",n.ClearedPair="nkeys: pair is cleared"})($g||($g={}));var Ig;(function(n){n[n.Seed=144]="Seed",n[n.Private=120]="Private",n[n.Operator=112]="Operator",n[n.Server=104]="Server",n[n.Cluster=16]="Cluster",n[n.Account=0]="Account",n[n.User=160]="User"})(Ig||(Ig={}));function UE(n){return t=>{let s={};return n.forEach(i=>{const o=i(t)||{};s=Object.assign(s,o)}),s}}function PE(){return()=>{}}function zE(n,t){return()=>{const s=typeof n=="function"?n():n,i=typeof t=="function"?t():t;return{user:s,pass:i}}}function $E(n){return()=>({auth_token:typeof n=="function"?n():n})}const sx=120*1e3,IE=2,ix=2*1e3;function HE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:sx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:ix,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function FE(n){const t=[];return typeof n.authenticator=="function"&&t.push(n.authenticator),Array.isArray(n.authenticator)&&t.push(...n.authenticator),n.token&&t.push($E(n.token)),n.user&&t.push(zE(n.user,n.pass)),t.length===0?PE():UE(t)}function GE(n){const t=`${cd}:${tx()}`;if(n=n||{servers:[t]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new ye("port and servers options are mutually exclusive",ue.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${cd}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[t]);const s=bu(HE(),n);if(s.authenticator=FE(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new ye(`${i} option should be a function`,ue.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let i=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return i&&(i++,i=Math.floor(Math.random()*i)),s.reconnectTimeWait+i}),s.inboxPrefix)try{Cr(s.inboxPrefix)}catch(i){throw new ye(i.message,ue.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof gd()=="function"),s.resolve&&typeof gd()!="function")throw new ye("'resolve' is not supported on this client",ue.InvalidOption);return s}function VE(n,t){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&t.noEcho)throw new ye("noEcho",ue.ServerOptionNotAvailable);const c=i||o||!1;if(t.tls&&!c)throw new ye("tls",ue.ServerOptionNotAvailable)}const YE=1024*32,KE=/^INFO\s+([^\r\n]+)\r\n/i,JE=ho(`PONG\r
38
+ `),Hg=ho(`PING\r
39
+ `);class QE{constructor(t,s,i){j(this,"echo");j(this,"no_responders");j(this,"protocol");j(this,"verbose");j(this,"pedantic");j(this,"jwt");j(this,"nkey");j(this,"sig");j(this,"user");j(this,"pass");j(this,"auth_token");j(this,"tls_required");j(this,"name");j(this,"lang");j(this,"version");j(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};bu(this,o)}}class ax extends Mt{constructor(s,i,o={}){var d;super();j(this,"sid");j(this,"queue");j(this,"draining");j(this,"max");j(this,"subject");j(this,"drained");j(this,"protocol");j(this,"timer");j(this,"info");j(this,"cleanupFn");j(this,"closed");j(this,"requestSubject");bu(this,o),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=ct();const c=!((d=s.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=Qi(o.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(y=>{this.stop(y),this.noIterator&&this.callback(y,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,d=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(y,g)=>{const{ingest:u}=o(g);u&&c(g)&&(i(y,g),d(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,i){this.cancelTimeout(),s?this.stop(s):this.push(i)}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(ye.errorForCode(ue.ConnectionClosed)):this.isClosed()?Promise.reject(ye.errorForCode(ue.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(ct()).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 XE{constructor(){j(this,"mux");j(this,"subs");j(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const s=t.permissionContext,i=this.all();let o;if(s.operation==="subscription"&&(o=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(o=i.find(c=>c.requestSubject===s.subject)),o)return o.callback(t,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class fu{constructor(t,s){j(this,"connected");j(this,"connectedOnce");j(this,"infoReceived");j(this,"info");j(this,"muxSubscriptions");j(this,"options");j(this,"outbound");j(this,"pongs");j(this,"subscriptions");j(this,"transport");j(this,"noMorePublishing");j(this,"connectError");j(this,"publisher");j(this,"_closed");j(this,"closed");j(this,"listeners");j(this,"heartbeats");j(this,"parser");j(this,"outMsgs");j(this,"inMsgs");j(this,"outBytes");j(this,"inBytes");j(this,"pendingLimit");j(this,"lastError");j(this,"abortReconnect");j(this,"whyClosed");j(this,"servers");j(this,"server");j(this,"features");j(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=YE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=s,this.subscriptions=new XE,this.muxSubscriptions=new RE,this.outbound=new Wi,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new dE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new ME(i,{randomize:!t.noRandomize}),this.closed=ct(),this.parser=new zg(this),this.heartbeats=new DE(this,this.options.pingInterval||sx,this.options.maxPingOut||IE)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const s=ye.errorForCode(ue.Disconnect);s.stack="",t.forEach(i=>{i.reject(s)}),this.parser=new zg(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(s=>{s.push(t)})}status(){const t=new Mt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=ct();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=s=>{t.reject(s)},this.transport=yE(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:Fi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Fi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:Tr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Tr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ue.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(t)}async dial(t){const s=this.prepare();let i;try{i=Qi(this.options.timeout||2e4);const o=this.transport.connect(t,this.options);await Promise.race([o,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(o){s.reject(o)}try{await Promise.race([i,s]),i&&i.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 i&&i.cancel(),await this.transport.close(o),o}}async _doDial(t){const{resolve:s}=this.options,i=await t.resolve({fn:gd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const c of i)try{o=null,this.dispatchStatus({type:Fi.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(d){o=d}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():ix;let i=s;const o=this.selectServer();if(!o||this.abortReconnect)throw t||(this.lastError?this.lastError:ye.errorForCode(ue.ConnectionRefused));const c=Date.now();if(o.lastConnect===0||o.lastConnect+s<=c){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(d){if(t=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const y=this.options.maxReconnectAttempts||0;y!==-1&&o.reconnects>=y&&this.servers.removeCurrentServer()}}else i=Math.min(i,o.lastConnect+s-c),await ea(i)}}static async connect(t,s){const i=new fu(t,s);return await i.dialLoop(),i}static toError(t){const s=t?t.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new ye(t,ue.PermissionsViolation),o=t.match(/(Publish|Subscription) to "(\S+)"/);if(o){i.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new ye(t,ue.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ye(t,ue.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ye(t,ue.AccountExpired):s.indexOf("authentication timeout")!==-1?new ye(t,ue.AuthenticationTimeout):new ye(t,ue.ProtocolError)}processMsg(t,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(t.sid);i&&(i.received+=1,i.callback&&i.callback(null,new Qd(t,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(t){const s=Og(t),i=fu.toError(s),o={type:Tr.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){o.permissionContext=i.permissionContext;const d=this.subscriptions.getMux();c=(d==null?void 0:d.subject)===i.permissionContext.subject}this.subscriptions.handleError(i),this.muxSubscriptions.handleError(c,i),c&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(i)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(JE)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const s=JSON.parse(Og(t));this.info=s;const i=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Js(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:d}=this.transport;try{const y=new QE({version:c,lang:d},this.options,s.nonce);s.headers&&(y.headers=!0,y.no_responders=!0);const g=JSON.stringify(y);this.transport.send(ho(`CONNECT ${g}${Wc}`)),this.transport.send(Hg)}catch(y){this._close(y)}}i&&this.dispatchStatus({type:Tr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Tr.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Yt.MSG:{const{msg:s,data:i}=t;this.processMsg(s,i);break}case Yt.OK:break;case Yt.ERR:this.processError(t.data);break;case Yt.PING:this.processPing();break;case Yt.PONG:this.processPong();break;case Yt.INFO:this.processInfo(t.data);break}}sendCommand(t,...s){const i=this.outbound.length();let o;typeof t=="string"?o=ho(t):o=t,this.outbound.fill(o,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,s=wn,i){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=Qs.encode(s);else throw ye.errorForCode(ue.BadPayload);let c=o.length;i=i||{},i.reply=i.reply||"";let d=wn,y=0;if(i.headers){if(this.info&&!this.info.headers)throw new ye("headers",ue.ServerOptionNotAvailable);d=i.headers.encode(),y=d.length,c=o.length+y}if(this.info&&c>this.info.max_payload)throw ye.errorForCode(ue.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${t} ${i.reply} ${y} ${c}\r
40
+ `:g=`HPUB ${t} ${y} ${c}\r
41
+ `,this.sendCommand(g,d,o,uu)):(i.reply?g=`PUB ${t} ${i.reply} ${c}\r
42
+ `:g=`PUB ${t} ${c}\r
43
+ `,this.sendCommand(g,o,uu))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
44
+ `):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
45
+ `)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,s){this.unsub(t,s),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,s){!t||this.isClosed()||(s?this.sendCommand(`UNSUB ${t.sid} ${s}\r
46
+ `):this.sendCommand(`UNSUB ${t.sid}\r
47
+ `),t.max=s)}resub(t,s){!t||this.isClosed()||(this.unsub(t),t.subject=s,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=ct()),this.pongs.push(t),this.outbound.fill(Hg),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?t.push(`SUB ${i.subject} ${i.queue} ${i.sid}${Wc}`):t.push(`SUB ${i.subject} ${i.sid}${Wc}`)}),t.length&&this.transport.send(ho(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),s=[];return t.forEach(i=>{s.push(i.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new ax(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const WE="$SRV";class Fg{constructor(t){j(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,s){return this.msg.respond(t,s)}respondError(t,s,i,o){var c,d;return o=o||{},o.headers=o.headers||Rr(),(c=o.headers)==null||c.set(au,`${t}`),(d=o.headers)==null||d.set(iu,s),this.msg.respond(i,o)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class xo{constructor(t,s="",i=""){j(this,"subject");j(this,"queue");j(this,"srv");s!==""&&e2("service group",s);let o="";if(t instanceof jo)this.srv=t,o="";else if(t instanceof xo){const c=t;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),o=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=i}calcSubject(t,s=""){return s===""?t:t!==""?`${t}.${s}`:s}addEndpoint(t="",s){s=s||{subject:t};const i=typeof s=="function"?{handler:s,subject:t}:s;co("endpoint",t);let{subject:o,handler:c,metadata:d,queue:y}=i;o=o||t,y=y||this.queue,ZE("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:t,subject:o,queue:y,handler:c,metadata:d};return this.srv._addEndpoint(g)}addGroup(t="",s=""){return new xo(this,t,s)}}function ZE(n,t){if(t==="")throw new Error(`${n} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${t}'`);const s=t.split(".");s.forEach((i,o)=>{if(i===">"&&o!==s.length-1)throw new Error(`${n} cannot have internal '>': '${t}'`)})}function e2(n,t){if(t.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${t}'`);t.split(".").forEach(i=>{if(i===">")throw new Error(`${n} name cannot contain internal '>': '${t}'`)})}class jo{constructor(t,s={name:"",version:""}){j(this,"nc");j(this,"_id");j(this,"config");j(this,"handlers");j(this,"internal");j(this,"_stopped");j(this,"_done");j(this,"started");this.nc=t,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),co("name",this.config.name),co("queue",this.config.queue),Js(this.config.version),this._id=vs.next(),this.internal=[],this._done=ct(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(i=>{this.close(i).catch()})}static controlSubject(t,s="",i="",o){const c=o??WE;return s===""&&i===""?`${c}.${t}`:(co("control subject name",s),i!==""?(co("control subject id",i),`${c}.${t}.${s}.${i}`):`${c}.${t}.${s}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const s=Rr();if(t instanceof ou){const i=t;s.set(iu,i.message),s.set(au,`${i.code}`)}else s.set(iu,t.message),s.set(au,"500");return s}setupHandler(t,s=!1){const i=s?"":t.queue?t.queue:this.config.queue,{name:o,subject:c,handler:d}=t,y=t;y.internal=s,s&&this.internal.push(y),y.stats=new t2(o,c,i),y.queue=i;const g=d?(u,m)=>{if(u){this.close(u);return}const b=Date.now();try{d(u,new Fg(m))}catch(x){y.stats.countError(x),m==null||m.respond(wn,{headers:this.errorToHeader(x)})}finally{y.stats.countLatency(b)}}:void 0;return y.sub=this.nc.subscribe(c,{callback:g,queue:i}),y.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(u=>{if(!this._stopped){const m=new Error(`required subscription ${t.subject} errored: ${u.message}`);m.stack=u.stack,this.close(m).catch()}}),y}info(){return{type:mo.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:s,metadata:i,name:o,queue:c}=t;return{subject:s,metadata:i,name:o,queue_group:c}})}async stats(){const t=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(i){s.stats.countError(i)}t.push(s.stats.stats(s.qi))}return{type:mo.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,s){const i=`${t}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,t,s),this._doAddInternalHandler(`${i}-kind`,t,s,this.name),this._doAddInternalHandler(`${i}`,t,s,this.name,this.id)}_doAddInternalHandler(t,s,i,o="",c=""){const d={};d.name=t,d.subject=jo.controlSubject(s,o,c),d.handler=i,this.setupHandler(d,!0)}start(){const t=Qn(),s=(d,y)=>d?(this.close(d),Promise.reject(d)):this.stats().then(g=>(y==null||y.respond(t.encode(g)),Promise.resolve())),i=(d,y)=>d?(this.close(d),Promise.reject(d)):(y==null||y.respond(t.encode(this.info())),Promise.resolve()),o=t.encode(this.ping()),c=(d,y)=>d?(this.close(d).then().catch(),Promise.reject(d)):(y.respond(o),Promise.resolve());return this.addInternalHandler(ys.PING,c),this.addInternalHandler(ys.STATS,s),this.addInternalHandler(ys.INFO,i),this.handlers.forEach(d=>{const{subject:y}=d;typeof y=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(i=>i.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:mo.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,s){return new xo(this,t,s)}addEndpoint(t,s){return new xo(this).addEndpoint(t,s)}_addEndpoint(t){const s=new Mt;s.noIterator=typeof t.handler=="function",s.noIterator||(t.handler=(o,c)=>{o?this.stop(o).catch():s.push(new Fg(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(t,!1);return i.qi=s,this.handlers.push(i),s}}class t2{constructor(t,s,i=""){j(this,"name");j(this,"subject");j(this,"average_processing_time");j(this,"num_requests");j(this,"processing_time");j(this,"num_errors");j(this,"last_error");j(this,"data");j(this,"metadata");j(this,"queue");this.name=t,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=t;s&&(s.time=0,s.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=lt(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:d,last_error:y,data:g,queue:u}=this;return{name:t,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:d,last_error:y,data:g,queue_group:u}}stats(t){const s=t;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=lt(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 n2{constructor(t,s={strategy:Jn.JitterTimer,maxWait:2e3},i){j(this,"nc");j(this,"prefix");j(this,"opts");this.nc=t,this.prefix=i,this.opts=s}ping(t="",s=""){return this.q(ys.PING,t,s)}stats(t="",s=""){return this.q(ys.STATS,t,s)}info(t="",s=""){return this.q(ys.INFO,t,s)}async q(t,s="",i=""){const o=new Mt,c=Qn(),d=jo.controlSubject(t,s,i,this.prefix),y=await this.nc.requestMany(d,wn,this.opts);return(async()=>{for await(const g of y)try{const u=c.decode(g.data);o.push(u)}catch(u){o.push(()=>{o.stop(u)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function ox(){return{key:{encode(n){return n},decode(n){return n}},value:{encode(n){return n},decode(n){return n}}}}function r2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:ox(),storage:md.File}}const hu="KV-Operation",Gg="$KV",s2=/^[-/=.\w]+$/,i2=/^[-/=.>*\w]+$/,a2=/^[-\w]+$/;function o2(n){if(n.startsWith(".")||n.endsWith(".")||!s2.test(n))throw new Error(`invalid key: ${n}`)}function l2(n){if(n.startsWith(".")||n.endsWith(".")||!i2.test(n))throw new Error(`invalid key: ${n}`)}function c2(n){if(n.startsWith(".")||n.endsWith("."))throw new Error(`invalid key: ${n}`);const t=n.split(".");let s=!1;for(let i=0;i<t.length;i++)switch(t[i]){case"*":s=!0;break;case">":if(i!==t.length-1)throw new Error(`invalid key: ${n}`);s=!0;break}return s}function Zc(n){if(!a2.test(n))throw new Error(`invalid bucket name: ${n}`)}var rr;(function(n){n.MsgIdHdr="Nats-Msg-Id",n.ExpectedStreamHdr="Nats-Expected-Stream",n.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",n.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",n.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(rr||(rr={}));class vo{constructor(t,s,i){j(this,"js");j(this,"jsm");j(this,"stream");j(this,"bucket");j(this,"direct");j(this,"codec");j(this,"prefix");j(this,"editPrefix");j(this,"useJsPrefix");j(this,"_prefixLen");j(this,"validateKey",o2);j(this,"validateSearchKey",l2);j(this,"hasWildcards",c2);Zc(t),this.js=s,this.jsm=i,this.bucket=t,this.prefix=Gg,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,s,i={}){Zc(s);const o=await t.jetstreamManager(),c=new vo(s,t,o);return await c.init(i),c}static async bind(t,s,i={}){const o=await t.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};Zc(s);const d=new vo(s,t,o);return c.config.name=i.streamName??d.bucketName(),Object.assign(d,c),d.stream=c.config.name,d.codec=i.codec||ox(),d.direct=c.config.allow_direct??!1,d.initializePrefixes(c),d}async init(t={}){const s=Object.assign(r2(),t);this.codec=s.codec;const i={};this.stream=i.name=t.streamName??this.bucketName(),i.retention=dd.Limits,i.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(i.max_bytes=s.max_bytes),i.max_msg_size=s.maxValueSize,i.storage=s.storage;const o=t.placementCluster??"";if(o&&(t.placement={},t.placement.cluster=o,t.placement.tags=[]),t.placement&&(i.placement=t.placement),t.republish&&(i.republish=t.republish),t.description&&(i.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(gn)||(b.name=`${gn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(t.sources){const b=t.sources.map(x=>{const v=Object.assign({},x),_=v.name.startsWith(gn)?v.name.substring(gn.length):v.name;return v.name.startsWith(gn)||(v.name=`${gn}${v.name}`),!x.external&&_!==this.bucket&&(v.subject_transforms=[{src:`$KV.${_}.>`,dest:`$KV.${this.bucket}.>`}]),v});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?_s.S2:_s.None);const c=this.js.nc,d=c.getServerVersion(),y=d?yd(d,Js("2.7.2"))>=0:!1;i.discard=y?bo.New:bo.Old;const{ok:g,min:u}=c.features.get(He.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${u}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,i.allow_direct=t.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=lt(s.ttl)),i.allow_rollup_hdrs=!0;let m;try{m=await this.jsm.streams.info(i.name),!m.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")m=await this.jsm.streams.add(i);else throw b}this.initializePrefixes(m)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=t.config;if(s){let i=s.name;if(i.startsWith(gn)&&(i=i.substring(gn.length)),s.external&&s.external.api!==""){const o=s.name.substring(gn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${gn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,s=!1){const i=[];return s?(this.useJsPrefix&&i.push(this.js.apiPrefix),this.editPrefix!==""?i.push(this.editPrefix):i.push(this.prefix)):this.prefix&&i.push(this.prefix),i.push(t),i.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${Gg}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.decode(i));break}return s.join(".")}close(){return Promise.resolve()}dataLen(t,s){const i=s&&s.get(Jt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):t.length}smToEntry(t){return new E2(this.bucket,this.prefixLen,t)}jmToEntry(t){const s=this.decodeKey(t.subject.substring(this.prefixLen));return new O2(this.bucket,s,t)}async create(t,s){var c;let i;try{const d=await this.put(t,s,{previousSeq:0});return Promise.resolve(d)}catch(d){if(i=d,((c=d==null?void 0:d.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(d)}let o=0;try{const d=await this.get(t);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(o=d!==null?d.revision:0,this.update(t,s,o)):Promise.reject(i)}catch(d){return Promise.reject(d)}}update(t,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(t,s,{previousSeq:i})}async put(t,s,i={}){var d,y;const o=this.encodeKey(t);this.validateKey(o);const c={};if(i.previousSeq!==void 0){const g=Rr();c.headers=g,g.set(rr.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,c)).seq}catch(g){const u=g;return u.isJetStreamError()?(u.message=(d=u.api_error)==null?void 0:d.description,u.code=`${(y=u.api_error)==null?void 0:y.code}`,Promise.reject(u)):Promise.reject(g)}}async get(t,s){const i=this.encodeKey(t);this.validateKey(i);let o={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(o={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),o):c=await this.jsm.streams.getMessage(this.bucketName(),o);const d=this.smToEntry(c);return d.key!==i?null:d}catch(d){if(d.code===ue.JetStream404NoMessages)return null;throw d}}purge(t,s){return this._deleteOrPurge(t,"PURGE",s)}delete(t,s){return this._deleteOrPurge(t,"DEL",s)}async purgeDeletes(t=1800*1e3){const s=ct(),i=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,o.stop();const c=Date.now()-t,d=i.map(g=>{const u=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:u,keep:1}):this.jsm.streams.purge(this.stream,{filter:u,keep:0})}),y=await Promise.all(d);return y.unshift({success:!0,purged:0}),y.reduce((g,u)=>(g.purged+=u.purged,g))}async _deleteOrPurge(t,s,i){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,s,i);const o=await this.keys(t),c=[];for await(const d of o)c.push(this._doDeleteOrPurge(d,s)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,s,i){const o=this.encodeKey(t);this.validateKey(o);const c=Rr();c.set(hu,s),s==="PURGE"&&c.set(Jt.RollupHdr,Jt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(rr.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),wn,{headers:c})}_buildCC(t,s,i={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const u=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(u)}),d=vt.LastPerSubject;s===Yn.AllHistory&&(d=vt.All),s===Yn.UpdatesOnly&&(d=vt.New);let y;return c.length===1&&(y=c[0],c=void 0),Object.assign({deliver_policy:d,ack_policy:Ct.None,filter_subjects:c,filter_subject:y,flow_control:!0,idle_heartbeat:lt(5*1e3)},i)}remove(t){return this.purge(t)}async history(t={}){const s=t.key??">",i=new Mt,o={};o.headers_only=t.headers_only||!1;let c;c=()=>{i.stop()};let d=0;const y=this._buildCC(s,Yn.AllHistory,o),g=y.filter_subject,u=bs(y);u.bindStream(this.stream),u.orderedConsumer(),u.callback((b,x)=>{if(b){i.stop(b);return}if(x){const v=this.jmToEntry(x);i.push(v),i.received++,(c&&d>0&&i.received>=d||x.info.pending===0)&&(i.push(c),c=void 0)}});const m=await this.js.subscribe(g,u);if(c){const{info:{last:b}}=m,x=b.num_pending+b.delivered.consumer_seq;if(x===0||i.received>=x)try{c()}catch(v){i.stop(v)}finally{c=void 0}else d=x}return i._data=m,i.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{i.stop()}).catch(b=>{i.stop(b)}),i}canSetWatcherName(){const s=this.js.nc,{ok:i}=s.features.get(He.JS_NEW_CONSUMER_CREATE_API);return i}async watch(t={}){const s=t.key??">",i=new Mt,o={};o.headers_only=t.headers_only||!1;let c=Yn.LastValue;t.include===Yn.AllHistory?c=Yn.AllHistory:t.include===Yn.UpdatesOnly&&(c=Yn.UpdatesOnly);const d=t.ignoreDeletes===!0;let y=t.initializedFn,g=0;const u=this._buildCC(s,c,o),m=u.filter_subject,b=bs(u);this.canSetWatcherName()&&b.consumerName(vs.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((v,_)=>{if(v){i.stop(v);return}if(_){const S=this.jmToEntry(_);if(d&&S.operation==="DEL")return;i.push(S),i.received++,y&&(g>0&&i.received>=g||_.info.pending===0)&&(i.push(y),y=void 0)}});const x=await this.js.subscribe(m,b);if(y){const{info:{last:v}}=x,_=v.num_pending+v.delivered.consumer_seq;if(_===0||i.received>=_)try{y()}catch(S){i.stop(S)}finally{y=void 0}else g=_}return i._data=x,i.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{i.stop()}).catch(v=>{i.stop(v)}),i}async keys(t=">"){const s=new Mt,i=this._buildCC(t,Yn.LastValue,{headers_only:!0}),o=Array.isArray(t)?">":i.filter_subject,c=bs(i);c.bindStream(this.stream),c.orderedConsumer();const d=await this.js.subscribe(o,c);return(async()=>{var g;for await(const u of d){const m=(g=u.headers)==null?void 0:g.get(hu);if(m!=="DEL"&&m!=="PURGE"){const b=this.decodeKey(u.subject.substring(this.prefixLen));s.push(b)}u.info.pending===0&&d.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),d.info.last.num_pending===0&&d.unsubscribe(),s}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const s=((c=this.js.nc.info)==null?void 0:c.cluster)??"",i=this.bucketName(),o=await this.jsm.streams.info(i);return new lx(o,s)}}class lx{constructor(t,s=""){j(this,"si");j(this,"cluster");this.si=t,this.cluster=s}get bucket(){return this.si.config.name.startsWith(gn)?this.si.config.name.substring(gn.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 Jd(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==_s.None:!1}}const Wd="OBJ_",Vg="SHA-256=";function u2(n){return Zc(n),`${Wd}${n}`}function f2(n){return n.startsWith(Wd)?n.substring(4):n}class vd{constructor(t){j(this,"si");j(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return f2(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!==_s.None:!1}}function sc(n){if(n===void 0)return;const{domain:t}=n;if(t===void 0)return n;const s=Object.assign({},n);if(delete s.domain,t==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${t}.API`},s}var Bn;(function(n){n[n.Unset=-1]="Unset",n[n.Consume=0]="Consume",n[n.Fetch=1]="Fetch"})(Bn||(Bn={}));var sr;(function(n){n.HeartbeatsMissed="heartbeats_missed",n.ConsumerNotFound="consumer_not_found",n.StreamNotFound="stream_not_found",n.ConsumerDeleted="consumer_deleted",n.OrderedConsumerRecreated="ordered_consumer_recreated",n.NoResponders="no_responders"})(sr||(sr={}));var Ki;(function(n){n.DebugEvent="debug",n.Discard="discard",n.Reset="reset",n.Next="next"})(Ki||(Ki={}));const Yg=Uint8Array.of(43,65,67,75),h2=Uint8Array.of(45,78,65,75),Za=Uint8Array.of(43,87,80,73),d2=Uint8Array.of(43,78,88,84),m2=Uint8Array.of(43,84,69,82,77),p2=Uint8Array.of(32);function _o(n,t=5e3){return new M2(n,t)}class Jh extends Mt{constructor(s,i,o=!1){super();j(this,"consumer");j(this,"opts");j(this,"sub");j(this,"monitor");j(this,"pending");j(this,"inbox");j(this,"refilling");j(this,"pong");j(this,"callback");j(this,"timeout");j(this,"cleanupHandler");j(this,"listeners");j(this,"statusIterator");j(this,"forOrderedConsumer");j(this,"resetHandler");j(this,"abortOnMissingResource");j(this,"bind");j(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,o),this.callback=c.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=Cr(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:i,idle_heartbeat:o,threshold_bytes:c,threshold_messages:d}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:y}=this;y&&y.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,u)=>{var b,x,v,_;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),u.subject===this.inbox){if(hd(u))return;const S=(x=u.headers)==null?void 0:x.code,C=((_=(v=u.headers)==null?void 0:v.description)==null?void 0:_.toLowerCase())||"unknown",{msgsLeft:L,bytesLeft:U}=this.parseDiscard(u.headers);if(L>0||U>0)this.pending.msgs-=L,this.pending.bytes-=U,this.pending.requests--,this.notify(Ki.Discard,{msgsLeft:L,bytesLeft:U});else if(S===400){this.stop(new ye(C,`${S}`));return}else if(S===409&&C==="consumer deleted"){if(this.notify(sr.ConsumerDeleted,`${S} ${C}`),!this.refilling||this.abortOnMissingResource){const re=new ye(C,`${S}`);this.stop(re);return}}else if(S===503){if(this.notify(sr.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const re=new ye("no responders",`${S}`);this.stop(re);return}}else this.notify(Ki.DebugEvent,`${S} ${C}`)}else this._push(_o(u,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=u.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=d||i&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new Xd(o,g=>(this.notify(sr.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var u;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const m of g)switch(m.type){case Tr.Disconnect:(u=this.monitor)==null||u.cancel();break;case Tr.Reconnect:this.resetPending().then(b=>{var x;b&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const i=typeof s=="function"?s:null;try{i?i():this.callback(s)}catch(o){this.stop(o)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}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,i=0;const o=Kd([this.opts.expires]);let c=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(i++,this.notify(sr.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(s++,this.notify(sr.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,i=0;this.inBackOff=!0;const y=o.backoff(c),g=ea(y);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const i=this.consumer.api.nc;this._push(()=>{i.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(Ki.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,o=lt(this.opts.idle_heartbeat),c=lt(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:o,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Jt.PendingMessagesHdr);o&&(i.msgsLeft=parseInt(o));const c=s==null?void 0:s.get(Jt.PendingBytesHdr);return c&&(i.bytesLeft=parseInt(c)),i}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,i;(s=this.monitor)==null||s.cancel(),this.monitor=null,(i=this.timeout)==null||i.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var i,o;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!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,i){const c=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||c;const d=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||d}return o}status(){const s=new Mt;return this.listeners.push(s),Promise.resolve(s)}}class y2 extends Mt{constructor(){super();j(this,"src");j(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(i=>{this.stop(i||void 0)}),(async()=>{const i=await this.src.status();for await(const o of i)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.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 Mt;return this.listeners.push(s),Promise.resolve(s)}}class _d{constructor(t,s){j(this,"api");j(this,"_info");j(this,"stream");j(this,"name");this.api=t,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Jh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const s=new Jh(this,t,!1),i=Math.round(s.opts.expires*1.05),o=Qi(i);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(t={expires:3e4}){const s=ct(),i=t;i.max_messages=1;const o=new Jh(this,i,!1),c=Math.round(o.opts.expires*1.05);c>=6e4&&(async()=>{for await(const y of await o.status())if(y.type===sr.HeartbeatsMissed&&y.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const y of o){s.resolve(y);break}})().catch(()=>{});const d=Qi(c);return o.closed().then(y=>{y?s.reject(y):s.resolve(null)}).catch(y=>{s.reject(y)}).finally(()=>{d.cancel()}),d.catch(y=>{s.resolve(null),o.close().catch()}),o.trackTimeout(d),s}delete(){const{stream_name:t,name:s}=this._info;return this.api.delete(t,s)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(o=>(this._info=o,this._info))}}class g2{constructor(t,s,i={}){j(this,"api");j(this,"consumerOpts");j(this,"consumer");j(this,"opts");j(this,"cursor");j(this,"stream");j(this,"namePrefix");j(this,"serial");j(this,"currentConsumer");j(this,"userCallback");j(this,"iter");j(this,"type");j(this,"startSeq");j(this,"maxInitialReset");this.api=t,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=vs.next(),typeof i.name_prefix=="string"&&(xu("name_prefix",i.name_prefix),this.namePrefix=i.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Bn.Unset,this.consumerOpts=i,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const s=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const i={name:s,deliver_policy:vt.StartSequence,opt_start_seq:t,ack_policy:Ct.None,inactive_threshold:lt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(i.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(i.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(i.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(i.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||vt.StartSequence,(this.consumerOpts.deliver_policy===vt.LastPerSubject||this.consumerOpts.deliver_policy===vt.New||this.consumerOpts.deliver_policy===vt.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===vt.LastPerSubject&&typeof i.filter_subjects>"u"&&typeof i.filter_subject>"u"&&(i.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete i.opt_start_seq,i.deliver_policy=vt.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=lt(this.consumerOpts.inactive_threshold))),i}async resetConsumer(t=0){var d,y,g,u,m;vs.next();const s=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(t);i.max_deliver=1,i.mem_storage=!0;const o=Kd([((y=this.opts)==null?void 0:y.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(sr.OrderedConsumerRecreated,c.name);break}catch(x){if(x.message==="stream not found"&&((u=this.iter)==null||u.notify(sr.StreamNotFound,b),this.type===Bn.Fetch||this.opts.abort_on_missing_resource===!0))return(m=this.iter)==null||m.stop(x),Promise.reject(x);if(s&&b>=this.maxInitialReset)throw x;await ea(o.backoff(b+1))}return c}internalHandler(t){return s=>{var o;if(this.serial!==t)return;const i=s.info.deliverySequence;if(i!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=i,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(t={max_messages:100,expires:3e4},s){var g,u;s=s||{};const i=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===Bn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((u=this.iter)==null?void 0:u.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new y2),this.consumer=new _d(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let d=null;this.type===Bn.Fetch&&i?d=await this.consumer.fetch(t):this.type===Bn.Consume&&(d=await this.consumer.consume(t));const y=d;y.forOrderedConsumer=!0,y.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(y)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(Ki.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Bn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Bn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=Bn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var o;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Bn.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:i}=t;return i&&(this.userCallback=i),this.type=Bn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const s=t;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=ct();return s.callback=c=>{this.userCallback=null,i.resolve(c)},(await this.fetch(s)).iterClosed.then(c=>{c&&i.reject(c),i.resolve(null)}).catch(c=>{i.reject(c)}),i}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class wd{constructor(t){j(this,"api");j(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(He.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new _d(this.api,t)}async get(t,s={}){return typeof s=="object"?this.ordered(t,s):(await this.checkVersion(),this.api.info(t,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new _d(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(t,s){await this.checkVersion();const i=this.api;return new Zd(i.nc,i.opts).info(t).then(c=>Promise.resolve(new g2(this.api,t,s))).catch(c=>Promise.reject(c))}}class _u{constructor(t,s){j(this,"api");j(this,"_info");this.api=t,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new _u(this.api,t)}else return this}info(t=!1,s){return t?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(t){return new wd(new cu(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new wd(new cu(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,s){return this.api.deleteMessage(this.name,t,s)}}class Zd extends Ao{constructor(t,s){super(t,s)}checkStreamConfigVersions(t){const s=this.nc;if(t.metadata){const{min:o,ok:c}=s.features.get(He.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${o}`)}if(t.first_seq){const{min:o,ok:c}=s.features.get(He.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${o}`)}if(t.subject_transform){const{min:o,ok:c}=s.features.get(He.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(t.compression){const{min:o,ok:c}=s.features.get(He.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${o}`)}if(t.consumer_limits){const{min:o,ok:c}=s.features.get(He.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function i(o,c){var y;if((((y=c==null?void 0:c.subject_transforms)==null?void 0:y.length)||0)>0){const{min:g,ok:u}=s.features.get(He.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!u)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(o=>{i("stream sources",o)}),t.mirror&&i("stream mirror",t.mirror)}async add(t={}){var o;this.checkStreamConfigVersions(t),Vt(t.name),t.mirror=sc(t.mirror),t.sources=(o=t.sources)==null?void 0:o.map(sc);const i=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(i),i}async delete(t){return Vt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,s={}){var y;if(typeof t=="object"){const g=t;t=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Vt(t);const i=await this.info(t),o=Object.assign(i.config,s);o.mirror=sc(o.mirror),o.sources=(y=o.sources)==null?void 0:y.map(sc);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,o);return this._fixInfo(d),d}async info(t,s){Vt(t);const i=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(i,s),{total:d,limit:y}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(d&&d>g){const u=[c],m=s||{};let b=0;for(;d>g;){b++,m.offset=y*b;const v=await this._request(i,m);d=v.total,u.push(v);const _=Object.getOwnPropertyNames(v.state.subjects).length;if(g+=_,_<y)break}let x={};for(let v=0;v<u.length;v++)c=u[v],c.state.subjects&&(x=Object.assign(x,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=x}return this._fixInfo(c),c}list(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>{const d=c;return d.streams.forEach(y=>{this._fixInfo(y)}),d.streams},o=`${this.prefix}.STREAM.LIST`;return new uo(o,i,this,s)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,s){if(s){const{keep:o,seq:c}=s;if(typeof o=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Vt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,s)}async deleteMessage(t,s,i=!0){Vt(t);const o={seq:s};return i||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,o)).success}async getMessage(t,s){Vt(t);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,s);return new cx(o)}find(t){return this.findStream(t)}listKvs(){const t=i=>{var g;const c=i.streams.filter(u=>u.config.name.startsWith(gn));c.forEach(u=>{this._fixInfo(u)});let d="";return c.length&&(d=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(u=>new lx(u,d))},s=`${this.prefix}.STREAM.LIST`;return new uo(s,t,this)}listObjectStores(){const t=i=>{const c=i.streams.filter(y=>y.config.name.startsWith(Wd));return c.forEach(y=>{this._fixInfo(y)}),c.map(y=>new vd(y))},s=`${this.prefix}.STREAM.LIST`;return new uo(s,t,this)}names(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>c.streams,o=`${this.prefix}.STREAM.NAMES`;return new uo(o,i,this,s)}async get(t){const s=await this.info(t);return Promise.resolve(new _u(this,s))}}class b2 extends Ao{constructor(t,s){super(t,s)}async getMessage(t,s){Vt(t);let i=s;const{last_by_subj:o}=i;o&&(i=null);const c=i?this.jc.encode(i):wn,d=this.opts.apiPrefix||"$JS.API",y=o?`${d}.DIRECT.GET.${t}.${o}`:`${d}.DIRECT.GET.${t}`,g=await this.nc.request(y,c,{timeout:this.timeout}),u=Vi(g);if(u)return Promise.reject(u);const m=new Sd(g);return Promise.resolve(m)}async getBatch(t,s){Vt(t);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,u)=>g==="up_to_time"&&u instanceof Date?u.toISOString():u),d=new Mt,y=await this.nc.requestMany(o,c,{strategy:Jn.SentinelMsg});return(async()=>{var b,x,v;let g=!1,u=!1,m;for await(const _ of y){if(!g){g=!0;const S=((b=_.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){m=(x=_.headers)==null?void 0:x.description.toLowerCase();break}if(((v=_.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){u=!0;break}}if(_.data.length===0)break;d.push(new Sd(_))}d.push(()=>{if(u)throw new Error("batch direct get not supported by the server");if(m)throw new Error(`bad request: ${m}`);d.stop()})})(),Promise.resolve(d)}}class Sd{constructor(t){j(this,"data");j(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Hi.Subject)}get seq(){const t=this.header.last(Hi.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Hi.TimeStamp)}get stream(){return this.header.last(Hi.Stream)}json(t){return Qn(t).decode(this.data)}string(){return xn.decode(this.data)}}j(Sd,"jc");class x2 extends Ao{constructor(s,i){super(s,i);j(this,"streams");j(this,"consumers");j(this,"direct");this.streams=new Zd(s,i),this.consumers=new cu(s,i),this.direct=new b2(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Mt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,o)=>{if(i)throw i;try{const c=this.parseJsResponse(o),d=c.type.split("."),y=d[d.length-1];s.push({kind:y,data:c})}catch(c){s.stop(c)}}}),s}}class cx{constructor(t){j(this,"_header");j(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):wn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=gs.decode(t)}else this._header=Rr();return this._header}_parse(t){const s=atob(t),i=s.length,o=new Uint8Array(i);for(let c=0;c<i;c++)o[c]=s.charCodeAt(c);return o}json(t){return Qn(t).decode(this.data)}string(){return xn.decode(this.data)}}j(cx,"jc");class v2{constructor(t){j(this,"api");this.api=t}get(t){return this.api.info(t).then(s=>new _u(this.api,s))}}class Qh{constructor(t){j(this,"info");j(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=gs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,s;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function Kg(n){const t={name:n.name,description:n.description??"",options:n.options,metadata:n.metadata};if(n.headers){const s=n.headers;t.headers=s.toRecord()}return t}function _2(){return new ReadableStream({pull(n){n.enqueue(new Uint8Array(0)),n.close()}})}class yo{constructor(t,s,i){j(this,"jsm");j(this,"js");j(this,"stream");j(this,"name");this.name=t,this.jsm=s,this.js=i}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const s=await this.rawInfo(t);return s?new Qh(s):null}async list(){const t=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;t.push(i)}return Promise.resolve(t)}async rawInfo(t){const{name:s,error:i}=this._checkNotEmpty(t);if(i)return Promise.reject(i);const o=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),y=Qn().decode(c.data);return y.revision=c.seq,y}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new vd(t)))}async status(t){const s=await this._si(t);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new vd(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,s,i){var le;const o=this.js.getOptions();i=i||{timeout:o.timeout},i.timeout=i.timeout||o.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:d}=i,y=this.js.nc.info,g=(y==null?void 0:y.max_payload)||1024;t=t||{},t.options=t.options||{};let u=((le=t.options)==null?void 0:le.max_chunk_size)||128*1024;u=u>g?g:u,t.options.max_chunk_size=u;const m=await this.info(t.name),{name:b,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=vs.next(),_=this._chunkSubject(v),S=this._metaSubject(b),C=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},Kg(t)),L=ct(),U=[],re=new Wi;try{const D=s?s.getReader():null,z=Bg.create();for(;;){const{done:ae,value:K}=D?await D.read():{done:!0,value:void 0};if(ae){if(re.size()>0){const Q=re.drain();z.update(Q),C.chunks++,C.size+=Q.length,U.push(this.js.publish(_,Q,{timeout:c}))}await Promise.all(U),U.length=0,C.mtime=new Date().toISOString();const M=Yi.encode(z.digest());C.digest=`${Vg}${M}`,C.deleted=!1;const $=Rr();typeof d=="number"&&$.set(rr.ExpectedLastSubjectSequenceHdr,`${d}`),$.set(Jt.RollupHdr,Jt.RollupValueSubject);const W=await this.js.publish(S,Qn().encode(C),{headers:$,timeout:c});if(C.revision=W.seq,m)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${m.nuid}`})}catch{}L.resolve(new Qh(C));break}if(K)for(re.fill(K);re.size()>u;){C.chunks++,C.size+=u;const M=re.drain(t.options.max_chunk_size);z.update(M),U.push(this.js.publish(_,M,{timeout:c}))}}}catch(D){await this.jsm.streams.purge(this.stream,{filter:_}),L.reject(D)}return L}putBlob(t,s,i){function o(c){return new ReadableStream({pull(d){d.enqueue(c),d.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(t,o(s),i)}put(t,s,i){var o;return(o=t==null?void 0:t.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,s,i)}async getBlob(t){async function s(c){const d=new Wi,y=c.getReader();for(;;){const{done:g,value:u}=await y.read();if(g)return d.drain();u&&u.length&&d.fill(u)}}const i=await this.get(t);if(i===null)return Promise.resolve(null);const o=await Promise.all([i.error,s(i.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(t){const s=await this.rawInfo(t);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const b=s.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await yo.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(Vg))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=pd(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=ct(),c={info:new Qh(s),error:o};if(s.size===0)return c.data=_2(),o.resolve(null),Promise.resolve(c);let d;const y=bs();y.orderedConsumer();const g=Bg.create(),u=`$O.${this.name}.C.${s.nuid}`,m=await this.js.subscribe(u,y);return(async()=>{for await(const b of m)b.data.length>0&&(g.update(b.data),d.enqueue(b.data)),b.info.pending===0&&(cE(i,g.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${i}`)),m.unsubscribe())})().then(()=>{o.resolve()}).catch(b=>{d.error(b),o.reject(b)}),c.data=new ReadableStream({start(b){d=b},cancel(){m.unsubscribe()}}),c}linkStore(t,s){if(!(s instanceof yo))return Promise.reject("bucket required");const i=s,{name:o,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const d={name:o,options:{link:{bucket:i.name}}};return this._put(d,null)}async link(t,s){const{name:i,error:o}=this._checkNotEmpty(t);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:s.bucket,name:s.name},y={name:i,bucket:s.bucket,options:{link:d}};await this.js.publish(this._metaSubject(t),JSON.stringify(y));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const s=await this.rawInfo(t);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Qn(),o=Rr();return o.set(Jt.RollupHdr,Jt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(t,s={}){const i=await this.rawInfo(t);if(i===null)return Promise.reject(new Error("object not found"));if(i.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??i.name;const{name:o,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(t!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const d=Object.assign({},i,Kg(s)),y=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return t!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(y)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let s=!1;const i=new Mt,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Qn(),d=bs();d.orderedConsumer(),t.includeHistory?d.deliverLastPerSubject():(s=!0,d.deliverNew()),d.callback((g,u)=>{var m;if(g){i.stop(g);return}if(u!==null){const b=c.decode(u.data);b.deleted&&t.ignoreDeletes===!0||i.push(b),((m=u.info)==null?void 0:m.pending)===0&&!s&&(s=!0,i.push(null))}});const y=await this.js.subscribe(o,d);return i._data=y,i.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Yi.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=u2(this.name)}catch(o){return Promise.reject(o)}const s=(t==null?void 0:t.ttl)||0;delete t.ttl;const i=Object.assign({max_age:s},t);i.name=this.stream,i.num_replicas=t.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=bo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(i.placement=t.placement),t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?_s.S2:_s.None);try{await this.jsm.streams.info(i.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(t,s,i={}){const o=await t.jetstreamManager(),c=new yo(s,o,t);return await c.init(i),Promise.resolve(c)}}class w2{constructor(t){j(this,"js");this.js=t}kv(t,s={}){const i=this.js,{ok:o,min:c}=i.nc.features.get(He.JS_KV);return o?s.bindOnly?vo.bind(this.js,t,s):vo.create(this.js,t,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,s={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const i=this.js,{ok:o,min:c}=i.nc.features.get(He.JS_OBJECTSTORE);return o?yo.create(this.js,t,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class em extends Ao{constructor(s,i){super(s,i);j(this,"consumers");j(this,"streams");j(this,"consumerAPI");j(this,"streamAPI");this.consumerAPI=new cu(s,i),this.streamAPI=new Zd(s,i),this.consumers=new wd(this.consumerAPI),this.streams=new v2(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const i=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(i)}get apiPrefix(){return this.prefix}get views(){return new w2(this)}async publish(s,i=wn,o){o=o||{},o.expect=o.expect||{};const c=(o==null?void 0:o.headers)||Rr();o&&(o.msgID&&c.set(rr.MsgIdHdr,o.msgID),o.expect.lastMsgID&&c.set(rr.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&c.set(rr.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&c.set(rr.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&c.set(rr.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const d=o.timeout||this.timeout,y={};d&&(y.timeout=d),o&&(y.headers=c);let{retries:g,retry_delay:u}=o;g=g||1,u=u||250;let m;for(let x=0;x<g;x++)try{m=await this.nc.request(s,i,y);break}catch(v){if(v.code==="503"&&x+1<g)await ea(u);else throw v}const b=this.parseJsResponse(m);if(b.stream==="")throw ye.errorForCode(ue.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,o=0){Vt(s),Gi(i);let c=this.timeout;o>c&&(c=o),o=o<0?0:lt(o);const d={batch:1,no_wait:o===0,expires:o},y=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{noMux:!0,timeout:c}),g=Vi(y);if(g)throw g;return _o(y,this.timeout)}fetch(s,i,o={}){Vt(s),Gi(i);let c=null;const d=(o.max_bytes??0)>0;let y=0;const g=d?o.max_bytes:0;let u=null;const m={};if(m.batch=o.batch||1,g){const U=this.nc.features.get(He.JS_PULL_MAX_BYTES);if(!U.ok)throw new Error(`max_bytes is only supported on servers ${U.min} or better`);m.max_bytes=g}m.no_wait=o.no_wait||!1,m.no_wait&&m.expires&&(m.expires=0);const b=o.expires||0;if(b&&(m.expires=lt(b)),b===0&&m.no_wait===!1)throw new Error("expires or no_wait is required");const x=o.idle_heartbeat||0;x&&(m.idle_heartbeat=lt(x),o.delay_heartbeat===!0&&(m.idle_heartbeat=lt(x*4)));const v=new Mt,_=m.batch;let S=0;v.protocolFilterFn=(U,re=!1)=>hd(U.msg)?(u==null||u.work(),!1):!0,v.dispatchedFn=U=>{if(U){if(d&&(y+=U.data.length),S++,c&&U.info.pending===0)return;(v.getPending()===1&&U.info.pending===0||_===S||g>0&&y>=g)&&v.stop()}};const C=Cr(this.nc.options.inboxPrefix),L=this.nc.subscribe(C,{max:o.batch,callback:(U,re)=>{U===null&&(U=Vi(re)),U!==null?(c&&(c.cancel(),c=null),FS(U)?v.stop(fx(U)===null?void 0:U):v.stop(U)):(u==null||u.work(),v.received++,v.push(_o(re,this.timeout)))}});return b&&(c=Qi(b),c.catch(()=>{L.isClosed()||(L.drain().catch(()=>{}),c=null),u&&u.cancel()})),(async()=>{try{x&&(u=new Xd(x,U=>(v.push(()=>{v.err=new ye(`${Un.IdleHeartbeatMissed}: ${U}`,ue.JetStreamIdleHeartBeat)}),!0)))}catch{}await L.closed,c!==null&&(c.cancel(),c=null),u&&u.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{reply:C}),v}async pullSubscribe(s,i=bs()){const o=await this._processOptions(s,i);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 c=o.config.ack_policy;if(c===Ct.None||c===Ct.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(o),y=new A2(this,o.deliver,d);y.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw y.unsubscribe(),g}return y}async subscribe(s,i=bs()){const o=await this._processOptions(s,i);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(o),d=new ux(this,o.deliver,c);d.info=o;try{await this._maybeCreateConsumer(o)}catch(y){throw d.unsubscribe(),y}return d._maybeSetupHbMonitoring(),d}async _processOptions(s,i=bs()){const o=Rg(i)?i.getOpts():i;if(o.isBind=Rg(i)?i.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!==Ct.NotSet&&o.config.ack_policy!==Ct.None)throw new ye("ordered consumer: ack_policy can only be set to 'none'",ue.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ye("ordered consumer: durable_name cannot be set",ue.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ye("ordered consumer: deliver_subject cannot be set",ue.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ye("ordered consumer: max_deliver cannot be set",ue.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ye("ordered consumer: deliver_group cannot be set",ue.ApiError);o.config.deliver_subject=Cr(this.nc.options.inboxPrefix),o.config.ack_policy=Ct.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||lt(5e3),o.config.ack_wait=lt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===Ct.NotSet&&(o.config.ack_policy=Ct.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 c=await this.consumerAPI.info(o.stream,o.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==s)throw new Error("subject does not match consumer");const d=o.config.deliver_group??"";if(d===""&&c.push_bound===!0)throw new Error("duplicate subscription");const y=c.config.deliver_group??"";if(d!==y)throw y===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${y}'`);o.last=c,o.config=c.config,o.attached=!0,o.config.durable_name||(o.name=c.name)}}catch(c){if(c.code!=="404")throw c}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||Cr(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=j2(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=em.ingestionFn(s.ordered),i.protocolFilterFn=(o,c=!1)=>{const d=o;return fd(d.msg)?(c||d.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Ct.None&&(i.dispatchedFn=T2),s.callbackFn&&(i.callback=s.callbackFn),i.max=s.max||0,i.queue=s.queue,i}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:vt.All,ack_policy:Ct.Explicit,ack_wait:lt(30*1e3),replay_policy:Xi.Instant},s.config);const i=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(i.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=i.name,s.config=i.config,s.last=i}static ingestionFn(s){return(i,o)=>{var g;const c=o;if(!i)return{ingest:!1,protocol:!1};const d=i;if(Vi(d.msg)||(g=c.monitor)==null||g.work(),hd(d.msg)){const u=s?c._checkHbOrderConsumer(d.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:u,protocol:!0}}else if(fd(d.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class tm{constructor(t){j(this,"options");j(this,"protocol");j(this,"draining");j(this,"listeners");j(this,"_services");this.draining=!1,this.options=GE(t),this.listeners=[]}static connect(t={}){return new Promise((s,i)=>{const o=new tm(t);fu.connect(o.options,o).then(c=>{o.protocol=c,(async function(){for await(const d of c.status())o.listeners.forEach(y=>{y.push(d)})})(),s(o)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,s,i){if(this.isClosed())throw ye.errorForCode(ue.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw ye.errorForCode(ue.ConnectionDraining);if(t=t||"",t.length===0)throw ye.errorForCode(ue.BadSubject)}publish(t,s,i){this._check(t,!1,!0),this.protocol.publish(t,s,i)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,s={}){this._check(t,!0,!1);const i=new ax(this.protocol,t,s);return this.protocol.subscribe(i),i}_resub(t,s,i){this._check(s,!0,!1);const o=t;o.max=i,i&&(o.max=i+o.received),this.protocol.resub(o,s)}requestMany(t,s=wn,i={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Jn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new ye("timeout",ue.InvalidOption));const c=new Mt;function d(g){c.push(()=>{c.stop(g)})}function y(g,u){g||u===null?d(g===null?void 0:g):c.push(u)}if(i.noMux){const g=o?new Error().stack:null;let u=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const m=this.subscribe(Cr(this.options.inboxPrefix),{callback:(_,S)=>{var C,L;if(((C=S==null?void 0:S.data)==null?void 0:C.length)===0&&((L=S==null?void 0:S.headers)==null?void 0:L.status)===ue.NoResponders&&(_=ye.errorForCode(ue.NoResponders)),_){g&&(_.stack+=`
48
+
49
+ ${g}`),b(_);return}y(null,S),i.strategy===Jn.Count&&(u--,u===0&&b()),i.strategy===Jn.JitterTimer&&(v(),x=setTimeout(()=>{b()},300)),i.strategy===Jn.SentinelMsg&&S&&S.data.length===0&&b()}});m.requestSubject=t,m.closed.then(()=>{d()}).catch(_=>{c.stop(_)});const b=_=>{_&&c.push(()=>{throw _}),v(),m.drain().then(()=>{d()}).catch(S=>{d()})};c.iterClosed.then(()=>{v(),m==null||m.unsubscribe()}).catch(_=>{v(),m==null||m.unsubscribe()});try{this.publish(t,s,{reply:m.getSubject()})}catch(_){b(_)}let x=setTimeout(()=>{b()},i.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const g=i;g.callback=y,c.iterClosed.then(()=>{u.cancel()}).catch(m=>{u.cancel(m)});const u=new uE(this.protocol.muxSubscriptions,t,g);this.protocol.request(u);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:i.headers})}catch(m){u.cancel(m)}}return Promise.resolve(c)}request(t,s,i={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const o=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new ye("timeout",ue.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new ye("reply can only be used with noMux",ue.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Cr(this.options.inboxPrefix),d=ct(),y=o?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(u,m)=>{u?(y&&u.code!==ue.Timeout&&(u.stack+=`
50
+
51
+ ${y.stack}`),g.unsubscribe(),d.reject(u)):(u=Xb(m),u?(y&&(u.stack+=`
52
+
53
+ ${y.stack}`),d.reject(u)):d.resolve(m))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:c,headers:i.headers}),d}else{const c=new ex(this.protocol.muxSubscriptions,t,i,o);this.protocol.request(c);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(y){c.cancel(y)}const d=Promise.race([c.timer,c.deferred]);return d.catch(()=>{c.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(ye.errorForCode(ue.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ye.errorForCode(ue.ConnectionClosed)):this.isDraining()?Promise.reject(ye.errorForCode(ue.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new Mt;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,i)=>s==="time"?new Date(Date.parse(i)):i)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new x2(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===ue.NoResponders&&(o.code=ue.JetStreamNotEnabled),o}return s}jetstream(t={}){return new em(this,t)}getServerVersion(){const t=this.info;return t?Js(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ye.errorForCode(ue.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new S2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ye.errorForCode(ue.ConnectionClosed)):this.isDraining()?Promise.reject(ye.errorForCode(ue.ConnectionDraining)):this.protocol.reconnect()}}class S2{constructor(t){j(this,"nc");this.nc=t}add(t){try{return new jo(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new n2(this.nc,t,s)}}class E2{constructor(t,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=i}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(hu)||"PUT"}get length(){const t=this.sm.header.get(Jt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class O2{constructor(t,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=t,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(Jd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(hu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Jt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class ux extends mE{constructor(s,i,o){super(s.nc,i,o);j(this,"js");j(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 i=Cr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=vs.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=i,c.config.deliver_subject=i,c.config.deliver_policy=vt.StartSequence,c.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=c.config;const y=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(y,d,{retries:-1}).then(g=>{const u=g,m=this.sub.info;m.last=u,this.info.config=u.config,this.info.name=u.name}).catch(g=>{const u=new ye(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,ue.RequestError,g);this.sub.callback(u,{})})}_maybeSetupHbMonitoring(){var i,o;const s=((o=(i=this.info)==null?void 0:i.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(Jd(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,d=y=>{var m,b,x,v;const g=KS(409,`${Un.IdleHeartbeatMissed}: ${y}`,this.sub.subject);if(!((m=this.info)==null?void 0:m.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const _=((x=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(_+1),(v=this.monitor)==null||v.restart(),!1}return!c.noIterator};this.monitor=new Xd(s,d,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Jt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Jt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,o=s.info.streamSequence,c=s.info.deliverySequence;return c!=i.delivery_seq+1?(this._resetOrderedConsumer(i.stream_seq+1),!1):(i.delivery_seq=c,i.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(o);return s.last=c,c}}class A2 extends ux{constructor(t,s,i){super(t,s,i)}pull(t={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,d={};if(d.batch=t.batch||1,d.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const u=this.js.nc.features.get(He.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);d.max_bytes=t.max_bytes}let y=0;t.expires&&t.expires>0&&(y=t.expires,d.expires=lt(y));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,d.idle_heartbeat=lt(g)),g&&y===0)throw new Error("idle_heartbeat requires expires");if(g>y)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),y&&g&&(this.monitor?this.monitor._change(g,y):this._setupHbMonitoring(g,y));const u=this.info.api,m=`${u.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;u.nc.publish(m,u.jc.encode(d),{reply:b})}}}function j2(n,t){return n?N2(t):k2(t)}function k2(n){return(t,s)=>t?[t,null]:(t=Vi(s),t?[t,null]:[null,_o(s,n)])}function N2(n){return(t,s)=>{if(t)return[t,null];const i=Vi(s);return i!==null?[fx(i),null]:[null,_o(s,n)]}}function fx(n){if(n!==null)switch(n.code){case ue.JetStream404NoMessages:case ue.JetStream408RequestTimeout:return null;case ue.JetStream409:return JS(n)?n:null;default:return n}return null}function T2(n){n&&n.ack()}function C2(n){const t=n.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class M2{constructor(t,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=C2(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Za[0]&&t[1]===Za[1]&&t[2]===Za[2]&&t[3]===Za[3]}async ackAck(t){var i;t=t||{},t.timeout=t.timeout||this.timeout;const s=ct();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,d=!((i=c.options)!=null&&i.noAsyncTraces),y=new ex(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},d);c.request(y);try{c.publish(this.msg.reply,Yg,{reply:`${c.muxSubscriptions.baseInbox}${y.token}`})}catch(g){y.cancel(g)}try{await Promise.race([y.timer,y.deferred]),s.resolve(!0)}catch(g){y.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(Yg)}nak(t){let s=h2;t&&(s=ud().encode(`-NAK ${JSON.stringify({delay:lt(t)})}`)),this.doAck(s)}working(){this.doAck(Za)}next(t,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=lt(s.expires));const o=Qn().encode(i),c=Wi.concat(d2,p2,o),d=t?{reply:t}:void 0;this.msg.respond(c,d)}term(t=""){let s=m2;(t==null?void 0:t.length)>0&&(s=ud().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const R2="1.30.3",D2="nats.ws";class q2{constructor(){j(this,"version");j(this,"lang");j(this,"closeError");j(this,"connected");j(this,"done");j(this,"socket");j(this,"options");j(this,"socketClosed");j(this,"encrypted");j(this,"peeked");j(this,"yields");j(this,"signal");j(this,"closedNotification");this.version=R2,this.lang=D2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=ct(),this.closedNotification=ct()}async connect(t,s){const i=ct();if(s.tls)return i.reject(new ye("tls",ue.InvalidOption)),i;this.options=s;const o=t.src;if(s.wsFactory){const{socket:c,encrypted:d}=await s.wsFactory(t.src,s);this.socket=c,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=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const d=Wi.concat(...this.yields),y=vE(d);if(y!==""){const g=KE.exec(y);if(!g){s.debug&&console.error("!!!",tc(d)),i.reject(new Error("unexpected response from server"));return}try{const u=JSON.parse(g[1]);VE(u,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(u){i.reject(u);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(c.wasClean||(d=new Error(c.reason)),this._closed(d))},this.socket.onerror=c=>{if(this.isDiscarded())return;const d=c,y=new ye(d.message,ue.Unknown,new Error(d.error));i.reject(y)},i}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ea(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${tc(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=ct())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${tc(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${tc(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function L2(n,t){/^(.*:\/\/)(.*)/.test(n)||(typeof t=="boolean"?n=`${t===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(t=!1),o==="wss:"&&(t=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,d;const y=i.hostname,g=i.pathname,u=i.search||"";switch(o){case"http:":case"ws:":case"nats:":d=i.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":d=i.port||"443",c="wss:";break;default:d=i.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${y}:${d}${g}${u}`}function B2(n={}){return pE({defaultPort:443,urlParseFn:L2,factory:()=>new q2}),tm.connect(n)}const U2=null,P2=null,Kt="lt.events";function hx(n,t){const s=n.split("."),i=t.split(".");for(let o=0;o<i.length;o++){const c=i[o];if(c===">")return!0;if(o>=s.length||c!=="*"&&c!==s[o])return!1}return s.length===i.length}const ta=O.createContext({connected:!1,subscribe:()=>()=>{}});function dx(){const{connected:n}=O.useContext(ta);return{connected:n}}function _n(n,t){const{subscribe:s}=O.useContext(ta),i=O.useRef(t);i.current=t,O.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function Xs(n,t){const{subscribe:s}=O.useContext(ta),i=O.useRef(t);i.current=t;const o=n.join(","),c=O.useMemo(()=>o.split(",").filter(Boolean),[o]);O.useEffect(()=>{const d=g=>i.current(g),y=c.map(g=>s(g,d));return()=>y.forEach(g=>g())},[s,c])}const z2=O.createContext({connected:!1,subscribe:()=>()=>{}}),$2=ud();function I2({children:n,url:t,token:s}){const i=O.useRef(null),[o,c]=O.useState(!1),d=O.useRef(null),y=O.useRef(new Map),g=O.useRef(new Map),u=O.useCallback((v,_)=>{(async()=>{for await(const S of _)try{if(!hx(S.subject,v))continue;const C=JSON.parse($2.decode(S.data)),L=y.current.get(v);if(!L)continue;for(const U of L)try{U(C)}catch{}}catch{}})()},[]),m=O.useCallback(v=>{var S;const _=i.current;if(!(!_||(S=_.isClosed)!=null&&S.call(_)||g.current.has(v)))try{const C=_.subscribe(v);g.current.set(v,C),u(v,C)}catch{}},[u]),b=O.useCallback((v,_)=>{const S=y.current;return S.has(v)||S.set(v,new Set),S.get(v).add(_),m(v),()=>{const C=S.get(v);if(C&&(C.delete(_),C.size===0)){S.delete(v);const L=g.current.get(v);if(L){g.current.delete(v);try{L.unsubscribe()}catch{}}}}},[m]),x=O.useCallback(async()=>{try{if(i.current)return;const v=t||U2;if(!v){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const _=await B2({servers:v,token:s||P2||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});i.current=_,c(!0);for(const S of y.current.keys())m(S);(async()=>{for await(const S of _.status())S.type==="disconnect"||S.type==="error"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),d.current=setTimeout(x,3e3)}},[m]);return O.useEffect(()=>(x(),()=>{d.current&&clearTimeout(d.current);for(const v of g.current.values())try{v.unsubscribe()}catch{}g.current.clear(),i.current&&(i.current.close().catch(()=>{}),i.current=null),c(!1)}),[x]),h.jsx(z2.Provider,{value:{connected:o,subscribe:b},children:h.jsx(ta.Provider,{value:{connected:o,subscribe:b},children:n})})}const ar=Object.create(null);ar.open="0";ar.close="1";ar.ping="2";ar.pong="3";ar.message="4";ar.upgrade="5";ar.noop="6";const eu=Object.create(null);Object.keys(ar).forEach(n=>{eu[ar[n]]=n});const Ed={type:"error",data:"parser error"},mx=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",px=typeof ArrayBuffer=="function",yx=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,nm=({type:n,data:t},s,i)=>mx&&t instanceof Blob?s?i(t):Jg(t,i):px&&(t instanceof ArrayBuffer||yx(t))?s?i(t):Jg(new Blob([t]),i):i(ar[n]+(t||"")),Jg=(n,t)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];t("b"+(i||""))},s.readAsDataURL(n)};function Qg(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Xh;function H2(n,t){if(mx&&n.data instanceof Blob)return n.data.arrayBuffer().then(Qg).then(t);if(px&&(n.data instanceof ArrayBuffer||yx(n.data)))return t(Qg(n.data));nm(n,!1,s=>{Xh||(Xh=new TextEncoder),t(Xh.encode(s))})}const Xg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Xg.length;n++)fo[Xg.charCodeAt(n)]=n;const F2=n=>{let t=n.length*.75,s=n.length,i,o=0,c,d,y,g;n[n.length-1]==="="&&(t--,n[n.length-2]==="="&&t--);const u=new ArrayBuffer(t),m=new Uint8Array(u);for(i=0;i<s;i+=4)c=fo[n.charCodeAt(i)],d=fo[n.charCodeAt(i+1)],y=fo[n.charCodeAt(i+2)],g=fo[n.charCodeAt(i+3)],m[o++]=c<<2|d>>4,m[o++]=(d&15)<<4|y>>2,m[o++]=(y&3)<<6|g&63;return u},G2=typeof ArrayBuffer=="function",rm=(n,t)=>{if(typeof n!="string")return{type:"message",data:gx(n,t)};const s=n.charAt(0);return s==="b"?{type:"message",data:V2(n.substring(1),t)}:eu[s]?n.length>1?{type:eu[s],data:n.substring(1)}:{type:eu[s]}:Ed},V2=(n,t)=>{if(G2){const s=F2(n);return gx(s,t)}else return{base64:!0,data:n}},gx=(n,t)=>{switch(t){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},bx="",Y2=(n,t)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,d)=>{nm(c,!1,y=>{i[d]=y,++o===s&&t(i.join(bx))})})},K2=(n,t)=>{const s=n.split(bx),i=[];for(let o=0;o<s.length;o++){const c=rm(s[o],t);if(i.push(c),c.type==="error")break}return i};function J2(){return new TransformStream({transform(n,t){H2(n,s=>{const i=s.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(s)})}})}let Wh;function ic(n){return n.reduce((t,s)=>t+s.length,0)}function ac(n,t){if(n[0].length===t)return n.shift();const s=new Uint8Array(t);let i=0;for(let o=0;o<t;o++)s[o]=n[0][i++],i===n[0].length&&(n.shift(),i=0);return n.length&&i<n[0].length&&(n[0]=n[0].slice(i)),s}function Q2(n,t){Wh||(Wh=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(d,y){for(s.push(d);;){if(i===0){if(ic(s)<1)break;const g=ac(s,1);c=(g[0]&128)===128,o=g[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(ic(s)<2)break;const g=ac(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(ic(s)<8)break;const g=ac(s,8),u=new DataView(g.buffer,g.byteOffset,g.length),m=u.getUint32(0);if(m>Math.pow(2,21)-1){y.enqueue(Ed);break}o=m*Math.pow(2,32)+u.getUint32(4),i=3}else{if(ic(s)<o)break;const g=ac(s,o);y.enqueue(rm(c?g:Wh.decode(g),t)),i=0}if(o===0||o>n){y.enqueue(Ed);break}}}})}const xx=4;function Ot(n){if(n)return X2(n)}function X2(n){for(var t in Ot.prototype)n[t]=Ot.prototype[t];return n}Ot.prototype.on=Ot.prototype.addEventListener=function(n,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(t),this};Ot.prototype.once=function(n,t){function s(){this.off(n,s),t.apply(this,arguments)}return s.fn=t,this.on(n,s),this};Ot.prototype.off=Ot.prototype.removeListener=Ot.prototype.removeAllListeners=Ot.prototype.removeEventListener=function(n,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+n];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,o=0;o<s.length;o++)if(i=s[o],i===t||i.fn===t){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};Ot.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,t)}return this};Ot.prototype.emitReserved=Ot.prototype.emit;Ot.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Ot.prototype.hasListeners=function(n){return!!this.listeners(n).length};const wu=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),Pn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),W2="arraybuffer";function vx(n,...t){return t.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const Z2=Pn.setTimeout,eO=Pn.clearTimeout;function Su(n,t){t.useNativeTimers?(n.setTimeoutFn=Z2.bind(Pn),n.clearTimeoutFn=eO.bind(Pn)):(n.setTimeoutFn=Pn.setTimeout.bind(Pn),n.clearTimeoutFn=Pn.clearTimeout.bind(Pn))}const tO=1.33;function nO(n){return typeof n=="string"?rO(n):Math.ceil((n.byteLength||n.size)*tO)}function rO(n){let t=0,s=0;for(let i=0,o=n.length;i<o;i++)t=n.charCodeAt(i),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(i++,s+=4);return s}function _x(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function sO(n){let t="";for(let s in n)n.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return t}function iO(n){let t={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class aO extends Error{constructor(t,s,i){super(t),this.description=s,this.context=i,this.type="TransportError"}}class sm extends Ot{constructor(t){super(),this.writable=!1,Su(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,i){return super.emitReserved("error",new aO(t,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=rm(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=sO(t);return s.length?"?"+s:""}}class oO extends sm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||s()})),this.writable||(i++,this.once("drain",function(){--i||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};K2(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Y2(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=_x()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let wx=!1;try{wx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const lO=wx;function cO(){}class uO extends oO{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,s){const i=this.request({method:"POST",data:t});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=t}}class ir extends Ot{constructor(t,s,i){super(),this.createRequest=t,Su(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const s=vx(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=ir.requestsCount++,ir.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=cO,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ir.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}ir.requestsCount=0;ir.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Wg);else if(typeof addEventListener=="function"){const n="onpagehide"in Pn?"pagehide":"unload";addEventListener(n,Wg,!1)}}function Wg(){for(let n in ir.requests)ir.requests.hasOwnProperty(n)&&ir.requests[n].abort()}const fO=(function(){const n=Sx({xdomain:!1});return n&&n.responseType!==null})();class hO extends uO{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=fO&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new ir(Sx,this.uri(),t)}}function Sx(n){const t=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||lO))return new XMLHttpRequest}catch{}if(!t)try{return new Pn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ex=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class dO extends sm{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,i=Ex?{}:vx(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,i)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],o=s===t.length-1;nm(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&wu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=_x()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const Zh=Pn.WebSocket||Pn.MozWebSocket;class mO extends dO{createSocket(t,s,i){return Ex?new Zh(t,s,i):s?new Zh(t,s):new Zh(t)}doWrite(t,s){this.ws.send(s)}}class pO extends sm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=Q2(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(s).getReader(),o=J2();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const c=()=>{i.read().then(({done:y,value:g})=>{y||(this.onPacket(g),c())}).catch(y=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],o=s===t.length-1;this._writer.write(i).then(()=>{o&&wu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const yO={websocket:mO,webtransport:pO,polling:hO},gO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,bO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Od(n){if(n.length>8e3)throw"URI too long";const t=n,s=n.indexOf("["),i=n.indexOf("]");s!=-1&&i!=-1&&(n=n.substring(0,s)+n.substring(s,i).replace(/:/g,";")+n.substring(i,n.length));let o=gO.exec(n||""),c={},d=14;for(;d--;)c[bO[d]]=o[d]||"";return s!=-1&&i!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=xO(c,c.path),c.queryKey=vO(c,c.query),c}function xO(n,t){const s=/\/{2,9}/g,i=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function vO(n,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const Ad=typeof addEventListener=="function"&&typeof removeEventListener=="function",tu=[];Ad&&addEventListener("offline",()=>{tu.forEach(n=>n())},!1);class xs extends Ot{constructor(t,s){if(super(),this.binaryType=W2,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const i=Od(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Od(s.host).host);Su(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(i=>{const o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=i}),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=iO(this.opts.query)),Ad&&(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"})},tu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=xx,s.transport=t,this.id&&(s.sid=this.id);const i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){const o=this.writeBuffer[i].data;if(o&&(s+=nO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,wu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,o){if(typeof s=="function"&&(o=s,s=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:t,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{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?i():t()}):this.upgrading?i():t()),this}_onError(t){if(xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ad&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=tu.indexOf(this._offlineEventListener);i!==-1&&tu.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}xs.protocol=xx;class _O extends xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),i=!1;xs.priorWebsocketSuccess=!1;const o=()=>{i||(s.send([{type:"ping",data:"probe"}]),s.once("packet",b=>{if(!i)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(m(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=s.name,this.emitReserved("upgradeError",x)}}))};function c(){i||(i=!0,m(),s.close(),s=null)}const d=b=>{const x=new Error("probe error: "+b);x.transport=s.name,c(),this.emitReserved("upgradeError",x)};function y(){d("transport closed")}function g(){d("socket closed")}function u(b){s&&b.name!==s.name&&c()}const m=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",y),this.off("close",g),this.off("upgrading",u)};s.once("open",o),s.once("error",d),s.once("close",y),this.once("close",g),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&s.push(t[i]);return s}}let wO=class extends _O{constructor(t,s={}){const i=typeof t=="object"?t:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>yO[o]).filter(o=>!!o)),super(t,i)}};function SO(n,t="",s){let i=n;s=s||typeof location<"u"&&location,n==null&&(n=s.protocol+"//"+s.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=s.protocol+n:n=s.host+n),/^(https?|wss?):\/\//.test(n)||(typeof s<"u"?n=s.protocol+"//"+n:n="https://"+n),i=Od(n)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const c=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+c+":"+i.port+t,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const EO=typeof ArrayBuffer=="function",OO=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Ox=Object.prototype.toString,AO=typeof Blob=="function"||typeof Blob<"u"&&Ox.call(Blob)==="[object BlobConstructor]",jO=typeof File=="function"||typeof File<"u"&&Ox.call(File)==="[object FileConstructor]";function im(n){return EO&&(n instanceof ArrayBuffer||OO(n))||AO&&n instanceof Blob||jO&&n instanceof File}function nu(n,t){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(nu(n[s]))return!0;return!1}if(im(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return nu(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&nu(n[s]))return!0;return!1}function kO(n){const t=[],s=n.data,i=n;return i.data=jd(s,t),i.attachments=t.length,{packet:i,buffers:t}}function jd(n,t){if(!n)return n;if(im(n)){const s={_placeholder:!0,num:t.length};return t.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=jd(n[i],t);return s}else if(typeof n=="object"&&!(n instanceof Date)){const s={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[i]=jd(n[i],t));return s}return n}function NO(n,t){return n.data=kd(n.data,t),delete n.attachments,n}function kd(n,t){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<t.length)return t[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=kd(n[s],t);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=kd(n[s],t));return n}const TO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Pe;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(Pe||(Pe={}));class CO{constructor(t){this.replacer=t}encode(t){return(t.type===Pe.EVENT||t.type===Pe.ACK)&&nu(t)?this.encodeAsBinary({type:t.type===Pe.EVENT?Pe.BINARY_EVENT:Pe.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Pe.BINARY_EVENT||t.type===Pe.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=kO(t),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class am extends Ot{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const i=s.type===Pe.BINARY_EVENT;i||s.type===Pe.BINARY_ACK?(s.type=i?Pe.EVENT:Pe.ACK,this.reconstructor=new MO(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(im(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const i={type:Number(t.charAt(0))};if(Pe[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Pe.BINARY_EVENT||i.type===Pe.BINARY_ACK){const c=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const d=t.substring(c,s);if(d!=Number(d)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const y=Number(d);if(!RO(y)||y<0)throw new Error("Illegal attachments");if(y>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=y}if(t.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););i.nsp=t.substring(c,s)}else i.nsp="/";const o=t.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const d=t.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===t.length)break}i.id=Number(t.substring(c,s+1))}if(t.charAt(++s)){const c=this.tryParse(t.substr(s));if(am.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Pe.CONNECT:return Zg(s);case Pe.DISCONNECT:return s===void 0;case Pe.CONNECT_ERROR:return typeof s=="string"||Zg(s);case Pe.EVENT:case Pe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&TO.indexOf(s[0])===-1);case Pe.ACK:case Pe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class MO{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=NO(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const RO=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function Zg(n){return Object.prototype.toString.call(n)==="[object Object]"}const DO=Object.freeze(Object.defineProperty({__proto__:null,Decoder:am,Encoder:CO,get PacketType(){return Pe}},Symbol.toStringTag,{value:"Module"}));function Kn(n,t,s){return n.on(t,s),function(){n.off(t,s)}}const qO=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ax extends Ot{constructor(t,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Kn(t,"open",this.onopen.bind(this)),Kn(t,"packet",this.onpacket.bind(this)),Kn(t,"error",this.onerror.bind(this)),Kn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var i,o,c;if(qO.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Pe.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const m=this.ids++,b=s.pop();this._registerAckCallback(m,b),d.id=m}const y=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!y||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[t]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===t&&this.sendBuffer.splice(y,1);s.call(this,new Error("operation has timed out"))},o),d=(...y)=>{this.io.clearTimeoutFn(c),s.apply(this,y)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...s){return new Promise((i,o)=>{const c=(d,y)=>d?o(d):i(y);c.withError=!0,s.push(c),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...c)=>(this._queue[0],o!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Pe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Pe.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Pe.EVENT:case Pe.BINARY_EVENT:this.onevent(t);break;case Pe.ACK:case Pe.BINARY_ACK:this.onack(t);break;case Pe.DISCONNECT:this.ondisconnect();break;case Pe.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Pe.ACK,id:t,data:o}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Pe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,t.data)}}}function na(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}na.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*n);n=(Math.floor(t*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};na.prototype.reset=function(){this.attempts=0};na.prototype.setMin=function(n){this.ms=n};na.prototype.setMax=function(n){this.max=n};na.prototype.setJitter=function(n){this.jitter=n};class Nd extends Ot{constructor(t,s){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Su(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((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new na({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const o=s.parser||DO;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new wO(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Kn(s,"open",function(){i.onopen(),t&&t()}),c=y=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",y),t?t(y):this.maybeReconnectOnOpen()},d=Kn(s,"error",c);if(this._timeout!==!1){const y=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},y);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Kn(t,"ping",this.onping.bind(this)),Kn(t,"data",this.ondata.bind(this)),Kn(t,"error",this.onerror.bind(this)),Kn(t,"close",this.onclose.bind(this)),Kn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){wu(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new Ax(this,t,s),this.nsps[t]=i),i}_destroy(t){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let i=0;i<s.length;i++)this.engine.write(s[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const eo={};function ru(n,t){typeof n=="object"&&(t=n,n=void 0),t=t||{};const s=SO(n,t.path||"/socket.io"),i=s.source,o=s.id,c=s.path,d=eo[o]&&c in eo[o].nsps,y=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let g;return y?g=new Nd(i,t):(eo[o]||(eo[o]=new Nd(i,t)),g=eo[o]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(ru,{Manager:Nd,Socket:Ax,io:ru,connect:ru});const LO=O.createContext({connected:!1,subscribe:()=>()=>{}});function BO({children:n}){const{isAuthenticated:t}=Rt(),s=O.useRef(null),[i,o]=O.useState(!1),c=O.useRef(new Map),d=O.useCallback((g,u)=>{var b;const m=c.current;return m.has(g)||(m.set(g,new Set),(b=s.current)==null||b.emit("lt.subscribe",g)),m.get(g).add(u),()=>{var v;const x=m.get(g);x&&(x.delete(u),x.size===0&&(m.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),y=O.useCallback((g,u)=>{for(const[m,b]of c.current)if(hx(g,m))for(const x of b)try{x(u)}catch{}},[]);return O.useEffect(()=>{if(!t)return;const g=ru({path:`${Pt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:u=>{const m=Yb();u(m?{token:m}:{})}});return s.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),o(!0);for(const u of c.current.keys())g.emit("lt.subscribe",u)}),g.on("disconnect",u=>{console.log("[lt-socketio] disconnected:",u),o(!1)}),g.on("connect_error",u=>{console.warn("[lt-socketio] connect error:",u.message),o(!1)}),g.onAny((u,m)=>{if(u.startsWith("lt."))try{const b=typeof m=="string"?JSON.parse(m):m;y(u,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[y,t]),h.jsx(LO.Provider,{value:{connected:i,subscribe:d},children:h.jsx(ta.Provider,{value:{connected:i,subscribe:d},children:n})})}function UO({children:n}){const{isAuthenticated:t}=Rt(),[s,i]=O.useState(null),[o,c]=O.useState({url:null,token:null});return O.useEffect(()=>{let d=!1;async function y(){var g;try{console.log("[lt-transport] detecting event transport...");const u=await Yd(),m=(g=u==null?void 0:u.events)==null?void 0:g.transport;if(console.log("[lt-transport] server reports:",m),!d){if(m==="nats"){let b=u.events.natsWsUrl??null,x=null;const v=Yb();if(v)try{const _=await fetch(`${Pt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${v}`}});if(_.ok){const S=await _.json();b=S.natsWsUrl??b,x=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}c({url:b,token:x})}i(m==="nats"?"nats":"socketio")}}catch(u){console.warn("[lt-transport] settings fetch error, falling back to socketio",u),d||i("socketio")}}return y(),()=>{d=!0}},[t]),s==="nats"?h.jsx(I2,{url:o.url,token:o.token,children:n}):s==="socketio"?h.jsx(BO,{children:n}):h.jsx(h.Fragment,{children:n})}const om="lt_view_as",lm="lt_ai_override",Td="lt_graph_enabled",Cd="lt_infrastructure_enabled",cm="lt_scan_override";function jx(){try{const n=localStorage.getItem(lm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function PO(n){try{localStorage.setItem(lm,String(n))}catch{}}function zO(){try{localStorage.removeItem(lm)}catch{}}function um(){try{const n=localStorage.getItem(om);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function $O(n){try{localStorage.setItem(om,n)}catch{}window.location.reload()}function Md(){try{localStorage.removeItem(om)}catch{}window.location.reload()}function kx(){try{return localStorage.getItem(Td)==="true"}catch{return!1}}function IO(n){try{n?localStorage.setItem(Td,"true"):localStorage.removeItem(Td)}catch{}}function Nx(){try{return localStorage.getItem(Cd)==="true"}catch{return!1}}function HO(n){try{n?localStorage.setItem(Cd,"true"):localStorage.removeItem(Cd)}catch{}}function Tx(){try{const n=localStorage.getItem(cm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function FO(n){try{localStorage.setItem(cm,String(n))}catch{}}function GO(){try{localStorage.removeItem(cm)}catch{}}function Cx(){const{isSuperAdmin:n,hasRoleType:t,hasRole:s}=Rt(),i=um(),o=n||s("engineer"),c=t("admin"),d=n||t("admin");return{isBuilder:i?!1:o,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":d,viewAs:i,realIsBuilder:o}}function Mx(){var u;const{isSuperAdmin:n,hasRoleType:t,hasRole:s}=Rt(),{data:i}=Xn(),o=((u=i==null?void 0:i.features)==null?void 0:u.publicPaceBoard)!==!1,c=n?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",d=um(),y=d==="admin"||d==="engineer"||d==="operator"?d:null,g=y??c;return{tier:g,realTier:c,viewAs:y,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}function Rx(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function Dr(n={}){const t=n.role?Rx(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Kt}.system.escalation.${t}.${s}.${i}`}function Rd(n){return n.verbs.map(t=>Dr({role:n.role,verb:t}))}function fm(n){const{user:t,isSuperAdmin:s,hasRoleType:i}=Rt(),o=s||i("admin"),c=((t==null?void 0:t.roles)??[]).map(y=>y.role).sort().join(","),d=(n??[]).join(",");return O.useMemo(()=>{const y=d?d.split(","):null;return o||!c?y?Rd({verbs:y}):[Dr({})]:c.split(",").flatMap(g=>y?Rd({role:g,verbs:y}):[Dr({role:g})])},[o,c,d])}const Dd="/escalations/detail/";function VO(n){return n.startsWith(Dd)&&n.slice(Dd.length).split("/")[0]||void 0}function YO(){const{user:n}=Rt(),t=Zi(),s=En(),i=O.useRef(s.pathname);i.current=s.pathname;const o=O.useRef(n==null?void 0:n.userId);o.current=n==null?void 0:n.userId;const c=O.useCallback(d=>{var b,x,v;if((d==null?void 0:d.assignedAtCreation)!==!0)return;const y=(d==null?void 0:d.escalationId)??((b=d==null?void 0:d.data)==null?void 0:b.id),g=(x=d==null?void 0:d.data)==null?void 0:x.assigned_to,u=(v=d==null?void 0:d.data)==null?void 0:v.parent_id;if(!y||g!==o.current||!u||u!==VO(i.current))return;const m=`${Dd}${y}`;i.current!==m&&t(m)},[t]);Xs(fm(["claimed"]),c)}function KO(n){const t=n??[];return t.length>0&&t.every(s=>s.type==="member"&&s.write_scope==="none")}const hm={staleTime:5*6e4,refetchOnWindowFocus:!1};function tC(n={},t={}){const s=new URLSearchParams;return n.role&&s.set("role",n.role),n.roleType&&s.set("roleType",n.roleType),n.status&&s.set("status",n.status),n.search&&s.set("search",n.search),n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),ze({queryKey:["users",n],queryFn:()=>he(`/users?${s}`),enabled:t.enabled??!0,...hm})}const e1=200;async function JO(n){const t=[];for(let s=0;s<n.length;s+=e1){const i=await he("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+e1)})});t.push(...i.users??[])}return t}let qd=[],Ld=new Map,Bd=!1;function QO(){const n=qd,t=Ld;qd=[],Ld=new Map,Bd=!1,JO(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of t)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of t.values())i.reject(s)})}function XO(n){return new Promise((t,s)=>{qd.push(n),Ld.set(n,{resolve:t,reject:s}),Bd||(Bd=!0,setTimeout(QO,0))})}function nC(n){return ze({queryKey:["user-name",n],queryFn:()=>XO(n),enabled:!!n,...hm})}function WO(n){return ze({queryKey:["users",n,"roles"],queryFn:async()=>(await he(`/users/${n}/roles`)).roles??[],enabled:!!n,...hm})}function rC(){const n=Ie();return Ve({mutationFn:t=>he("/users",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function sC(){const n=Ie();return Ve({mutationFn:({id:t,...s})=>he(`/users/${t}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function iC(){const n=Ie();return Ve({mutationFn:({id:t,ops:s})=>he(`/users/${t}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function aC(){return ze({queryKey:["users","system-property-keys"],queryFn:()=>he("/users/system-property-keys")})}function oC(){const n=Ie();return Ve({mutationFn:t=>he(`/users/${t}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function lC(){const n=Ie();return Ve({mutationFn:({userId:t,role:s,type:i,read_scope:o,write_scope:c})=>he(`/users/${t}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function cC(){const n=Ie();return Ve({mutationFn:({userId:t,role:s})=>he(`/users/${t}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function ZO(){return ze({queryKey:["roles"],queryFn:()=>he("/roles")})}function Eu(n){return ze({queryKey:["roles","details"],queryFn:()=>he("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function uC(n,t,s=!0){return ze({queryKey:["roles",n,"schema",t??"latest"],queryFn:()=>he(`/roles/${encodeURIComponent(n)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!n})}function fC(n){return ze({queryKey:["roles",n,"schema-versions"],queryFn:()=>he(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function hC(n,t,s=!0){return ze({queryKey:["roles",n,"list-schema",t??"latest"],queryFn:()=>he(`/roles/${encodeURIComponent(n)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!n})}function dC(n){return ze({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>he(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function mC(){const n=Ie();return Ve({mutationFn:t=>he("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function pC(){const n=Ie();return Ve({mutationFn:({role:t,...s})=>he(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await n.cancelQueries({queryKey:["roles","details"]});const i=n.getQueryData(["roles","details"]);return i&&n.setQueryData(["roles","details"],{roles:i.roles.map(o=>o.role===t?{...o,...s}:o)}),{previous:i}},onError:(t,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function yC(){const n=Ie();return Ve({mutationFn:t=>he(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const Dx="lt:station:kiosk-role:";function Ud(n){return`${Dx}${n}`}const Pd=new Set;function eA(){for(const n of Pd)n()}function tA(n){try{return localStorage.getItem(Ud(n))}catch{return null}}function nA(n,t){try{t===null?localStorage.removeItem(Ud(n)):localStorage.setItem(Ud(n),t)}catch{}eA()}function rA(n){Pd.add(n);const t=s=>{(s.key===null||s.key.startsWith(Dx))&&n()};try{window.addEventListener("storage",t)}catch{}return()=>{Pd.delete(n);try{window.removeEventListener("storage",t)}catch{}}}function sA(n){return O.useSyncExternalStore(rA,()=>n?tA(n):null)}function qx(){const{user:n}=Rt(),t=(n==null?void 0:n.userId)??null,{data:s}=WO(t),{data:i}=Eu(),o=sA(t),c=O.useCallback(d=>{t&&nA(t,d)},[t]);return O.useMemo(()=>{const d={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},y=s??[];if(y.length===0||y.some(x=>x.type!=="member"))return d;const g=x=>{var v,_,S;return((S=(_=(v=i==null?void 0:i.roles)==null?void 0:v.find(C=>C.role===x))==null?void 0:_.properties)==null?void 0:S.kiosk)===!0},u=y.map(x=>x.role).filter(g),m=x=>({kiosk:!0,role:x,homePath:`/escalations/available?role=${encodeURIComponent(x)}&status=available`,targets:u,selectable:u.length>=2,selectRole:c});if(y.length===1)return u.length===1?m(u[0]):d;if(!KO(y)||u.length===0)return d;const b=o&&u.includes(o)?o:u.length===1?u[0]:null;return b?m(b):{...d,targets:u,selectable:!0}},[s,i,o,c])}const iA=["/escalations","/scan","/login"];function aA(n){return iA.some(t=>n===t||n.startsWith(`${t}/`)||n.startsWith(`${t}?`))}const dm=O.createContext(null),ed="lt_sidebar_collapsed",Lx="(max-width: 1023px)";function oA(){try{return window.matchMedia(Lx).matches}catch{return!1}}function lA({children:n}){const[t,s]=O.useState(()=>{if(oA())return!0;try{return localStorage.getItem(ed)==="true"}catch{return!1}});O.useEffect(()=>{let o;try{o=window.matchMedia(Lx)}catch{return}const c=d=>{if(d.matches)s(!0);else try{s(localStorage.getItem(ed)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=O.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(ed,String(c))}catch{}return c})},[]);return h.jsx(dm.Provider,{value:{collapsed:t,toggle:i},children:n})}function cA({children:n}){return h.jsx(dm.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function mm(){const n=O.useContext(dm);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const t1=380,pm=O.createContext(null);function uA({children:n}){const[t,s]=O.useState({node:null,width:t1,open:!1,ownerKey:null}),i=En(),o=O.useRef(i.pathname),c=O.useCallback((y,g)=>{s({node:y,width:(g==null?void 0:g.width)??t1,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=O.useCallback(y=>{s(g=>typeof y=="string"&&g.ownerKey!==y?g:{...g,open:!1})},[]);return O.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(y=>y.open||y.node?{...y,node:null,open:!1,ownerKey:null}:y))},[i.pathname]),h.jsx(pm.Provider,{value:{...t,setPanel:c,closePanel:d},children:n})}function ym(){const n=O.useContext(pm);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function gC(){return O.useContext(pm)}function fA({open:n,width:t=380,children:s,className:i=""}){const[o,c]=O.useState(n);return O.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?t:0,maxWidth:"50%"},onTransitionEnd:d=>{!n&&d.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:t},className:"h-full",children:o?s:null})})}function bC({label:n,children:t}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:n}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function xC({views:n,activeId:t,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:d}){const y=n.find(g=>g.id===t)??n[0];return y?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${d?"pt-10 pb-2":"pt-3"}`,children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:n.map(g=>{const u=g.icon,m=g.id===y.id;return h.jsx("button",{role:"radio","aria-checked":m,onClick:()=>s(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${m?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:h.jsx(u,{className:"w-3.5 h-3.5"})},g.id)})}),d&&h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:y.label})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o,i&&h.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:h.jsx(Qt,{className:"w-3.5 h-3.5"})})]})]}),!d&&h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:y.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${d?"pt-4 pb-8":"pb-5 pt-1"}`,children:y.content})]})}):null}function Bx(n,t){var s,i,o,c,d;t.facets&&Object.keys(t.facets).length&&n.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&n.set("block",JSON.stringify(t.block)),(i=t.range)!=null&&i.length&&n.set("range",JSON.stringify(t.range)),(o=t.exists)!=null&&o.length&&n.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&n.set("roles",JSON.stringify(t.roles)),(d=t.orderBy)!=null&&d.length&&n.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&n.set("available",String(t.available)),t.jeopardy===!0&&n.set("jeopardy","1"),t.include&&n.set("include",t.include)}function vC(n,t,s){const i=n??"24h",o=t&&Object.keys(t).length?JSON.stringify(t):null;return ze({queryKey:["stationMetrics",i,o],queryFn:()=>he(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function _C(n){const t=n?`?period=${n}`:"";return ze({queryKey:["escalationStats",n],queryFn:()=>he(`/escalations/stats${t}`)})}function wC(){return ze({queryKey:["escalationTypes"],queryFn:()=>he("/escalations/types")})}function SC(n=!0){return ze({queryKey:["escalationFacetKeys"],queryFn:()=>he("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function hA(n){return ze({queryKey:["escalationFacetValues",n],queryFn:()=>he(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function Ux(n){const{enabled:t=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.status&&o.set("status",i.status),i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.assigned_to&&o.set("assigned_to",i.assigned_to),i.parent_id&&o.set("parent_id",i.parent_id),i.claimed&&o.set("claimed","true"),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),Bx(o,i),ze({queryKey:["escalations",i],queryFn:()=>he(`/escalations?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function Px(n){const{enabled:t=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),Bx(o,i),ze({queryKey:["escalations","available",i],queryFn:()=>he(`/escalations/available?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function EC(n){return ze({queryKey:["escalations","by-workflow",n],queryFn:()=>he(`/escalations/by-workflow/${n}`),enabled:!!n})}function OC(n){return ze({queryKey:["escalations",n],queryFn:()=>he(`/escalations/${n}`),enabled:!!n})}function AC(n,t){return ze({queryKey:["escalations",n,"lookups"],queryFn:()=>he(`/escalations/${n}/lookups`),enabled:!!n&&t,staleTime:1/0})}function jC(){const n=Ie();return Ve({mutationFn:({id:t,durationMinutes:s})=>he(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function kC(){const n=Ie();return Ve({mutationFn:t=>he(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function NC(){const n=Ie();return Ve({mutationFn:({id:t,resolverPayload:s})=>he(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),n.resetQueries({queryKey:["tasks"]}),n.resetQueries({queryKey:["jobs"]})}})}function TC(){const n=Ie();return Ve({mutationFn:({id:t,targetRole:s})=>he(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function CC(){const n=Ie();return Ve({mutationFn:({ids:t,priority:s})=>he("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function MC(){const n=Ie();return Ve({mutationFn:({ids:t,durationMinutes:s})=>he("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function RC(){const n=Ie();return Ve({mutationFn:({ids:t,targetUserId:s,durationMinutes:i,reassign:o})=>he("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function DC(){const n=Ie();return Ve({mutationFn:({ids:t})=>he("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function qC(){const n=Ie();return Ve({mutationFn:({ids:t,hint:s})=>he("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function LC(){const n=Ie();return Ve({mutationFn:t=>he(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function BC(){const n=Ie();return Ve({mutationFn:({ids:t})=>he("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function gm(n){const t=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":t.push(["tasks"]),t.push(["jobs"]),t.push(["processes"]),n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["workflowState",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId])),n.originId&&t.push(["processes",n.originId]);break;case"escalation":t.push(["escalations"]),t.push(["escalationStats"]),t.push(["stationMetrics"]),n.workflowId&&t.push(["workflowExecution",n.workflowId]);break;case"workflow":t.push(["jobs"]),t.push(["tasks"]),t.push(["processes"]),n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["workflowState",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId]),t.push(["mcpQueryResult",n.workflowId]),t.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&t.push(["mcpRunExecution",n.workflowId]),t.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId])),t.push(["tasks"]);break;case"knowledge":t.push(["knowledge"]);break;case"file":t.push(["files"]);break;case"agent":t.push(["agents"]);break;default:t.push(["jobs"]),t.push(["tasks"]);break}return t}const dA={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},UC=300,n1={DETAIL:0,LIST:1,SUMMARY:2};function mA(n){const t=new Map,s={},i={};let o=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function d(m){delete s[m],i[m]=Date.now();const b=[];for(const[v,_]of t)_===m&&b.push(v);for(const v of b)t.delete(v);if(b.length===0)return;const x=c();x&&(o=!0);for(const v of b)n.invalidateQueries({queryKey:JSON.parse(v),...x?{refetchType:"none"}:{}})}function y(m){if(s[m])return;const{coalesceMs:b,minIntervalMs:x}=dA[m],v=i[m],_=v===void 0?0:v+x-Date.now(),S=Math.max(b,_);s[m]=setTimeout(()=>d(m),S)}function g(m,b){for(const x of b){const v=JSON.stringify(x),_=t.get(v);(_===void 0||n1[m]<n1[_])&&t.set(v,m)}y(m)}const u=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",u),{request:g,dispose(){for(const m of Object.keys(s)){const b=s[m];b&&clearTimeout(b),delete s[m]}t.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",u)}}}const r1=new WeakMap;function pA(n){let t=r1.get(n);return t||(t=mA(n),r1.set(n,t)),t}function rn(n){const t=Ie();return O.useCallback(s=>{pA(t).request(n,s)},[t,n])}function bm(n){return n?[`${Kt}.system.workflow.>`,`${Kt}.system.activity.>`,`${Kt}.system.milestone.>`,`${Kt}.system.task.>`,`${Kt}.system.escalation.>`]:[]}function PC(){const n=rn("LIST");_n(`${Kt}.system.task.>`,()=>{n([["jobs"]])}),_n(`${Kt}.system.workflow.>`,()=>{n([["jobs"]])})}function zC(n){const t=rn("DETAIL");Xs(bm(n),s=>{var y;if(!n||!(s.workflowId===n||((y=s.workflowId)==null?void 0:y.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=gm(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),t(d)})}function $C(n){const t=rn("DETAIL");Xs(bm(n),s=>{var y;if(!n||!(s.workflowId===n||((y=s.workflowId)==null?void 0:y.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=gm(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),t(d)})}function IC(n){const t=rn("DETAIL");Xs(bm(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=gm(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),t(o)})}function HC(n){const t=rn("DETAIL"),s=O.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||t([["processes",n]]))},[n,t]);_n(`${Kt}.system.task.>`,s),_n(`${Kt}.system.workflow.>`,s),_n(`${Kt}.system.escalation.>`,s)}function FC(){const n=rn("SUMMARY");_n(Dr({}),()=>{n([["escalationStats"]])})}function GC(){const n=rn("SUMMARY");_n(Dr({}),()=>{n([["stationMetrics"]])})}function VC(){const n=rn("SUMMARY");_n(Dr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function YC(n){const t=rn("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=O.useMemo(()=>{const c=i?i.split(","):null;return c?Rd({role:s,verbs:c}):[Dr({role:s})]},[s,i]);Xs(o,()=>{t([["escalations"]])})}function KC(n){const t=rn("DETAIL");_n(Dr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||t([["escalations",n]])})}function JC(){const n=rn("LIST");_n(`${Kt}.system.agent.>`,()=>{n([["agents"]])})}function QC(){const n=rn("LIST");_n(`${Kt}.system.task.>`,()=>{n([["processes"]])}),_n(`${Kt}.system.workflow.>`,()=>{n([["processes"]])})}function yA(){const{user:n}=Rt(),t=n==null?void 0:n.userId,s=rn("SUMMARY");Xs(fm(),()=>{s([["escalations"]])});const{data:i}=Px({limit:1}),{data:o}=Ux({assigned_to:t,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function xm({size:n="sm",hideLabel:t=!1,className:s="",appName:i="LongTail",variant:o="full"}){const c=n==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Pt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Pt}/logo512.png)`}})});const d=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",y=c?"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":i,className:`logo-mark shrink-0 z-0 ${d}`,style:{"--logo-url":`url(${Pt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${y} ${t?"opacity-0":""}`,children:i})]})}const gA="system.surfaces.dashboard",bA=`${Kt}.${gA}`;function zx(n=!0){return ze({queryKey:["announcements"],queryFn:()=>he("/announcements"),enabled:n,staleTime:3e4})}function xA(){const n=Ie();return Ve({mutationFn:t=>he("/announcements",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function vA(){const n=Ie();return Ve({mutationFn:t=>he(`/announcements/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}const $x=6048e5,_A=864e5,s1=6e4,i1=525600,a1=43200,o1=1440,l1=Symbol.for("constructDateFrom");function qr(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&l1 in n?n[l1](t):n instanceof Date?new n.constructor(t):new Date(t)}function Sn(n,t){return qr(t||n,n)}let wA={};function ko(){return wA}function wo(n,t){var y,g,u,m;const s=ko(),i=(t==null?void 0:t.weekStartsOn)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((m=(u=s.locale)==null?void 0:u.options)==null?void 0:m.weekStartsOn)??0,o=Sn(n,t==null?void 0:t.in),c=o.getDay(),d=(c<i?7:0)+c-i;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function du(n,t){return wo(n,{...t,weekStartsOn:1})}function Ix(n,t){const s=Sn(n,t==null?void 0:t.in),i=s.getFullYear(),o=qr(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=du(o),d=qr(s,0);d.setFullYear(i,0,4),d.setHours(0,0,0,0);const y=du(d);return s.getTime()>=c.getTime()?i+1:s.getTime()>=y.getTime()?i:i-1}function mu(n){const t=Sn(n),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+n-+s}function Hx(n,...t){const s=qr.bind(null,n||t.find(i=>typeof i=="object"));return t.map(s)}function c1(n,t){const s=Sn(n,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function SA(n,t,s){const[i,o]=Hx(s==null?void 0:s.in,n,t),c=c1(i),d=c1(o),y=+c-mu(c),g=+d-mu(d);return Math.round((y-g)/_A)}function EA(n,t){const s=Ix(n,t),i=qr(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),du(i)}function OA(n,t){const s=+Sn(n)-+Sn(t);return s<0?-1:s>0?1:s}function AA(n){return qr(n,Date.now())}function jA(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function kA(n){return!(!jA(n)&&typeof n!="number"||isNaN(+Sn(n)))}function NA(n){return t=>{const i=(n?Math[n]:Math.trunc)(t);return i===0?0:i}}function TA(n,t){const s=Sn(n,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const CA={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"}},MA=(n,t,s)=>{let i;const o=CA[n];return typeof o=="string"?i=o:t===1?i=o.one:i=o.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function td(n){return(t={})=>{const s=t.width?String(t.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const RA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},DA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},qA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},LA={date:td({formats:RA,defaultWidth:"full"}),time:td({formats:DA,defaultWidth:"full"}),dateTime:td({formats:qA,defaultWidth:"full"})},BA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},UA=(n,t,s,i)=>BA[n];function to(n){return(t,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const d=n.defaultFormattingWidth||n.defaultWidth,y=s!=null&&s.width?String(s.width):d;o=n.formattingValues[y]||n.formattingValues[d]}else{const d=n.defaultWidth,y=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[y]||n.values[d]}const c=n.argumentCallback?n.argumentCallback(t):t;return o[c]}}const PA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},zA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$A={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"]},IA={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"]},HA={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"}},FA={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"}},GA=(n,t)=>{const s=Number(n),i=s%100;if(i>20||i<10)switch(i%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},VA={ordinalNumber:GA,era:to({values:PA,defaultWidth:"wide"}),quarter:to({values:zA,defaultWidth:"wide",argumentCallback:n=>n-1}),month:to({values:$A,defaultWidth:"wide"}),day:to({values:IA,defaultWidth:"wide"}),dayPeriod:to({values:HA,defaultWidth:"wide",formattingValues:FA,defaultFormattingWidth:"wide"})};function no(n){return(t,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=t.match(o);if(!c)return null;const d=c[0],y=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(y)?KA(y,b=>b.test(d)):YA(y,b=>b.test(d));let u;u=n.valueCallback?n.valueCallback(g):g,u=s.valueCallback?s.valueCallback(u):u;const m=t.slice(d.length);return{value:u,rest:m}}}function YA(n,t){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&t(n[s]))return s}function KA(n,t){for(let s=0;s<n.length;s++)if(t(n[s]))return s}function JA(n){return(t,s={})=>{const i=t.match(n.matchPattern);if(!i)return null;const o=i[0],c=t.match(n.parsePattern);if(!c)return null;let d=n.valueCallback?n.valueCallback(c[0]):c[0];d=s.valueCallback?s.valueCallback(d):d;const y=t.slice(o.length);return{value:d,rest:y}}}const QA=/^(\d+)(th|st|nd|rd)?/i,XA=/\d+/i,WA={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},ZA={any:[/^b/i,/^(a|c)/i]},ej={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},tj={any:[/1/i,/2/i,/3/i,/4/i]},nj={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},rj={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]},sj={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},ij={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]},aj={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},oj={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}},lj={ordinalNumber:JA({matchPattern:QA,parsePattern:XA,valueCallback:n=>parseInt(n,10)}),era:no({matchPatterns:WA,defaultMatchWidth:"wide",parsePatterns:ZA,defaultParseWidth:"any"}),quarter:no({matchPatterns:ej,defaultMatchWidth:"wide",parsePatterns:tj,defaultParseWidth:"any",valueCallback:n=>n+1}),month:no({matchPatterns:nj,defaultMatchWidth:"wide",parsePatterns:rj,defaultParseWidth:"any"}),day:no({matchPatterns:sj,defaultMatchWidth:"wide",parsePatterns:ij,defaultParseWidth:"any"}),dayPeriod:no({matchPatterns:aj,defaultMatchWidth:"any",parsePatterns:oj,defaultParseWidth:"any"})},Fx={code:"en-US",formatDistance:MA,formatLong:LA,formatRelative:UA,localize:VA,match:lj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function cj(n,t){const s=Sn(n,t==null?void 0:t.in);return SA(s,TA(s))+1}function uj(n,t){const s=Sn(n,t==null?void 0:t.in),i=+du(s)-+EA(s);return Math.round(i/$x)+1}function Gx(n,t){var m,b,x,v;const s=Sn(n,t==null?void 0:t.in),i=s.getFullYear(),o=ko(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((v=(x=o.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,d=qr((t==null?void 0:t.in)||n,0);d.setFullYear(i+1,0,c),d.setHours(0,0,0,0);const y=wo(d,t),g=qr((t==null?void 0:t.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const u=wo(g,t);return+s>=+y?i+1:+s>=+u?i:i-1}function fj(n,t){var y,g,u,m;const s=ko(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(u=s.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??1,o=Gx(n,t),c=qr((t==null?void 0:t.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),wo(c,t)}function hj(n,t){const s=Sn(n,t==null?void 0:t.in),i=+wo(s,t)-+fj(s,t);return Math.round(i/$x)+1}function Qe(n,t){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return s+i}const ds={y(n,t){const s=n.getFullYear(),i=s>0?s:1-s;return Qe(t==="yy"?i%100:i,t.length)},M(n,t){const s=n.getMonth();return t==="M"?String(s+1):Qe(s+1,2)},d(n,t){return Qe(n.getDate(),t.length)},a(n,t){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(n,t){return Qe(n.getHours()%12||12,t.length)},H(n,t){return Qe(n.getHours(),t.length)},m(n,t){return Qe(n.getMinutes(),t.length)},s(n,t){return Qe(n.getSeconds(),t.length)},S(n,t){const s=t.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return Qe(o,t.length)}},Ui={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},u1={G:function(n,t,s){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(i,{width:"abbreviated"});case"GGGGG":return s.era(i,{width:"narrow"});case"GGGG":default:return s.era(i,{width:"wide"})}},y:function(n,t,s){if(t==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ds.y(n,t)},Y:function(n,t,s,i){const o=Gx(n,i),c=o>0?o:1-o;if(t==="YY"){const d=c%100;return Qe(d,2)}return t==="Yo"?s.ordinalNumber(c,{unit:"year"}):Qe(c,t.length)},R:function(n,t){const s=Ix(n);return Qe(s,t.length)},u:function(n,t){const s=n.getFullYear();return Qe(s,t.length)},Q:function(n,t,s){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return Qe(i,2);case"Qo":return s.ordinalNumber(i,{unit:"quarter"});case"QQQ":return s.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,s){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return Qe(i,2);case"qo":return s.ordinalNumber(i,{unit:"quarter"});case"qqq":return s.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,s){const i=n.getMonth();switch(t){case"M":case"MM":return ds.M(n,t);case"Mo":return s.ordinalNumber(i+1,{unit:"month"});case"MMM":return s.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,s){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return Qe(i+1,2);case"Lo":return s.ordinalNumber(i+1,{unit:"month"});case"LLL":return s.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,s,i){const o=hj(n,i);return t==="wo"?s.ordinalNumber(o,{unit:"week"}):Qe(o,t.length)},I:function(n,t,s){const i=uj(n);return t==="Io"?s.ordinalNumber(i,{unit:"week"}):Qe(i,t.length)},d:function(n,t,s){return t==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ds.d(n,t)},D:function(n,t,s){const i=cj(n);return t==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):Qe(i,t.length)},E:function(n,t,s){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(i,{width:"short",context:"formatting"});case"EEEE":default:return s.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return Qe(c,2);case"eo":return s.ordinalNumber(c,{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(n,t,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return Qe(c,t.length);case"co":return s.ordinalNumber(c,{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(n,t,s){const i=n.getDay(),o=i===0?7:i;switch(t){case"i":return String(o);case"ii":return Qe(o,t.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(i,{width:"short",context:"formatting"});case"iiii":default:return s.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,s){const o=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(n,t,s){const i=n.getHours();let o;switch(i===12?o=Ui.noon:i===0?o=Ui.midnight:o=i/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(n,t,s){const i=n.getHours();let o;switch(i>=17?o=Ui.evening:i>=12?o=Ui.afternoon:i>=4?o=Ui.morning:o=Ui.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(n,t,s){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ds.h(n,t)},H:function(n,t,s){return t==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ds.H(n,t)},K:function(n,t,s){const i=n.getHours()%12;return t==="Ko"?s.ordinalNumber(i,{unit:"hour"}):Qe(i,t.length)},k:function(n,t,s){let i=n.getHours();return i===0&&(i=24),t==="ko"?s.ordinalNumber(i,{unit:"hour"}):Qe(i,t.length)},m:function(n,t,s){return t==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ds.m(n,t)},s:function(n,t,s){return t==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ds.s(n,t)},S:function(n,t){return ds.S(n,t)},X:function(n,t,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return h1(i);case"XXXX":case"XX":return Vs(i);case"XXXXX":case"XXX":default:return Vs(i,":")}},x:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"x":return h1(i);case"xxxx":case"xx":return Vs(i);case"xxxxx":case"xxx":default:return Vs(i,":")}},O:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+f1(i,":");case"OOOO":default:return"GMT"+Vs(i,":")}},z:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+f1(i,":");case"zzzz":default:return"GMT"+Vs(i,":")}},t:function(n,t,s){const i=Math.trunc(+n/1e3);return Qe(i,t.length)},T:function(n,t,s){return Qe(+n,t.length)}};function f1(n,t=""){const s=n>0?"-":"+",i=Math.abs(n),o=Math.trunc(i/60),c=i%60;return c===0?s+String(o):s+String(o)+t+Qe(c,2)}function h1(n,t){return n%60===0?(n>0?"-":"+")+Qe(Math.abs(n)/60,2):Vs(n,t)}function Vs(n,t=""){const s=n>0?"-":"+",i=Math.abs(n),o=Qe(Math.trunc(i/60),2),c=Qe(i%60,2);return s+o+t+c}const d1=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Vx=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},dj=(n,t)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return d1(n,t);let c;switch(i){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",d1(i,t)).replace("{{time}}",Vx(o,t))},mj={p:Vx,P:dj},pj=/^D+$/,yj=/^Y+$/,gj=["D","DD","YY","YYYY"];function bj(n){return pj.test(n)}function xj(n){return yj.test(n)}function vj(n,t,s){const i=_j(n,t,s);if(console.warn(i),gj.includes(n))throw new RangeError(i)}function _j(n,t,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const wj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Sj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ej=/^'([^]*?)'?$/,Oj=/''/g,Aj=/[a-zA-Z]/;function vm(n,t,s){var m,b,x,v;const i=ko(),o=i.locale??Fx,c=i.firstWeekContainsDate??((b=(m=i.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??1,d=i.weekStartsOn??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,y=Sn(n,s==null?void 0:s.in);if(!kA(y))throw new RangeError("Invalid time value");let g=t.match(Sj).map(_=>{const S=_[0];if(S==="p"||S==="P"){const C=mj[S];return C(_,o.formatLong)}return _}).join("").match(wj).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const S=_[0];if(S==="'")return{isToken:!1,value:jj(_)};if(u1[S])return{isToken:!0,value:_};if(S.match(Aj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:_}});o.localize.preprocessor&&(g=o.localize.preprocessor(y,g));const u={firstWeekContainsDate:c,weekStartsOn:d,locale:o};return g.map(_=>{if(!_.isToken)return _.value;const S=_.value;(xj(S)||bj(S))&&vj(S,t,String(n));const C=u1[S[0]];return C(y,S,o.localize,u)}).join("")}function jj(n){const t=n.match(Ej);return t?t[1].replace(Oj,"'"):n}function kj(n,t,s){const i=ko(),o=(s==null?void 0:s.locale)??i.locale??Fx,c=OA(n,t);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[y,g]=Hx(s==null?void 0:s.in,...c>0?[t,n]:[n,t]),u=NA((s==null?void 0:s.roundingMethod)??"round"),m=g.getTime()-y.getTime(),b=m/s1,x=mu(g)-mu(y),v=(m-x)/s1,_=s==null?void 0:s.unit;let S;if(_?S=_:b<1?S="second":b<60?S="minute":b<o1?S="hour":v<a1?S="day":v<i1?S="month":S="year",S==="second"){const C=u(m/1e3);return o.formatDistance("xSeconds",C,d)}else if(S==="minute"){const C=u(b);return o.formatDistance("xMinutes",C,d)}else if(S==="hour"){const C=u(b/60);return o.formatDistance("xHours",C,d)}else if(S==="day"){const C=u(v/o1);return o.formatDistance("xDays",C,d)}else if(S==="month"){const C=u(v/a1);return C===12&&_!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",C,d)}else{const C=u(v/i1);return o.formatDistance("xYears",C,d)}}function Nj(n,t){return kj(n,AA(n),t)}function XC(n){return n.toLocaleString()}function WC(n){return n>=1e9?`${(n/1e9).toFixed(1).replace(/\.0$/,"")}B`:n>=1e6?`${(n/1e6).toFixed(1).replace(/\.0$/,"")}M`:n>=1e4?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}K`:n.toLocaleString()}function Tj(n){const t=new Date(n);return t.getTime()>Date.now()?"just now":Nj(t,{addSuffix:!0})}function ZC(n){const t=Date.now()-new Date(n).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const o=Math.floor(i/60);if(o<24)return`${o}h`;const c=Math.floor(o/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function e5(n){return n<=0?"Expired":_m(n)}function Cj(n){return n==null?"--":_m(n)}function t5(n){return n?vm(new Date(n),"MMM d, yyyy h:mm a"):"--"}function _m(n){if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4){const d=n/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const t=Math.floor(n/1e3),s=Math.floor(t/86400),i=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),c=t%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?o>0?`${i}h ${o}m`:`${i}h`:c>0?`${o}m ${c}s`:`${o}m`}function n5(n,t){const s=new Date(n).getTime(),i=t?new Date(t).getTime():Date.now();return _m(i-s)}function Yx({options:n,children:t,className:s=""}){const[i,o]=O.useState(!1),[c,d]=O.useState(null),[y,g]=O.useState(null),u=O.useRef(null),m=O.useRef(void 0),b=O.useRef(void 0),x=220,v=O.useCallback(()=>{if(!u.current)return;const L=u.current.getBoundingClientRect(),U=window.innerWidth-x-8,re=Math.max(8,Math.min(L.left,U));g({top:L.bottom+4,left:re})},[]),_=O.useCallback(async(L,U)=>{try{await navigator.clipboard.writeText(L),d(U),clearTimeout(m.current),m.current=setTimeout(()=>d(null),1200)}catch{}},[]),S=O.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=O.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return O.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:u,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[t,i&&y&&Hd.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:y.top,left:y.left},onMouseEnter:S,onMouseLeave:C,children:n.map(L=>h.jsxs("button",{onClick:U=>{U.stopPropagation(),_(L.value,L.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-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:L.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===L.label?"✓":L.value})]},L.label))}),document.body)]})}function Mj(n,t){const s=new Date(n);switch(t){case"relative":return Tj(n);case"datetime":return vm(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function Rj(n){const t=new Date(n);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:vm(t,"MMM d, yyyy h:mm:ss a")}]}function Kx({date:n,format:t="relative",className:s=""}){const[,i]=O.useState(0);O.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>i(d=>d+1),3e4);return()=>clearInterval(c)},[t]);const o=O.useMemo(()=>Rj(n),[n]);return h.jsx(Yx,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:Mj(n,t)})})}function Dj({values:n,options:t,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const d=t.filter(y=>!n.includes(y));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(y=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==y)),className:"inline-flex items-center gap-1 text-2xs font-mono text-text-primary border border-surface-border px-1.5 py-0.5 hover:text-status-error hover:border-status-error/50 transition-colors",title:`Remove ${y}`,children:[y,h.jsx(Qt,{className:"w-3 h-3",strokeWidth:1.5})]},y)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),d.length>0&&h.jsxs("select",{value:"",onChange:y=>y.target.value&&s([...n,y.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),d.map(y=>h.jsx("option",{value:y,children:y},y))]})]})}const qj=[{minutes:1,label:"1 minute"},{minutes:15,label:"15 minutes"},{minutes:30,label:"30 minutes"},{minutes:60,label:"1 hour"},{minutes:240,label:"4 hours"},{minutes:1440,label:"24 hours"},{minutes:4320,label:"3 days"},{minutes:10080,label:"7 days"}];function Lj(){const{data:n}=zx(),{data:t}=ZO(),s=xA(),i=vA(),[o,c]=O.useState(""),[d,y]=O.useState(""),[g,u]=O.useState(1440),[m,b]=O.useState([]),x=(n==null?void 0:n.announcements)??[],v=()=>{d.trim()&&s.mutate({body:d.trim(),...o.trim()?{title:o.trim()}:{},...m.length?{roles:m}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),y(""),b([])}})};return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),h.jsx("input",{type:"text",value:o,onChange:_=>c(_.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),h.jsx("textarea",{value:d,onChange:_=>y(_.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),h.jsx("select",{value:g,onChange:_=>u(Number(_.target.value)),className:"select text-xs w-full",children:qj.map(_=>h.jsx("option",{value:_.minutes,children:_.label},_.minutes))})]}),h.jsxs("div",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),h.jsx(Dj,{values:m,options:(t==null?void 0:t.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&h.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),h.jsx("button",{onClick:v,disabled:!d.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),x.length>0&&h.jsxs("div",{className:"mt-6",children:[h.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),h.jsx("div",{className:"space-y-1",children:x.map(_=>h.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs text-text-primary truncate",children:_.title??_.body.split(`
54
+ `)[0]}),h.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",h.jsx(Kx,{date:_.expires_at,format:"relative"})]})]}),h.jsx("button",{onClick:()=>i.mutate(_.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${_.title??"announcement"}`,children:h.jsx(Qt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},_.id))})]})]})}const Bj=[{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"}],Uj=["operator","engineer","admin","superadmin"];function m1(n){return Uj.indexOf(n)}function Pj(n,t){return m1(n)>=m1(t)}function zj({onClose:n}){var je,Te,nt,Nt,Dt,ut,ft;const{isSuperAdmin:t,hasRoleType:s,hasRole:i}=Rt(),{data:o}=Xn(),c=um(),d=!!((je=o==null?void 0:o.ai)!=null&&je.enabled),y=jx(),g=y!==null?y:d,[u,m]=O.useState(g),b=(Te=o==null?void 0:o.features)==null?void 0:Te.graphWorkflows,x=b==null,[v,_]=O.useState(b===!0||x&&kx()),S=t||i("engineer"),[C,L]=O.useState(Nx()),U=!!((nt=o==null?void 0:o.features)!=null&&nt.scanCodes),re=Tx(),[le,D]=O.useState(re!==null?re:U),z=t?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ae=((Nt=o==null?void 0:o.branding)==null?void 0:Nt.appName)??"LongTail",K=(Dt=o==null?void 0:o.environment)==null?void 0:Dt.longTailVersion,M=(ut=o==null?void 0:o.environment)==null?void 0:ut.hotmeshVersion,$=(ft=o==null?void 0:o.environment)==null?void 0:ft.nodeEnv;O.useEffect(()=>{const fe=pe=>{pe.key==="Escape"&&n()};return document.addEventListener("keydown",fe),()=>document.removeEventListener("keydown",fe)},[n]);const W=Bj.filter(fe=>Pj(z,fe.minTier)),Q=W.length>1,oe=z!=="operator",ve=[...Q?[{id:"viewas",label:"View As",icon:Kw}]:[],{id:"features",label:"Features",icon:Jw},...oe?[{id:"alerts",label:"Alerts",icon:Qw}]:[]],[ke,Y]=O.useState(ve[0].id),Z=fe=>{fe===null?Md():$O(fe)},ce=()=>{const fe=!u;m(fe),fe===d?zO():PO(fe),window.location.reload()},_e=()=>{const fe=!v;_(fe),IO(fe),window.location.reload()},we=()=>{const fe=!C;L(fe),HO(fe),window.location.reload()},Ne=()=>{const fe=!le;D(fe),fe===U?GO():FO(fe),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:n,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:fe=>fe.stopPropagation(),children:[h.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Qt,{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(${Pt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),K&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",K,M&&h.jsxs(h.Fragment,{children:[" · HotMesh v",M]}),$&&$!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:$})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),ve.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:ve.map(fe=>{const pe=ke===fe.id;return h.jsxs("button",{role:"tab","aria-selected":pe,onClick:()=>Y(fe.id),title:fe.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${pe?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(fe.icon,{className:"w-5 h-5",strokeWidth:1.5,...pe?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:fe.label})]},fe.id)})}),ke==="viewas"&&Q&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),W.map(fe=>{const pe=c===fe.id,ht=fe.id===null?`Your view · ${z}`:fe.label;return h.jsxs("button",{onClick:()=>Z(fe.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 ${pe?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:pe&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${pe?"text-accent":"text-text-primary group-hover:text-accent"}`,children:ht}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:fe.description})]})]},String(fe.id))})]}),ke==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:u?"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 ${u?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${u?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:_e,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:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:v?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${v?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${v?"translate-x-4":"translate-x-0"}`})})]}),S&&h.jsxs("button",{onClick:we,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group","data-testid":"feature-infrastructure",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Infrastructure"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:C?"Visible — Routers, Messages, and DB Maintenance in the sidebar":"Hidden — routers, message streams, and database maintenance"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${C?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]}),h.jsxs("button",{onClick:Ne,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:"Scan input"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:le?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${le?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${le?"translate-x-4":"translate-x-0"}`})})]})]}),ke==="alerts"&&oe&&h.jsx(Lj,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const Jx=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],p1="blue",Qx="lt.theme";let Xx=[];function $j(n){const t=new Set(Jx.map(i=>i.id)),s=new Set;Xx=n.filter(i=>!(i!=null&&i.id)||t.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function Ij(){return[...Jx,...Xx]}function Wx(){try{return localStorage.getItem(Qx)||p1}catch{return p1}}function Zx(n){document.documentElement.dataset.theme=n}function Hj(n){try{localStorage.setItem(Qx,n)}catch{}Zx(n)}const ev=O.createContext(null);function Fj(){const n=O.useContext(ev);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function Gj({children:n}){const[t,s]=O.useState(null),i=O.useRef(t);i.current=t,O.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const g=new Date(t.expiresAt).getTime()-Date.now();if(g<=0){s(null);return}const u=setTimeout(()=>s(null),g);return()=>clearTimeout(u)},[t]);const o=O.useCallback(g=>{var m;if(!g.actingToken||!g.actor)return null;const u=((m=i.current)==null?void 0:m.actingToken)??null;return s({actingToken:g.actingToken,actorId:g.actor.id,displayName:g.actor.displayName,expiresAt:g.expiresAt??null}),u},[]),c=O.useCallback(()=>s(null),[]);O.useEffect(()=>(wg(()=>{var g;return((g=i.current)==null?void 0:g.actingToken)??null}),Sg(c),()=>{wg(null),Sg(null)}),[c]);const d=O.useCallback(()=>{var u;const g=(u=i.current)==null?void 0:u.expiresAt;return g?Math.max(0,Math.floor((new Date(g).getTime()-Date.now())/1e3)):0},[]),y=O.useMemo(()=>({identity:t,prime:o,clear:c,remainingSeconds:d}),[t,o,c,d]);return h.jsx(ev.Provider,{value:y,children:n})}const su={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},tv="lt_scan_wedge_config";function nv(){try{const n=localStorage.getItem(tv);return n?{...su,...JSON.parse(n)}:su}catch{return su}}function Vj(n){const t={...nv(),...n};return localStorage.setItem(tv,JSON.stringify(t)),t}const Yj=[/[1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+$/,/[1-9][0-9]{7,}$/];function y1(n){let t=null;for(const s of Yj){const i=n.match(s);i&&(!t||i[0].length>t.length)&&(t=i[0])}return t}const Kj=new Set(["Shift","CapsLock"]),oc={suppress:!1,emit:null};function Jj(n=su){let t={buffer:"",times:[],lastKeyMs:0};function s(){t={buffer:"",times:[],lastKeyMs:0}}function i(d){const{key:y,timeMs:g,hasModifier:u,isRepeat:m}=d;if(Kj.has(y))return oc;if(n.terminators.includes(y)){const S=y1(t.buffer);return s(),S&&S.length>=n.minLength?{suppress:!0,emit:S,consumedLength:S.length}:oc}if(u||m||y.length!==1)return s(),oc;const b=g-t.lastKeyMs,x=t.lastKeyMs>0&&b<=n.maxKeyGapMs,v=(x?t.buffer+y:y).slice(-128),_=(x?[...t.times,g]:[g]).slice(-128);return t={buffer:v,times:_,lastKeyMs:g},oc}function o(){return{buffer:t.buffer}}function c(){const d=y1(t.buffer);if(!d||d.length<n.minLength)return null;const y=t.times.slice(-d.length);return y.length<2||(y[y.length-1]-y[0])/(y.length-1)>n.autoFireMaxAvgKeyMs?null:{code:d,consumedLength:d.length}}return{step:i,reset:s,snapshot:o,pendingAutoFire:c}}function Qj(){const n=document.activeElement;return n instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(n.type)?n:null:n instanceof HTMLTextAreaElement?n:null}function Xj(n,t,s){var c;const i=n instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,o=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;o?o.call(n,t):n.value=t;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function g1(n){if(n<=0)return;const t=Qj();if(!t)return;const s=t.selectionStart??t.value.length,i=Math.max(0,s-n);Xj(t,t.value.slice(0,i)+t.value.slice(s),i)}function Wj({active:n,wedgeConfig:t,diagnosticsOn:s,onScan:i,onDiag:o}){const c=O.useRef({diagnosticsOn:s,onScan:i,onDiag:o});c.current={diagnosticsOn:s,onScan:i,onDiag:o};const d=O.useRef(0),y=O.useRef(0);O.useEffect(()=>{if(!n)return;const g=Jj(t);let u=null;const m=()=>{u&&(clearTimeout(u),u=null)},b=(_,S,C)=>{S&&g1(S),c.current.diagnosticsOn&&(console.debug("[scan]",C),c.current.onDiag({seq:++d.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:C})),c.current.onScan(_)},x=()=>{m(),g.pendingAutoFire()&&(u=setTimeout(()=>{u=null;const _=g.pendingAutoFire();_&&(g.reset(),b(_.code,_.consumedLength,`capture → ${_.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},v=_=>{const S=g.snapshot().buffer,{suppress:C,emit:L,consumedLength:U}=g.step({key:_.key,timeMs:_.timeStamp,hasModifier:_.ctrlKey||_.metaKey||_.altKey,isRepeat:_.repeat});if(C&&(_.preventDefault(),_.stopPropagation()),c.current.diagnosticsOn){const re=g.snapshot().buffer,le=t.terminators.includes(_.key),D=L?`capture → ${L}`:le?`terminator — no code tail in "${S.slice(-24)}"`:re===S?S?"neutral (chord key)":"ignored":re===""?"reset (edit/chord/non-printable)":re.length<=1&&S.length>1?"gap — new episode":"accumulate",z=y.current?Math.round(_.timeStamp-y.current):0,ae={seq:++d.current,key:_.key,code:_.code!==_.key?_.code:"",deltaMs:z,buffer:re.slice(-24),note:D};console.debug("[scan]",ae.key,ae.code,`${ae.deltaMs}ms`,ae.note),c.current.onDiag(ae)}y.current=_.timeStamp,L?(m(),U&&g1(U),c.current.onScan(L)):x()};return window.addEventListener("keydown",v,{capture:!0}),()=>{m(),window.removeEventListener("keydown",v,{capture:!0})}},[n,t])}const $e={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices"},lc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",PRESENT:"present"},Zj={ACTION:"action",IDENTITY:"identity"};function ek(n,t){return he("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{}})})}function r5(n){return he("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function tk(n){return ze({queryKey:["scan-schemes"],queryFn:()=>he("/scan-codes/schemes"),...n})}function s5(n){return ze({queryKey:["scan-schemes",n],queryFn:()=>he(`/scan-codes/schemes/${n}`),enabled:n!=null})}function i5(){const n=Ie();return Ve({mutationFn:t=>he(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function a5(){const n=Ie();return Ve({mutationFn:t=>he(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function o5(){const n=Ie();return Ve({mutationFn:t=>he(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function l5(){const n=Ie();return Ve({mutationFn:t=>he(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const So={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar"},Pi=n=>{if(n)try{return JSON.parse(n)}catch{return}},Ys=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function nk(n){const t={},s=Pi(n.get("facets"));Ys(s)||(t.facets=s);const i=Pi(n.get("block"));Ys(i)||(t.block=i);const o=Pi(n.get("range"));Ys(o)||(t.range=o);const c=Pi(n.get("exists"));Ys(c)||(t.exists=c);const d=Pi(n.get("roles"));Ys(d)||(t.roles=d);const y=Pi(n.get("orderBy"));Ys(y)||(t.orderBy=y),n.get("available")!=null&&(t.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function c5(n,t){const s=(i,o)=>Ys(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?n.delete("available"):n.set("available",String(t.available)),t.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const b1=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function rv(n,t){const s={};for(const[o,c]of Object.entries(n))s[o]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${i}${b1}`:`/escalations/available?facets=${i}${b1}`}function rk(n,t,s){return rv({[n]:t},s)}function u5(n){var t,s,i;return Object.keys(n.facets??{}).length+(((t=n.block)==null?void 0:t.length)??0)+(((s=n.range)==null?void 0:s.length)??0)+(((i=n.exists)==null?void 0:i.length)??0)+(n.available!=null?1:0)+(n.jeopardy===!0?1:0)}function wm(){var s;const{data:n}=Xn(),t=Tx();return t!==null?t:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const sv=O.createContext(null);function Sm(){const n=O.useContext(sv);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}const sk="scanPendingAction",ik="scanChoices",ak="/scan/station";function ok({children:n}){const{user:t}=Rt(),s=wm(),i=Zi(),{identity:o,prime:c}=Fj(),[d,y]=O.useState(null),[g,u]=O.useState(!1),[m,b]=O.useState(()=>nv()),[x,v]=O.useState([]),[_,S]=O.useState(!1),C=O.useCallback(M=>{var W;const{outcome:$}=M;if($===$e.CONFIRM_REQUIRED&&M.pendingAction)return i(`/escalations/detail/${M.pendingAction.escalationId}`,{state:{[sk]:M.pendingAction}}),!0;if($===$e.EXECUTED&&M.escalation){const Q=[lc.SHOW_DETAIL,lc.CLAIM_SHOW_DETAIL,lc.CLAIM,lc.ESCALATE];return M.verb&&Q.includes(M.verb)?(i(`/escalations/detail/${M.escalation.id}`),!0):!1}if($===$e.MATCHED_LIST&&M.listQuery){const{targetFacet:Q,target:oe,roles:ve}=M.listQuery;return i(rv({[Q]:oe},(ve==null?void 0:ve[0])??null)),!0}return $===$e.CHOICES&&M.choices?(i(ak,{state:{[ik]:M}}),!0):$===$e.NO_MATCH_FALLBACK&&((W=M.fallback)!=null&&W.route)?(i(M.fallback.route),!0):!1},[i]),L=O.useRef(null);L.current=(o==null?void 0:o.actingToken)??null;const U=O.useRef(null),re=O.useRef(null),le=O.useCallback(M=>{re.current=M},[]),D=O.useCallback(async(M,$=So.MANUAL)=>{var Q;if((Q=re.current)!=null&&Q.call(re,M))return;u(!0);const W=Date.now();try{const oe=await ek(M,{actingToken:L.current??void 0,previousActingToken:U.current??void 0});oe.outcome===$e.IDENTITY_PRIMED&&(U.current=c(oe));const ve=C(oe);y({code:M,source:$,at:W,response:oe,error:null,navigated:ve})}catch(oe){y({code:M,source:$,at:W,response:null,error:oe.message,navigated:!1})}finally{u(!1)}},[C,c]),z=O.useRef(D);z.current=D,Wj({active:!!t&&s,wedgeConfig:m,diagnosticsOn:_,onScan:M=>void z.current(M,So.KEYBOARD_WEDGE),onDiag:M=>v($=>[...$.slice(-29),M])});const ae=O.useCallback(M=>{b(Vj(M))},[]),K=O.useMemo(()=>({submitCode:D,setCodeInterceptor:le,lastResult:d,busy:g,wedgeConfig:m,updateWedgeConfig:ae,diagnostics:x,diagnosticsOn:_,setDiagnosticsOn:S}),[D,le,d,g,m,ae,x,_]);return h.jsx(sv.Provider,{value:K,children:n})}var cc={},ro={},uc={},x1;function On(){if(x1)return uc;x1=1,Object.defineProperty(uc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var t=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return uc.default=t,uc}var v1;function lk(){if(v1)return ro;v1=1,Object.defineProperty(ro,"__esModule",{value:!0}),ro.CODE39=void 0;var n=(function(){function S(C,L){for(var U=0;U<L.length;U++){var re=L[U];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(C,re.key,re)}}return function(C,L,U){return L&&S(C.prototype,L),U&&S(C,U),C}})(),t=On(),s=i(t);function i(S){return S&&S.__esModule?S:{default:S}}function o(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")}function c(S,C){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:S}function d(S,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);S.prototype=Object.create(C&&C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(S,C):S.__proto__=C)}var y=(function(S){d(C,S);function C(L,U){return o(this,C),L=L.toUpperCase(),U.mod43&&(L+=x(_(L))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,L,U))}return n(C,[{key:"encode",value:function(){for(var U=m("*"),re=0;re<this.data.length;re++)U+=m(this.data[re])+"0";return U+=m("*"),{data:U,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),C})(s.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],u=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function m(S){return b(v(S))}function b(S){return u[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function _(S){for(var C=0,L=0;L<S.length;L++)C+=v(S[L]);return C=C%43,C}return ro.CODE39=y,ro}var Vn={},fc={},hc={},yt={},_1;function No(){if(_1)return yt;_1=1,Object.defineProperty(yt,"__esModule",{value:!0});var n;function t(g,u,m){return u in g?Object.defineProperty(g,u,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[u]=m,g}var s=yt.SET_A=0,i=yt.SET_B=1,o=yt.SET_C=2;yt.SHIFT=98;var c=yt.START_A=103,d=yt.START_B=104,y=yt.START_C=105;return yt.MODULO=103,yt.STOP=106,yt.FNC1=207,yt.SET_BY_CODE=(n={},t(n,c,s),t(n,d,i),t(n,y,o),n),yt.SWAP={101:s,100:i,99:o},yt.A_START_CHAR="Ð",yt.B_START_CHAR="Ñ",yt.C_START_CHAR="Ò",yt.A_CHARS="[\0-_È-Ï]",yt.B_CHARS="[ -È-Ï]",yt.C_CHARS="(Ï*[0-9]{2}Ï*)",yt.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],yt}var w1;function Ou(){if(w1)return hc;w1=1,Object.defineProperty(hc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),t=On(),s=o(t),i=No();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function y(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){y(m,u);function m(b,x){c(this,m);var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b.substring(1),x));return v.bytes=b.split("").map(function(_){return _.charCodeAt(0)}),v}return n(m,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.bytes,v=x.shift()-105,_=i.SET_BY_CODE[v];if(_===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&x.unshift(i.FNC1);var S=m.next(x,1,_);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:m.getBar(v)+S.result+m.getBar((S.checksum+v)%i.MODULO)+m.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var x=this.options.ean128||!1;return typeof x=="string"&&(x=x.toLowerCase()==="true"),x}}],[{key:"getBar",value:function(x){return i.BARS[x]?i.BARS[x].toString():""}},{key:"correctIndex",value:function(x,v){if(v===i.SET_A){var _=x.shift();return _<32?_+64:_-32}else return v===i.SET_B?x.shift()-32:(x.shift()-48)*10+x.shift()-48}},{key:"next",value:function(x,v,_){if(!x.length)return{result:"",checksum:0};var S=void 0,C=void 0;if(x[0]>=200){C=x.shift()-105;var L=i.SWAP[C];L!==void 0?S=m.next(x,v+1,L):((_===i.SET_A||_===i.SET_B)&&C===i.SHIFT&&(x[0]=_===i.SET_A?x[0]>95?x[0]-96:x[0]:x[0]<32?x[0]+96:x[0]),S=m.next(x,v+1,_))}else C=m.correctIndex(x,_),S=m.next(x,v+1,_);var U=m.getBar(C),re=C*v;return{result:U+S.result,checksum:re+S.checksum}}}]),m})(s.default);return hc.default=g,hc}var dc={},S1;function ck(){if(S1)return dc;S1=1,Object.defineProperty(dc,"__esModule",{value:!0});var n=No(),t=function(y){return y.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(y){return y.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(y){return y.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(d,y){var g=y?n.A_CHARS:n.B_CHARS,u=d.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(u)return u[1]+"Ì"+c(d.substring(u[1].length));var m=d.match(new RegExp("^"+g+"+"))[0];return m.length===d.length?d:m+String.fromCharCode(y?205:206)+o(d.substring(m.length),!y)}function c(d){var y=i(d),g=y.length;if(g===d.length)return d;d=d.substring(g);var u=t(d)>=s(d);return y+String.fromCharCode(u?206:205)+o(d,u)}return dc.default=function(d){var y=void 0,g=i(d).length;if(g>=2)y=n.C_START_CHAR+c(d);else{var u=t(d)>s(d);y=(u?n.A_START_CHAR:n.B_START_CHAR)+o(d,u)}return y.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(m,b){return"Ë"+b})},dc}var E1;function uk(){if(E1)return fc;E1=1,Object.defineProperty(fc,"__esModule",{value:!0});var n=Ou(),t=o(n),s=ck(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function y(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){y(m,u);function m(b,x){if(c(this,m),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,(0,i.default)(b),x));else var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x));return d(v)}return m})(t.default);return fc.default=g,fc}var mc={},O1;function fk(){if(O1)return mc;O1=1,Object.defineProperty(mc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),t=Ou(),s=o(t),i=No();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function y(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){y(m,u);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.A_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),m})(s.default);return mc.default=g,mc}var pc={},A1;function hk(){if(A1)return pc;A1=1,Object.defineProperty(pc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),t=Ou(),s=o(t),i=No();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function y(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){y(m,u);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.B_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),m})(s.default);return pc.default=g,pc}var yc={},j1;function dk(){if(j1)return yc;j1=1,Object.defineProperty(yc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),t=Ou(),s=o(t),i=No();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function y(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){y(m,u);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.C_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),m})(s.default);return yc.default=g,yc}var k1;function mk(){if(k1)return Vn;k1=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.CODE128C=Vn.CODE128B=Vn.CODE128A=Vn.CODE128=void 0;var n=uk(),t=g(n),s=fk(),i=g(s),o=hk(),c=g(o),d=dk(),y=g(d);function g(u){return u&&u.__esModule?u:{default:u}}return Vn.CODE128=t.default,Vn.CODE128A=i.default,Vn.CODE128B=c.default,Vn.CODE128C=y.default,Vn}var Gt={},gc={},kr={},N1;function To(){return N1||(N1=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.SIDE_BIN="101",kr.MIDDLE_BIN="01010",kr.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},kr.EAN2_STRUCTURE=["LL","LG","GL","GG"],kr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],kr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),kr}var bc={},xc={},T1;function Co(){if(T1)return xc;T1=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=To(),t=function(i,o,c){var d=i.split("").map(function(g,u){return n.BINARIES[o[u]]}).map(function(g,u){return g?g[i[u]]:""});if(c){var y=i.length-1;d=d.map(function(g,u){return u<y?g+c:g})}return d.join("")};return xc.default=t,xc}var C1;function iv(){if(C1)return bc;C1=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),t=To(),s=Co(),i=d(s),o=On(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function y(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){u(x,b);function x(v,_){y(this,x);var S=g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.fontSize=!_.flat&&_.fontSize>_.width*10?_.width*10:_.fontSize,S.guardHeight=_.height+S.fontSize/2+_.textMargin,S}return n(x,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(_,S){return this.text.substr(_,S)}},{key:"leftEncode",value:function(_,S){return(0,i.default)(_,S)}},{key:"rightText",value:function(_,S){return this.text.substr(_,S)}},{key:"rightEncode",value:function(_,S){return(0,i.default)(_,S)}},{key:"encodeGuarded",value:function(){var _={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:_},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:_},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var _=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:_.join(""),text:this.text}}}]),x})(c.default);return bc.default=m,bc}var M1;function pk(){if(M1)return gc;M1=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),t=function b(x,v,_){x===null&&(x=Function.prototype);var S=Object.getOwnPropertyDescriptor(x,v);if(S===void 0){var C=Object.getPrototypeOf(x);return C===null?void 0:b(C,v,_)}else{if("value"in S)return S.value;var L=S.get;return L===void 0?void 0:L.call(_)}},s=To(),i=iv(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function y(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=function(x){var v=x.substr(0,12).split("").map(function(_){return+_}).reduce(function(_,S,C){return C%2?_+S*3:_+S},0);return(10-v%10)%10},m=(function(b){g(x,b);function x(v,_){d(this,x),v.search(/^[0-9]{12}$/)!==-1&&(v+=u(v));var S=y(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.lastChar=_.lastChar,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===u(this.data)}},{key:"leftText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var _=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,_,S)}},{key:"rightText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var _=this.data.substr(7,6);return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,_,"RRRRRR")}},{key:"encodeGuarded",value:function(){var _=t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(_.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(_.push({data:"00"}),_.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),_}}]),x})(o.default);return gc.default=m,gc}var vc={},R1;function yk(){if(R1)return vc;R1=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function m(b,x){for(var v=0;v<x.length;v++){var _=x[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(b,_.key,_)}}return function(b,x,v){return x&&m(b.prototype,x),v&&m(b,v),b}})(),t=function m(b,x,v){b===null&&(b=Function.prototype);var _=Object.getOwnPropertyDescriptor(b,x);if(_===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:m(S,x,v)}else{if("value"in _)return _.value;var C=_.get;return C===void 0?void 0:C.call(v)}},s=iv(),i=o(s);function o(m){return m&&m.__esModule?m:{default:m}}function c(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function d(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function y(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var g=function(b){var x=b.substr(0,7).split("").map(function(v){return+v}).reduce(function(v,_,S){return S%2?v+_:v+_*3},0);return(10-x%10)%10},u=(function(m){y(b,m);function b(x,v){return c(this,b),x.search(/^[0-9]{7}$/)!==-1&&(x+=g(x)),d(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x,v))}return n(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var v=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var v=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return vc.default=u,vc}var _c={},D1;function gk(){if(D1)return _c;D1=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function x(v,_){for(var S=0;S<_.length;S++){var C=_[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}return function(v,_,S){return _&&x(v.prototype,_),S&&x(v,S),v}})(),t=To(),s=Co(),i=d(s),o=On(),c=d(o);function d(x){return x&&x.__esModule?x:{default:x}}function y(x,v){if(!(x instanceof v))throw new TypeError("Cannot call a class as a function")}function g(x,v){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:x}function u(x,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);x.prototype=Object.create(v&&v.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(x,v):x.__proto__=v)}var m=function(v){var _=v.split("").map(function(S){return+S}).reduce(function(S,C,L){return L%2?S+C*9:S+C*3},0);return _%10},b=(function(x){u(v,x);function v(_,S){return y(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,S))}return n(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[m(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return _c.default=b,_c}var wc={},q1;function bk(){if(q1)return wc;q1=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),t=To(),s=Co(),i=d(s),o=On(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function y(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){u(x,b);function x(v,_){return y(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_))}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var _=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,_,"01"),text:this.text}}}]),x})(c.default);return wc.default=m,wc}var so={},L1;function av(){if(L1)return so;L1=1,Object.defineProperty(so,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})();so.checksum=m;var t=Co(),s=c(t),i=On(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function y(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=(function(b){g(x,b);function x(v,_){d(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=m(v));var S=y(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.displayValue=_.displayValue,_.fontSize>_.width*10?S.fontSize=_.width*10:S.fontSize=_.fontSize,S.guardHeight=_.height+S.fontSize/2+_.textMargin,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==m(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var _="";return _+="101",_+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),_+="01010",_+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),_+="101",{data:_,text:this.text}}},{key:"guardedEncoding",value:function(){var _=[];return this.displayValue&&_.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),_.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),_.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),_.push({data:"01010",options:{height:this.guardHeight}}),_.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),_.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&_.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),_}}]),x})(o.default);function m(b){var x=0,v;for(v=1;v<11;v+=2)x+=parseInt(b[v]);for(v=0;v<11;v+=2)x+=parseInt(b[v])*3;return(10-x%10)%10}return so.default=u,so}var Sc={},B1;function xk(){if(B1)return Sc;B1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var n=(function(){function _(S,C){for(var L=0;L<C.length;L++){var U=C[L];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(S,U.key,U)}}return function(S,C,L){return C&&_(S.prototype,C),L&&_(S,L),S}})(),t=Co(),s=d(t),i=On(),o=d(i),c=av();function d(_){return _&&_.__esModule?_:{default:_}}function y(_,S){if(!(_ instanceof S))throw new TypeError("Cannot call a class as a function")}function g(_,S){if(!_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:_}function u(_,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);_.prototype=Object.create(S&&S.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(_,S):_.__proto__=S)}var m=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],x=(function(_){u(S,_);function S(C,L){y(this,S);var U=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,L));if(U.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)U.middleDigits=C,U.upcA=v(C,"0"),U.text=L.text||""+U.upcA[0]+C+U.upcA[U.upcA.length-1],U.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(U.middleDigits=C.substring(1,C.length-1),U.upcA=v(U.middleDigits,C[0]),U.upcA[U.upcA.length-1]===C[C.length-1])U.isValid=!0;else return g(U);else return g(U);return U.displayValue=L.displayValue,L.fontSize>L.width*10?U.fontSize=L.width*10:U.fontSize=L.fontSize,U.guardHeight=L.height+U.fontSize/2+L.textMargin,U}return n(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var L="";return L+="101",L+=this.encodeMiddleDigits(),L+="010101",{data:L,text:this.text}}},{key:"guardedEncoding",value:function(){var L=[];return this.displayValue&&L.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),L.push({data:"101",options:{height:this.guardHeight}}),L.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),L.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&L.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),L}},{key:"encodeMiddleDigits",value:function(){var L=this.upcA[0],U=this.upcA[this.upcA.length-1],re=b[parseInt(U)][parseInt(L)];return(0,s.default)(this.middleDigits,re)}}]),S})(o.default);function v(_,S){for(var C=parseInt(_[_.length-1]),L=m[C],U="",re=0,le=0;le<L.length;le++){var D=L[le];D==="X"?U+=_[re++]:U+=D}return U=""+S+U,""+U+(0,c.checksum)(U)}return Sc.default=x,Sc}var U1;function vk(){if(U1)return Gt;U1=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.UPCE=Gt.UPC=Gt.EAN2=Gt.EAN5=Gt.EAN8=Gt.EAN13=void 0;var n=pk(),t=x(n),s=yk(),i=x(s),o=gk(),c=x(o),d=bk(),y=x(d),g=av(),u=x(g),m=xk(),b=x(m);function x(v){return v&&v.__esModule?v:{default:v}}return Gt.EAN13=t.default,Gt.EAN8=i.default,Gt.EAN5=c.default,Gt.EAN2=y.default,Gt.UPC=u.default,Gt.UPCE=b.default,Gt}var Fs={},Ec={},zi={},P1;function _k(){return P1||(P1=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.START_BIN="1010",zi.END_BIN="11101",zi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),zi}var z1;function ov(){if(z1)return Ec;z1=1,Object.defineProperty(Ec,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),t=_k(),s=On(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function y(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){y(m,u);function m(){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return n(m,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var x=this,v=this.data.match(/.{2}/g).map(function(_){return x.encodePair(_)}).join("");return{data:t.START_BIN+v+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=t.BINARIES[x[1]];return t.BINARIES[x[0]].split("").map(function(_,S){return(_==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),m})(i.default);return Ec.default=g,Ec}var Oc={},$1;function wk(){if($1)return Oc;$1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),t=ov(),s=i(t);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function c(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function d(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var y=function(m){var b=m.substr(0,13).split("").map(function(x){return parseInt(x,10)}).reduce(function(x,v,_){return x+v*(3-_%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(u){d(m,u);function m(b,x){return o(this,m),b.search(/^[0-9]{13}$/)!==-1&&(b+=y(b)),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===y(this.data)}}]),m})(s.default);return Oc.default=g,Oc}var I1;function Sk(){if(I1)return Fs;I1=1,Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.ITF14=Fs.ITF=void 0;var n=ov(),t=o(n),s=wk(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Fs.ITF=t.default,Fs.ITF14=i.default,Fs}var mn={},Ac={},H1;function Mo(){if(H1)return Ac;H1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),t=On(),s=i(t);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function c(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function d(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var y=(function(u){d(m,u);function m(b,x){return o(this,m),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"encode",value:function(){for(var x="110",v=0;v<this.data.length;v++){var _=parseInt(this.data[v]),S=_.toString(2);S=g(S,4-S.length);for(var C=0;C<S.length;C++)x+=S[C]=="0"?"100":"110"}return x+="1001",{data:x,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),m})(s.default);function g(u,m){for(var b=0;b<m;b++)u="0"+u;return u}return Ac.default=y,Ac}var jc={},io={},F1;function Au(){if(F1)return io;F1=1,Object.defineProperty(io,"__esModule",{value:!0}),io.mod10=n,io.mod11=t;function n(s){for(var i=0,o=0;o<s.length;o++){var c=parseInt(s[o]);(o+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function t(s){for(var i=0,o=[2,3,4,5,6,7],c=0;c<s.length;c++){var d=parseInt(s[s.length-1-c]);i+=o[c%o.length]*d}return(11-i%11)%11}return io}var G1;function Ek(){if(G1)return jc;G1=1,Object.defineProperty(jc,"__esModule",{value:!0});var n=Mo(),t=i(n),s=Au();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m+(0,s.mod10)(m),b))}return u})(t.default);return jc.default=y,jc}var kc={},V1;function Ok(){if(V1)return kc;V1=1,Object.defineProperty(kc,"__esModule",{value:!0});var n=Mo(),t=i(n),s=Au();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m+(0,s.mod11)(m),b))}return u})(t.default);return kc.default=y,kc}var Nc={},Y1;function Ak(){if(Y1)return Nc;Y1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=Mo(),t=i(n),s=Au();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){d(u,g);function u(m,b){return o(this,u),m+=(0,s.mod10)(m),m+=(0,s.mod10)(m),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return u})(t.default);return Nc.default=y,Nc}var Tc={},K1;function jk(){if(K1)return Tc;K1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=Mo(),t=i(n),s=Au();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){d(u,g);function u(m,b){return o(this,u),m+=(0,s.mod11)(m),m+=(0,s.mod10)(m),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return u})(t.default);return Tc.default=y,Tc}var J1;function kk(){if(J1)return mn;J1=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.MSI1110=mn.MSI1010=mn.MSI11=mn.MSI10=mn.MSI=void 0;var n=Mo(),t=m(n),s=Ek(),i=m(s),o=Ok(),c=m(o),d=Ak(),y=m(d),g=jk(),u=m(g);function m(b){return b&&b.__esModule?b:{default:b}}return mn.MSI=t.default,mn.MSI10=i.default,mn.MSI11=c.default,mn.MSI1010=y.default,mn.MSI1110=u.default,mn}var ao={},Q1;function Nk(){if(Q1)return ao;Q1=1,Object.defineProperty(ao,"__esModule",{value:!0}),ao.pharmacode=void 0;var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),t=On(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){d(u,g);function u(m,b){o(this,u);var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b));return x.number=parseInt(m,10),x}return n(u,[{key:"encode",value:function(){for(var b=this.number,x="";!isNaN(b)&&b!=0;)b%2===0?(x="11100"+x,b=(b-2)/2):(x="100"+x,b=(b-1)/2);return x=x.slice(0,-2),{data:x,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),u})(s.default);return ao.pharmacode=y,ao}var oo={},X1;function Tk(){if(X1)return oo;X1=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.codabar=void 0;var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),t=On(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){d(u,g);function u(m,b){o(this,u),m.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(m="A"+m+"A");var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(u,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],x=this.getEncodings(),v=0;v<this.data.length;v++)b.push(x[this.data.charAt(v)]),v!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),u})(s.default);return oo.codabar=y,oo}var Gs={},Cc={},$i={},W1;function Ck(){return W1||(W1=1,Object.defineProperty($i,"__esModule",{value:!0}),$i.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],$i.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],$i.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),$i}var Z1;function lv(){if(Z1)return Cc;Z1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),t=Ck(),s=On(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function y(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){y(m,u);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.data.split("").flatMap(function(C){return t.MULTI_SYMBOLS[C]||C}),v=x.map(function(C){return m.getEncoding(C)}).join(""),_=m.checksum(x,20),S=m.checksum(x.concat(_),15);return{text:this.text,data:m.getEncoding("ÿ")+v+m.getEncoding(_)+m.getEncoding(S)+m.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(x){return t.BINARIES[m.symbolValue(x)]}},{key:"getSymbol",value:function(x){return t.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return t.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var _=x.slice().reverse().reduce(function(S,C,L){var U=L%v+1;return S+m.symbolValue(C)*U},0);return m.getSymbol(_%47)}}]),m})(i.default);return Cc.default=g,Cc}var Mc={},eb;function Mk(){if(eb)return Mc;eb=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),t=lv(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return n(u,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),u})(s.default);return Mc.default=y,Mc}var tb;function Rk(){if(tb)return Gs;tb=1,Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.CODE93FullASCII=Gs.CODE93=void 0;var n=lv(),t=o(n),s=Mk(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Gs.CODE93=t.default,Gs.CODE93FullASCII=i.default,Gs}var lo={},nb;function Dk(){if(nb)return lo;nb=1,Object.defineProperty(lo,"__esModule",{value:!0}),lo.GenericBarcode=void 0;var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),t=On(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return n(u,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),u})(s.default);return lo.GenericBarcode=y,lo}var rb;function qk(){if(rb)return cc;rb=1,Object.defineProperty(cc,"__esModule",{value:!0});var n=lk(),t=mk(),s=vk(),i=Sk(),o=kk(),c=Nk(),d=Tk(),y=Rk(),g=Dk();return cc.default={CODE39:n.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:s.EAN13,EAN8:s.EAN8,EAN5:s.EAN5,EAN2:s.EAN2,UPC:s.UPC,UPCE:s.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:c.pharmacode,codabar:d.codabar,CODE93:y.CODE93,CODE93FullASCII:y.CODE93FullASCII,GenericBarcode:g.GenericBarcode},cc}var Rc={},sb;function ju(){if(sb)return Rc;sb=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=Object.assign||function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t};return Rc.default=function(t,s){return n({},t,s)},Rc}var Dc={},ib;function Lk(){if(ib)return Dc;ib=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.default=n;function n(t){var s=[];function i(o){if(Array.isArray(o))for(var c=0;c<o.length;c++)i(o[c]);else o.text=o.text||"",o.data=o.data||"",s.push(o)}return i(t),s}return Dc}var qc={},ab;function Bk(){if(ab)return qc;ab=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.default=n;function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return qc}var Lc={},Bc={},Uc={},ob;function cv(){if(ob)return Uc;ob=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.default=n;function n(t){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof t[i]=="string"&&(t[i]=parseInt(t[i],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Uc}var Pc={},lb;function uv(){if(lb)return Pc;lb=1,Object.defineProperty(Pc,"__esModule",{value:!0});var n={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return Pc.default=n,Pc}var cb;function Uk(){if(cb)return Bc;cb=1,Object.defineProperty(Bc,"__esModule",{value:!0});var n=cv(),t=o(n),s=uv(),i=o(s);function o(d){return d&&d.__esModule?d:{default:d}}function c(d){var y={};for(var g in i.default)i.default.hasOwnProperty(g)&&(d.hasAttribute("jsbarcode-"+g.toLowerCase())&&(y[g]=d.getAttribute("jsbarcode-"+g.toLowerCase())),d.hasAttribute("data-"+g.toLowerCase())&&(y[g]=d.getAttribute("data-"+g.toLowerCase())));return y.value=d.getAttribute("jsbarcode-value")||d.getAttribute("data-value"),y=(0,t.default)(y),y}return Bc.default=c,Bc}var zc={},$c={},pn={},ub;function fv(){if(ub)return pn;ub=1,Object.defineProperty(pn,"__esModule",{value:!0}),pn.getTotalWidthOfEncodings=pn.calculateEncodingAttributes=pn.getBarcodePadding=pn.getEncodingHeight=pn.getMaximumHeightOfEncodings=void 0;var n=ju(),t=s(n);function s(u){return u&&u.__esModule?u:{default:u}}function i(u,m){return m.height+(m.displayValue&&u.text.length>0?m.fontSize+m.textMargin:0)+m.marginTop+m.marginBottom}function o(u,m,b){if(b.displayValue&&m<u){if(b.textAlign=="center")return Math.floor((u-m)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(u-m)}return 0}function c(u,m,b){for(var x=0;x<u.length;x++){var v=u[x],_=(0,t.default)(m,v.options),S;_.displayValue?S=g(v.text,_,b):S=0;var C=v.data.length*_.width;v.width=Math.ceil(Math.max(S,C)),v.height=i(v,_),v.barcodePadding=o(S,C,_)}}function d(u){for(var m=0,b=0;b<u.length;b++)m+=u[b].width;return m}function y(u){for(var m=0,b=0;b<u.length;b++)u[b].height>m&&(m=u[b].height);return m}function g(u,m,b){var x;if(b)x=b;else if(typeof document<"u")x=document.createElement("canvas").getContext("2d");else return 0;x.font=m.fontOptions+" "+m.fontSize+"px "+m.font;var v=x.measureText(u);if(!v)return 0;var _=v.width;return _}return pn.getMaximumHeightOfEncodings=y,pn.getEncodingHeight=i,pn.getBarcodePadding=o,pn.calculateEncodingAttributes=c,pn.getTotalWidthOfEncodings=d,pn}var fb;function Pk(){if(fb)return $c;fb=1,Object.defineProperty($c,"__esModule",{value:!0});var n=(function(){function y(g,u){for(var m=0;m<u.length;m++){var b=u[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,u,m){return u&&y(g.prototype,u),m&&y(g,m),g}})(),t=ju(),s=o(t),i=fv();function o(y){return y&&y.__esModule?y:{default:y}}function c(y,g){if(!(y instanceof g))throw new TypeError("Cannot call a class as a function")}var d=(function(){function y(g,u,m){c(this,y),this.canvas=g,this.encodings=u,this.options=m}return n(y,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var u=0;u<this.encodings.length;u++){var m=(0,s.default)(this.options,this.encodings[u].options);this.drawCanvasBarcode(m,this.encodings[u]),this.drawCanvasText(m,this.encodings[u]),this.moveCanvasDrawing(this.encodings[u])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var u=this.canvas.getContext("2d");u.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,u);var m=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=m+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,u.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(u.fillStyle=this.options.background,u.fillRect(0,0,this.canvas.width,this.canvas.height)),u.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(u,m){var b=this.canvas.getContext("2d"),x=m.data,v;u.textPosition=="top"?v=u.marginTop+u.fontSize+u.textMargin:v=u.marginTop,b.fillStyle=u.lineColor;for(var _=0;_<x.length;_++){var S=_*u.width+m.barcodePadding;x[_]==="1"?b.fillRect(S,v,u.width,u.height):x[_]&&b.fillRect(S,v,u.width,u.height*x[_])}}},{key:"drawCanvasText",value:function(u,m){var b=this.canvas.getContext("2d"),x=u.fontOptions+" "+u.fontSize+"px "+u.font;if(u.displayValue){var v,_;u.textPosition=="top"?_=u.marginTop+u.fontSize-u.textMargin:_=u.height+u.textMargin+u.marginTop+u.fontSize,b.font=x,u.textAlign=="left"||m.barcodePadding>0?(v=0,b.textAlign="left"):u.textAlign=="right"?(v=m.width-1,b.textAlign="right"):(v=m.width/2,b.textAlign="center"),b.fillText(m.text,v,_)}}},{key:"moveCanvasDrawing",value:function(u){var m=this.canvas.getContext("2d");m.translate(u.width,0)}},{key:"restoreCanvas",value:function(){var u=this.canvas.getContext("2d");u.restore()}}]),y})();return $c.default=d,$c}var Ic={},hb;function zk(){if(hb)return Ic;hb=1,Object.defineProperty(Ic,"__esModule",{value:!0});var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),t=ju(),s=o(t),i=fv();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}var d="http://www.w3.org/2000/svg",y=(function(){function g(u,m,b){c(this,g),this.svg=u,this.encodings=m,this.options=b,this.document=b.xmlDocument||document}return n(g,[{key:"render",value:function(){var m=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var x=this.encodings[b],v=(0,s.default)(this.options,x.options),_=this.createGroup(m,v.marginTop,this.svg);this.setGroupOptions(_,v),this.drawSvgBarcode(_,v,x),this.drawSVGText(_,v,x),m+=x.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,i.calculateEncodingAttributes)(this.encodings,this.options);var m=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings),x=m+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(x,b),this.options.background&&this.drawRect(0,0,x,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(m,b,x){var v=x.data,_;b.textPosition=="top"?_=b.fontSize+b.textMargin:_=0;for(var S=0,C=0,L=0;L<v.length;L++)C=L*b.width+x.barcodePadding,v[L]==="1"?S++:S>0&&(this.drawRect(C-b.width*S,_,b.width*S,b.height,m),S=0);S>0&&this.drawRect(C-b.width*(S-1),_,b.width*S,b.height,m)}},{key:"drawSVGText",value:function(m,b,x){var v=this.document.createElementNS(d,"text");if(b.displayValue){var _,S;v.setAttribute("font-family",b.font),v.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||x.barcodePadding>0?(_=0,v.setAttribute("text-anchor","start")):b.textAlign=="right"?(_=x.width-1,v.setAttribute("text-anchor","end")):(_=x.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",_),v.setAttribute("y",S),v.appendChild(this.document.createTextNode(x.text)),m.appendChild(v)}}},{key:"setSvgAttributes",value:function(m,b){var x=this.svg;x.setAttribute("width",m+"px"),x.setAttribute("height",b+"px"),x.setAttribute("x","0px"),x.setAttribute("y","0px"),x.setAttribute("viewBox","0 0 "+m+" "+b),x.setAttribute("xmlns",d),x.setAttribute("version","1.1")}},{key:"createGroup",value:function(m,b,x){var v=this.document.createElementNS(d,"g");return v.setAttribute("transform","translate("+m+", "+b+")"),x.appendChild(v),v}},{key:"setGroupOptions",value:function(m,b){m.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(m,b,x,v,_){var S=this.document.createElementNS(d,"rect");return S.setAttribute("x",m),S.setAttribute("y",b),S.setAttribute("width",x),S.setAttribute("height",v),_.appendChild(S),S}}]),g})();return Ic.default=y,Ic}var Hc={},db;function $k(){if(db)return Hc;db=1,Object.defineProperty(Hc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var y=c[d];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(o,y.key,y)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function t(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,d){t(this,i),this.object=o,this.encodings=c,this.options=d}return n(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Hc.default=s,Hc}var mb;function Ik(){if(mb)return zc;mb=1,Object.defineProperty(zc,"__esModule",{value:!0});var n=Pk(),t=d(n),s=zk(),i=d(s),o=$k(),c=d(o);function d(y){return y&&y.__esModule?y:{default:y}}return zc.default={CanvasRenderer:t.default,SVGRenderer:i.default,ObjectRenderer:c.default},zc}var Ii={},pb;function hv(){if(pb)return Ii;pb=1,Object.defineProperty(Ii,"__esModule",{value:!0});function n(d,y){if(!(d instanceof y))throw new TypeError("Cannot call a class as a function")}function t(d,y){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:d}function s(d,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);d.prototype=Object.create(y&&y.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(d,y):d.__proto__=y)}var i=(function(d){s(y,d);function y(g,u){n(this,y);var m=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return m.name="InvalidInputException",m.symbology=g,m.input=u,m.message='"'+m.input+'" is not a valid input for '+m.symbology,m}return y})(Error),o=(function(d){s(y,d);function y(){n(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return y})(Error),c=(function(d){s(y,d);function y(){n(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return y})(Error);return Ii.InvalidInputException=i,Ii.InvalidElementException=o,Ii.NoElementException=c,Ii}var yb;function Hk(){if(yb)return Lc;yb=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},t=Uk(),s=d(t),i=Ik(),o=d(i),c=hv();function d(m){return m&&m.__esModule?m:{default:m}}function y(m){if(typeof m=="string")return g(m);if(Array.isArray(m)){for(var b=[],x=0;x<m.length;x++)b.push(y(m[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLImageElement)return u(m);if(m&&m.nodeName&&m.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&m instanceof SVGElement)return{element:m,options:(0,s.default)(m),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLCanvasElement)return{element:m,options:(0,s.default)(m),renderer:o.default.CanvasRenderer};if(m&&m.getContext)return{element:m,renderer:o.default.CanvasRenderer};if(m&&(typeof m>"u"?"undefined":n(m))==="object"&&!m.nodeName)return{element:m,renderer:o.default.ObjectRenderer};throw new c.InvalidElementException}}function g(m){var b=document.querySelectorAll(m);if(b.length!==0){for(var x=[],v=0;v<b.length;v++)x.push(y(b[v]));return x}}function u(m){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(m),renderer:o.default.CanvasRenderer,afterRender:function(){m.setAttribute("src",b.toDataURL())}}}return Lc.default=y,Lc}var Fc={},gb;function Fk(){if(gb)return Fc;gb=1,Object.defineProperty(Fc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var y=c[d];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(o,y.key,y)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function t(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){t(this,i),this.api=o}return n(i,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var d=c.apply(void 0,arguments);return this.api._options.valid(!0),d}catch(y){return this.handleCatch(y),this.api}}}]),i})();return Fc.default=s,Fc}var nd,bb;function Gk(){if(bb)return nd;bb=1;var n=qk(),t=L(n),s=ju(),i=L(s),o=Lk(),c=L(o),d=Bk(),y=L(d),g=Hk(),u=L(g),m=cv(),b=L(m),x=Fk(),v=L(x),_=hv(),S=uv(),C=L(S);function L(M){return M&&M.__esModule?M:{default:M}}var U=function(){},re=function($,W,Q){var oe=new U;if(typeof $>"u")throw Error("No element to render on was provided.");return oe._renderProperties=(0,u.default)($),oe._encodings=[],oe._options=C.default,oe._errorHandler=new v.default(oe),typeof W<"u"&&(Q=Q||{},Q.format||(Q.format=ae()),oe.options(Q)[Q.format](W,Q).render()),oe};re.getModule=function(M){return t.default[M]};for(var le in t.default)t.default.hasOwnProperty(le)&&D(t.default,le);function D(M,$){U.prototype[$]=U.prototype[$.toUpperCase()]=U.prototype[$.toLowerCase()]=function(W,Q){var oe=this;return oe._errorHandler.wrapBarcodeCall(function(){Q.text=typeof Q.text>"u"?void 0:""+Q.text;var ve=(0,i.default)(oe._options,Q);ve=(0,b.default)(ve);var ke=M[$],Y=z(W,ke,ve);return oe._encodings.push(Y),oe})}}function z(M,$,W){M=""+M;var Q=new $(M,W);if(!Q.valid())throw new _.InvalidInputException(Q.constructor.name,M);var oe=Q.encode();oe=(0,c.default)(oe);for(var ve=0;ve<oe.length;ve++)oe[ve].options=(0,i.default)(W,oe[ve].options);return oe}function ae(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}U.prototype.options=function(M){return this._options=(0,i.default)(this._options,M),this},U.prototype.blank=function(M){var $=new Array(M+1).join("0");return this._encodings.push({data:$}),this},U.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var M;for(var $ in this._renderProperties){M=this._renderProperties[$];var W=(0,i.default)(this._options,M.options);W.format=="auto"&&(W.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var Q=W.value,oe=t.default[W.format.toUpperCase()],ve=z(Q,oe,W);K(M,ve,W)})}}},U.prototype.render=function(){if(!this._renderProperties)throw new _.NoElementException;if(Array.isArray(this._renderProperties))for(var M=0;M<this._renderProperties.length;M++)K(this._renderProperties[M],this._encodings,this._options);else K(this._renderProperties,this._encodings,this._options);return this},U.prototype._defaults=C.default;function K(M,$,W){$=(0,c.default)($);for(var Q=0;Q<$.length;Q++)$[Q].options=(0,i.default)(W,$[Q].options),(0,y.default)($[Q].options);(0,y.default)(W);var oe=M.renderer,ve=new oe(M.element,$,W);ve.render(),M.afterRender&&M.afterRender()}return typeof window<"u"&&(window.JsBarcode=re),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(M,$){var W=[];return jQuery(this).each(function(){W.push(this)}),re(W,M,$)}),nd=re,nd}var Vk=Gk();const Yk=$w(Vk),Kk={[$e.EXECUTED]:"Executed",[$e.MATCHED_LIST]:"Matched list",[$e.CONFIRM_REQUIRED]:"Awaiting confirmation",[$e.NO_MATCH_FALLBACK]:"No match",[$e.UNCONFIGURED]:"Not configured",[$e.INVALID_CODE]:"Invalid code",[$e.FORBIDDEN]:"Not permitted",[$e.CONFLICT]:"Conflict",[$e.IDENTITY_PRIMED]:"Identity primed",[$e.IDENTITY_UNKNOWN]:"Badge not recognized",[$e.NOT_PRIMED]:"Badge required",[$e.CHOICES]:"Choices presented"},Jk={[$e.EXECUTED]:"text-status-success",[$e.MATCHED_LIST]:"text-status-success",[$e.CONFIRM_REQUIRED]:"text-status-warning",[$e.NO_MATCH_FALLBACK]:"text-text-secondary",[$e.UNCONFIGURED]:"text-status-warning",[$e.INVALID_CODE]:"text-status-error",[$e.FORBIDDEN]:"text-status-error",[$e.CONFLICT]:"text-status-warning",[$e.IDENTITY_PRIMED]:"text-status-success",[$e.IDENTITY_UNKNOWN]:"text-status-warning",[$e.NOT_PRIMED]:"text-status-warning",[$e.CHOICES]:"text-status-success"};function Qk(n){return n.outcome===$e.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${Kk[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function xb(n){var t,s,i;return n.outcome===$e.NO_MATCH_FALLBACK?((t=n.fallback)==null?void 0:t.markdown)??null:n.outcome===$e.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===$e.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:null}function ms(n){return n.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function Xk({content:n,compact:t}){const s=[],i=/^```(\w*)\n([\s\S]*?)^```$/gm;let o=0,c;for(;(c=i.exec(n))!==null;)c.index>o&&s.push({type:"text",text:n.slice(o,c.index)}),s.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),o=c.index+c[0].length;o<n.length&&s.push({type:"text",text:n.slice(o)});const d=t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},y=[];for(const g of s){if(g.type==="code"){const u=g.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");y.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${d.code} font-mono text-text-secondary leading-relaxed">${u}</code></pre>`);continue}y.push(...Wk(g.text,d))}return h.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:y.join(`
55
+ `)}})}function Wk(n,t){const s=n.split(`
56
+ `),i=[];let o=!1,c=!1,d=[];for(const y of s){const g=y.trim();if(g.startsWith("|")&&g.endsWith("|")){const u=g.slice(1,-1).split("|").map(m=>m.trim());if(u.every(m=>/^[-:]+$/.test(m)))continue;c||(c=!0,d=[]),d.push(u);continue}if(c){c=!1;const[u,...m]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of u)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ms(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of m){i.push("<tr>");for(const x of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${ms(x)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),d=[]}if(!g){o&&(i.push("</ul>"),o=!1);continue}if(g.startsWith("### ")){o&&(i.push("</ul>"),o=!1),i.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ms(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ms(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){o&&(i.push("</ul>"),o=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){o||(i.push('<ul class="space-y-1 my-1">'),o=!0),i.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ms(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${t.text} text-text-secondary my-1">${ms(g)}</p>`)}if(c&&d.length){const[y,...g]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of y)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ms(u)}</th>`);i.push("</tr></thead><tbody>");for(const u of g){i.push("<tr>");for(const m of u)i.push(`<td class="py-1 px-2 border-b border-border/50">${ms(m)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function Em({result:n,compact:t=!1}){const{response:s}=n,i=t?"text-xs":"text-sm";return h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:`${i} font-mono text-text-secondary truncate`,children:n.code}),s?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`${i} font-medium ${Jk[s.outcome]}`,children:Qk(s)}),s.error&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:s.error}),xb(s)&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(Xk,{content:xb(s),compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function dv(n){return n.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function Zk(n){const t=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&t.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function eN({value:n}){const t=O.useRef(null),[s,i]=O.useState(!1);return O.useEffect(()=>{if(!(!t.current||!n))try{Yk(t.current,n,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[n]),n?h.jsxs("div",{children:[h.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?h.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",h.jsx("span",{className:"font-mono",children:Zk(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function tN({onClose:n}){const{submitCode:t,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:d,diagnosticsOn:y,setDiagnosticsOn:g}=Sm(),[u,m]=O.useState(""),[b,x]=O.useState(!1),v=_=>{_.preventDefault();const S=u.trim();S&&(m(""),t(S))};return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[h.jsx(Oo,{className:"w-4 h-4"}),"Scan"]}),h.jsx("button",{type:"button",onClick:n,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:h.jsx(Qt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[h.jsxs("form",{onSubmit:v,className:"space-y-2",children:[h.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:u,onChange:_=>m(dv(_.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),h.jsx("button",{type:"submit",disabled:i||!u.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),h.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),h.jsx(eN,{value:u.trim()}),s&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),h.jsx(Em,{result:s})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{type:"button",onClick:()=>x(_=>!_),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block text-sm text-text-primary",children:[h.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),h.jsx("input",{type:"number",min:100,max:2e3,step:50,value:o.maxKeyGapMs,onChange:_=>c({maxKeyGapMs:Number(_.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),h.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[h.jsx("input",{type:"checkbox",checked:y,onChange:_=>g(_.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),y&&h.jsxs("div",{className:"border border-surface-border rounded",children:[h.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),h.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[d.length===0&&h.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),d.map(_=>h.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${_.buffer}`,children:[h.jsxs("span",{className:"text-text-tertiary",children:[String(_.deltaMs).padStart(4),"ms "]}),h.jsx("span",{className:"text",children:JSON.stringify(_.key)}),_.code&&h.jsxs("span",{className:"text-text-tertiary",children:[" (",_.code,")"]}),h.jsxs("span",{className:"text-text-tertiary",children:[" — ",_.note]})]},_.seq))]}),h.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",h.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",h.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",h.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const mv=/^\{lt:([A-Za-z0-9_]+)\}$/;function f5(n){return`{lt:${n}}`}const pv="lt:station:link-vars:";function zd(n){return`${pv}${n}`}const $d=new Set;function nN(){for(const n of $d)n()}let pu,Gc={};function yv(n){let t=null;try{t=localStorage.getItem(zd(n))}catch{t=null}if(t===pu)return Gc;pu=t;try{const s=t?JSON.parse(t):{};Gc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Gc={}}return Gc}function rN(n,t,s){const i={...yv(n)};s===null||s===""?delete i[t]:i[t]=s;try{Object.keys(i).length===0?localStorage.removeItem(zd(n)):localStorage.setItem(zd(n),JSON.stringify(i))}catch{}pu=void 0,nN()}function sN(n){$d.add(n);const t=s=>{(s.key===null||s.key.startsWith(pv))&&(pu=void 0,n())};try{window.addEventListener("storage",t)}catch{}return()=>{$d.delete(n);try{window.removeEventListener("storage",t)}catch{}}}const iN={};function aN(n){return O.useSyncExternalStore(sN,()=>n?yv(n):iN)}function oN(n,t,s){let i;try{i=new URL(n,"http://local")}catch{return n}const o=i.searchParams.get("facets");if(!o)return n;let c;try{const y=JSON.parse(o);if(!y||typeof y!="object"||Array.isArray(y))return n;c=y}catch{return n}let d=!1;for(const[y,g]of Object.entries(c)){if(typeof g!="string")continue;const u=mv.exec(g);if(!u)continue;const m=t[u[1]]??s[u[1]];typeof m=="string"&&m!==""?c[y]=m:delete c[y],d=!0}return d?(Object.keys(c).length===0?i.searchParams.delete("facets"):i.searchParams.set("facets",JSON.stringify(c)),i.pathname+i.search):n}function h5(n){let t;try{t=new URL(n,"http://local")}catch{return[]}const s=t.searchParams.get("facets");if(!s)return[];try{const i=JSON.parse(s);if(!i||typeof i!="object"||Array.isArray(i))return[];const o=[];for(const c of Object.values(i)){if(typeof c!="string")continue;const d=mv.exec(c);d&&!o.includes(d[1])&&o.push(d[1])}return o}catch{return[]}}function Om(){const{user:n,isSuperAdmin:t,hasRoleType:s}=Rt(),i=(n==null?void 0:n.userId)??null,o=t||s("admin"),c=O.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(x=>x.role)),[n]),{data:d}=Eu({enabled:o||c.size>0}),y=aN(i),g=O.useMemo(()=>{var _;const x=[],v=new Set;for(const S of(d==null?void 0:d.roles)??[]){if(!o&&!c.has(S.role))continue;const C=(_=S.properties)==null?void 0:_.link_variables;if(Array.isArray(C))for(const L of C){const U=L==null?void 0:L.name;if(typeof U!="string"||U===""||v.has(U))continue;v.add(U);const re=L.label,le=L.default;x.push({name:U,...typeof re=="string"&&re!==""?{label:re}:{},...typeof le=="string"&&le!==""?{default:le}:{},fromRole:S.role})}}return x},[d,c,o]),u=O.useMemo(()=>{const x={};for(const v of g)v.default!==void 0&&(x[v.name]=v.default);return x},[g]),m=O.useCallback(x=>oN(x,y,u),[y,u]),b=O.useCallback((x,v)=>{i&&rN(i,x,v)},[i]);return{declarations:g,values:y,defaults:u,resolveUrl:m,setValue:b}}function lN({open:n,onClose:t,title:s,children:i,maxWidth:o}){return O.useEffect(()=>{if(!n)return;const c=d=>{d.key==="Escape"&&t()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[n,t]),n?Hd.createPortal(h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-text-primary/30",onClick:t}),h.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"lt-modal-title",className:`relative bg-surface-raised border border-surface-border rounded-lg shadow-xl w-full ${o??"max-w-md"} mx-4 max-h-[85vh] flex flex-col`,children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b shrink-0",children:[h.jsx("h2",{id:"lt-modal-title",className:"text-sm font-medium text-text-primary",children:s}),h.jsx("button",{onClick:t,"aria-label":"Close dialog",className:"text-text-tertiary hover:text-text-primary text-lg leading-none",children:"×"})]}),h.jsx("div",{className:"px-6 py-5 overflow-y-auto",children:i})]})]}),document.body):null}function cN({open:n,onClose:t}){const{declarations:s,values:i,setValue:o}=Om();return h.jsxs(lN,{open:n,onClose:t,title:"Link Variables",maxWidth:"max-w-lg",children:[h.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed mb-4",children:"Values bound on this device. Pinned links and the Pace Board open scoped to the value applied; an unbound variable falls back to the role's default, or applies no filter at all."}),h.jsx("div",{className:"divide-y divide-surface-border",children:s.map((c,d)=>h.jsx(uN,{declaration:c,value:i[c.name]??"",autoFocus:d===0,onChange:y=>o(c.name,y),onClear:()=>o(c.name,null),onEnter:t},c.name))}),s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary",children:"Your roles declare no link variables."}),s.length>0&&h.jsx("div",{className:"flex justify-end pt-4",children:h.jsx("button",{onClick:t,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function uN({declaration:n,value:t,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const d=O.useId(),{data:y}=hA(n.name),g=(y==null?void 0:y.values)??[];return h.jsxs("div",{className:"py-3 flex items-center gap-3","data-testid":"link-var-row",children:[h.jsxs("div",{className:"w-40 shrink-0 min-w-0",children:[h.jsx("p",{className:"text-xs font-mono text-text-primary truncate",title:n.name,children:n.name}),h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:`declared by ${n.fromRole}`,children:n.label??n.fromRole})]}),h.jsx("input",{type:"text",list:d,autoFocus:s,value:t,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&c()},placeholder:n.default?`${n.default} (default)`:"no filter","aria-label":`Value for ${n.name}`,className:"input text-xs font-mono flex-1 min-w-0"}),h.jsx("datalist",{id:d,children:g.map(u=>h.jsx("option",{value:u},u))}),h.jsx("button",{onClick:o,disabled:t==="",title:`Clear ${n.name}`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0",children:"×"})]})}const vb=["escalationId","workflowId"],fN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,gv="lt:search:mode",hN="lt:search:facet",kt={FACET:"facet",COMMAND:"command"};function dN(n,t){return{version:n.version,category:t.category,name:t.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length}}function Eo(n){return n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function mN(n,t){if(n.encoding==="delimited")return pN(n,t)?{code:t}:{code:`${Eo(n)}${t}`};if(!/^[0-9]+$/.test(t))return{error:`${n.name} takes digits only`};const s=n.targetLength;return s&&t.length!==s&&t.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${Eo(n)}${t}`}}function pN(n,t){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(t)}function yN(n,t){return n==="escalationId"||n==="workflowId"?null:rk(n,t)}function gN(n){return n.kind===kt.FACET?n.facet:n.command.name}function bN(n){return n.kind===kt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function xN(n){return n.kind===kt.FACET?{kind:kt.FACET,facet:n.facet}:{kind:kt.COMMAND,version:n.command.version,category:n.command.category}}function vN(n,t,s){if((n==null?void 0:n.kind)===kt.FACET&&t.includes(n.facet))return{kind:kt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===kt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:kt.COMMAND,command:i}}return t.length>0?{kind:kt.FACET,facet:t[0]}:s.length>0?{kind:kt.COMMAND,command:s[0]}:null}function _N(){try{const n=localStorage.getItem(gv);if(n){const s=JSON.parse(n);if(s.kind===kt.FACET&&typeof s.facet=="string"||s.kind===kt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const t=localStorage.getItem(hN);return t?{kind:kt.FACET,facet:t}:null}catch{return null}}function wN(n){try{localStorage.setItem(gv,JSON.stringify(n))}catch{}}const _b=5*6e4,SN=n=>({rules:n.map(t=>{var s;return((s=t.data)==null?void 0:s.rules)??null}),loading:n.some(t=>t.isLoading)});function EN(n){const t=tk({enabled:n,staleTime:_b}),s=O.useMemo(()=>{var d;return(((d=t.data)==null?void 0:d.schemes)??[]).filter(y=>y.enabled&&y.kind===Zj.ACTION).sort((y,g)=>y.version-g.version)},[t.data]),{rules:i,loading:o}=Iw({queries:s.map(d=>({queryKey:["scan-schemes",d.version,"actions"],queryFn:()=>he(`/scan-codes/schemes/${d.version}/actions`),enabled:n,staleTime:_b})),combine:SN});return{commands:O.useMemo(()=>s.flatMap((d,y)=>(i[y]??[]).filter(g=>g.enabled).sort((g,u)=>g.category.localeCompare(u.category)).map(g=>dN(d,g))),[s,i]),loading:t.isLoading||o}}const ON={escalationId:"opens the item",workflowId:"opens the run"};function AN({mode:n,facets:t,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,d]=O.useState(!1),y=O.useRef(null);O.useEffect(()=>{if(!c)return;const x=_=>{y.current&&!y.current.contains(_.target)&&d(!1)},v=_=>{_.key==="Escape"&&d(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v)}},[c]);const g=n.kind===kt.COMMAND,u=g?`${n.command.schemeName} · ${n.command.name} — ${Eo(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,m=jN(s),b=x=>{i(x),d(!1)};return h.jsxs("div",{ref:y,className:"relative h-full shrink-0",children:[h.jsxs("button",{type:"button",onClick:()=>d(x=>!x),"aria-expanded":c,"aria-haspopup":"listbox","aria-label":"Search or run as",title:u,className:"group flex items-center gap-1 h-full pl-2.5 pr-2 border-l border-surface-field-border hover:bg-surface-hover transition-colors rounded-r-[var(--lt-radius-field)]","data-testid":"search-mode",children:[h.jsx("span",{className:`text-2xs whitespace-nowrap truncate max-w-[9rem] ${g?"font-medium text-accent":"font-mono text-text-tertiary"}`,children:gN(n)}),h.jsx(Fd,{className:`w-3 h-3 shrink-0 text-text-quaternary group-hover:text-accent transition-transform ${c?"rotate-180":""}`,strokeWidth:1.5})]}),c&&h.jsxs("div",{role:"listbox","aria-label":"Search or run as",className:"absolute z-50 top-full right-0 mt-1.5 min-w-[17rem] max-w-[24rem] max-h-[70vh] overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[t.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(wb,{children:"Find"}),t.map(x=>h.jsx(Sb,{label:x,mono:!0,note:ON[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:kt.FACET,facet:x})},x))]}),m.map(({schemeName:x,targetFacet:v,items:_})=>h.jsxs("div",{children:[h.jsxs(wb,{note:v,children:["Run · ",x]}),_.map(S=>h.jsx(Sb,{label:S.name,note:Eo(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:kt.COMMAND,command:S})},`${S.version}:${S.category}`))]},x)),o&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/60 my-1"}),h.jsxs("button",{type:"button",onClick:()=>{d(!1),o()},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-accent hover:bg-surface-hover","data-testid":"search-mode-scan-panel",children:[h.jsx(Oo,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function jN(n){const t=[];for(const s of n){const i=t.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):t.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return t}function wb({children:n,note:t}){return h.jsxs("p",{className:"px-3 pt-2 pb-1 flex items-baseline gap-2 text-2xs font-semibold uppercase tracking-widest text-text-quaternary first:pt-1",children:[h.jsx("span",{className:"truncate",children:n}),t&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:t})]})}function Sb({label:n,note:t,active:s,mono:i,noteMono:o,onClick:c}){return h.jsxs("button",{type:"button",role:"option","aria-selected":s,onClick:c,className:`w-full text-left pl-3 pr-3 py-1.5 flex items-baseline gap-3 border-l-2 transition-colors ${s?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[h.jsx("span",{className:`text-xs font-medium truncate ${i?"font-mono":""}`,children:n}),h.jsx("span",{className:`ml-auto text-2xs shrink-0 ${o?"font-mono tabular-nums":""} ${s?"text-accent/70":"text-text-quaternary"}`,children:t})]})}const kN=6e3;function NN({onOpenScanPanel:n}){const t=Zi(),{data:s}=Xn(),i=wm(),{submitCode:o,busy:c,lastResult:d}=Sm(),{commands:y}=EN(i),[g,u]=O.useState(""),[m,b]=O.useState(!1),[x,v]=O.useState(null),[_,S]=O.useState(null),[C,L]=O.useState(""),[U,re]=O.useState(null),[le,D]=O.useState(_N),z=O.useRef(null),ae=O.useMemo(()=>{var ce;if(!((ce=s==null?void 0:s.search)!=null&&ce.enabled))return[];const Z=(s.search.facets??[]).filter(_e=>!vb.includes(_e));return[...vb,...Z]},[s]),K=O.useMemo(()=>vN(le,ae,y),[le,ae,y]),M=(d==null?void 0:d.source)===So.TOOLBAR&&!d.navigated&&U!==d.at?d:null;O.useEffect(()=>{if(!M)return;const Z=setTimeout(()=>re(M.at),kN);return()=>clearTimeout(Z)},[M]);const $=()=>{v(null),S(null),d&&re(d.at)},W=Z=>{var _e;const ce=xN(Z);D(ce),wN(ce),$(),(_e=z.current)==null||_e.focus()},Q=(Z,ce)=>{const _e=mN(Z.command,dv(ce));if("error"in _e){v(_e.error);return}u(""),o(_e.code,So.TOOLBAR)},oe=async(Z,ce)=>{const _e=yN(Z,ce);if(_e){u(""),t(_e);return}if(Z==="escalationId"&&!fN.test(ce)){v("That is not a valid escalation id");return}b(!0);try{if(Z==="escalationId")await he(`/escalations/${encodeURIComponent(ce)}`),u(""),t(`/escalations/detail/${encodeURIComponent(ce)}`);else{const we=await he(`/escalations/by-workflow/${encodeURIComponent(ce)}`),Ne=(we==null?void 0:we.escalations)??[];Ne.length===1?(u(""),t(`/escalations/detail/${Ne[0].id}`)):(L(ce),S(Ne))}}catch{v(`No ${Z==="escalationId"?"escalation":"workflow"} found for "${ce}"`)}finally{b(!1)}},ve=()=>{const Z=g.trim();!Z||m||c||!K||($(),K.kind===kt.COMMAND?Q(K,Z):oe(K.facet,Z))};if(!K)return null;const ke=K.kind===kt.COMMAND,Y=m||c;return h.jsxs("div",{className:"relative w-full max-w-[28rem]","data-testid":"global-search",children:[h.jsxs("div",{className:"flex items-center h-8 bg-surface-field border border-surface-field-border rounded-[var(--lt-radius-field)] focus-within:border-accent focus-within:bg-surface-field-focus transition-colors",children:[h.jsxs("label",{htmlFor:"global-search-input",className:"flex items-center gap-1.5 pl-2.5 shrink-0 cursor-text",children:[ke?h.jsx(Oo,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(Xw,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),ke&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:Eo(K.command)})]}),h.jsx("input",{ref:z,id:"global-search-input",type:"text",value:g,onChange:Z=>{u(Z.target.value),$()},onKeyDown:Z=>{Z.key==="Enter"&&ve(),Z.key==="Escape"&&(u(""),$())},placeholder:bN(K),"aria-label":ke?"Run target":"Global search",autoComplete:"off",spellCheck:!1,className:`flex-1 min-w-0 h-full bg-transparent text-xs text-text-primary placeholder:text-text-quaternary focus:outline-none ${ke?"pl-0.5 pr-2 font-mono":"px-2"}`}),Y&&h.jsx("span",{className:"w-1.5 h-1.5 mr-2 rounded-full bg-accent animate-pulse shrink-0","aria-label":"Working"}),h.jsx(AN,{mode:K,facets:ae,commands:y,onSelect:W,onOpenScanPanel:n})]}),x&&h.jsx("p",{className:"absolute top-full left-0 mt-1 text-2xs text-status-error whitespace-nowrap",role:"alert",children:x}),M&&h.jsx("div",{role:"status",className:"absolute top-full left-0 mt-1.5 z-50 w-full max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg px-3 py-2 animate-fade-in","data-testid":"search-run-outcome",children:h.jsx(Em,{result:M,compact:!0})}),_!==null&&h.jsxs("div",{className:"absolute top-full left-0 mt-1.5 z-50 min-w-72 max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1","data-testid":"search-workflow-results",children:[_.map(Z=>h.jsxs(Nr,{to:`/escalations/detail/${Z.id}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-hover truncate",children:[h.jsx("span",{className:"font-medium text-text-primary",children:Z.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),Z.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:Z.type})]},Z.id)),_.length===0&&h.jsx("p",{className:"px-3 py-1.5 text-2xs text-text-tertiary",children:"No escalations for this workflow."}),h.jsx("hr",{className:"border-surface-border/60 my-0.5"}),h.jsx(Nr,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function TN(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function bv(n){var t;return((t=n.title)==null?void 0:t.trim())||TN(n.role)}const xv="lt:bookmarks",Vc="scan";function CN(){try{const n=localStorage.getItem(xv);if(!n)return[];const t=JSON.parse(n);return Array.isArray(t)?t:[]}catch{return[]}}function Eb(n){try{localStorage.setItem(xv,JSON.stringify(n))}catch{}}function MN({onToggleEventFeed:n,onToggleDocs:t,onToggleNav:s}){var ut,ft,fe;const i=Zi(),{user:o,logout:c}=Rt(),{viewAs:d,realIsBuilder:y}=Cx(),{available:g,mine:u}=yA();Mx();const{connected:m}=dx(),{data:b}=Xn(),{role:x,targets:v,selectable:_,selectRole:S}=qx(),{declarations:C,values:L}=Om(),[U,re]=O.useState(!1),{data:le}=Eu({enabled:_}),{setPanel:D,closePanel:z,open:ae,ownerKey:K}=ym(),M=wm(),$=En(),W=()=>{ae&&K===Vc?z(Vc):D(h.jsx(tN,{onClose:()=>z(Vc)}),{width:360,key:Vc})},[Q,oe]=O.useState(!1),[ve,ke]=O.useState(!1),[Y,Z]=O.useState(Wx),[ce,_e]=O.useState(CN),we=O.useRef(null),Ne=(ut=b==null?void 0:b.branding)==null?void 0:ut.appName,je=(ft=b==null?void 0:b.branding)==null?void 0:ft.themes,Te=O.useMemo(()=>($j(je??[]),Ij()),[je]),nt=pe=>{Hj(pe),Z(pe)},Nt=()=>{const pe=window.prompt("Bookmark label:");if(!(pe!=null&&pe.trim()))return;const ht=$.pathname+$.search,Ht=[...ce,{label:pe.trim(),url:ht}].sort((An,zt)=>An.label.localeCompare(zt.label));_e(Ht),Eb(Ht),oe(!1)},Dt=pe=>{const ht=ce.filter(Ht=>!(Ht.label===pe.label&&Ht.url===pe.url));_e(ht),Eb(ht)};return O.useEffect(()=>{if(!Q)return;const pe=ht=>{we.current&&!we.current.contains(ht.target)&&oe(!1)};return document.addEventListener("mousedown",pe),()=>document.removeEventListener("mousedown",pe)},[Q]),h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${Q?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(Ww,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(Nr,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:pe=>{(pe.ctrlKey||pe.metaKey)&&(pe.preventDefault(),ke(!0))},children:h.jsx(xm,{appName:Ne,className:"flex"})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(Pb,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(id,{className:"w-5 h-5",strokeWidth:2})})]}),(((fe=b==null?void 0:b.search)==null?void 0:fe.enabled)||M)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(NN,{onOpenScanPanel:M?W:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsxs(Nr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${g>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(ad,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),g>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),h.jsxs(Nr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${u>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(ad,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),u>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:u})]}),d&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[d," View"]}),h.jsx("button",{onClick:Md,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Qt,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:we,children:[h.jsxs("button",{onClick:()=>oe(pe=>!pe),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(Zw,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),d&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),Q&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[h.jsx(Nr,{to:"/credentials",onClick:()=>oe(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),M&&h.jsx("button",{onClick:()=>{oe(!1),W()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-scan",children:"Scan a code"}),h.jsx("button",{onClick:()=>{oe(!1),m?n==null||n():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:m?"Events":"Reconnect events"}),y&&h.jsx("button",{onClick:()=>{oe(!1),t==null||t()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-docs",children:"Docs"}),d&&h.jsxs("button",{onClick:()=>{oe(!1),Md()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",d," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Te.map(pe=>h.jsx("button",{type:"button",onClick:()=>nt(pe.id),title:pe.label,"aria-label":`${pe.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${Y===pe.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:pe.swatch}},pe.id))})]}),_&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("button",{type:"button",onClick:()=>{oe(!1),S(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${x?"text-text-secondary":"text-accent"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${x?"bg-surface-border":"bg-accent"}`}),h.jsx("span",{className:"truncate",children:"Full dashboard"})]}),v.map(pe=>{var An;const ht=(An=le==null?void 0:le.roles)==null?void 0:An.find(zt=>zt.role===pe),Ht=pe===x;return h.jsxs("button",{type:"button",onClick:()=>{oe(!1),S(pe),i(`/escalations/available?role=${encodeURIComponent(pe)}&status=available`)},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${Ht?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Ht?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:bv({role:pe,title:ht==null?void 0:ht.title})})]},pe)})]})]}),C.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Link variables"}),h.jsxs("button",{type:"button",onClick:()=>{oe(!1),re(!0)},className:"flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded text-text-secondary hover:bg-surface-hover","data-testid":"link-vars-menu-entry",children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Object.keys(L).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(L).length>0?Object.entries(L).map(([pe,ht])=>`${pe} = ${ht}`).join(", "):"Set values for this device"})]})]}),h.jsx("button",{onClick:()=>{oe(!1),c()},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(pe=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(Nr,{to:pe.url,onClick:()=>oe(!1),title:pe.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:pe.label}),h.jsx("button",{type:"button",onClick:()=>Dt(pe),title:`Remove "${pe.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(Qt,{className:"w-3 h-3"})})]},`${pe.label}::${pe.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:Nt,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(eS,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),ve&&h.jsx(zj,{onClose:()=>ke(!1)}),h.jsx(cN,{open:U,onClose:()=>re(!1)})]})}function Am({open:n,children:t}){const[s,i]=O.useState(n);return O.useEffect(()=>{n&&i(!0)},[n]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${n?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{n||i(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function Id(n){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return n?`${s} justify-center w-10 h-10 mx-auto ${t?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${t?i:o}`}}function RN(){return({isActive:n})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${n?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function DN({group:n,collapsed:t}){const{pathname:s}=En(),i=n.matchPaths.some(y=>s.startsWith(y)),[o,c]=O.useState(i),d=o||i;return t?h.jsx(h.Fragment,{children:n.items.map(y=>h.jsx(Ji,{to:y.to,className:Id(!0),title:y.label,children:y.icon&&h.jsx(y.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},y.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(y=>!y),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:[n.icon&&h.jsx(n.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:n.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(Am,{open:d,children:n.items.map(y=>h.jsxs(Ji,{to:y.to,end:y.end,className:RN(),children:[y.icon&&h.jsx(y.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:y.label})]},y.to))})]})}function qN(n){return n.kind==="group"}function LN({entry:n,collapsed:t}){const{pathname:s,search:i}=En(),o=n.to.includes("?"),c=n.icon&&h.jsx(n.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${n.iconClassName??""}`,strokeWidth:1.5,...n.solid?{fill:"currentColor"}:{}});if(o){const[d,y]=n.to.split("?"),g=s===d&&i===`?${y}`,u=Id(t)({isActive:g});return h.jsxs(Ji,{to:n.to,className:u,title:t?n.label:void 0,children:[c,!t&&h.jsx("span",{children:n.label})]})}return h.jsxs(Ji,{to:n.to,end:n.end,className:Id(t),title:t?n.label:void 0,children:[c,!t&&h.jsx("span",{children:n.label})]})}function Mr({heading:n,entries:t}){const{collapsed:s}=mm();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:n}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:n}),t.map(i=>qN(i)?h.jsx(DN,{group:i,collapsed:s},i.label):h.jsx(LN,{entry:i,collapsed:s},i.to))]})}function BN({aiEnabled:n=!1,isBuilder:t=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1}){const c=[{to:"/pace",label:"Pace Board",icon:tS},{to:"/trends",label:"Trend Board",icon:nS}];if(!t&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(Mr,{heading:"Monitor",entries:c}):null;if(!t)return h.jsx(Mr,{heading:"Monitor",entries:o?c:[]});const d=[...o?c:[],{to:"/topics",label:"Event Topics",icon:zb},{to:"/agents",label:n?"Agents":"Automations",icon:rS},{to:"/capabilities",label:"Capabilities",icon:sS}];return h.jsx(Mr,{heading:"Monitor",entries:d})}function UN(){return ze({queryKey:["me","preferences"],queryFn:()=>he("/me/preferences"),staleTime:6e4})}function PN(){const n=Ie();return Ve({mutationFn:t=>he("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{n.setQueryData(["me","preferences"],t)}})}function zN(n,t){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(y=>y.label)),c=[...s],d=new Set;for(const{role:y,pins:g}of t)for(const u of g)o.has(u.label)||i.has(u.label)||d.has(u.label)||(d.add(u.label),c.push({...u,id:`role:${y}:${u.label}`,fromRole:y}));return c}function $N(n){let t;try{t=new URL(n,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const s=t.searchParams,i=nk(s),o=s.get("status")||void 0,c=t.pathname==="/escalations/available"&&(o===void 0||o==="available");return{available:c,params:{...i,role:s.get("role")||void 0,type:s.get("type")||void 0,priority:s.get("priority")?parseInt(s.get("priority"),10):void 0,status:c||o==="all"?void 0:o,search:s.get("search")||void 0}}}function IN(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function HN(){var K;const{collapsed:n}=mm(),{user:t}=Rt(),s=UN(),i=PN(),o=O.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(M=>M.role)),[t]),{data:c}=Eu({enabled:o.size>0}),d=rn("SUMMARY");Xs(fm(),()=>{d([["escalations"]])});const y=(K=s.data)==null?void 0:K.preferences,g=O.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(M=>o.has(M.role)&&Array.isArray(M.default_pins)&&M.default_pins.length>0).map(M=>({role:M.role,pins:M.default_pins})),[c,o]),{resolveUrl:u}=Om(),m=O.useMemo(()=>zN(y,g),[y,g]),b=O.useMemo(()=>new Map(m.map(M=>[M.id,M.url])),[m]),x=O.useMemo(()=>m.map(M=>({...M,url:u(M.url)})),[m,u]),v=O.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(M=>[M.role,bv(M)])),[c]),_=O.useMemo(()=>x.filter(M=>!M.fromRole),[x]),S=O.useMemo(()=>g.map(({role:M})=>({role:M,title:v.get(M)??M,pins:x.filter($=>$.fromRole===M)})).filter(M=>M.pins.length>0),[g,v,x]),C=(y==null?void 0:y.pinnedViews)??[],L=O.useRef(null),U=M=>i.mutate({pinnedViews:M}),re=M=>U(C.filter($=>$.id!==M)),le=M=>U([...C,{id:IN(),label:M.label,url:b.get(M.id)??M.url,badge:M.badge}]),D=M=>i.mutate({hiddenRolePins:[...(y==null?void 0:y.hiddenRolePins)??[],M]}),z=(M,$)=>{if(M===$)return;const W=[...C],[Q]=W.splice(M,1);W.splice($,0,Q),U(W)};if(x.length===0)return null;const ae="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return h.jsxs("div",{className:"space-y-1",children:[n&&h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!n&&_.length>0&&h.jsx("p",{className:ae,children:"Pinned"}),_.map(M=>{const $=C.findIndex(W=>W.id===M.id);return h.jsx(Ob,{pin:M,collapsed:n,draggable:$!==-1,onDragStart:()=>{L.current=$},onDropOn:()=>{L.current!==null&&$!==-1&&z(L.current,$),L.current=null},onRemove:()=>re(M.id)},M.id)}),S.map(M=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:ae,title:`${M.title} — pins from the ${M.role} role`,"data-testid":"pin-group-label",children:M.title}),M.pins.map($=>h.jsx(Ob,{pin:$,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>le($),onHide:()=>D($.label)},$.id))]},M.role))]})}function Ob({pin:n,collapsed:t,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:d,onHide:y}){const{pathname:g,search:u}=En(),[m,b=""]=n.url.split("?"),x=g===m&&u===(b?`?${b}`:""),v="group flex items-center rounded-md transition-colors duration-150",_=x?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?h.jsx(Ji,{to:n.url,className:`${v} ${_} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(dg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${v} ${_} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:o,children:[h.jsxs(Ji,{to:n.url,title:n.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[h.jsx(dg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...n.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:n.label}),n.badge&&h.jsx(FN,{url:n.url})]}),h.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[d&&h.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx($b,{className:"w-3 h-3"})}),y&&h.jsx("button",{onClick:y,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(iS,{className:"w-3 h-3"})}),c&&h.jsx("button",{onClick:c,title:`Remove "${n.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Qt,{className:"w-3 h-3"})})]})]})}function FN({url:n}){var d;const t=O.useMemo(()=>$N(n),[n]),s={limit:1,staleTime:15e3},i=Px({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),o=Ux({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?i:o;return c.isError||((d=c.data)==null?void 0:d.total)===void 0?null:h.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function GN(){var c;const{data:n}=Xn(),t=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=t===!0||t!==!1&&kx(),i=[{to:"/workflows/registry",label:"Registry",icon:mg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:od},{to:"/workflows/executions",label:"Executions",icon:pg}],o=s?[{kind:"group",label:"Procedural",icon:aS,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:Gd,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:mg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:od},{to:"/mcp/executions",label:"Executions",icon:pg}]}]:i;return h.jsx(Mr,{heading:"Orchestrate",entries:o})}function d5(){return ze({queryKey:["activeWorkers"],queryFn:async()=>(await he("/workflows/workers")).workers})}function m5(){return ze({queryKey:["discoveredWorkflows"],queryFn:async()=>(await he("/workflows/discovered")).workflows})}function p5(){return ze({queryKey:["workflowConfigs"],queryFn:async()=>(await he("/workflows/config")).workflows})}function vv(){return ze({queryKey:["invocableWorkflows"],queryFn:async()=>(await he("/workflows/invocable")).workflows})}function y5(){return ze({queryKey:["cronStatus"],queryFn:async()=>(await he("/workflows/cron/status")).schedules})}function g5(n){return ze({queryKey:["workflowExecution",n],queryFn:()=>he(`/workflow-states/${n}/execution`),enabled:!!n})}function b5(n,t){const s=new URLSearchParams;return n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),n.entity&&s.set("entity",n.entity),n.search&&s.set("search",n.search),n.status&&s.set("status",n.status),n.sort_by&&s.set("sort_by",n.sort_by),n.order&&s.set("order",n.order),n.registered&&s.set("registered",n.registered),n.namespace&&s.set("namespace",n.namespace),ze({queryKey:["jobs",n],queryFn:()=>he(`/workflow-states/jobs?${s}`),enabled:(t==null?void 0:t.enabled)??!0})}function x5(){const n=Ie();return Ve({mutationFn:t=>he(`/workflows/${t}/terminate`,{method:"POST"}),onSuccess:(t,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function v5(){const n=Ie();return Ve({mutationFn:({workflow_type:t,...s})=>he(`/workflows/${encodeURIComponent(t)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function _5(){const n=Ie();return Ve({mutationFn:t=>he(`/workflows/${encodeURIComponent(t)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function w5(){const n=Ie();return Ve({mutationFn:({workflowType:t,data:s,metadata:i,execute_as:o})=>he(`/workflows/${t}/invoke`,{method:"POST",body:JSON.stringify({data:s,metadata:i,...o?{execute_as:o}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function VN(){const{data:n}=vv();return n!=null&&n.length?h.jsx(Mr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:od}]}):null}const YN=[{to:"/mcp/queries",label:"Designer",icon:oS},{to:"/mcp/servers",label:"Servers & Tools",icon:lS}];function KN(){return h.jsx(Mr,{heading:"Design",entries:YN})}const JN=[{to:"/files",label:"Files",icon:cS},{to:"/knowledge",label:"Knowledge Base",icon:Ib}];function QN(){return h.jsx(Mr,{heading:"Storage",entries:JN})}function XN({isBuilder:n=!1,isOps:t=!1}){var d;const{data:s}=Xn(),i=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:uS},...n||t?[{to:"/admin/roles",label:"Roles",icon:ad},{to:"/admin/personas",label:"Personas",icon:fS},{to:"/admin/scan-codes",label:"Scan Codes",icon:Oo}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:hS},{to:"/admin/streams",label:"Messages",icon:Ib},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:dS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(Mr,{heading:"Identity & Access",entries:o}),n&&Nx()&&h.jsx(Mr,{heading:"Infrastructure",entries:c})]})}function _v({aiEnabled:n,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:o}){return h.jsxs(h.Fragment,{children:[h.jsx(BN,{aiEnabled:n,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:o}),h.jsx(HN,{}),!t&&h.jsx(VN,{}),t&&h.jsx(GN,{}),t&&n&&h.jsx(KN,{}),t&&h.jsx(QN,{}),(t||s)&&h.jsx(XN,{isBuilder:t,isOps:s})]})}function WN({open:n,onClose:t,...s}){const i=En();return O.useEffect(()=>{t()},[i.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${n?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${n?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),h.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${n?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Qt,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(cA,{children:h.jsx(_v,{...s})})})]})]})}const wv="lt_event_feed_patterns";function ZN(n,t){if(n.startsWith("/topics/")){const d=decodeURIComponent(n.replace("/topics/",""));if(d&&!d.includes("/"))return`lt.events.${d}`}const s=n.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(n.startsWith("/escalations")){const d=new URLSearchParams(t).get("role");return d?`lt.events.system.escalation.${Rx(d)}.>`:"lt.events.system.escalation.>"}const i=n.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(n.startsWith("/workflows"))return"lt.events.system.workflow.>";const o=n.match(/^\/agents\/([^/]+)$/);if(o&&o[1]!=="new")return`lt.events.system.agent.${o[1]}.>`;if(n.startsWith("/agents"))return"lt.events.system.agent.>";if(n.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(n.startsWith("/files"))return"lt.events.system.file.>";if(n==="/")return"lt.events.system.>";const c=n.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(n.startsWith("/mcp"),"lt.events.system.>")}function eT(){try{const n=localStorage.getItem(wv);return n?JSON.parse(n):[]}catch{return[]}}function rd(n){try{localStorage.setItem(wv,JSON.stringify(n))}catch{}}function tT(){const{pathname:n,search:t}=En(),[s,i]=O.useState(eT),o=O.useMemo(()=>ZN(n,t),[n,t]),c=O.useMemo(()=>{const u=new Set([o,...s]);return Array.from(u)},[o,s]),d=O.useCallback(u=>{const m=u.startsWith("lt.events.")?u:`lt.events.${u}`;i(b=>{if(b.includes(m))return b;const x=[...b,m];return rd(x),x})},[]),y=O.useCallback(u=>{i(m=>{const b=m.filter(x=>x!==u);return rd(b),b})},[]),g=O.useCallback(()=>{i([]),rd([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:d,removePattern:y,clearUserPatterns:g}}function nT({children:n,className:t=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:n})}const sd=280,Ab="cubic-bezier(0.4, 0, 0.2, 1)",Yc=40;function rT(n){if(!n)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,i=t-Yc*2,o=s-Yc*2,c=n.width/i,d=n.height/o,y=n.left+n.width/2-(Yc+i/2),g=n.top+n.height/2-(Yc+o/2);return`translate(${y}px, ${g}px) scale(${c}, ${d})`}function Sv({open:n,onClose:t,sourceRef:s,children:i}){const[o,c]=O.useState(null),d=O.useRef(null),y=O.useRef(!1);O.useEffect(()=>{var x,v;n&&!y.current?(d.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&y.current&&o==="open"&&(d.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),y.current=n},[n,s,o]),O.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),O.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),O.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&t()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,t]);const g=O.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(O.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),sd+50);return()=>clearTimeout(x)},[o]),!o)return null;const u=o==="entering"||o==="exiting",m=u?rT(d.current):"none",b=u?0:1;return Hd.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${sd}ms ${Ab}, opacity ${sd}ms ${Ab}`,transform:m,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function sT({className:n}){return h.jsx("svg",{className:n,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 iT({className:n}){return h.jsx("svg",{className:n,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 aT({className:n}){return h.jsx("svg",{className:n,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 oT({className:n}){return h.jsx("svg",{className:n,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 lT({className:n}){return h.jsx("svg",{className:n,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 cT({className:n}){return h.jsx("svg",{className:n,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 uT(n){const t=n.trim().split(`
57
+ `);if(t.length<2)return n;const s=y=>y.split("|").map(g=>g.trim()).filter(Boolean),i=s(t[0]),o=t.slice(2),c=i.map(y=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${y}</th>`).join(""),d=o.map(y=>`<tr class="border-t border-surface-border">${s(y).map(m=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${m}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${d}</tbody></table>`}function Kc(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function fT(n){const t=[];let s=n.replace(/```(\w*)\n([\s\S]*?)```/g,(g,u,m)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${m}</code></pre>`),`\0CODE${b}\0`});const i=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(i,(g,u,m,b)=>uT(`${u}
58
+ ${m}
59
+ ${b.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,u)=>`<h4 id="${Kc(u)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${u}</h4>`).replace(/^### (.+)$/gm,(g,u)=>`<h3 id="${Kc(u)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${u}</h3>`).replace(/^## (.+)$/gm,(g,u)=>`<h2 id="${Kc(u)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${u}</h2>`).replace(/^# (.+)$/gm,(g,u)=>`<h1 id="${Kc(u)}" class="text-lg font-bold text-text-primary mb-3">${u}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const u=g.replace(/^> /gm,"").trim(),m=/⚠️|warning|caution/i.test(u),b=/note:|ℹ️|info/i.test(u);return`<div class="${m?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${m?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${u}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,u)=>t[parseInt(u,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",y=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const u=g.trim();if(!u)return"";const m=[];let b=u,x;for(;(x=y.exec(b))!==null;){const v=x.index+x[0].length;m.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),y.lastIndex=0}return b&&m.push(b),m.map(v=>{const _=v.trim();return _?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(_)?_:`<p class="${d}">${_}</p>`:""}).join("")}).join(""),s}const hT=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function dT(n){return hT.test(n)}function ku({content:n,className:t,onClick:s}){const i=O.useMemo(()=>fT(n),[n]);return h.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function yu({data:n,depth:t=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:t>0,[c,d]=O.useState(o),[y,g]=O.useState(s);if(s!==void 0&&s!==y&&(g(s),d(s%2===0&&t>0)),n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',n,'"']});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",n.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:n.map((u,m)=>h.jsxs("div",{children:[h.jsx(yu,{data:u,depth:t+1,generation:s}),m<n.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof n=="object"){const u=Object.entries(n);return u.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?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:u.map(([m,b],x)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:m}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(yu,{data:b,depth:t+1,generation:s}),x<u.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(n)})}function go({data:n,depth:t=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&dT(n)?h.jsx(ku,{content:n}):h.jsx("span",{className:"text-text-primary",children:n});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:n.map((s,i)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(go,{data:s,depth:t+1})})]},i))});if(typeof n=="object"){const s=Object.entries(n);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,o])=>{const c=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(go,{data:o,depth:t+1})}):h.jsx(go,{data:o,depth:t+1})]},i)})})}return h.jsx("span",{children:String(n)})}function jb({mode:n,setMode:t,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:d,onClose:y,large:g}){const u=g?"w-5 h-5":"w-3.5 h-3.5",m=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent 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:[n==="json"&&h.jsx("button",{onClick:i,className:m,title:s?"Expand all":"Collapse all",children:s?h.jsx(cT,{className:u}):h.jsx(lT,{className:u})}),h.jsx("button",{onClick:()=>t(n==="json"?"tree":"json"),className:m,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(sT,{className:u}):h.jsx(iT,{className:u})}),h.jsx("button",{onClick:o,className:m,title:"Copy to clipboard",children:c?h.jsx(oT,{className:`${u} text-status-success`}):h.jsx(aT,{className:u})}),d&&h.jsx("button",{onClick:d,className:m,title:"Fullscreen",children:h.jsx(Hb,{className:u})}),y&&h.jsx("button",{onClick:y,className:m,title:"Close (Esc)",children:h.jsx(Fb,{className:u})})]})}function mT({data:n,label:t,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=O.useRef(null),[d,y]=O.useState(o??"json"),[g,u]=O.useState(!1),[m,b]=O.useState(!1),[x,v]=O.useState(i?0:1),[_,S]=O.useState(1),C=x%2===0,L=_%2===0,U=O.useCallback(()=>v($=>$+1),[]),re=O.useCallback(()=>S($=>$+1),[]);let le=n;if(typeof n=="string")try{le=JSON.parse(n)}catch{}const D=async()=>{const $=typeof n=="string"?n:JSON.stringify(le,null,2);await navigator.clipboard.writeText($),u(!0),setTimeout(()=>u(!1),2e3)},z=O.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",K=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",M=ae?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:K,children:[t&&h.jsx(nT,{children:t}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(jb,{mode:d,setMode:y,isCollapsed:C,onToggleCollapse:U,onCopy:D,copied:g,onFullscreen:z})}),h.jsx("div",{className:M,children:d==="json"?h.jsx(yu,{data:le,generation:x}):h.jsx(go,{data:le})})]}),h.jsxs(Sv,{open:m,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(jb,{mode:d,setMode:y,isCollapsed:L,onToggleCollapse:re,onCopy:D,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(yu,{data:le,generation:_}):h.jsx(go,{data:le})})]})]})}const pT=100,kb=500;let yT=0;const Ev={"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 Ov(n){const t=n.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:n}function Nb({event:n,forceExpanded:t=!1}){var x,v;const[s,i]=O.useState(t),o=Ev[Ov(n.type)]||"text-text-tertiary";O.useEffect(()=>{i(t)},[t]);const c=t,d=c?"text-xs":"text-2xs",y=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",u=c?"w-3.5 h-3.5":"w-2.5 h-2.5",m=c?"py-2 px-4":"py-1 px-3",b=c?"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:()=>i(!s),className:`flex items-center gap-2 ${m} 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(n.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${y} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:n.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(x=n.data)!=null&&x.workflowId?String(n.data.workflowId):"",(v=n.data)!=null&&v.escalationId?` esc:${String(n.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${u} 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(Am,{open:s,children:h.jsx("div",{className:b,children:h.jsx(mT,{data:n.data})})})]})}function gT({open:n,onToggle:t,configOpen:s,onToggleConfig:i}){const[o,c]=O.useState([]),[d,y]=O.useState(!1),[g,u]=O.useState(""),m=O.useRef(null),b=O.useRef(new Map),{subscribe:x}=O.useContext(ta),{connected:v}=dx(),{patterns:_,pagePattern:S,userPatterns:C,addPattern:L,removePattern:U}=tT(),re=O.useCallback(z=>{const ae=String(z.type||"unknown");if(ae.startsWith("mesh."))return;const K=`${ae}:${z.timestamp||""}:${z.escalationId||z.workflowId||z.taskId||""}`,M=Date.now(),$=b.current.get(K);if(!($&&M-$<kb)){if(b.current.set(K,M),b.current.size>200)for(const[W,Q]of b.current)M-Q>kb*2&&b.current.delete(W);c(W=>[{id:++yT,type:ae,timestamp:z.timestamp||new Date().toISOString(),data:z},...W].slice(0,pT))}},[]),le=O.useRef(re);le.current=re;const D=n||d||s;return O.useEffect(()=>{if(!D)return;const z=_.map(ae=>x(ae,K=>le.current(K)));return()=>z.forEach(ae=>ae())},[x,_.join(","),D]),O.useEffect(()=>{n&&m.current&&(m.current.scrollTop=0)},[o.length,n]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[n?h.jsx(Fd,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(Gb,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[o.length," events"]}),o.length>0&&!n&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Ev[Ov(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 ${v?"text-status-success":"text-status-warning hover:text-text-primary cursor-pointer"}`,title:v?"Live events connected":"Events disconnected — click to reconnect",onClick:z=>{z.stopPropagation(),v||window.location.reload()},children:h.jsx(zb,{className:"w-3 h-3"})}),h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:z=>{z.stopPropagation(),i()},children:h.jsx(mS,{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:z=>{z.stopPropagation(),y(!0)},children:h.jsx(Hb,{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:z=>{z.stopPropagation(),c([])},children:h.jsx(pS,{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-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:S.replace("lt.events.","")}),C.map(z=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[z.replace("lt.events.",""),h.jsx("button",{onClick:()=>U(z),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Qt,{className:"w-2 h-2"})})]},z))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&g.trim()&&(L(g.trim()),u(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(L(g.trim()),u(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx($b,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Am,{open:n,children:h.jsx("div",{ref:m,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(z=>h.jsx(Nb,{event:z},z.id))})}),h.jsxs(Sv,{open:d,onClose:()=>y(!1),sourceRef:m,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>y(!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(Fb,{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(z=>h.jsx(Nb,{event:z,forceExpanded:!0},z.id))]})]})}function bT(){return ze({queryKey:["docs"],queryFn:()=>he("/docs"),staleTime:5*6e4})}function xT(n){return ze({queryKey:["docs",n],queryFn:()=>he(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function vT(){const[n,t]=O.useState([]),[s,i]=O.useState([]),[o,c]=O.useState(null),d=O.useRef(o),y=O.useRef(n),g=O.useRef(s);d.current=o,y.current=n,g.current=s;const u=O.useCallback((_,S)=>{var L;const C=d.current;if(C){const U=((L=S==null?void 0:S.current)==null?void 0:L.scrollTop)??0;t([...y.current,{...C,scrollTop:U}])}i([]),c({path:_,scrollTop:0})},[]),m=O.useCallback(_=>{var U;const S=y.current;if(S.length===0)return;const C=S[S.length-1],L=d.current;if(L){const re=((U=_==null?void 0:_.current)==null?void 0:U.scrollTop)??0;i([...g.current,{...L,scrollTop:re}])}t(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),b=O.useCallback(_=>{var U;const S=g.current;if(S.length===0)return;const C=S[S.length-1],L=d.current;if(L){const re=((U=_==null?void 0:_.current)==null?void 0:U.scrollTop)??0;t([...y.current,{...L,scrollTop:re}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),x=O.useCallback(_=>{var L,U;const S=d.current;if(!S)return;const C=((L=_==null?void 0:_.current)==null?void 0:L.scrollTop)??0;t([...y.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((U=_==null?void 0:_.current)==null?void 0:U.scrollTop)??0})},[]),v=O.useCallback(()=>{t([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:u,goBack:m,goForward:b,pushScrollPosition:x,reset:v}}function _T(n,t){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((t?t.replace(/[^/]+$/,""):"")+o).split("/"),y=[];for(const g of d)g===".."?y.pop():g&&g!=="."&&y.push(g);o=y.join("/")}return{path:o,anchor:i}}function wT(n){if(!n.startsWith("#docs"))return null;const t=n.slice(1).split(":"),s=t[1]||"README.md",i=t[2]||void 0;return{path:s,anchor:i}}function ST(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function ET({content:n,currentPath:t,onNavigate:s,onAnchorClick:i}){const o=c=>{var u;const d=c.target,y=d.closest("[data-anchor]");if(y){c.preventDefault(),i();const m=y.dataset.anchor,b=(u=y.closest(".docs-content"))==null?void 0:u.querySelector(`#${CSS.escape(m)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=d.closest("[data-doc-link]");if(g){c.preventDefault();const{path:m,anchor:b}=_T(g.dataset.docLink,t);s(m,b);return}};return h.jsx(ku,{content:n,className:"docs-content",onClick:o})}function OT(n){const t=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){t.push(i);continue}let c=s;for(let d=0;d<o.length-1;d++){const y=o[d];c.has(y)||c.set(y,{label:y,children:[],subdirs:new Map});const g=c.get(y);d===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:t,dirs:s}}function AT({docs:n,selected:t,onSelect:s}){const{topLevel:i,dirs:o}=OT(n),c=y=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===y?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(y,g){return h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(yS,{className:"w-3 h-3",strokeWidth:1.5}),y.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...y.subdirs.values()].map(u=>d(u)),y.children.map(u=>h.jsx("button",{className:c(u.path),onClick:()=>s(u.path),children:u.title},u.path))]})]},y.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(y=>h.jsx("button",{className:c(y.path),onClick:()=>s(y.path),children:y.title},y.path)),[...o.values()].map(y=>d(y))]})}function jT({open:n,onClose:t}){var ae,K,M;const[s,i]=O.useState(!1),{data:o}=bT(),c=vT(),{data:d,isLoading:y}=xT(((ae=c.current)==null?void 0:ae.path)??null),g=O.useRef(null),[u,m]=O.useState(null);O.useEffect(()=>{u&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var W;const $=(W=g.current)==null?void 0:W.querySelector(`#${CSS.escape(u)}`);$==null||$.scrollIntoView({behavior:"smooth",block:"start"}),m(null)})},[u,d]);const b=O.useCallback(()=>{var Q;const $=wT(window.location.hash),W=($==null?void 0:$.path)??"README.md";((Q=c.current)==null?void 0:Q.path)!==W&&c.navigate(W,g),$!=null&&$.anchor&&m($.anchor)},[c]),x=O.useRef(!0);O.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const $=ST(c.current.path);window.location.hash!==$&&window.history.replaceState(null,"",window.location.pathname+window.location.search+$)},[n,(K=c.current)==null?void 0:K.path]),O.useEffect(()=>{if(!n)return;const $=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)},[n,b]);const v=O.useCallback(($,W)=>{W&&m(W),c.navigate($,g)},[c]),_=O.useCallback($=>{c.navigate($,g)},[c]),S=O.useCallback(()=>{c.goBack(g)},[c]),C=O.useCallback(()=>{c.goForward(g)},[c]),L=O.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(O.useEffect(()=>{if(n){x.current=!0,b();const $=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame($)}},[n]),!(n||s))return null;const re=()=>{i(!1),setTimeout(()=>{t(),c.reset()},200)},le=((M=c.current)==null?void 0:M.path)??null,D=c.backStack.length>0,z=c.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&&n?"opacity-100":"opacity-0"}`,onClick:re}),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&&n?"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:S,disabled:!D,className:`p-0.5 transition-colors ${D?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(Pb,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,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(id,{className:"w-4 h-4"})}),h.jsx(gS,{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:re,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Qt,{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(AT,{docs:o.docs,selected:le,onSelect:_}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:le?y?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(ET,{content:d.content,currentPath:le,onNavigate:v,onAnchorClick:L}):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(id,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function kT(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const Tb=2e3;function NT(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
60
+ ${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
61
+ `)}
62
+ [End prior conversation]
63
+
64
+ `}function TT(n){const t=n.summary,s=n.title;if(t){const i=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?t.slice(0,i).trim():t}return s||(typeof n=="string"?n:"Query completed.")}const Av=O.createContext(null);function CT({children:n}){const t=En(),[s,i]=O.useState(!1),[o,c]=O.useState([]),[d,y]=O.useState(null),[g,u]=O.useState({}),m=O.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??kT(t.pathname)};O.useEffect(()=>()=>{m.current&&clearInterval(m.current)},[]);const x=O.useCallback(()=>i(L=>!L),[]),v=O.useCallback(L=>{u(L)},[]),_=O.useCallback(()=>{c([]),y(null)},[]),S=O.useCallback(async L=>{var K;const U=new Date().toISOString(),re={id:`user-${Date.now()}`,role:"user",content:L,timestamp:U},le={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:U,pending:!0};c(M=>[...M,re,le]);const D={...b};(K=D.entities)!=null&&K.yamlContent&&D.entities.yamlContent.length>Tb&&(D.entities={...D.entities,yamlContent:D.entities.yamlContent.slice(0,Tb)+`
65
+ ... (truncated)`});const ae=`${NT(o.concat(re))}${L}`;try{const $=(await he("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:D.suggestedTags,context:D,wait:!1,direct:!0})})).workflow_id;y($),c(W=>W.map(Q=>Q.id===le.id?{...Q,workflowId:$}:Q)),m.current&&clearInterval(m.current),m.current=setInterval(async()=>{var W;try{const Q=await he(`/workflows/${$}/result`),oe=(W=Q==null?void 0:Q.result)==null?void 0:W.data;if(oe){m.current&&clearInterval(m.current),m.current=null,y(null);const ve=TT(oe);let ke;try{ke=(await he(`/workflow-states/${$}/execution`)).duration_ms}catch{}c(Y=>Y.map(Z=>Z.id===le.id?{...Z,content:ve,timestamp:new Date().toISOString(),pending:!1,durationMs:ke}:Z))}}catch{}},3e3)}catch{c(M=>M.map($=>$.id===le.id?{...$,content:"Failed to submit query. Please try again.",pending:!1}:$))}},[o,b]),C=O.useCallback(async L=>{const U=o.find(D=>D.id===L);if(!(U!=null&&U.workflowId)||U.compilationStatus==="compiling"||U.compilationStatus==="done")return;const re=o.indexOf(U),le=o.slice(0,re).reverse().find(D=>D.role==="user");if(le){c(D=>D.map(z=>z.id===L?{...z,compilationStatus:"compiling"}:z));try{const D=await he("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:le.content,summary:U.content})}),z=await he("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:U.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:D.tool_name,description:D.description,tags:D.tags,app_id:""})});await he(`/yaml-workflows/${z.id}/deploy`,{method:"POST"}),c(ae=>ae.map(K=>K.id===L?{...K,compilationStatus:"done"}:K))}catch(D){const z=D instanceof Error?D.message:"Compilation failed";c(ae=>ae.map(K=>K.id===L?{...K,compilationStatus:"error",compilationError:z}:K))}}},[o]);return h.jsx(Av.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:d,clearMessages:_,compileMessage:C},children:n})}function jv(){const n=O.useContext(Av);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function MT(){const{helpOpen:n,toggleHelp:t}=jv();return h.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":n?"Close help":"Ask for help",children:n?h.jsx(Qt,{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(${Pt}/logo512.png)`}})})}function RT({ms:n,className:t=""}){const s=Cj(n),i=O.useMemo(()=>n==null?[]:[{label:"ms",value:String(n)},{label:"sec",value:`${(n/1e3).toFixed(3)}s`},{label:"text",value:s}],[n,s]);return n==null?h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):h.jsx(Yx,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const DT=["sm","md","lg","full"],Cb={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"},Mb={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function qT({which:n}){const t="stroke-current";switch(n){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function LT({msg:n}){const[t,s]=O.useState(0);O.useEffect(()=>{const d=new Date(n.timestamp).getTime(),y=()=>s(Math.floor((Date.now()-d)/1e3));y();const g=setInterval(y,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(t/60),o=t%60,c=i>0?`${i}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:c})]}),n.workflowId&&h.jsxs(Nr,{to:`/workflows/executions/${n.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(Gd,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function BT({msg:n,compileMessage:t}){const s=n.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(Kx,{date:n.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),n.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(RT,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(Nr,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(Gd,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>t(n.id),disabled:n.compilationStatus==="compiling"||n.compilationStatus==="done",className:"transition-colors",title:n.compilationStatus==="done"?"Compiled — future queries will match this pipeline":n.compilationStatus==="error"?n.compilationError??"Compilation failed":n.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(bS,{className:`w-2.5 h-2.5 ${n.compilationStatus==="done"?"text-status-success":n.compilationStatus==="error"?"text-status-error":n.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function UT(){const{helpOpen:n,setHelpOpen:t,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:d,compileMessage:y}=jv(),[g,u]=O.useState(""),[m,b]=O.useState("md"),[x,v]=O.useState(!0),_=O.useRef(null),S=O.useRef(null);if(O.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[s]),O.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),O.useEffect(()=>{if(!n)return;const D=z=>{z.key==="Escape"&&(m==="full"?b("lg"):m==="lg"?b("md"):m==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[n,m,t]),!n)return null;const C=()=>{const D=g.trim();!D||c||(i(D),u(""),S.current&&(S.current.style.height="auto"))},L=D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),C())},U=m==="full",re=o.page.replace(/-/g," "),le=U?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${U?Cb.full:`right-6 ${Cb[m]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:le,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!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 ${x?"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-2xs text-text-tertiary truncate",children:re})]}),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:DT.map(D=>h.jsx("button",{onClick:()=>b(D),className:`p-1 rounded transition-colors ${D===m?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":D===m,"aria-label":Mb[D],title:Mb[D],children:h.jsx(qT,{which:D})},D))}),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(xS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Qt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:_,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${x?"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(D=>h.jsxs("div",{className:`text-xs leading-relaxed ${D.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 ${D.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:D.pending?h.jsx(LT,{msg:D}):D.role==="assistant"?h.jsx(ku,{content:D.content}):D.content}),!D.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(BT,{msg:D,compileMessage:y})})]},D.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:S,value:g,onChange:D=>{u(D.target.value);const z=D.target;z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,120)}px`},onKeyDown:L,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:!!c}),h.jsx("button",{onClick:C,disabled:!g.trim()||!!c,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(vS,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const PT=6e3,zT="scan";function $T(){const{lastResult:n}=Sm(),{open:t,ownerKey:s}=ym(),[i,o]=O.useState(null);return O.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),PT);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||t&&s===zT||n.source===So.TOOLBAR?null:h.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:h.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[h.jsx(Oo,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx(Em,{result:n})}),h.jsx("button",{type:"button",onClick:()=>o(n.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:h.jsx(Qt,{className:"w-3.5 h-3.5"})})]})})}const kv="lt-announcement-dismissed:";function IT(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HT(n){try{return localStorage.getItem(`${kv}${n}`)==="1"}catch{return!1}}function FT(){const{isAuthenticated:n,userRoleNames:t}=Rt(),{data:s}=zx(n),i=Ie(),[o,c]=O.useState(null),[d,y]=O.useState(0);_n(bA,()=>{i.invalidateQueries({queryKey:["announcements"]})});const g=Date.now(),u=((s==null?void 0:s.announcements)??[]).filter(b=>!HT(b.id)&&new Date(b.expires_at).getTime()>g&&(b.roles.length===0||b.roles.some(x=>t.includes(x))));if(O.useEffect(()=>{const b=((s==null?void 0:s.announcements)??[]).map(v=>new Date(v.expires_at).getTime()-Date.now()).filter(v=>v>0);if(b.length===0)return;const x=setTimeout(()=>y(v=>v+1),Math.min(...b)+250);return()=>clearTimeout(x)},[s,d]),u.length===0)return null;const m=b=>{try{localStorage.setItem(`${kv}${b}`,"1")}catch{}y(x=>x+1)};return h.jsx("div",{"data-testid":"announcement-banner",className:"relative z-40",children:u.map(b=>{const x=o===b.id,v=b.title??b.body.split(`
66
+ `)[0];return h.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),h.jsxs("button",{type:"button",onClick:()=>c(x?null:b.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[h.jsx("span",{className:"truncate",children:v}),x?h.jsx(Gb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(Fd,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>m(b.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${v}`,children:h.jsx(Qt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),x&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(ku,{content:IT(b.body)})})]},b.id)})})}function GT(){var D;const{isBuilder:n,isOps:t,viewAs:s}=Cx(),{canSeePaceBoard:i}=Mx();YO();const{data:o}=Xn(),c=jx(),d=c!==null?c:!!((D=o==null?void 0:o.ai)!=null&&D.enabled),{collapsed:y,toggle:g}=mm(),[u,m]=O.useState(!1),[b,x]=O.useState(!1),[v,_]=O.useState(!1),[S,C]=O.useState(()=>window.location.hash.startsWith("#docs")),L=En(),U=O.useRef(null),{kiosk:re,homePath:le}=qx();return O.useEffect(()=>{const z=U.current;z&&(z.classList.remove("animate-page-in"),z.offsetWidth,z.classList.add("animate-page-in"))},[L.pathname]),O.useEffect(()=>{const z=()=>{window.location.hash.startsWith("#docs")&&C(!0)};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]),re&&le&&!aA(L.pathname)?h.jsx(bn,{to:le,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(MN,{onToggleEventFeed:()=>m(z=>!z),onToggleDocs:()=>C(z=>!z),onToggleNav:re?void 0:()=>x(z=>!z)}),h.jsx(FT,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!re&&h.jsxs("aside",{className:`${y?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(_v,{aiEnabled:d,isBuilder:n,isOps:t,viewAs:s,canSeePaceBoard:i})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${y?"flex justify-center":"flex items-center px-7"}`,"aria-label":y?"Expand sidebar":"Collapse sidebar",children:y?h.jsx(_S,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(wS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!y&&(o==null?void 0:o.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs 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 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:U,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(Ks,{})})}),h.jsx(VT,{})]}),!re&&h.jsx(WN,{open:b,onClose:()=>x(!1),aiEnabled:d,isBuilder:n,isOps:t,viewAs:s,canSeePaceBoard:i}),h.jsx(gT,{open:u,onToggle:()=>m(z=>!z),configOpen:v,onToggleConfig:()=>_(z=>!z)}),h.jsx(jT,{open:S,onClose:()=>{C(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(MT,{}),d&&h.jsx(UT,{}),h.jsx($T,{})]})}function VT(){const{node:n,width:t,open:s}=ym();return h.jsx(fA,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:n})}function YT(){const{isAuthenticated:n}=Rt(),t=En();return n?h.jsx(lA,{children:h.jsx(uA,{children:h.jsx(CT,{children:h.jsx(Gj,{children:h.jsx(ok,{children:h.jsx(GT,{})})})})})}):h.jsx(bn,{to:"/login",state:{from:t.pathname},replace:!0})}function Nv({provider:n,className:t="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),h.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),h.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),h.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function KT(){return he("/auth/oauth/providers")}async function JT(n,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return he(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function S5(){return ze({queryKey:["oauth-connections"],queryFn:()=>he("/auth/oauth/connections")})}function E5(){const n=Ie();return Ve({mutationFn:({provider:t,label:s})=>JT(t,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function QT(){var ae;const{login:n,isAuthenticated:t}=Rt(),s=Zi(),i=En(),o=new URLSearchParams(i.search),c=o.get("token"),d=o.get("error"),y=((ae=i.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=O.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[u,m]=O.useState(""),[b,x]=O.useState(""),[v,_]=O.useState(d||""),[S,C]=O.useState(!1),[L,U]=O.useState(!!c),[re,le]=O.useState([]),D=O.useRef(!1);if(O.useEffect(()=>{c||D.current||(D.current=!0,(async()=>{var K,M,$,W;try{const Q=await Yd().catch(()=>null);if(!((K=Q==null?void 0:Q.auth)!=null&&K.sso))return;const oe=await fetch(`${Pt}/api/auth/sso`,{method:"POST"});if(!oe.ok){_("Host authentication required — please log in to your organization first");return}const ve=await oe.json();ve.token&&((M=Q.auth)!=null&&M.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",Q.auth.ssoLogoutUrl),U(!0),n(ve.token,void 0,{displayName:($=ve.user)==null?void 0:$.display_name,username:(W=ve.user)==null?void 0:W.external_id}))}catch{}})())},[]),O.useEffect(()=>{c||KT().then(le).catch(()=>{})},[]),O.useEffect(()=>{if(!L)return;const K=setTimeout(()=>s(y,{replace:!0}),1500);return()=>clearTimeout(K)},[L]),t&&!L)return h.jsx(bn,{to:y,replace:!0});const z=async K=>{var M,$;if(K.preventDefault(),_(""),!u.trim()||!b){_("Username and password are required");return}C(!0);try{const W=await fetch(`${Pt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.trim(),password:b})}),Q=await W.json();if(!W.ok){_(Q.error||"Login failed");return}U(!0),n(Q.token,{username:u.trim(),password:b},{displayName:(M=Q.user)==null?void 0:M.display_name,username:($=Q.user)==null?void 0:$.external_id})}catch{_("Unable to connect to server")}finally{C(!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 ${L?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(xm,{size:"lg",hideLabel:L})}),h.jsxs("form",{onSubmit:z,className:`space-y-5 transition-opacity duration-300 ${L?"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:u,onChange:K=>m(K.target.value),className:"input",placeholder:"Enter your username",autoFocus:!L,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:b,onChange:K=>x(K.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),v&&h.jsx("p",{className:"text-sm text-status-error",children:v}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||L,children:S?"Signing in...":"Sign In"}),re.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:re.filter(K=>K.provider!=="anthropic").map(K=>h.jsxs("a",{href:`${Pt}/api/auth/oauth/${K.provider}?returnTo=${encodeURIComponent(y)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(Nv,{provider:K.provider}),"Sign in with ",K.name]},K.provider))})]})]})]})})}function Rb(){const{isAuthenticated:n}=Rt(),t=Zi(),s=En(),i=new URLSearchParams(s.search),o=i.get("state")||"";O.useEffect(()=>{n||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,d]=O.useState(""),[y,g]=O.useState(i.get("label")||"default"),[u,m]=O.useState(""),[b,x]=O.useState(!1),v=c.trim().startsWith("sk-ant-oat"),_=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const L=c.trim();if(!L){m("A token or API key is required");return}if(!L.startsWith("sk-ant-")){m('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}x(!0),m("");const U=`${Pt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(L)}&state=${encodeURIComponent(o)}`;window.location.href=U};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(xm,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(Nv,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",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:S,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:c,onChange:C=>d(C.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),v&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),_&&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:y,onChange:C=>g(C.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").'})]}),u&&h.jsx("p",{className:"text-sm text-status-error",children:u}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"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-2xs",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 Jc({roleTypes:n,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=Rt();return i?h.jsx(Ks,{}):n&&n.some(d=>c(d))?h.jsx(Ks,{}):t&&t.some(d=>o(d))?h.jsx(Ks,{}):h.jsx(bn,{to:s,replace:!0})}function XT(){const{data:n,isSuccess:t}=vv();return t&&n.length===0?h.jsx(bn,{to:"/",replace:!0}):h.jsx(Ks,{})}function WT({redirectTo:n="/"}){var i;const{data:t,isLoading:s}=Xn();return s||!t?null:(i=t.ai)!=null&&i.enabled?h.jsx(Ks,{}):h.jsx(bn,{to:n,replace:!0})}function ZT({flag:n,redirectTo:t="/"}){var o;const{data:s,isLoading:i}=Xn();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(bn,{to:t,replace:!0}):h.jsx(Ks,{})}const e3=O.lazy(()=>Oe(()=>import("./ProcessesListPage-5NnysKFC.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(n=>({default:n.ProcessesListPage}))),t3=O.lazy(()=>Oe(()=>import("./ProcessDetailPage-BLGjZXpM.js"),__vite__mapDeps([16,1,2,17,12,18,15,9,4,19,20]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),n3=O.lazy(()=>Oe(()=>import("./McpOverview-CMGUq8hx.js"),__vite__mapDeps([21,1,22,23,24,25,13,12,26,4]),import.meta.url).then(n=>({default:n.McpOverview}))),r3=O.lazy(()=>Oe(()=>import("./McpRunsPage-B6rb5QBf.js"),__vite__mapDeps([27,1,23,24,3,4,28,25,6,7,8,15,12,29,13,11,10,14,30]),import.meta.url).then(n=>({default:n.McpRunsPage}))),s3=O.lazy(()=>Oe(()=>import("./McpRunDetailPage-DBm8hUaW.js"),__vite__mapDeps([31,1,23,13,12,32,33,11,34,18,4,35,14,36]),import.meta.url).then(n=>({default:n.McpRunDetailPage}))),i3=O.lazy(()=>Oe(()=>import("./McpQueryPage-CNSNMagY.js"),__vite__mapDeps([37,1,13,12,7,8,11,10,14,6,9,29,15,30,3,4,38]),import.meta.url).then(n=>({default:n.McpQueryPage}))),a3=O.lazy(()=>Oe(()=>import("./McpQueryDetailPage-CdhLhaKn.js"),__vite__mapDeps([39,1,13,12,18,38,4,24,40,41,23,2,42,43,44,45,46,47,36,48,34,35]),import.meta.url).then(n=>({default:n.McpQueryDetailPage}))),o3=O.lazy(()=>Oe(()=>import("./EscalationsOverview-Bx6Zrzm-.js"),__vite__mapDeps([49,1,13,12,26,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),l3=O.lazy(()=>Oe(()=>import("./AvailableEscalationsPage-CqM_MOMy.js"),__vite__mapDeps([50,1,4,51,12,52,53,5,54,55,11,56,19,15,20,57,58,7,8,18,10,3,30]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),c3=O.lazy(()=>Oe(()=>import("./OperatorDashboard-DBOscDnf.js"),__vite__mapDeps([59,1,3,4,5,6,51,7,8,10,30,54,12,55,11,56,19,15,20,57,58,18,14]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),u3=O.lazy(()=>Oe(()=>import("./index-CegPUKpc.js"),__vite__mapDeps([60,1,52,53,5,61,62,12,58,7,8,18,20,10,4,13,14,19,57,36,63]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),f3=O.lazy(()=>Oe(()=>import("./WorkflowsOverview-BTMc2PJ_.js"),__vite__mapDeps([64,1,13,12,26,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),h3=O.lazy(()=>Oe(()=>import("./index-DPLssnMW.js"),__vite__mapDeps([65,1,13,12,11,15,66,58,7,8,18,20,10,4,67,45,46,62,61]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),d3=O.lazy(()=>Oe(()=>import("./index-DPLssnMW.js"),__vite__mapDeps([65,1,13,12,11,15,66,58,7,8,18,20,10,4,67,45,46,62,61]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),m3=O.lazy(()=>Oe(()=>import("./WorkflowsDashboard-B0r2lQXk.js"),__vite__mapDeps([68,1,29,28,25,4,3,6,7,8,15,12,13,11,10,14,30]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"durable"})}))),p3=O.lazy(()=>Oe(()=>import("./WorkflowsDashboard-B0r2lQXk.js"),__vite__mapDeps([68,1,29,28,25,4,3,6,7,8,15,12,13,11,10,14,30]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"all"})}))),y3=O.lazy(()=>Oe(()=>import("./YamlWorkflowsPage-BAuXfwi0.js"),__vite__mapDeps([69,1,24,3,4,13,12,11,8,47,67,18]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),g3=O.lazy(()=>Oe(()=>import("./GraphInvokePage-DV7Y0fe2.js"),__vite__mapDeps([70,1,24,13,12,42,44,45,46,43,4,47,67]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),b3=O.lazy(()=>Oe(()=>import("./YamlWorkflowDetailPage-DUiCVnZp.js"),__vite__mapDeps([71,1,24,18,67,12,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),x3=O.lazy(()=>Oe(()=>import("./TasksListPage-BQNaSzCn.js"),__vite__mapDeps([72,1,2,3,4,7,8,18,56,48,10,11,12,13,15]),import.meta.url).then(n=>({default:n.TasksListPage}))),v3=O.lazy(()=>Oe(()=>import("./TaskDetailPage-NqVZF3jW.js"),__vite__mapDeps([73,1,2,18,56,13,12,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),Db=O.lazy(()=>Oe(()=>import("./WorkflowExecutionPage-CmHGcaN9.js"),__vite__mapDeps([74,1,33,11,12,34,18,4,35,2,13,32,14,36]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),_3=O.lazy(()=>Oe(()=>import("./AdminDashboard-Drs-9TRM.js"),__vite__mapDeps([75,1,2,22,17,12,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),w3=O.lazy(()=>Oe(()=>import("./index-D7ESqn22.js"),__vite__mapDeps([76,1,7,8,11,12,30,3,4,13,77,15]),import.meta.url).then(n=>({default:n.WorkersPage}))),S3=O.lazy(()=>Oe(()=>import("./index-DoETPlJP.js"),__vite__mapDeps([78,1,11,12,79,19,15,13,4,45,46,67,62,58,7,8,18,20,10,66]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),qb=O.lazy(()=>Oe(()=>import("./index-DoETPlJP.js"),__vite__mapDeps([78,1,11,12,79,19,15,13,4,45,46,67,62,58,7,8,18,20,10,66]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),E3=O.lazy(()=>Oe(()=>import("./index-DWse7ERF.js"),__vite__mapDeps([80,1,22,8,79,13,12,11,10,3,4,81,44,45,46,47,43,30,18]),import.meta.url).then(n=>({default:n.McpServersPage}))),Lb=O.lazy(()=>Oe(()=>import("./index-e2X-s0EQ.js"),__vite__mapDeps([82,1,22,13,12,40,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),O3=O.lazy(()=>Oe(()=>import("./index-DL83W7Gu.js"),__vite__mapDeps([83,1,3,4,7,8,10,11,12,79,30,13,19,46,48,84,85,32]),import.meta.url).then(n=>({default:n.UsersPage}))),A3=O.lazy(()=>Oe(()=>import("./RolesPage-BmW1LzkU.js"),__vite__mapDeps([86,1,11,12,13,19,4]),import.meta.url).then(n=>({default:n.RolesPage}))),j3=O.lazy(()=>Oe(()=>import("./RoleDetailPage-C_LIoe1j.js"),__vite__mapDeps([87,1,88,79,12,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),k3=O.lazy(()=>Oe(()=>import("./PersonasPage-DRzOZcVa.js"),__vite__mapDeps([89,1,84,11,12,13,19,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),N3=O.lazy(()=>Oe(()=>import("./PersonaDetailPage-BGRdGpeR.js"),__vite__mapDeps([90,1,84,19,12,85,88,79,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),T3=O.lazy(()=>Oe(()=>import("./EscalationSchemaPage-D4VlEwyS.js"),__vite__mapDeps([91,1,12,4]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),C3=O.lazy(()=>Oe(()=>import("./EscalationListSchemaPage-BeQUTUEO.js"),__vite__mapDeps([92,1,12,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),M3=O.lazy(()=>Oe(()=>import("./ScanCodesPage-FiYIYB-m.js"),__vite__mapDeps([93,1,13,12,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),R3=O.lazy(()=>Oe(()=>import("./ScanSchemeDetailPage-BiAqtD-a.js"),__vite__mapDeps([94,1,79,13,12,4]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),D3=O.lazy(()=>Oe(()=>import("./ScanStationPage-8CdOtbCD.js"),__vite__mapDeps([95,1,12,63,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),q3=O.lazy(()=>Oe(()=>import("./index-CsKiRyhy.js"),__vite__mapDeps([96,1,13,12,53,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),Bb=O.lazy(()=>Oe(()=>import("./OperationsPage-Dxk1fAMg.js").then(n=>n.O),__vite__mapDeps([97,1,55,12,4,13]),import.meta.url).then(n=>({default:n.OperationsPage}))),L3=O.lazy(()=>Oe(()=>import("./index-BNZknxFY.js"),__vite__mapDeps([98,1,17,12,11,3,4,28,25,41,77,7,8,30]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),B3=O.lazy(()=>Oe(()=>import("./index-DvxxrFBo.js"),__vite__mapDeps([99,1,35,12,3,4,28,25,6,7,8,10,11,13,14]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),U3=O.lazy(()=>Oe(()=>import("./CredentialsPage-hniUAFBK.js"),__vite__mapDeps([100,1,13,12,48,79,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),P3=O.lazy(()=>Oe(()=>import("./index-C-Xr2V3F.js"),__vite__mapDeps([101,1,4,13,12,11,14,6,8,102,48]),import.meta.url).then(n=>({default:n.FilesPage}))),z3=O.lazy(()=>Oe(()=>import("./index-PcyGjmBm.js"),__vite__mapDeps([103,1,13,12,11,14,10,8,102,48,104,40,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),$3=O.lazy(()=>Oe(()=>import("./HomePage-G785SWcW.js"),__vite__mapDeps([105,1,23,25,19,12,15,14,97,55,4,13,51]),import.meta.url).then(n=>({default:n.HomePage}))),I3=O.lazy(()=>Oe(()=>import("./AgentsPage-D77JeViQ.js"),__vite__mapDeps([106,1,107,3,4,6,7,8,10,11,12,13,14]),import.meta.url).then(n=>({default:n.AgentsPage}))),H3=O.lazy(()=>Oe(()=>import("./AgentDetailPage-CGBulM4_.js"),__vite__mapDeps([108,1,107,109,12,15,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),Ub=O.lazy(()=>Oe(()=>import("./AgentConfigPage-BDPDZ7-v.js"),__vite__mapDeps([110,1,107,109,12,13,104,44,45,46,24,111,112,15,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),F3=O.lazy(()=>Oe(()=>import("./CapabilitiesPage-D9TC2iKy.js"),__vite__mapDeps([113,1,111,81,22,44,45,46,12,47,4,43,13,11]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),G3=O.lazy(()=>Oe(()=>import("./TopicsPage-h-oyTeEJ.js"),__vite__mapDeps([114,1,112,13,12,11,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),V3=O.lazy(()=>Oe(()=>import("./TopicDetailPage-TXX3QNSo.js"),__vite__mapDeps([115,1,112,14,12,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function Y3(){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 Se({children:n}){return h.jsx(O.Suspense,{fallback:h.jsx(Y3,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const Tv=new Hw({defaultOptions:{queries:{staleTime:1e4,retry:(n,t)=>t instanceof Error&&t.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{Tv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",t=`${n}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(i)}`}});const K3=Vw([{path:"/login",element:h.jsx(QT,{})},{path:"/connect/anthropic",element:h.jsx(Rb,{})},{path:"/connect/:provider",element:h.jsx(Rb,{})},{path:"/",element:h.jsx(YT,{}),children:[{index:!0,element:h.jsx(Se,{children:h.jsx($3,{})})},{path:"processes/all",element:h.jsx(Se,{children:h.jsx(e3,{})})},{path:"processes/detail/:originId",element:h.jsx(Se,{children:h.jsx(t3,{})})},{path:"credentials",element:h.jsx(Se,{children:h.jsx(U3,{})})},{path:"connections",element:h.jsx(bn,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(Se,{children:h.jsx(o3,{})})},{path:"escalations/available",element:h.jsx(Se,{children:h.jsx(l3,{})})},{path:"escalations/queue",element:h.jsx(Se,{children:h.jsx(c3,{})})},{path:"escalations/detail/:id",element:h.jsx(Se,{children:h.jsx(u3,{})})},{path:"scan/station",element:h.jsx(Se,{children:h.jsx(D3,{})})},{path:"capabilities",element:h.jsx(Se,{children:h.jsx(F3,{})})},{path:"agents",element:h.jsx(Se,{children:h.jsx(I3,{})})},{path:"agents/new",element:h.jsx(Se,{children:h.jsx(Ub,{})})},{path:"agents/:id",element:h.jsx(Se,{children:h.jsx(H3,{})})},{path:"agents/:id/edit",element:h.jsx(Se,{children:h.jsx(Ub,{})})},{path:"topics",element:h.jsx(Se,{children:h.jsx(G3,{})})},{path:"topics/:topic",element:h.jsx(Se,{children:h.jsx(V3,{})})},{element:h.jsx(XT,{}),children:[{path:"workflows/start",element:h.jsx(Se,{children:h.jsx(h3,{})})},{path:"workflows/durable/invoke",element:h.jsx(Se,{children:h.jsx(d3,{})})}]},{element:h.jsx(Jc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(Se,{children:h.jsx(f3,{})})},{path:"workflows/executions",element:h.jsx(Se,{children:h.jsx(p3,{})})},{path:"workflows/durable/executions",element:h.jsx(Se,{children:h.jsx(m3,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(Se,{children:h.jsx(Db,{})})},{path:"workflows/tasks",element:h.jsx(Se,{children:h.jsx(x3,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(Se,{children:h.jsx(v3,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(Se,{children:h.jsx(Db,{})})},{path:"workflows/cron",element:h.jsx(bn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(Se,{children:h.jsx(w3,{})})},{path:"workflows/registry",element:h.jsx(Se,{children:h.jsx(S3,{})})},{path:"workflows/registry/new",element:h.jsx(Se,{children:h.jsx(qb,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(Se,{children:h.jsx(qb,{})})}]},{element:h.jsx(Jc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(Se,{children:h.jsx(y3,{})})},{path:"mcp/workflows/invoke",element:h.jsx(Se,{children:h.jsx(g3,{})})},{path:"mcp/workflows/:id",element:h.jsx(Se,{children:h.jsx(b3,{})})},{path:"mcp/executions",element:h.jsx(Se,{children:h.jsx(r3,{})})},{path:"mcp/executions/:jobId",element:h.jsx(Se,{children:h.jsx(s3,{})})},{path:"files",element:h.jsx(Se,{children:h.jsx(P3,{})})},{path:"knowledge",element:h.jsx(Se,{children:h.jsx(z3,{})})},{element:h.jsx(WT,{}),children:[{path:"mcp",element:h.jsx(Se,{children:h.jsx(n3,{})})},{path:"mcp/queries",element:h.jsx(Se,{children:h.jsx(i3,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(Se,{children:h.jsx(a3,{})})},{path:"mcp/tools",element:h.jsx(bn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(Se,{children:h.jsx(E3,{})})},{path:"mcp/servers/new",element:h.jsx(Se,{children:h.jsx(Lb,{})})},{path:"mcp/servers/:serverId",element:h.jsx(Se,{children:h.jsx(Lb,{})})}]}]},{path:"pace",element:h.jsx(Se,{children:h.jsx(Bb,{})})},{path:"trends",element:h.jsx(Se,{children:h.jsx(Bb,{})})},{path:"operations",element:h.jsx(bn,{to:"/pace",replace:!0})},{element:h.jsx(Jc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(Se,{children:h.jsx(_3,{})})},{path:"admin/users",element:h.jsx(Se,{children:h.jsx(O3,{})})},{path:"admin/escalation-chains",element:h.jsx(bn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(Se,{children:h.jsx(A3,{})})},{path:"admin/roles/:role",element:h.jsx(Se,{children:h.jsx(j3,{})})},{path:"admin/roles/:role/schema",element:h.jsx(Se,{children:h.jsx(T3,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(Se,{children:h.jsx(C3,{})})},{path:"admin/scan-codes",element:h.jsx(Se,{children:h.jsx(M3,{})})},{path:"admin/scan-codes/:version",element:h.jsx(Se,{children:h.jsx(R3,{})})},{path:"admin/personas",element:h.jsx(Se,{children:h.jsx(k3,{})})},{path:"admin/personas/:key",element:h.jsx(Se,{children:h.jsx(N3,{})})}]},{element:h.jsx(Jc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(bn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(ZT,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(Se,{children:h.jsx(q3,{})})}]},{path:"admin/controlplane",element:h.jsx(Se,{children:h.jsx(L3,{})})},{path:"admin/streams",element:h.jsx(Se,{children:h.jsx(B3,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function J3(){return h.jsx(Fw,{client:Tv,children:h.jsx(LS,{children:h.jsx(UO,{children:h.jsx(Yw,{router:K3})})})})}Zx(Wx());const jm=document.createElement("link");jm.rel="stylesheet";jm.href=`${Pt}/api/settings/custom.css`;document.head.appendChild(jm);jS.createRoot(document.getElementById("root")).render(h.jsx(O.StrictMode,{children:h.jsx(J3,{})}));export{wC as $,YC as A,nk as B,Am as C,RT as D,c5 as E,Sv as F,SC as G,u5 as H,ym as I,mT as J,UN as K,PN as L,lN as M,Kt as N,IN as O,bC as P,Cx as Q,qx as R,nT as S,CC as T,MC as U,RC as V,DC as W,qC as X,BC as Y,ZO as Z,Eu as _,p5 as a,i5 as a$,Rt as a0,bv as a1,hC as a2,uC as a3,Px as a4,Ux as a5,_m as a6,kC as a7,TN as a8,ZC as a9,zC as aA,x5 as aB,d5 as aC,_5 as aD,v5 as aE,rv as aF,nC as aG,rC as aH,sC as aI,lC as aJ,cC as aK,iC as aL,aC as aM,oC as aN,mC as aO,yC as aP,pC as aQ,f5 as aR,fC as aS,XC as aT,Pt as aU,Yb as aV,VC as aW,t5 as aX,dC as aY,tk as aZ,Zj as a_,gC as aa,sk as ab,lc as ac,ku as ad,Xk as ae,Fj as af,wm as ag,WO as ah,OC as ai,KC as aj,AC as ak,TC as al,LC as am,KO as an,_g as ao,tC as ap,vm as aq,Yx as ar,e5 as as,b5 as at,Xs as au,dx as av,w5 as aw,vv as ax,y5 as ay,m5 as az,HC as b,Dj as b0,o5 as b1,l5 as b2,s5 as b3,a5 as b4,Sm as b5,Tj as b6,ik as b7,r5 as b8,$e as b9,vC as ba,GC as bb,cN as bc,S5 as bd,E5 as be,Nv as bf,fm as bg,Mx as bh,WC as bi,JC as bj,Xn as c,n5 as d,UC as e,Cj as f,Kx as g,fA as h,xC as i,rn as j,_n as k,PC as l,he as m,g5 as n,$C as o,IC as p,EC as q,jC as r,NC as s,FC as t,QC as u,_C as v,Om as w,h5 as x,jx as y,rk as z};
67
+ //# sourceMappingURL=index-BMlQYOE1.js.map